Ocean
Ocean::Rendering::Material Class Reference

This class is the base class for all materials. More...

Inheritance diagram for Ocean::Rendering::Material:

Public Member Functions

virtual RGBAColor ambientColor () const
 Returns the ambient color of this material. More...
 
virtual RGBAColor diffuseColor () const
 Returns the diffuse color of this material. More...
 
virtual RGBAColor emissiveColor () const
 Returns the emissive color of this material. More...
 
virtual RGBAColor specularColor () const
 Returns the specular color of this material. More...
 
virtual float specularExponent () const
 Returns the specular exponent of this material with range [0.0, infinity). More...
 
virtual float transparency () const
 Returns the transparency factor of this material with range [0.0, 1.0]. More...
 
virtual float reflectivity () const
 Returns the reflectivity factor of this material with range [0.0, 1.0]. More...
 
virtual float refractionIndex () const
 Returns the index of refraction of this material with range [0.0, 1.0]. More...
 
virtual void get (RGBAColor &ambient, RGBAColor &diffuse, RGBAColor &emissive, RGBAColor &specular, float &specularExponent, float &transparency)
 Gets all color values of the material at once. More...
 
virtual bool setAmbientColor (const RGBAColor &color)
 Sets the ambient color of the material. More...
 
virtual bool setDiffuseColor (const RGBAColor &color)
 Sets the diffuse color of the material. More...
 
virtual bool setEmissiveColor (const RGBAColor &color)
 Sets the emissive color of the material. More...
 
virtual bool setSpecularColor (const RGBAColor &color)
 Sets the specular color of the material. More...
 
virtual bool setSpecularExponent (const float specularExponent)
 Sets the specular exponent of this material with range [0.0, infinity). More...
 
virtual bool setTransparency (const float transparency)
 Sets the transparency of the material. More...
 
virtual bool setReflectivity (const float reflectivity)
 Sets the reflectivity of this material. More...
 
virtual bool setRefractionIndex (const float index)
 Sets the index of refraction of this material. More...
 
virtual bool set (const RGBAColor &ambient, const RGBAColor &diffuse, const RGBAColor &emissive, const RGBAColor &specular, const float specularExponent, const float transparency)
 Sets all color values of the material at once. More...
 
ObjectType type () const override
 Returns the type of this object. More...
 
- Public Member Functions inherited from Ocean::Rendering::Object
ObjectId id () const
 Returns the unique object id of this object. More...
 
const std::string & name () const
 Returns the name of this object. More...
 
virtual void setName (const std::string &name)
 Sets or changes the name of this object. More...
 
virtual const std::string & engineName () const =0
 Returns the name of the owner engine. More...
 
ObjectRefs parentObjects () const
 Returns all parent objects. More...
 
ObjectRefSet parentNodes () const
 Returns all parent nodes. More...
 
virtual std::string descriptiveInformation () const
 Returns descriptive information about the object as string. More...
 

Protected Member Functions

 Material ()
 Creates a new material object. More...
 
 ~Material () override
 Destructs a meterial object. More...
 
- Protected Member Functions inherited from Ocean::Rendering::Attribute
 Attribute ()
 Creates a new attribute object. More...
 
 ~Attribute () override
 Destructs an attribute object. More...
 
- Protected Member Functions inherited from Ocean::Rendering::Object
 Object ()
 Creates a new object. More...
 
 Object (const Object &object)=delete
 Disabled copy constructor. More...
 
virtual ~Object ()
 Destructs an object. More...
 
Engineengine () const
 Returns the render engine which is owner of this object. More...
 
void registerParent (const ObjectId parentId)
 Registers a parent node for this (child) node. More...
 
void unregisterParent (const ObjectId parentId)
 Unregisters a parent node for this (child) node. More...
 
void registerThisObjectAsParent (const ObjectRef &child)
 Registers this object at a child as parent object. More...
 
void unregisterThisObjectAsParent (const ObjectRef &child)
 Unregisters this object from a child as parent. More...
 
Objectoperator= (const Object &object)=delete
 Disabled copy operator. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::Rendering::Object
