SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::gui::common::BaseViewer Class Referenceabstract

#include <BaseViewer.h>

Inheritance diagram for sofa::gui::common::BaseViewer:

Protected Attributes

sofa::simulation::Node::SPtr groot
 the sofa root note of the current scene More...
 
sofa::component::visual::BaseCamera::SPtr currentCamera
 
std::string sceneFileName
 
bool _video
 
bool m_isVideoButtonPressed
 
bool m_bShowAxis
 
bool _fullScreen
 
int _background
 
bool initTexturesDone
 
sofa::type::Vec3 backgroundColour
 
std::string backgroundImageFile
 
sofa::type::Vec3 ambientColour
 
std::unique_ptr< PickHandlerpick
 
int _navigationMode
 
bool _mouseInteractorMoving
 
int _mouseInteractorSavedPosX
 
int _mouseInteractorSavedPosY
 
std::string _screenshotDirectory
 

Public Member Functions

 BaseViewer ()
 
virtual ~BaseViewer ()
 
virtual void drawColourPicking (ColourPickingVisitor::ColourCode)
 
virtual sofa::simulation::NodegetScene ()
 
virtual const std::string & getSceneFileName ()
 
virtual void setSceneFileName (const std::string &f)
 
virtual void setScene (sofa::simulation::Node::SPtr scene, const char *filename=nullptr, bool=false)
 
virtual void setCameraMode (core::visual::VisualParams::CameraType)
 
virtual bool ready ()
 
virtual void wait ()
 ask the viewer to resume its activity More...
 
virtual bool load (void)
 Load the viewer. It's the initialisation. More...
 
virtual bool unload (void)
 unload the viewer without delete More...
 
virtual void viewAll (void)=0
 Recompute viewer's home position so it encompass the whole scene and apply it. More...
 
virtual void configure (sofa::component::setting::ViewerSetting *viewerConf)
 
virtual const std::string screenshotName ()
 
virtual void setPrefix (const std::string &prefix, bool prependDirectory=true)
 
virtual void screenshot (const std::string &filename, int compression_level=-1)
 
virtual void getView (sofa::type::Vec3 &pos, sofa::type::Quat< SReal > &ori) const
 
virtual void setView (const sofa::type::Vec3 &pos, const sofa::type::Quat< SReal > &ori)
 
virtual void moveView (const sofa::type::Vec3 &pos, const sofa::type::Quat< SReal > &ori)
 
virtual void newView ()
 
virtual void resetView ()
 
virtual void setBackgroundColour (float r, float g, float b)
 
virtual void setBackgroundImage (std::string imageFileName=std::string("textures/SOFA_logo.bmp"))
 
std::string getBackgroundImage ()
 
virtual void saveView ()=0
 
virtual void setSizeW (int)=0
 
virtual void setSizeH (int)=0
 
virtual int getWidth ()=0
 
virtual int getHeight ()=0
 
virtual void captureEvent ()
 
virtual void fitObjectBBox (sofa::core::objectmodel::BaseObject *)
 
virtual void fitNodeBBox (sofa::core::objectmodel::BaseNode *)
 
virtual void setFullScreen (bool)
 
virtual void moveRayPickInteractor (int, int)
 RayCasting PickHandler. More...
 
PickHandlergetPickHandler ()
 
virtual void drawScene (void)=0
 the rendering pass is done here (have to be called in a loop) More...
 

Protected Member Functions

virtual void redraw ()=0
 internally called while the actual viewer needs a redraw (ie the camera changed) More...
 

Attribute details

◆ _background

int sofa::gui::common::BaseViewer::_background
protected

◆ _fullScreen

bool sofa::gui::common::BaseViewer::_fullScreen
protected

◆ _mouseInteractorMoving

bool sofa::gui::common::BaseViewer::_mouseInteractorMoving
protected

◆ _mouseInteractorSavedPosX

int sofa::gui::common::BaseViewer::_mouseInteractorSavedPosX
protected

◆ _mouseInteractorSavedPosY

int sofa::gui::common::BaseViewer::_mouseInteractorSavedPosY
protected

◆ _navigationMode

int sofa::gui::common::BaseViewer::_navigationMode
protected

◆ _screenshotDirectory

std::string sofa::gui::common::BaseViewer::_screenshotDirectory
protected

◆ _video

bool sofa::gui::common::BaseViewer::_video
protected

◆ ambientColour

sofa::type::Vec3 sofa::gui::common::BaseViewer::ambientColour
protected

◆ backgroundColour

sofa::type::Vec3 sofa::gui::common::BaseViewer::backgroundColour
protected

◆ backgroundImageFile

std::string sofa::gui::common::BaseViewer::backgroundImageFile
protected

◆ currentCamera

sofa::component::visual::BaseCamera::SPtr sofa::gui::common::BaseViewer::currentCamera
protected

◆ groot

sofa::simulation::Node::SPtr sofa::gui::common::BaseViewer::groot
protected

the sofa root note of the current scene

◆ initTexturesDone

bool sofa::gui::common::BaseViewer::initTexturesDone
protected

◆ m_bShowAxis

bool sofa::gui::common::BaseViewer::m_bShowAxis
protected

◆ m_isVideoButtonPressed

bool sofa::gui::common::BaseViewer::m_isVideoButtonPressed
protected

◆ pick

std::unique_ptr<PickHandler> sofa::gui::common::BaseViewer::pick
protected

◆ sceneFileName

std::string sofa::gui::common::BaseViewer::sceneFileName
protected

Constructor details

◆ BaseViewer()

sofa::gui::common::BaseViewer::BaseViewer ( )

◆ ~BaseViewer()

