Choreonoid  1.8
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cnoid::GLSceneRenderer Class Referenceabstract

#include <GLSceneRenderer.h>

Inheritance diagram for cnoid::GLSceneRenderer:
cnoid::SceneRenderer cnoid::GL1SceneRenderer cnoid::GLSLSceneRenderer

Public Types

enum  RendererType { GL1_RENDERER, GLSL_RENDERER }
 
enum  LightingMode {
  NormalLighting, MinimumLighting, SolidColorLighting, NoLighting,
  NumLightingModes
}
 
enum  CullingMode { ENABLE_BACK_FACE_CULLING, DISABLE_BACK_FACE_CULLING, FORCE_BACK_FACE_CULLING, N_CULLING_MODES }
 
- Public Types inherited from cnoid::SceneRenderer
typedef PolymorphicSceneNodeFunctionSet NodeFunctionSet
 
typedef std::function< SgNode *(SgNode *targetNode)> NodeDecorationFunction
 

Public Member Functions

 GLSceneRenderer (SgGroup *root=nullptr)
 
virtual ~GLSceneRenderer ()
 
virtual void setOutputStream (std::ostream &os)
 
virtual SgGroupsceneRoot () override
 
virtual SgGroupscene () override
 
virtual bool initializeGL ()=0
 
virtual void flushGL ()=0
 
virtual void clearGL ()
 
virtual void setDefaultFramebufferObject (unsigned int id)
 
virtual const std::string & glVendor () const =0
 
virtual void setViewport (int x, int y, int width, int height)=0
 
virtual void updateViewportInformation (int x, int y, int width, int height)
 
Array4i viewport () const
 
void getViewport (int &out_x, int &out_y, int &out_width, int &out_height) const
 
double aspectRatio () const
 
void getPerspectiveProjectionMatrix (double fovy, double aspect, double zNear, double zFar, Matrix4 &out_matrix)
 
void getOrthographicProjectionMatrix (double left, double right, double bottom, double top, double nearVal, double farVal, Matrix4 &out_matrix)
 
void getViewFrustum (const SgPerspectiveCamera *camera, double &left, double &right, double &bottom, double &top) const
 
void getViewVolume (const SgOrthographicCamera *camera, float &out_left, float &out_right, float &out_bottom, float &out_top) const
 
bool unproject (double x, double y, double z, Vector3 &out_projected) const
 
const Vector3f & backgroundColor () const
 
void setBackgroundColor (const Vector3f &color)
 
const Vector3f & defaultColor () const
 
void setDefaultColor (const Vector3f &color)
 
virtual void setLightingMode (LightingMode mode)=0
 
virtual LightingMode lightingMode () const =0
 
virtual void clearShadows ()
 
virtual void enableShadowOfLight (int index, bool on=true)
 
virtual void enableShadowAntiAliasing (bool on)
 
virtual void setDefaultSmoothShading (bool on)=0
 
virtual SgMaterialdefaultMaterial ()=0
 
virtual void enableTexture (bool on)=0
 
virtual void setDefaultPointSize (double size)=0
 
virtual void setDefaultLineWidth (double width)=0
 
virtual void showNormalVectors (double length)=0
 
virtual void requestToClearResources ()=0
 
virtual void enableUnusedResourceCheck (bool on)=0
 
virtual const Vector3pickedPoint () const =0
 
virtual const SgNodePathpickedNodePath () const =0
 
virtual void setColor (const Vector3f &color)=0
 
virtual void setUpsideDown (bool on)
 
virtual void setBackFaceCullingMode (int mode)=0
 
virtual int backFaceCullingMode () const =0
 
virtual void setBoundingBoxRenderingForLightweightRenderingGroupEnabled (bool on)
 
virtual void setPickingImageOutputEnabled (bool on)
 
virtual bool getPickingImage (Image &out_image)
 
virtual bool isShadowCastingAvailable () const
 
- Public Member Functions inherited from cnoid::SceneRenderer
 SceneRenderer ()
 
virtual ~SceneRenderer ()
 
void setName (const std::string &name)
 
const std::string & name () const
 
virtual void applyExtensions ()
 
virtual bool applyNewExtensions ()
 
virtual void clearScene ()
 
virtual PolymorphicSceneNodeFunctionSetrenderingFunctions ()=0
 
virtual void renderCustomGroup (SgGroup *group, std::function< void()> traverseFunction)=0
 
virtual void renderCustomTransform (SgTransform *transform, std::function< void()> traverseFunction)=0
 
virtual void renderNode (SgNode *node)=0
 
virtual void addNodeDecoration (SgNode *targetNode, NodeDecorationFunction func, int id)=0
 
virtual void clearNodeDecorations (int id)=0
 
int numCameras () const
 
SgCameracamera (int index)
 
const SgNodePathcameraPath (int index) const
 
const Isometry3cameraPosition (int index) const
 
const Isometry3currentCameraPosition () const
 