enum  ObjectType {
  TYPE_UNKNOWN , TYPE_ABSOLUTE_TRANSFORM , TYPE_ATTRIBUTE , TYPE_ATTRIBUTE_SET ,
  TYPE_BACKGROUND , TYPE_BILLBOARD , TYPE_BITMAP_FRAMEBUFFER , TYPE_BLEND_ATTRIBUTE ,
  TYPE_BOX , TYPE_CONE , TYPE_CYLINDER , TYPE_DEPTH_ATTRIBUTE ,
  TYPE_DIRECTIONAL_LIGHT , TYPE_FRAMEBUFFER , TYPE_FRAME_TEXTURE_2D , TYPE_GEOMETRY ,
  TYPE_GROUP , TYPE_INDEPENDENT_PRIMITIVE , TYPE_LIGHT_SOURCE , TYPE_LINES ,
  TYPE_LINE_STRIPS , TYPE_LOD , TYPE_MATERIAL , TYPE_NODE ,
  TYPE_OBJECT , TYPE_PARALLEL_VIEW , TYPE_PERSPECTIVE_VIEW , TYPE_PHANTOM_ATTRIBUTE ,
  TYPE_POINT_LIGHT , TYPE_POINTS , TYPE_PRIMITIVE , TYPE_PRIMITIVE_ATTRIBUTE ,
  TYPE_QUAD_STRIPS , TYPE_QUADS , TYPE_RENDERABLE , TYPE_SCENE ,
  TYPE_SHADER_PROGRAM , TYPE_SHAPE , TYPE_SKY_BACKGROUND , TYPE_SPHERE ,
  TYPE_SPOT_LIGHT , TYPE_STEREO_ATTRIBUTE , TYPE_STEREO_VIEW , TYPE_STRIP_PRIMITIVE ,
  TYPE_SWITCH , TYPE_TEXT , TYPE_TEXTURE , TYPE_TEXTURE_2D ,
  TYPE_MEDIA_TEXTURE_2D , TYPE_TEXTURE_FRAMEBUFFER , TYPE_TEXTURES , TYPE_TRANSFORM ,
  TYPE_TRIANGLE_FANS , TYPE_TRIANGLES , TYPE_TRIANGLE_STRIPS , TYPE_UNDISTORTED_BACKGROUND ,
  TYPE_VERTEX_SET , TYPE_VIEW , TYPE_WINDOW_FRAMEBUFFER
}
 Definition of different object type. More...
 
typedef std::unordered_map< ObjectId, unsigned int > ObjectIdMap
 Definition of a map holding object ids to reference counters. More...
 
- Static Public Member Functions inherited from Ocean::Rendering::Object
static std::string translateObjectType (const ObjectType objectType)
 Translates an object type to a readable string. More...
 
- Protected Attributes inherited from Ocean::Rendering::Object
Lock objectLock
 Lock for the object. More...
 

Detailed Description

This class is the base class for all materials.

Each material is composed by different color components and appearance values:
Ambient color models light that is inherent in the global scene due to global illumination, (0.2, 0.2, 0.2) as default.
Diffuse color models light reflected on rough surfaces, (0.8, 0.8, 0.8) as default.
Emissive color enabled objects to seam self-luminous, (0.0, 0.0, 0.0) as default.
Specular color models light reflected on shiny surfaces, (0.0, 0.0, 0.0) as default.
Specular exponent models the sharpness of the reflection with range [0.0, infinity), 0.0 as default.
Transparency models transparent surfaces with range [0.0, 1.0], 0.0 (fully opaque) as default.

Use the material object to define the appearance of geometry nodes.
Each geometry node is associated with at most one material object.
The material object has to be inserted to an attribute set which itself is connected to the geometry node.

See also
AttributeSet, Geometry, Attribute

Constructor & Destructor Documentation

◆ Material()

Ocean::Rendering::Material::Material ( )
protected

Creates a new material object.

◆ ~Material()

Ocean::Rendering::Material::~Material ( )
overrideprotected

Destructs a meterial object.

Member Function Documentation

◆ ambientColor()

virtual RGBAColor Ocean::Rendering::Material::ambientColor ( ) const
virtual

Returns the ambient color of this material.

Returns
Ambient color
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
setAmbientColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ diffuseColor()

virtual RGBAColor Ocean::Rendering::Material::diffuseColor ( ) const
virtual

Returns the diffuse color of this material.

Returns
Diffuse color
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
setDiffuseColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ emissiveColor()

virtual RGBAColor Ocean::Rendering::Material::emissiveColor ( ) const
virtual

Returns the emissive color of this material.

Returns
Emissive color
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
setEmissiveColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ get()

virtual void Ocean::Rendering::Material::get ( RGBAColor ambient,
RGBAColor diffuse,
RGBAColor emissive,
RGBAColor specular,
float &  specularExponent,
float &  transparency 
)
virtual

Gets all color values of the material at once.

Parameters
ambientResulting ambient color of this material
diffuseResulting diffuse color of this material
emissiveResulting emissive color of this material
specularResulting specular color of this material
specularExponentResulting specular exponent of this material with range [0.0, infinity)
transparencyResulting transparency factor of this material with range [0.0, 1.0]
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
set().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ reflectivity()

virtual float Ocean::Rendering::Material::reflectivity ( ) const
virtual

Returns the reflectivity factor of this material with range [0.0, 1.0].

0.0 means no reflection, 1.0 means total reflection.
Beware: This parameter it used for global illumination and therefore not supported by most engines.

Returns
Reflection factor
Exceptions
NotSupportedExcecptionIs thrown if this function is not supported
See also
setReflectivity().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial.

