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

This node defines material properties that can effect both the front and back side of a polygon individually. More...

#include <TwoSidedMaterial.h>

Inheritance diagram for H3D::TwoSidedMaterial:

Inheritance graph
List of all members.

Public Member Functions

 TwoSidedMaterial (Inst< DisplayList > _displayList=0, Inst< SFFloat > _ambientIntensity=0, Inst< SFColor > _diffuseColor=0, Inst< SFColor > _emissiveColor=0, Inst< SFNode > _metadata=0, Inst< SFFloat > _shininess=0, Inst< SFColor > _specularColor=0, Inst< SFFloat > _transparency=0, Inst< SFFloat > _backAmbientIntensity=0, Inst< SFColor > _backDiffuseColor=0, Inst< SFColor > _backEmissiveColor=0, Inst< SFFloat > _backShininess=0, Inst< SFColor > _backSpecularColor=0, Inst< SFFloat > _backTransparency=0, Inst< SFBool > _separateBackColor=0)
 Constructor.
virtual void render ()
 Set up the material properties in OpenGL.
virtual void preRender ()
 This function will be called by the X3DShapeNode before any rendering of geometry and before the call to the render function.
virtual void postRender ()
 This function will be called by the X3DShapeNode after the geometry has been rendered to restore the states to what it was before the call to preRender().
virtual bool isTransparent ()
 This function checks the transparency field to determine if the material requires that the geometry is rendered with transparency.

Public Attributes

auto_ptr< SFFloatambientIntensity
 The ambientIntensity field specifies how much ambient light from light sources this surface shall reflect.
auto_ptr< SFColordiffuseColor
 The diffuseColor field reflects all light sources depending on the angle of the surface with respect to the light source.
auto_ptr< SFColoremissiveColor
 The emissiveColor field models "glowing" objects.
auto_ptr< SFFloatshininess
 Shininess effect the specular highlights.
auto_ptr< SFColorspecularColor
 The color of the specular highlights.
auto_ptr< SFFloattransparency
 The transparency field specifies how "clear" an object is, with 1.0 being completely transparent, and 0.0 completely opaque.
auto_ptr< SFFloatbackAmbientIntensity
 The backAmbientIntensity is the same as the ambientIntensity field but will be used for the back side of the geometry if separateBackColor is true;.
auto_ptr< SFColorbackDiffuseColor
 The backDiffuseColor is the same as the diffuseColor field but will be used for the back side of the geometry if separateBackColor is true;.
auto_ptr< SFColorbackEmissiveColor
 The backEmissiveColor is the same as the emissiveColor field but will be used for the back side of the geometry if separateBackColor is true;.
auto_ptr< SFFloatbackShininess
 The backShininess is the same as the shininess field but will be used for the back side of the geometry if separateBackColor is true;.
auto_ptr< SFColorbackSpecularColor
 The backSpecularColor is the same as the specularColor field but will be used for the back side of the geometry if separateBackColor is true;.
auto_ptr< SFFloatbackTransparency
 The backTransparency is the same as the transparency field but will be used for the back side of the geometry if separateBackColor is true.
auto_ptr< SFBoolseparateBackColor
 If the separateBackColor field is set to TRUE, then the rendering shall render the front and back faces of the geometry with different values.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Detailed Description

This node defines material properties that can effect both the front and back side of a polygon individually.

These materials are used for both the front and back side of the geometry whenever the X3D lighting model is active.

If the separateBackColor field is set to TRUE, then the rendering shall render the front and back faces of the geometry with different values. If the value is FALSE, then the front colours are used for both the front and back side of the polygon, as per the existing X3D lighting rules.

When calculating the terms in the lighting equations, the front geometry shall use the fields ambientIntensity, diffuseColor,emissiveColor, shininess, specularColor, and transparency. The faces that are determined to be the back side are rendered using backAmbientIntensity, backDiffuseColor, backEmissiveColor, backShininess, and backTransparency as the appropriate components in the lighting equations.

Internal routes:
TwoSidedMaterial.dot


Member Function Documentation

virtual void H3D::TwoSidedMaterial::preRender  )  [inline, virtual]
 

This function will be called by the X3DShapeNode before any rendering of geometry and before the call to the render function.

So this is the place to save the states that are going to be changed in render() in order to restore it in postRender().

Reimplemented from H3D::X3DAppearanceChildNode.

void TwoSidedMaterial::render  )  [virtual]
 

Set up the material properties in OpenGL.

If an RGB, BGR, RGBA or BGRA texture the texture values should not be modulated with diffuseColor according to the X3D spec. So we set the diffuse color to 1 1 1 in order to show the texture values as they are. The alpha value should be the one from material if 3 component texture and the one from the texture if 4-component texture.

If an RGB, BGR, RGBA or BGRA texture the texture values should not be modulated with diffuseColor according to the X3D spec. So we set the diffuse color to 1 1 1 in order to show the texture values as they are. The alpha value should be the one from material if 3 component texture and the one from the texture if 4-component texture.

