33 #ifndef DART_GUI_OSG_WORLDNODE_HPP_
34 #define DART_GUI_OSG_WORLDNODE_HPP_
37 #include <osgShadow/ShadowTechnique>
38 #include <unordered_map>
45 namespace simulation {
72 explicit WorldNode(std::shared_ptr<dart::simulation::World> world =
nullptr, ::osg::ref_ptr<osgShadow::ShadowTechnique> shadowTechnique =
nullptr);
75 void setWorld(std::shared_ptr<dart::simulation::World> newWorld);
78 std::shared_ptr<dart::simulation::World>
getWorld()
const;
139 void setShadowTechnique(::osg::ref_ptr<osgShadow::ShadowTechnique> shadowTechnique =
nullptr);
176 using NodeMap = std::unordered_map<dart::dynamics::Frame*, ShapeFrameNode*>;
182 std::shared_ptr<dart::simulation::World>
mWorld;
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition: Frame.hpp:57
Definition: Viewer.hpp:116
WorldNode class encapsulates a World to be displayed in OpenSceneGraph.
Definition: WorldNode.hpp:65
std::unordered_map< dart::dynamics::Frame *, ShapeFrameNode * > NodeMap
Definition: WorldNode.hpp:176
void refreshSkeletons()
Refresh all the Skeleton rendering data.
Definition: WorldNode.cpp:231
void refreshBaseFrameNode(dart::dynamics::Frame *frame)
Definition: WorldNode.cpp:259
Viewer * mViewer
Viewer that this WorldNode is inside of.
Definition: WorldNode.hpp:191
std::size_t getNumStepsPerCycle() const
Get the number of steps that will be taken between each render cycle (only if the simulation is not p...
Definition: WorldNode.cpp:178
bool isSimulating() const
Returns true iff the WorldNode is stepping between render cycles.
Definition: WorldNode.cpp:160
virtual ~WorldNode()
Destructor.
Definition: WorldNode.cpp:184
NodeMap mFrameToNode
Map from Frame pointers to FrameNode pointers.
Definition: WorldNode.hpp:179
bool mSimulating
True iff simulation is active.
Definition: WorldNode.hpp:185
virtual void setupViewer()
Called when this world gets added to an dart::gui::osg::Viewer.
Definition: WorldNode.cpp:190
WorldNode(std::shared_ptr< dart::simulation::World > world=nullptr, ::osg::ref_ptr< osgShadow::ShadowTechnique > shadowTechnique=nullptr)
Default constructor Shadows are disabled by default.
Definition: WorldNode.cpp:68
void setNumStepsPerCycle(std::size_t steps)
Set the number of steps to take between each render cycle (only if the simulation is not paused)
Definition: WorldNode.cpp:172
void setWorld(std::shared_ptr< dart::simulation::World > newWorld)
Set the World that this WorldNode is associated with.
Definition: WorldNode.cpp:99
virtual void refresh()
This function is called at the beginning of each rendering cycle.
Definition: WorldNode.cpp:111
::osg::ref_ptr<::osg::Group > mNormalGroup
OSG group for non-shadowed objects.
Definition: WorldNode.hpp:194
void refreshSimpleFrames()
Refresh all the custom Frame rendering data.
Definition: WorldNode.cpp:249
virtual void customPreStep()
If update() is not overloaded, this function will be called at the beginning of each simulation step.
Definition: WorldNode.cpp:148
void setShadowTechnique(::osg::ref_ptr< osgShadow::ShadowTechnique > shadowTechnique=nullptr)
Set the ShadowTechnique If you wish to disable shadows, pass a nullptr.
Definition: WorldNode.cpp:332
static ::osg::ref_ptr< osgShadow::ShadowTechnique > createDefaultShadowTechnique(const Viewer *viewer)
Helper function to create a default ShadowTechnique given a Viewer the default ShadowTechnique is Sha...
Definition: WorldNode.cpp:355
bool mShadowed
Whether the shadows are enabled.
Definition: WorldNode.hpp:200
void simulate(bool on)
Pass in true to take steps between render cycles; pass in false to turn off steps between render cycl...
Definition: WorldNode.cpp:166
void clearUnusedNodes()
Clear any nodes whose utilization flags were not triggered on this render cycle.
Definition: WorldNode.cpp:203
virtual void customPostStep()
If update() is not overloaded, this function will be called at the end of each simulation step.
Definition: WorldNode.cpp:154
void refreshShapeFrameNode(dart::dynamics::Frame *frame)
Definition: WorldNode.cpp:279
bool isShadowed() const
Get whether the WorldNode is casting shadows.
Definition: WorldNode.cpp:326
virtual void customPostRefresh()
If update() is not overloaded, this function will be called at the end of each rendering cycle.
Definition: WorldNode.cpp:142
::osg::ref_ptr< osgShadow::ShadowTechnique > getShadowTechnique() const
Get the current ShadowTechnique nullptr is there are no shadows.
Definition: WorldNode.cpp:348
void clearChildUtilizationFlags()
Clear the utilization flags of each child node.
Definition: WorldNode.cpp:196
virtual void customPreRefresh()
If update() is not overloaded, this function will be called at the beginning of each rendering cycle.
Definition: WorldNode.cpp:136
std::shared_ptr< dart::simulation::World > getWorld() const
Get the World that this WorldNode is associated with.
Definition: WorldNode.cpp:105
std::shared_ptr< dart::simulation::World > mWorld
The World that this WorldNode is associated with.
Definition: WorldNode.hpp:182
::osg::ref_ptr<::osg::Group > mShadowedGroup
OSG group for shadowed objects.
Definition: WorldNode.hpp:197
std::size_t mNumStepsPerCycle
Number of steps to take between rendering cycles.
Definition: WorldNode.hpp:188
Definition: BulletCollisionDetector.cpp:63