sofa::gui::common::BaseViewer::~BaseViewer ( )
virtual

Function details

◆ captureEvent()

virtual void sofa::gui::common::BaseViewer::captureEvent ( )
inlinevirtual

◆ configure()

void sofa::gui::common::BaseViewer::configure ( sofa::component::setting::ViewerSetting viewerConf)
virtual

◆ drawColourPicking()

virtual void sofa::gui::common::BaseViewer::drawColourPicking ( ColourPickingVisitor::ColourCode  )
inlinevirtual

◆ drawScene()

virtual void sofa::gui::common::BaseViewer::drawScene ( void  )
pure virtual

the rendering pass is done here (have to be called in a loop)

Implemented in sofa::gui::qt::viewer::qgl::QtGLViewer.

◆ fitNodeBBox()

void sofa::gui::common::BaseViewer::fitNodeBBox ( sofa::core::objectmodel::BaseNode node)
virtual

◆ fitObjectBBox()

void sofa::gui::common::BaseViewer::fitObjectBBox ( sofa::core::objectmodel::BaseObject object)
virtual

◆ getBackgroundImage()

std::string sofa::gui::common::BaseViewer::getBackgroundImage ( )

◆ getHeight()

virtual int sofa::gui::common::BaseViewer::getHeight ( )
pure virtual

◆ getPickHandler()

PickHandler * sofa::gui::common::BaseViewer::getPickHandler ( )

◆ getScene()

sofa::simulation::Node * sofa::gui::common::BaseViewer::getScene ( )
virtual

◆ getSceneFileName()

const std::string & sofa::gui::common::BaseViewer::getSceneFileName ( )
virtual

◆ getView()

void sofa::gui::common::BaseViewer::getView ( sofa::type::Vec3 pos,
sofa::type::Quat< SReal > &  ori 
) const
virtual

◆ getWidth()

virtual int sofa::gui::common::BaseViewer::getWidth ( )
pure virtual

◆ load()

bool sofa::gui::common::BaseViewer::load ( void  )
virtual

Load the viewer. It's the initialisation.

◆ moveRayPickInteractor()

virtual void sofa::gui::common::BaseViewer::moveRayPickInteractor ( int  ,
int   
)
inlinevirtual

◆ moveView()

void sofa::gui::common::BaseViewer::moveView ( const sofa::type::Vec3 pos,
const sofa::type::Quat< SReal > &  ori 
)
virtual

◆ newView()

void sofa::gui::common::BaseViewer::newView ( )
virtual

◆ ready()

bool sofa::gui::common::BaseViewer::ready ( )
virtual

true when the viewer keep the hand on the render false when it's not in activity

Reimplemented in sofa::gui::qt::viewer::qt::QtViewer, and sofa::gui::qt::viewer::qgl::QtGLViewer.

◆ redraw()

virtual void sofa::gui::common::BaseViewer::redraw ( )
protectedpure virtual

internally called while the actual viewer needs a redraw (ie the camera changed)

Implemented in sofa::gui::qt::viewer::SofaViewer.

◆ resetView()

void sofa::gui::common::BaseViewer::resetView ( )
virtual

◆ saveView()

virtual void sofa::gui::common::BaseViewer::saveView ( )
pure virtual

◆ screenshot()

void sofa::gui::common::BaseViewer::screenshot ( const std::string &  filename,
int  compression_level = -1 
)
virtual

◆ screenshotName()

const std::string sofa::gui::common::BaseViewer::screenshotName ( )
virtual

◆ setBackgroundColour()

void sofa::gui::common::BaseViewer::setBackgroundColour ( float  r,
float  g,
float  b 
)
virtual

◆ setBackgroundImage()

void sofa::gui::common::BaseViewer::setBackgroundImage ( std::string  imageFileName = std::string("textures/SOFA_logo.bmp"))
virtual

◆ setCameraMode()

void sofa::gui::common::BaseViewer::setCameraMode ( core::visual::VisualParams::CameraType  mode)
virtual

◆ setFullScreen()

virtual void sofa::gui::common::BaseViewer::setFullScreen ( bool  )
inlinevirtual

◆ setPrefix()

void sofa::gui::common::BaseViewer::setPrefix ( const std::string &  prefix,
bool  prependDirectory = true 
)
virtual

◆ setScene()

void sofa::gui::common::BaseViewer::setScene ( sofa::simulation::Node::SPtr  scene,
const char filename = nullptr,
bool  = false 
)
virtual

◆ setSceneFileName()

void sofa::gui::common::BaseViewer::setSceneFileName ( const std::string &  f)
virtual

◆ setSizeH()

virtual void sofa::gui::common::BaseViewer::setSizeH ( int  )
pure virtual

◆ setSizeW()

virtual void sofa::gui::common::BaseViewer::setSizeW ( int  )
pure virtual

◆ setView()

void sofa::gui::common::BaseViewer::setView ( const sofa::type::Vec3 pos,
const sofa::type::Quat< SReal > &  ori 
)
virtual

◆ unload()

bool sofa::gui::common::BaseViewer::unload ( void  )
virtual

unload the viewer without delete

◆ viewAll()

virtual void sofa::gui::common::BaseViewer::viewAll ( void  )
pure virtual

Recompute viewer's home position so it encompass the whole scene and apply it.

Implemented in sofa::gui::qt::viewer::qt::QtViewer, and sofa::gui::qt::viewer::qgl::QtGLViewer.

◆ wait()

void sofa::gui::common::BaseViewer::wait ( )
virtual

ask the viewer to resume its activity

Reimplemented in sofa::gui::qt::viewer::qt::QtViewer, and sofa::gui::qt::viewer::qgl::QtGLViewer.