Choreonoid  1.8
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cnoid::GLSLSceneRenderer Class Reference

#include <GLSLSceneRenderer.h>

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

Public Member Functions

 GLSLSceneRenderer (SgGroup *root=nullptr)
 
virtual ~GLSLSceneRenderer ()
 
virtual void applyExtensions () override
 
virtual bool applyNewExtensions () override
 
virtual void setOutputStream (std::ostream &os) override
 
virtual PolymorphicSceneNodeFunctionSetrenderingFunctions () override
 
virtual void renderCustomGroup (SgGroup *transform, std::function< void()> traverseFunction) override
 
virtual void renderCustomTransform (SgTransform *transform, std::function< void()> traverseFunction) override
 
virtual void renderNode (SgNode *node) override
 
virtual void addNodeDecoration (SgNode *node, NodeDecorationFunction func, int id) override
 
virtual void clearNodeDecorations (int id) override
 
virtual const Affine3currentModelTransform () const override
 
virtual const Matrix4projectionMatrix () const override
 
const Isometry3viewTransform () const
 
const Matrix4viewProjectionMatrix () const
 
Matrix4 modelViewMatrix () const
 
Matrix4 modelViewProjectionMatrix () const
 
virtual double projectedPixelSizeRatio (const Vector3 &position) const override
 
void pushShaderProgram (ShaderProgram *program)
 
void popShaderProgram ()
 
void renderLights (LightingProgram *program)
 
void renderFog (LightingProgram *program)
 
void dispatchToTransparentPhase (ReferencedPtr object, int id, const std::function< void(Referenced *object, const Affine3 &modelTransform, int id)> &renderingFunction)
 
virtual bool initializeGL () override
 
virtual void flushGL () override
 
virtual void clearGL () override
 
virtual void setDefaultFramebufferObject (unsigned int id) override
 
virtual const std::string & glVendor () const override
 
virtual void setViewport (int x, int y, int width, int height) override
 
virtual void updateViewportInformation (int x, int y, int width, int height) override
 
virtual const Vector3pickedPoint () const override
 
virtual const SgNodePathpickedNodePath () const override
 
virtual bool isRenderingPickingImage () const override
 
virtual void setLightingMode (LightingMode mode) override
 
virtual LightingMode lightingMode () const override
 
virtual void clearShadows () override
 
virtual void enableShadowOfLight (int index, bool on) override
 
virtual void enableShadowAntiAliasing (bool on) override
 
virtual void setDefaultSmoothShading (bool on) override
 
virtual SgMaterialdefaultMaterial () override
 
virtual void enableTexture (bool on) override
 
virtual void setDefaultPointSize (double size) override
 
virtual void setDefaultLineWidth (double width) override
 
virtual void showNormalVectors (double length) override
 
virtual void requestToClearResources () override
 
virtual void enableUnusedResourceCheck (bool on) override
 
virtual void setColor (const Vector3f &color) override
 
virtual void setUpsideDown (bool on) override
 
virtual void setBackFaceCullingMode (int mode) override
 
virtual int backFaceCullingMode () const override
 
virtual void setBoundingBoxRenderingForLightweightRenderingGroupEnabled (bool on) override
 
void setLowMemoryConsumptionMode (bool on)
 
virtual void setPickingImageOutputEnabled (bool on) override
 
virtual bool getPickingImage (Image &out_image) override
 
virtual bool isShadowCastingAvailable () const override
 
- Public Member Functions inherited from cnoid::GLSceneRenderer
 GLSceneRenderer (SgGroup *root=nullptr)
 
virtual ~GLSceneRenderer ()
 
virtual SgGroupsceneRoot () override
 
virtual SgGroupscene () override
 
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)
 
- Public Member Functions inherited from cnoid::SceneRenderer
 SceneRenderer ()
 
virtual ~SceneRenderer ()
 
void setName (const std::string &name)
 
const std::string & name () const
 
virtual void clearScene ()
 
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
 
void extractPreprocessedNodes ()
 
void setFlagVariableToUpdatePreprocessedNodeTree (bool &flag)
 
void render ()
 
bool pick (int x, int y)
 
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 addExtension (std::function< void(GLSLSceneRenderer *renderer)> func)
 
- Static Public Member Functions inherited from cnoid::GLSceneRenderer
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)
 

