AGXDynamics  2.35.0.2
RigidBodyRenderCache.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agxQt/export.h>
20 #include <agx/Math.h>
21 #include <agx/Referenced.h>
22 #include <agx/RigidBody.h>
23 #include <agxOSG/GeometryNode.h>
24 
25 namespace agxQt
26 {
28 
37  {
38  public:
44  RigidBodyRenderCache(bool onlyAddEmittedBodies=true);
45 
51  void addToCache(osg::Group* rootNode);
52 
58 
62  bool getOnlyAddEmittedBodies() const;
63 
67  void setOnlyAddEmittedBodies( bool enable );
68 
72  void clear();
73 
74  protected:
75  virtual ~RigidBodyRenderCache();
76  void traverseAndInsert(osg::Group* group);
77  bool shouldAddBody(agx::RigidBody* body) const;
78 
79  private:
80  // Internal cache to map RigidBody to GeometryNode
81  BodyToGeometryNodeTable m_bodiesToGeometryNodes;
82  bool m_onlyAddEmittedBodies;
83  };
84 }
85 
86 
Referenced.h
AGXQT_EXPORT
#define AGXQT_EXPORT
agxQt
Contains classes/utility functions for connecting AGX to QT with OSG.
Definition: AnalysisBoundWidget.h:33
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
agxQt::RigidBodyRenderCache
RigidBodyRenderCache is used to cache mappings between RigidBodies and GeometryNodes for fast lookup ...
Definition: RigidBodyRenderCache.h:36
export.h
agxWire::getNode
const Node * getNode(const IteratorCompatibleContainer &container, agx::Real distanceFromStart)
Finds the wire node given current distance from the start of the wire (wire defined to be iterator co...
Definition: WireUtils.h:392
Math.h
GeometryNode.h
agx::LinearProbingHashTable
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: LinearProbingHashTable.h:871
agxQt::BodyToGeometryNodeTable
agx::HashTable< agx::RigidBody *, agxOSG::GeometryNode * > BodyToGeometryNodeTable
Definition: RigidBodyRenderCache.h:27
RigidBody.h
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agxOSG::GeometryNode
A node that can be associated with a collision geometry so that the transformation of this node is up...
Definition: GeometryNode.h:41
agxTerrain::Profiler::clear
AGXTERRAIN_EXPORT void clear()