SOFA plugin: SofaSimpleGUI  master
Open source framework for multi-physics simuation
sofa::simplegui::SofaScene Class Reference

#include <SofaScene.h>

A sofa scene graph with simulation functions. More...

Detailed Description

A sofa scene graph with simulation functions.

There are methods to initialize and update the visual models, but rendering must be performed externally, see e.g. class SofaGL.

The typical life cycle is:

 loadPlugins( list of plugin names );
 setScene( scenegraph ); or open(filename)
 initVisual()
 [ your main loop: ]
     step(dt);
     updateVisual();
     [ use a SofaGL object to display the simulated objects ]
Author
Francois Faure, 2014

Protected Attributes

simulation::Node::SPtr _groot
 root of the scene More...
 
simulation::Node_iroot
 root of the interactors, child of _groot More...
 

Public Member Functions

 SofaScene ()
 Initialize Sofa. More...
 
virtual ~SofaScene ()
 
void loadPlugins (const std::vector< std::string > &plugins)
 load the given plugin More...
 
void open (const std::string &fileName)
 Load a scene file. The previous scene graph, if any, is deleted. More...
 
void setScene (simulation::Node *graph)
 Set the scene graph. The previous scene graph, if any, is deleted. More...
 
void printGraph ()
 Print the scene graph on the standard ouput, for debugging. More...
 
void step (SReal dt)
 Integrate time by one step and update the Sofa scene. More...
 
void reset ()
 restart from the beginning More...
 
void getBoundingBox (SReal *xmin, SReal *xmax, SReal *ymin, SReal *ymax, SReal *zmin, SReal *zmax)
 Compute the bounding box of the simulated objects. More...
 
void initVisual ()
 To do once before rendering a scene, typically at initialization time. More...
 
void updateVisual ()
 Update the visual models. To do after animating and before rendering. More...
 
Developer API

To be used to create new functionalities.

simulation::Nodegroot ()
 Root of the simulated scene. More...
 
simulation::Nodeiroot ()
 Root of the interactors, set as child of groot. More...
 
void insertInteractor (Interactor *)
 Do not use this directly. Use Interactor::attach, which calls this. More...
 

Attribute details

◆ _groot

simulation::Node::SPtr sofa::simplegui::SofaScene::_groot
protected

root of the scene

◆ _iroot

simulation::Node* sofa::simplegui::SofaScene::_iroot
protected

root of the interactors, child of _groot

Constructor details

◆ SofaScene()

sofa::simplegui::SofaScene::SofaScene ( )

Initialize Sofa.

◆ ~SofaScene()

virtual sofa::simplegui::SofaScene::~SofaScene ( )
inlinevirtual

Function details

◆ getBoundingBox()

void sofa::simplegui::SofaScene::getBoundingBox ( SReal *  xmin,
SReal *  xmax,
SReal *  ymin,
SReal *  ymax,
SReal *  zmin,
SReal *  zmax 
)

Compute the bounding box of the simulated objects.

Parameters
xminmin coordinate in the X direction
xmaxmax coordinate in the X direction
yminetc.
ymax
zmin
zmax

◆ groot()

simulation::Node * sofa::simplegui::SofaScene::groot ( )

Root of the simulated scene.

◆ initVisual()

void sofa::simplegui::SofaScene::initVisual ( )

To do once before rendering a scene, typically at initialization time.

◆ insertInteractor()

void sofa::simplegui::SofaScene::insertInteractor ( Interactor interactor)

Do not use this directly. Use Interactor::attach, which calls this.

◆ iroot()

simulation::Node* sofa::simplegui::SofaScene::iroot ( )
inline

Root of the interactors, set as child of groot.

◆ loadPlugins()

void sofa::simplegui::SofaScene::loadPlugins ( const std::vector< std::string > &  plugins)

load the given plugin

Parameters
pluginsnames of the plugins

◆ open()

void sofa::simplegui::SofaScene::open ( const std::string &  fileName)

Load a scene file. The previous scene graph, if any, is deleted.

Parameters
fileNameScene file to load

◆ printGraph()

void sofa::simplegui::SofaScene::printGraph ( )

Print the scene graph on the standard ouput, for debugging.

◆ reset()

void sofa::simplegui::SofaScene::reset ( )

restart from the beginning

◆ setScene()

void sofa::simplegui::SofaScene::setScene ( simulation::Node graph)

Set the scene graph. The previous scene graph, if any, is deleted.

Parameters
graphthe scene to simulate

◆ step()

void sofa::simplegui::SofaScene::step ( SReal  dt)

Integrate time by one step and update the Sofa scene.

◆ updateVisual()

void sofa::simplegui::SofaScene::updateVisual ( )

Update the visual models. To do after animating and before rendering.