Core Scene Graph Data Structures in C++


Material

If not NULL, the material field of an Appearance node is only allowed to contain a pointer to a Material node. The Material node has several fields which contain information used to render the objects represented in the geometry field of the Shape node. Not all of these fields are used in DGP2023 application yet. The diffuseColor field value is used to paint a geometry object when the object is not specified with bound color properties.

This is how the Material node is defined in the VRML'97 Standard.

Material {
  SFFloat ambientIntensity	0.2	
  SFColor diffuseColor		0.8 0.8 0.8
  SFColor emissiveColor		0 0 0
  SFFloat shininess		0.2	
  SFColor specularColor		0 0 0
  SFFloat transparency		0
}

This is the public interface to the Material class as defined in the DGP2023 implementation.

class Material : public Node {
  public:
                        Material();
    virtual            ~Material();
    float               getAmbientIntensity();
    Color&              getDiffuseColor();
    Color&              getEmissiveColor();
    float               getShininess();
    Color               getSpecularColor();
    float               getTransparency();
    void                setAmbientIntensity(float value);
    void                setDiffuseColor(Color& value);
    void                setEmissiveColor(Color&value);
    void                setShininess(float value);
    void                setSpecularColor(Color& value);
    void                setTransparency(float value);
    virtual bool        isMaterial() const;
    virtual string      getType()    const;
};