SignalProxy< void()> sigCamerasChanged () const
 
SgCameracurrentCamera () const
 
int currentCameraIndex () const
 
void setCurrentCamera (int index)
 
bool setCurrentCamera (SgCamera *camera)
 
SignalProxy< void()> sigCurrentCameraChanged ()
 
std::vector< std::string > simplifiedCameraPathStrings (int cameraIndex)
 
bool getSimplifiedCameraPathStrings (int cameraIndex, std::vector< std::string > &out_pathStrings)
 
int findCameraPath (const std::vector< std::string > &simplifiedPathStrings)
 
bool setCurrentCameraPath (const std::vector< std::string > &simplifiedPathStrings)
 
void setCurrentCameraAutoRestorationMode (bool on)
 
int numLights () const
 
void getLightInfo (int index, SgLight *&out_light, Isometry3 &out_position) const
 
void setAsDefaultLight (SgLight *light)
 
void unsetDefaultLight (SgLight *light)
 
SgLightheadLight ()
 
void setHeadLight (SgLight *light)
 
void enableAdditionalLights (bool on)
 
void enableFog (bool on)
 
bool isFogEnabled () const
 
int numFogs () const
 
SgFogfog (int index) const
 
virtual const Affine3currentModelTransform () const =0
 
virtual const Matrix4projectionMatrix () const =0
 
virtual double projectedPixelSizeRatio (const Vector3 &position) const =0
 
void extractPreprocessedNodes ()
 
void setFlagVariableToUpdatePreprocessedNodeTree (bool &flag)
 
void render ()
 
bool pick (int x, int y)
 
virtual bool isRenderingPickingImage () const
 
void setProperty (PropertyKey key, bool value)
 
void setProperty (PropertyKey key, int value)
 
void setProperty (PropertyKey key, double value)
 
bool property (PropertyKey key, bool defaultValue) const
 
int property (PropertyKey key, int defaultValue) const
 
double property (PropertyKey key, double defaultValue) const
 

Static Public Member Functions

static void initializeClass ()
 
static int rendererType ()
 
static GLSceneRenderercreate (SgGroup *root=nullptr)
 
- Static Public Member Functions inherited from cnoid::SceneRenderer
static void addExtension (std::function< void(SceneRenderer *renderer)> func)
 

Additional Inherited Members

- Protected Member Functions inherited from cnoid::SceneRenderer
virtual void doRender ()=0
 
virtual bool doPick (int x, int y)
 

Member Enumeration Documentation

◆ CullingMode

Enumerator
ENABLE_BACK_FACE_CULLING 
DISABLE_BACK_FACE_CULLING 
FORCE_BACK_FACE_CULLING 
N_CULLING_MODES 

◆ LightingMode

Enumerator
NormalLighting 
MinimumLighting 
SolidColorLighting 
NoLighting 
NumLightingModes 

◆ RendererType

Enumerator
GL1_RENDERER 
GLSL_RENDERER 

Constructor & Destructor Documentation

◆ GLSceneRenderer()

GLSceneRenderer::GLSceneRenderer ( SgGroup root = nullptr)

◆ ~GLSceneRenderer()

GLSceneRenderer::~GLSceneRenderer ( )
virtual

Member Function Documentation

◆ aspectRatio()

double GLSceneRenderer::aspectRatio ( ) const

◆ backFaceCullingMode()

virtual int cnoid::GLSceneRenderer::backFaceCullingMode ( ) const
pure virtual

◆ backgroundColor()

const Vector3f & GLSceneRenderer::backgroundColor ( ) const

◆ clearGL()

void GLSceneRenderer::clearGL ( )
virtual

This function clears all the OpenGL resourses used in the renderer. The function should be called when the renderer is deleted. The function must be called when the OpenGL context is changed, and then the initializeGL function must be called again for the new OpenGL context. Note that the corresponding OpenGL context must be made current when the function is called.

Reimplemented in cnoid::GLSLSceneRenderer.

◆ clearShadows()

void GLSceneRenderer::clearShadows ( )
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ create()

GLSceneRenderer * GLSceneRenderer::create ( SgGroup root = nullptr)
static

◆ defaultColor()

const Vector3f & GLSceneRenderer::defaultColor ( ) const

◆ defaultMaterial()

virtual SgMaterial* cnoid::GLSceneRenderer::defaultMaterial ( )
pure virtual

◆ enableShadowAntiAliasing()

void GLSceneRenderer::enableShadowAntiAliasing ( bool  on)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ enableShadowOfLight()

void GLSceneRenderer::enableShadowOfLight ( int  index,
bool  on = true 
)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ enableTexture()

virtual void cnoid::GLSceneRenderer::enableTexture ( bool  on)
pure virtual

◆ enableUnusedResourceCheck()

virtual void cnoid::GLSceneRenderer::enableUnusedResourceCheck ( bool  on)
pure virtual

◆ flushGL()

virtual void cnoid::GLSceneRenderer::flushGL ( )
pure virtual