Reimplemented from H3D::Node.


Member Data Documentation

auto_ptr< SFFloat > H3D::TwoSidedMaterial::ambientIntensity
 

The ambientIntensity field specifies how much ambient light from light sources this surface shall reflect.

Ambient light is omnidirectional and depends only on the number of light sources, not their positions with respect to the surface. Ambient colour is calculated as ambientIntensity × diffuseColor.

Access type: inputOutput
Default value: 0.2
Valid range: [0-1]

TwoSidedMaterial_ambientIntensity.dot

auto_ptr< SFFloat > H3D::TwoSidedMaterial::backAmbientIntensity
 

The backAmbientIntensity is the same as the ambientIntensity field but will be used for the back side of the geometry if separateBackColor is true;.

Access type: inputOutput
Default value: 0.2
Valid range: [0-1]

TwoSidedMaterial_backAmbientIntensity.dot

auto_ptr< SFColor > H3D::TwoSidedMaterial::backDiffuseColor
 

The backDiffuseColor is the same as the diffuseColor field but will be used for the back side of the geometry if separateBackColor is true;.

Access type: inputOutput
Default value: RGB( 0.8, 0.8, 0.8 )
Valid range: [0-1]

TwoSidedMaterial_backDiffuseColor.dot

auto_ptr< SFColor > H3D::TwoSidedMaterial::backEmissiveColor
 

The backEmissiveColor is the same as the emissiveColor field but will be used for the back side of the geometry if separateBackColor is true;.

Access type: inputOutput
Default value: RGB( 0, 0, 0 )
Valid range: [0-1]

TwoSidedMaterial_backEmissiveColor.dot

auto_ptr< SFFloat > H3D::TwoSidedMaterial::backShininess
 

The backShininess is the same as the shininess field but will be used for the back side of the geometry if separateBackColor is true;.

Access type: inputOutput
Default value: 0.2
Valid range: [0-1]

TwoSidedMaterial_backShininess.dot

auto_ptr< SFColor > H3D::TwoSidedMaterial::backSpecularColor
 

The backSpecularColor is the same as the specularColor field but will be used for the back side of the geometry if separateBackColor is true;.

Access type: inputOutput
Default value: RGB( 0, 0, 0 )
Valid range: [0-1]

TwoSidedMaterial_backSpecularColor.dot

auto_ptr< SFFloat > H3D::TwoSidedMaterial::backTransparency
 

The backTransparency is the same as the transparency field but will be used for the back side of the geometry if separateBackColor is true.

Access type: inputOutput
Default value: 0
Valid range: [0-1]

TwoSidedMaterial_backTransparency.dot

auto_ptr< SFColor > H3D::TwoSidedMaterial::diffuseColor
 

The diffuseColor field reflects all light sources depending on the angle of the surface with respect to the light source.

The more directly the surface faces the light, the more diffuse light reflects.

Access type: inputOutput
Default value: RGB( 0.8, 0.8, 0.8 )
Valid range: [0-1]

TwoSidedMaterial_diffuseColor.dot

auto_ptr< SFColor > H3D::TwoSidedMaterial::emissiveColor
 

The emissiveColor field models "glowing" objects.

This can be useful for displaying pre-lit models (where the light energy of the room is computed explicitly), or for displaying scientific data.

Access type: inputOutput
Default value: RGB( 0, 0, 0 )
Valid range: [0-1]

TwoSidedMaterial_emissiveColor.dot

auto_ptr< SFBool > H3D::TwoSidedMaterial::separateBackColor
 

If the separateBackColor field is set to TRUE, then the rendering shall render the front and back faces of the geometry with different values.

If the value is FALSE, then the front colours are used for both the front and back side of the polygon,

Access type: inputOutput
Default value: 0
Valid range: [0-1]

TwoSidedMaterial_separateBackColor.dot

auto_ptr< SFFloat > H3D::TwoSidedMaterial::shininess
 

Shininess effect the specular highlights.

Lower shininess values produce soft glows, while higher values result in sharper, smaller highlights.

Access type: inputOutput
Default value: 0.2
Valid range: [0-1]

TwoSidedMaterial_shininess.dot

auto_ptr< SFColor > H3D::TwoSidedMaterial::specularColor
 

The color of the specular highlights.

Access type: inputOutput
Default value: RGB( 0, 0, 0 )
Valid range: [0-1]

TwoSidedMaterial_specularColor.dot

auto_ptr< SFFloat > H3D::TwoSidedMaterial::transparency
 

The transparency field specifies how "clear" an object is, with 1.0 being completely transparent, and 0.0 completely opaque.

Access type: inputOutput
Default value: 0
Valid range: [0-1]

TwoSidedMaterial_transparency.dot


Generated on Thu Aug 24 12:40:16 2006 for H3D API by  doxygen 1.4.5