Protected Member Functions

virtual void doRender () override
 
virtual bool doPick (int x, int y) override
 

Additional Inherited Members

- Public Types inherited from cnoid::GLSceneRenderer
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
 

Constructor & Destructor Documentation

◆ GLSLSceneRenderer()

GLSLSceneRenderer::GLSLSceneRenderer ( SgGroup root = nullptr)

◆ ~GLSLSceneRenderer()

GLSLSceneRenderer::~GLSLSceneRenderer ( )
virtual

Member Function Documentation

◆ addExtension()

void GLSLSceneRenderer::addExtension ( std::function< void(GLSLSceneRenderer *renderer)>  func)
static

◆ addNodeDecoration()

void GLSLSceneRenderer::addNodeDecoration ( SgNode node,
NodeDecorationFunction  func,
int  id 
)
overridevirtual

Implements cnoid::SceneRenderer.

◆ applyExtensions()

void GLSLSceneRenderer::applyExtensions ( )
overridevirtual

Reimplemented from cnoid::SceneRenderer.

◆ applyNewExtensions()

bool GLSLSceneRenderer::applyNewExtensions ( )
overridevirtual

Reimplemented from cnoid::SceneRenderer.

◆ backFaceCullingMode()

int GLSLSceneRenderer::backFaceCullingMode ( ) const
overridevirtual

◆ clearGL()

void GLSLSceneRenderer::clearGL ( )
overridevirtual

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 from cnoid::GLSceneRenderer.

◆ clearNodeDecorations()

void GLSLSceneRenderer::clearNodeDecorations ( int  id)
overridevirtual

Implements cnoid::SceneRenderer.

◆ clearShadows()

void GLSLSceneRenderer::clearShadows ( )
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ currentModelTransform()

const Affine3 & GLSLSceneRenderer::currentModelTransform ( ) const
overridevirtual

Implements cnoid::SceneRenderer.

◆ defaultMaterial()

SgMaterial * GLSLSceneRenderer::defaultMaterial ( )
overridevirtual

◆ dispatchToTransparentPhase()

void GLSLSceneRenderer::dispatchToTransparentPhase ( ReferencedPtr  object,
int  id,
const std::function< void(Referenced *object, const Affine3 &modelTransform, int id)> &  renderingFunction 
)

◆ doPick()

bool GLSLSceneRenderer::doPick ( int  x,
int  y 
)
overrideprotectedvirtual

Reimplemented from cnoid::SceneRenderer.

◆ doRender()

void GLSLSceneRenderer::doRender ( )
overrideprotectedvirtual

Implements cnoid::SceneRenderer.

◆ enableShadowAntiAliasing()

void GLSLSceneRenderer::enableShadowAntiAliasing ( bool  on)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ enableShadowOfLight()

void GLSLSceneRenderer::enableShadowOfLight ( int  index,
bool  on 
)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ enableTexture()

void GLSLSceneRenderer::enableTexture ( bool  on)
overridevirtual

◆ enableUnusedResourceCheck()

void GLSLSceneRenderer::enableUnusedResourceCheck ( bool  on)
overridevirtual

◆ flushGL()

void GLSLSceneRenderer::flushGL ( )
overridevirtual

This is necessary when the rendering is done for an internal frame buffer object and the rendererd image data is retrieved from it because another frame buffer object may be bounded in the renderer.

Implements cnoid::GLSceneRenderer.

◆ getPickingImage()

bool GLSLSceneRenderer::getPickingImage ( Image out_image)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ glVendor()

const std::string & GLSLSceneRenderer::glVendor ( ) const
overridevirtual

◆ initializeGL()

bool GLSLSceneRenderer::initializeGL ( )
overridevirtual

◆ isRenderingPickingImage()

bool GLSLSceneRenderer::isRenderingPickingImage ( ) const
overridevirtual

Reimplemented from cnoid::SceneRenderer.

◆ isShadowCastingAvailable()

bool GLSLSceneRenderer::isShadowCastingAvailable ( ) const
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ lightingMode()

GLSceneRenderer::LightingMode GLSLSceneRenderer::lightingMode ( ) const
overridevirtual

◆ modelViewMatrix()

Matrix4 GLSLSceneRenderer::modelViewMatrix ( ) const

◆ modelViewProjectionMatrix()