◆ getOrthographicProjectionMatrix()

void GLSceneRenderer::getOrthographicProjectionMatrix ( double  left,
double  right,
double  bottom,
double  top,
double  nearVal,
double  farVal,
Matrix4 out_matrix 
)

◆ getPerspectiveProjectionMatrix()

void GLSceneRenderer::getPerspectiveProjectionMatrix ( double  fovy,
double  aspect,
double  zNear,
double  zFar,
Matrix4 out_matrix 
)

◆ getPickingImage()

bool GLSceneRenderer::getPickingImage ( Image out_image)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ getViewFrustum()

void GLSceneRenderer::getViewFrustum ( const SgPerspectiveCamera camera,
double &  left,
double &  right,
double &  bottom,
double &  top 
) const

◆ getViewport()

void GLSceneRenderer::getViewport ( int &  out_x,
int &  out_y,
int &  out_width,
int &  out_height 
) const

◆ getViewVolume()

void GLSceneRenderer::getViewVolume ( const SgOrthographicCamera camera,
float &  out_left,
float &  out_right,
float &  out_bottom,
float &  out_top 
) const

◆ glVendor()

virtual const std::string& cnoid::GLSceneRenderer::glVendor ( ) const
pure virtual

◆ initializeClass()

void GLSceneRenderer::initializeClass ( )
static

◆ initializeGL()

virtual bool cnoid::GLSceneRenderer::initializeGL ( )
pure virtual

◆ isShadowCastingAvailable()

bool GLSceneRenderer::isShadowCastingAvailable ( ) const
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ lightingMode()

virtual LightingMode cnoid::GLSceneRenderer::lightingMode ( ) const
pure virtual

◆ pickedNodePath()

virtual const SgNodePath& cnoid::GLSceneRenderer::pickedNodePath ( ) const
pure virtual

◆ pickedPoint()

virtual const Vector3& cnoid::GLSceneRenderer::pickedPoint ( ) const
pure virtual

◆ rendererType()

int GLSceneRenderer::rendererType ( )
static

◆ requestToClearResources()

virtual void cnoid::GLSceneRenderer::requestToClearResources ( )
pure virtual

◆ scene()

SgGroup * GLSceneRenderer::scene ( )
overridevirtual

Implements cnoid::SceneRenderer.

◆ sceneRoot()

SgGroup * GLSceneRenderer::sceneRoot ( )
overridevirtual

Implements cnoid::SceneRenderer.

◆ setBackFaceCullingMode()

virtual void cnoid::GLSceneRenderer::setBackFaceCullingMode ( int  mode)
pure virtual

◆ setBackgroundColor()

void GLSceneRenderer::setBackgroundColor ( const Vector3f &  color)

◆ setBoundingBoxRenderingForLightweightRenderingGroupEnabled()

void GLSceneRenderer::setBoundingBoxRenderingForLightweightRenderingGroupEnabled ( bool  on)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ setColor()

virtual void cnoid::GLSceneRenderer::setColor ( const Vector3f &  color)
pure virtual

◆ setDefaultColor()

void GLSceneRenderer::setDefaultColor ( const Vector3f &  color)

◆ setDefaultFramebufferObject()

void GLSceneRenderer::setDefaultFramebufferObject ( unsigned int  id)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ setDefaultLineWidth()

virtual void cnoid::GLSceneRenderer::setDefaultLineWidth ( double  width)
pure virtual

◆ setDefaultPointSize()

virtual void cnoid::GLSceneRenderer::setDefaultPointSize ( double  size)
pure virtual

◆ setDefaultSmoothShading()

virtual void cnoid::GLSceneRenderer::setDefaultSmoothShading ( bool  on)
pure virtual

◆ setLightingMode()

virtual void cnoid::GLSceneRenderer::setLightingMode ( LightingMode  mode)
pure virtual

◆ setOutputStream()

void GLSceneRenderer::setOutputStream ( std::ostream &  os)
virtual

◆ setPickingImageOutputEnabled()

void GLSceneRenderer::setPickingImageOutputEnabled ( bool  on)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ setUpsideDown()

void GLSceneRenderer::setUpsideDown ( bool  on)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ setViewport()

virtual void cnoid::GLSceneRenderer::setViewport ( int  x,
int  y,
int  width,
int  height 
)
pure virtual

◆ showNormalVectors()

virtual void cnoid::GLSceneRenderer::showNormalVectors ( double  length)
pure virtual

◆ unproject()

bool GLSceneRenderer::unproject ( double  x,
double  y,
double  z,
Vector3 out_projected 
) const

◆ updateViewportInformation()

void GLSceneRenderer::updateViewportInformation ( int  x,
int  y,
int  width,
int  height 
)
virtual

Reimplemented in cnoid::GLSLSceneRenderer.

◆ viewport()

Array4i GLSceneRenderer::viewport ( ) const

The documentation for this class was generated from the following files: