H3D API  2.4.1
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
H3D::Appearance Class Reference

The Appearance node specifies the visual properties of geometry. More...

#include <H3D/Appearance.h>

Inheritance diagram for H3D::Appearance:
Inheritance graph

Public Types

typedef DependentSFNode< FillProperties, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFFillProperties
 The SFFillProperties field is dependent on the displayList field of the containing FillProperties node.
 
typedef DependentSFNode< LineProperties, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFLineProperties
 The SFLineProperties field is dependent on the displayList field of the containing LineProperties node.
 
typedef DependentSFNode< X3DMaterialNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFMaterialNode
 The SFMaterialNode field is dependent on the displayList field of the containing X3DMaterialNode.
 
typedef DependentSFNode< X3DTextureTransformNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFTextureTransformNode
 The SFTextureTransformNode field is dependent on the displayList field of the containing X3DTextureTransformNode node.
 
typedef DependentSFNode< X3DTextureNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFTextureNode
 The SFTextureNode field is dependent on the displayList field of the containing X3DTextureNode node.
 
typedef DependentMFNode< X3DShaderNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > MFShaderNode
 The MFShaderNode field is dependent on the displayList field of the containing X3DShaderNode node.
 
typedef DependentSFNode< RenderProperties, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFRenderProperties
 The SFRenderProperties field is dependent on the displayList field of the containing X3DShaderNode node.
 
- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 

Public Member Functions

 Appearance (Inst< DisplayList > _displayList=0, Inst< SFFillProperties > _fillProperties=0, Inst< SFLineProperties > _lineProperties=0, Inst< SFMaterialNode > _material=0, Inst< SFNode > _metadata=0, Inst< SFTextureNode > _texture=0, Inst< SFTextureTransformNode > _textureTransform=0, Inst< SFSurface > _surface=0, Inst< MFShaderNode > _shaders=0, Inst< SFRenderProperties > _renderProperties=0, Inst< SFBool > _shadow=0)
 Constructor.
 
virtual void render ()
 Set up the appearance in OpenGL. More...
 
virtual void preRender ()
 This function will be called by the X3DShapeNode before any rendering of geometry and before the call to the render function. More...
 
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 GLbitfield getAffectedGLAttribs ()
 Returns a bitmask of the OpenGL attrib bits that will be affected by this node. More...
 
virtual void traverseSG (TraverseInfo &ti)
 Traversing the scene graph. More...
 
virtual bool isTransparent ()
 This function checks the transparency field to determine if the material requires that the geometry is rendered with transparency.
 
virtual bool hasGeometryShadow ()
 This function return true if the appearance has decided that shadow should be cast. More...
 
virtual bool usingMultiPassTransparency ()
 This function checks if multi-pass transparency should be used or not (see RenderProperties_multiPassTransparency)
 
- Public Member Functions inherited from H3D::X3DAppearanceNode
 X3DAppearanceNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFSurface > _surface=0)
 Constructor.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Public Attributes

H3DUniquePtr< SFFillPropertiesfillProperties
 If specified it contains a FillProperties node that specifies additional properties to be applied to all polygonal areas. More...
 
H3DUniquePtr< SFLinePropertieslineProperties
 If specified it contains a LineProperties node that specifies additional properties to be applied to all line geometry. More...
 
H3DUniquePtr< SFMaterialNodematerial
 The material field, if specified, shall contain a Material node. More...
 
H3DUniquePtr< SFTextureNodetexture
 Contains a X3DTextureNode to be used in the texturing. More...
 
H3DUniquePtr< SFTextureTransformNodetextureTransform
 Contains a X3DTextureTransformNode that specifies a transformation of texture coordinates. More...
 
H3DUniquePtr< MFShaderNodeshaders
 The shaders field defines the collection of shaders of various languages in the order of preference. More...
 
H3DUniquePtr< SFRenderPropertiesrenderProperties
 The renderProperties field, if specified, shall contain a RenderProperties node. More...
 
H3DUniquePtr< SFBoolshadow
 The shadow field specifies if the geometry this Appearance is used on should cast a shadow or not. More...
 
- Public Attributes inherited from H3D::X3DAppearanceNode
H3DUniquePtr< SFSurfacesurface
 Contains the Surface node that will determine how an object will feel haptically. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DAppearanceNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Additional Inherited Members

- Static Public Member Functions inherited from H3D::X3DAppearanceNode
static void setDefaultUsingMultiPassTransparency (bool b)
 Set the default value for usage of multi pass transparancy. More...
 
static bool getDefaultUsingMultiPassTransparency ()
 Get the default value for usage of multi pass transparancy.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 