Matrix4 GLSLSceneRenderer::modelViewProjectionMatrix ( ) const

◆ pickedNodePath()

const SgNodePath & GLSLSceneRenderer::pickedNodePath ( ) const
overridevirtual

◆ pickedPoint()

const Vector3 & GLSLSceneRenderer::pickedPoint ( ) const
overridevirtual

◆ popShaderProgram()

void GLSLSceneRenderer::popShaderProgram ( )

◆ projectedPixelSizeRatio()

double GLSLSceneRenderer::projectedPixelSizeRatio ( const Vector3 position) const
overridevirtual

Implements cnoid::SceneRenderer.

◆ projectionMatrix()

const Matrix4 & GLSLSceneRenderer::projectionMatrix ( ) const
overridevirtual

Implements cnoid::SceneRenderer.

◆ pushShaderProgram()

void GLSLSceneRenderer::pushShaderProgram ( ShaderProgram program)

◆ renderCustomGroup()

void GLSLSceneRenderer::renderCustomGroup ( SgGroup transform,
std::function< void()>  traverseFunction 
)
overridevirtual

Implements cnoid::SceneRenderer.

◆ renderCustomTransform()

void GLSLSceneRenderer::renderCustomTransform ( SgTransform transform,
std::function< void()>  traverseFunction 
)
overridevirtual

Implements cnoid::SceneRenderer.

◆ renderFog()

void GLSLSceneRenderer::renderFog ( LightingProgram program)

◆ renderingFunctions()

SceneRenderer::NodeFunctionSet * GLSLSceneRenderer::renderingFunctions ( )
overridevirtual

Implements cnoid::SceneRenderer.

◆ renderLights()

void GLSLSceneRenderer::renderLights ( LightingProgram program)

◆ renderNode()

void GLSLSceneRenderer::renderNode ( SgNode node)
overridevirtual

Implements cnoid::SceneRenderer.

◆ requestToClearResources()

void GLSLSceneRenderer::requestToClearResources ( )
overridevirtual

◆ setBackFaceCullingMode()

void GLSLSceneRenderer::setBackFaceCullingMode ( int  mode)
overridevirtual

◆ setBoundingBoxRenderingForLightweightRenderingGroupEnabled()

void GLSLSceneRenderer::setBoundingBoxRenderingForLightweightRenderingGroupEnabled ( bool  on)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ setColor()

void GLSLSceneRenderer::setColor ( const Vector3f &  color)
overridevirtual

◆ setDefaultFramebufferObject()

void GLSLSceneRenderer::setDefaultFramebufferObject ( unsigned int  id)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ setDefaultLineWidth()

void GLSLSceneRenderer::setDefaultLineWidth ( double  width)
overridevirtual

◆ setDefaultPointSize()

void GLSLSceneRenderer::setDefaultPointSize ( double  size)
overridevirtual

◆ setDefaultSmoothShading()

void GLSLSceneRenderer::setDefaultSmoothShading ( bool  on)
overridevirtual

◆ setLightingMode()

void GLSLSceneRenderer::setLightingMode ( LightingMode  mode)
overridevirtual

◆ setLowMemoryConsumptionMode()

void GLSLSceneRenderer::setLowMemoryConsumptionMode ( bool  on)

◆ setOutputStream()

void GLSLSceneRenderer::setOutputStream ( std::ostream &  os)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ setPickingImageOutputEnabled()

void GLSLSceneRenderer::setPickingImageOutputEnabled ( bool  on)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ setUpsideDown()

void GLSLSceneRenderer::setUpsideDown ( bool  on)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ setViewport()

void GLSLSceneRenderer::setViewport ( int  x,
int  y,
int  width,
int  height 
)
overridevirtual

◆ showNormalVectors()

void GLSLSceneRenderer::showNormalVectors ( double  length)
overridevirtual

◆ updateViewportInformation()

void GLSLSceneRenderer::updateViewportInformation ( int  x,
int  y,
int  width,
int  height 
)
overridevirtual

Reimplemented from cnoid::GLSceneRenderer.

◆ viewProjectionMatrix()

const Matrix4 & GLSLSceneRenderer::viewProjectionMatrix ( ) const

◆ viewTransform()

const Isometry3 & GLSLSceneRenderer::viewTransform ( ) const

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