◆ refractionIndex()

virtual float Ocean::Rendering::Material::refractionIndex ( ) const
virtual

Returns the index of refraction of this material with range [0.0, 1.0].

The default value is 1 (as for standard for vacuum; water has 1.33, fused quartz glass has 1.46). Beware: This parameter it used for global illumination and therefore not supported by most engines.

Returns
Index of refraction
Exceptions
NotSupportedExcecptionIs thrown if this function is not supported
See also
setRefractionIndex().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial.

◆ set()

virtual bool Ocean::Rendering::Material::set ( const RGBAColor ambient,
const RGBAColor diffuse,
const RGBAColor emissive,
const RGBAColor specular,
const float  specularExponent,
const float  transparency 
)
virtual

Sets all color values of the material at once.

Parameters
ambientAmbient color to set
diffuseDiffuse color to set
emissiveEmissive color to set
specularSpecular color to set
specularExponentSpecular exponent to set with range [0.0, infinity)
transparencyTransparency factor to set with range [0.0, 1.0]
Returns
True, if at least one specified value was valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
get().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ setAmbientColor()

virtual bool Ocean::Rendering::Material::setAmbientColor ( const RGBAColor color)
virtual

Sets the ambient color of the material.

Parameters
colorAmbient color
Returns
True, if the specified color is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
ambientColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ setDiffuseColor()

virtual bool Ocean::Rendering::Material::setDiffuseColor ( const RGBAColor color)
virtual

Sets the diffuse color of the material.

Parameters
colorDiffuse color
Returns
True, if the specified color is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
diffuseColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ setEmissiveColor()

virtual bool Ocean::Rendering::Material::setEmissiveColor ( const RGBAColor color)
virtual

Sets the emissive color of the material.

Parameters
colorEmissive color
Returns
True, if the specified color is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
emissiveColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ setReflectivity()

virtual bool Ocean::Rendering::Material::setReflectivity ( const float  reflectivity)
virtual

Sets the reflectivity of this material.

0 means no reflection, 1 means total reflection.
Beware: This parameter it used for global illumination and therefore not supported by most engines.

Parameters
reflectivityReflectivity factor of this material with range [0.0, 1.0]
Returns
True, if the specified value is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
reflectivity().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial.

◆ setRefractionIndex()

virtual bool Ocean::Rendering::Material::setRefractionIndex ( const float  index)
virtual

Sets the index of refraction of this material.

The default value is 1 (as for standard for vacuum; water has 1.33, fused quartz glass has 1.46). Beware: This parameter it used for global illumination and therefore not supported by most engines.

Parameters
indexRefraction index to be set with range [0.0, infinity)
Returns
True, if the specified value is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
refractionIndex().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial.

◆ setSpecularColor()

virtual bool Ocean::Rendering::Material::setSpecularColor ( const RGBAColor color)
virtual

Sets the specular color of the material.

Parameters
colorSpecular color
Returns
True, if the specified color is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
specularColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ setSpecularExponent()

virtual bool Ocean::Rendering::Material::setSpecularExponent ( const float  specularExponent)
virtual

Sets the specular exponent of this material with range [0.0, infinity).

The higher the specular exponent value the sharper the reflection area.

Parameters
specularExponentSpecular exponent
Returns
True, if the specified exponent is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
specularExponent().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ setTransparency()

virtual bool Ocean::Rendering::Material::setTransparency ( const float  transparency)
virtual

Sets the transparency of the material.

0.0 means fully opaque, 1.0 means fully transparent.

Parameters
transparencyTransparency factor of the material with range [0.0, 1.0]
Returns
True, if the specified value is valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
transparency().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ specularColor()

virtual RGBAColor Ocean::Rendering::Material::specularColor ( ) const
virtual

Returns the specular color of this material.

Returns
Specular color
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
setSpecularColor().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ specularExponent()

virtual float Ocean::Rendering::Material::specularExponent ( ) const
virtual

Returns the specular exponent of this material with range [0.0, infinity).

The higher the specular exponent value the sharper the reflection area.

Returns
Specular exponent
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
setSpecularExponent().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ transparency()

virtual float Ocean::Rendering::Material::transparency ( ) const
virtual

Returns the transparency factor of this material with range [0.0, 1.0].

0.0 means fully opaque, 1.0 means fully transparent.

Returns
Transparency factor
Exceptions
NotSupportedExceptionIs thrown if this function is not supported
See also
setTransparency().

Reimplemented in Ocean::Rendering::GlobalIllumination::GIMaterial, and Ocean::Rendering::GLESceneGraph::GLESMaterial.

◆ type()

ObjectType Ocean::Rendering::Material::type ( ) const
overridevirtual

Returns the type of this object.

See also
Object::type().

Reimplemented from Ocean::Rendering::Attribute.


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