- Static Protected Attributes inherited from H3D::X3DAppearanceNode
static bool default_using_multi_pass_transparency = true
 The default value to use for multipass transparency, if the inherited appearance node does not contain any information about using multipass transparency.
 

Detailed Description

The Appearance node specifies the visual properties of geometry.

The value for each of the fields in this node may be NULL. However, if the field is non-NULL, it shall contain one node of the appropriate type.

Examples:

Internal routes:

Member Function Documentation

◆ getAffectedGLAttribs()

GLbitfield Appearance::getAffectedGLAttribs ( )
virtual

◆ hasGeometryShadow()

virtual bool H3D::Appearance::hasGeometryShadow ( )
inlinevirtual

This function return true if the appearance has decided that shadow should be cast.


Reimplemented from H3D::X3DAppearanceNode.

◆ preRender()

void Appearance::preRender ( )
virtual

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

This function will be called by the X3DShapeNode before any rendering of geometry in order to set up all OpenGL states that are needed to for the appearance of the geometry.


Reimplemented from H3D::X3DAppearanceNode.

References H3D::X3DShapeNode::disable_lighting_if_no_app, fillProperties, H3DUtil::RefCountedClass::getName(), H3D::X3DShaderNode::isSupported(), H3D::X3DShaderNode::language, lineProperties, material, H3D::X3DAppearanceChildNode::preRender(), H3D::X3DAppearanceNode::preRender(), H3D::X3DTextureNode::preRender(), H3D::X3DTextureTransformNode::preRender(), renderProperties, H3D::X3DShaderNode::setSelected(), shaders, texture, and textureTransform.

◆ render()

void Appearance::render ( )
virtual

Set up the appearance 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.

Reimplemented from H3D::Node.

References H3D::H3DDisplayListObject::displayList, fillProperties, H3D::X3DTextureNode::getActiveTexture(), H3D::H3DImageObject::image, H3D::X3DShaderNode::isSelected, lineProperties, material, H3DUtil::Image::pixelType(), H3D::Node::render(), H3D::X3DTextureTransformNode::renderForTextureUnit(), H3D::X3DTextureTransformNode::renderForTextureUnits(), renderProperties, shaders, texture, H3D::MultiTexture::texture, and textureTransform.

◆ traverseSG()

void Appearance::traverseSG ( TraverseInfo ti)
virtual

Member Data Documentation

◆ fillProperties

H3DUniquePtr< SFFillProperties > H3D::Appearance::fillProperties

If specified it contains a FillProperties node that specifies additional properties to be applied to all polygonal areas.

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), postRender(), preRender(), render(), and traverseSG().

◆ lineProperties

H3DUniquePtr< SFLineProperties > H3D::Appearance::lineProperties

If specified it contains a LineProperties node that specifies additional properties to be applied to all line geometry.

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), postRender(), preRender(), render(), and traverseSG().

◆ material

H3DUniquePtr< SFMaterialNode > H3D::Appearance::material

The material field, if specified, shall contain a Material node.

If the material field is NULL or unspecified, lighting is off (all lights are ignored during rendering of the object that references this Appearance) and the unlit object colour is (1, 1, 1).

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), H3D::Scene::idle(), isTransparent(), postRender(), preRender(), render(), and traverseSG().

◆ renderProperties

H3DUniquePtr< SFRenderProperties > H3D::Appearance::renderProperties

The renderProperties field, if specified, shall contain a RenderProperties node.

If renderProperties is NULL or unspecified, the renderProperties field has no effect (this field is not part of the X3D specification)

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), H3D::Scene::idle(), postRender(), preRender(), render(), and traverseSG().

◆ shaders

H3DUniquePtr< MFShaderNode > H3D::Appearance::shaders

The shaders field defines the collection of shaders of various languages in the order of preference.

The first node declared is the highest preference. If the language is not supported for the current preference level, the X3DShaderNode's isSelected field is set to false, and the next shader is checked.

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), isTransparent(), postRender(), preRender(), render(), and traverseSG().

◆ shadow

H3DUniquePtr< SFBool > H3D::Appearance::shadow

The shadow field specifies if the geometry this Appearance is used on should cast a shadow or not.

Access type: inputOutput Default value: false

Referenced by Appearance().

◆ texture

H3DUniquePtr< SFTextureNode > H3D::Appearance::texture

Contains a X3DTextureNode to be used in the texturing.

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), postRender(), preRender(), render(), and traverseSG().

◆ textureTransform

H3DUniquePtr< SFTextureTransformNode > H3D::Appearance::textureTransform

Contains a X3DTextureTransformNode that specifies a transformation of texture coordinates.

Access type: inputOutput

Referenced by Appearance(), getAffectedGLAttribs(), postRender(), preRender(), render(), and traverseSG().


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