H3D::GeneratedCubeMapTexture Class Reference
[X3D node classes.]

The ComposedCubeMapTexture node defines a cubic environment map that sources its data from internally generated images. More...

#include <H3D/GeneratedCubeMapTexture.h>

Inheritance diagram for H3D::GeneratedCubeMapTexture:

Inheritance graph

List of all members.

Public Member Functions

 GeneratedCubeMapTexture (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFString > _update=0, Inst< SFInt32 > _size=0)
 Constructor.
virtual void enableTexturing ()
 Enables cube map texturing.
virtual void disableTexturing ()
 Disables cube map texturing.
virtual void render ()
 Creates the cube map from the texture fields.
virtual void preRender ()
 preRender disables rendering if it is called when rendering the cube maps for this node.
virtual void postRender ()
 postRender enables rendering again if it was disabled by preRender.
virtual void initializeTextures ()
 Initialize OpenGL textures by allocation memory and setting up texture parameters.
virtual void updateCubeMapTextures (X3DChildNode *n, X3DViewpointNode *vp)
 Updates the cube map textures by rendering the given node from all directionss and saving the result as textures.
virtual void traverseSG (TraverseInfo &ti)
 Saves the accumulatedForwardMatrix in the local_to_global member variable.
virtual void renderPreViewpoint (X3DChildNode *n, X3DViewpointNode *vp)
 Updates the cube map textures of the GeneratedCubeMapTexture.

Public Attributes

auto_ptr< SFStringupdate
 The texture to use on the back face of the cube.
auto_ptr< SFInt32size
 The texture to use on the front face of the cube.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Member Functions

virtual void updateCubeMap (GLuint texture_target, const Vec3f &camera_position, const Vec3f &camera_dir, const Vec3f &camera_up, X3DChildNode *n, X3DViewpointNode *vp)
 Renders a scene and puts it into a texture.

Protected Attributes

bool textures_initialized
 True when the cube map textures has been initialized.
bool generating_textures
 True if this not is currrently rendering the scene in order to create a cube map.
Matrix4f local_to_global
 Transformation matrix from the local coordinate system of the node to the global coordinate system.


Detailed Description

The ComposedCubeMapTexture node defines a cubic environment map that sources its data from internally generated images.

The viewpoint location of a texture is the location of the geometry in world space.

The field of view shall be 90 degrees with an aspect ratio of 1:1.

The size field indicates the resolution of the generated images in number of pixels per side.

The update field allows the user to request a regeneration of the texture. Setting this field to "ALWAYS" will make the texture be rendered every frame. A value of "NONE" will stop rendering so that no further updates are performed even if the contained scene graph changes. When the value is set to "NEXT_FRAME_ONLY", it is an instruction to render the texture at the end of this frame, and then not to render again. What this means is that the update frame indicator is set to this frame, and at the start of the next frame, the update value will be automatically set back to "NONE" to indicate that the rendering has taken place already. Since this is a field change value, it will automatically generate an output event that may be routed.

Internal routes:
GeneratedCubeMapTexture.dot

Member Function Documentation

void GeneratedCubeMapTexture::initializeTextures (  )  [virtual]

Initialize OpenGL textures by allocation memory and setting up texture parameters.

References size, and textures_initialized.

Referenced by render(), and updateCubeMapTextures().

virtual void H3D::GeneratedCubeMapTexture::preRender (  )  [inline, virtual]

preRender disables rendering if it is called when rendering the cube maps for this node.

This will cause the geometry the GeneratedCubeMapTexture is applied to, not to be rendered as part of the cube map.

Reimplemented from H3D::X3DTextureNode.

References H3D::X3DTextureNode::preRender().

void GeneratedCubeMapTexture::renderPreViewpoint ( X3DChildNode n,
X3DViewpointNode vp 
) [virtual]

Updates the cube map textures of the GeneratedCubeMapTexture.

Updates the cube map textures of all instances of GeneratedCubeMapTexture.

The update field will be checked to see if an update is required.

Parameters:
n The scenegraph to render.
vp The viewpoint the scene is currently rendered with in the normal rendering.
The update field will be checked to see if an update is required.

References H3DUtil::RefCountedClass::getName(), H3D::X3DEnvironmentTextureNode::getTextureId(), update, and updateCubeMapTextures().

void GeneratedCubeMapTexture::traverseSG ( TraverseInfo ti  )  [virtual]

Saves the accumulatedForwardMatrix in the local_to_global member variable.

Parameters:
ti The TraverseInfo object containing information about the traversal.

Reimplemented from H3D::Node.

References H3D::TraverseInfo::getAccForwardMatrix(), and local_to_global.

void GeneratedCubeMapTexture::updateCubeMap ( GLuint  texture_target,
const Vec3f &  camera_position,
const Vec3f &  camera_dir,
const Vec3f &  camera_up,
X3DChildNode n,
X3DViewpointNode vp 
) [protected, virtual]

Renders a scene and puts it into a texture.

Parameters:
texture_target The texture target of the texture to put the rendered scene in.
camera_position The position of the camera used to render the scene (in the coordinate system of vp)
camera_dir The look at vector of the camera.
camera_up The up vector of the camera.
n The node to render.
vp The X3DViewpointNode that is used currently in the normal rendering of the scene.

References H3D::X3DViewpointNode::accForwardMatrix, H3D::H3DDisplayListObject::displayList, H3D::DeviceInfo::getActive(), H3D::X3DBackgroundNode::getActive(), local_to_global, H3D::Node::render(), H3D::X3DBackgroundNode::renderBackground(), H3D::DeviceInfo::renderStyli(), size, and H3D::X3DViewpointNode::totalOrientation.

Referenced by updateCubeMapTextures().

void GeneratedCubeMapTexture::updateCubeMapTextures ( X3DChildNode n,
X3DViewpointNode vp 
) [virtual]

Updates the cube map textures by rendering the given node from all directionss and saving the result as textures.

Parameters:
n The scenegraph to render.
vp The viewpoint the scene is currently rendered with in the normal rendering.

References H3D::H3DDisplayListObject::displayList, generating_textures, initializeTextures(), textures_initialized, and updateCubeMap().

Referenced by renderPreViewpoint().


Member Data Documentation

True if this not is currrently rendering the scene in order to create a cube map.

Referenced by updateCubeMapTextures().

Transformation matrix from the local coordinate system of the node to the global coordinate system.

Referenced by traverseSG(), and updateCubeMap().

The texture to use on the front face of the cube.

Access type: inputOutput

GeneratedCubeMapTexture_size.dot

Referenced by GeneratedCubeMapTexture(), initializeTextures(), and updateCubeMap().

The texture to use on the back face of the cube.

Access type: inputOutput

GeneratedCubeMapTexture_update.dot

Referenced by GeneratedCubeMapTexture(), and renderPreViewpoint().


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

Generated on Fri Nov 7 10:30:11 2008 for H3D API by  doxygen 1.5.7