33 #ifndef DART_GUI_OSG_WORLDNODE_HPP_
34 #define DART_GUI_OSG_WORLDNODE_HPP_
37 #include <unordered_map>
39 #include <osgShadow/ShadowTechnique>
45 namespace simulation {
72 std::shared_ptr<dart::simulation::World> world =
nullptr,
73 ::osg::ref_ptr<osgShadow::ShadowTechnique> shadowTechnique =
nullptr);
76 void setWorld(std::shared_ptr<dart::simulation::World> newWorld);
79 std::shared_ptr<dart::simulation::World>
getWorld()
const;
141 ::osg::ref_ptr<osgShadow::ShadowTechnique> shadowTechnique =
nullptr);
149 static ::osg::ref_ptr<osgShadow::ShadowTechnique>
179 unordered_map<dart::dynamics::Frame*, ::osg::ref_ptr<ShapeFrameNode>>;
185 std::shared_ptr<dart::simulation::World>
mWorld;
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition: Frame.hpp:58
Definition: Viewer.hpp:112
WorldNode class encapsulates a World to be displayed in OpenSceneGraph.
Definition: WorldNode.hpp:65
void refreshSkeletons()
Refresh all the Skeleton rendering data.
Definition: WorldNode.cpp:229
void refreshBaseFrameNode(dart::dynamics::Frame *frame)
Definition: WorldNode.cpp:257
Viewer * mViewer
Viewer that this WorldNode is inside of.
Definition: WorldNode.hpp:194
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:179
bool isSimulating() const
Returns true iff the WorldNode is stepping between render cycles.
Definition: WorldNode.cpp:161
virtual ~WorldNode()
Destructor.
Definition: WorldNode.cpp:185
NodeMap mFrameToNode
Map from Frame pointers to FrameNode pointers.
Definition: WorldNode.hpp:182
bool mSimulating
True iff simulation is active.
Definition: WorldNode.hpp:188
virtual void setupViewer()
Called when this world gets added to an dart::gui::osg::Viewer.
Definition: WorldNode.cpp:191
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:66
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:173
void setWorld(std::shared_ptr< dart::simulation::World > newWorld)
Set the World that this WorldNode is associated with.
Definition: WorldNode.cpp:100
virtual void refresh()
This function is called at the beginning of each rendering cycle.
Definition: WorldNode.cpp:112
::osg::ref_ptr<::osg::Group > mNormalGroup
OSG group for non-shadowed objects.
Definition: WorldNode.hpp:197
void refreshSimpleFrames()
Refresh all the custom Frame rendering data.
Definition: WorldNode.cpp:247
virtual void customPreStep()
If update() is not overloaded, this function will be called at the beginning of each simulation step.
Definition: WorldNode.cpp:149
std::unordered_map< dart::dynamics::Frame *, ::osg::ref_ptr< ShapeFrameNode > > NodeMap
Definition: WorldNode.hpp:179
void setShadowTechnique(::osg::ref_ptr< osgShadow::ShadowTechnique > shadowTechnique=nullptr)
Set the ShadowTechnique If you wish to disable shadows, pass a nullptr.
Definition: WorldNode.cpp:340
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:365
bool mShadowed
Whether the shadows are enabled.
Definition: WorldNode.hpp:203
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:167
void clearUnusedNodes()
Clear any nodes whose utilization flags were not triggered on this render cycle.
Definition: WorldNode.cpp:204
virtual void customPostStep()
If update() is not overloaded, this function will be called at the end of each simulation step.
Definition: WorldNode.cpp:155
void refreshShapeFrameNode(dart::dynamics::Frame *frame)
Definition: WorldNode.cpp:277
::osg::ref_ptr<::osgShadow::ShadowedScene > mShadowedGroup
OSG group for shadowed objects.
Definition: WorldNode.hpp:200
bool isShadowed() const
Get whether the WorldNode is casting shadows.
Definition: WorldNode.cpp:334
virtual void customPostRefresh()
If update() is not overloaded, this function will be called at the end of each rendering cycle.
Definition: WorldNode.cpp:143
::osg::ref_ptr< osgShadow::ShadowTechnique > getShadowTechnique() const
Get the current ShadowTechnique nullptr is there are no shadows.
Definition: WorldNode.cpp:356
void clearChildUtilizationFlags()
Clear the utilization flags of each child node.
Definition: WorldNode.cpp:197
virtual void customPreRefresh()
If update() is not overloaded, this function will be called at the beginning of each rendering cycle.
Definition: WorldNode.cpp:137
std::shared_ptr< dart::simulation::World > getWorld() const
Get the World that this WorldNode is associated with.
Definition: WorldNode.cpp:106
std::shared_ptr< dart::simulation::World > mWorld
The World that this WorldNode is associated with.
Definition: WorldNode.hpp:185
std::size_t mNumStepsPerCycle
Number of steps to take between rendering cycles.
Definition: WorldNode.hpp:191
Definition: BulletCollisionDetector.cpp:65