AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxCollide::RenderMaterial Class Reference

Class for storing rendering material. More...

#include <RenderMaterial.h>

+ Inheritance diagram for agxCollide::RenderMaterial:

Public Types

enum  TextureMode {
  DIFFUSE_TEXTURE =0 , NORMALMAP_TEXTURE = 1 , HEIGHTMAP_TEXTURE = 2 , ROUGHNESS_TEXTURE = 3 ,
  METALLIC_TEXTURE = 4 , NUM_TEXTURE_MODES =5
}
 

Public Member Functions

 RenderMaterial ()
 Constructor.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxCollide::RenderMaterial)
 
RenderMaterialclone () const
 Returns a cloned copy of the RenderMaterial.
 
int compare (const RenderMaterial &other) const
 Slow string comparison function that uses the toString() method to convert each material to a string.
 
bool equal (const RenderMaterial &other) const
 
agx::Vec4f getAmbientColor () const
 
agx::Vec4f getDiffuseColor () const
 
agx::Vec4f getEmissiveColor () const
 
agx::UInt32 getHash () const
 
agx::String getMaterialSpecification () const
 
float getMetallic () const
 
agx::String getName () const
 
float getRoughness () const
 
float getShininess () const
 
agx::Vec4f getSpecularColor () const
 
TextureDataRef getTextureData (TextureMode mode=DIFFUSE_TEXTURE) const
 
agx::String getTexturePath (TextureMode mode=DIFFUSE_TEXTURE) const
 
float getTransparency () const
 
bool hasAmbientColor () const
 
bool hasDiffuseColor () const
 
bool hasEmissiveColor () const
 
bool hasMaterialSpecification () const
 
bool hasMetallic () const
 
bool hasRoughness () const
 
bool hasSpecularColor () const
 
bool hasTextureData (TextureMode mode=DIFFUSE_TEXTURE) const
 
bool hasTexturePath (TextureMode mode=DIFFUSE_TEXTURE) const
 
bool hasTransparency () const
 
bool operator== (const RenderMaterial &other) const
 
void setAmbientColor (const agx::Vec4f &color)
 Set the ambient color.
 
void setDiffuseColor (const agx::Vec4f &color)
 Set the diffuse color.
 
void setEmissiveColor (const agx::Vec4f &color)
 Set the emissive color.
 
void setMaterialSpecification (const agx::String &material)
 Store a string with a material specification, for example Keyshot material string.
 
void setMetallic (float metallic)
 Set the metallic of the material.
 
void setName (const agx::String &name)
 Set the name of this material.
 
void setRoughness (float roughness)
 Set the roughness of the material.
 
void setSpecularColor (const agx::Vec4f &color)
 Set the specular color.
 
void setTextureData (TextureDataRef data, TextureMode mode=DIFFUSE_TEXTURE)
 Set the data of a texture used for the specified texturing mode (default DIFFUSE)
 
void setTexturePath (const agx::String &path, TextureMode mode=DIFFUSE_TEXTURE)
 Set the path to a texture for the specified texturing mode (default DIFFUSE)
 
void setTransparency (float transparency)
 Set the transparency of the material 1 - transparent, 0 - opaque.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Protected Member Functions

virtual ~RenderMaterial ()
 
agx::String toString () const
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

agx::Vec4f m_ambientColor
 
agx::Vec4f m_diffuseColor
 
agx::Vec4f m_emissiveColor
 
agx::String m_materialSpecification
 
float m_metallic
 
agx::String m_name
 
float m_roughness
 
agx::Vec4f m_specularColor
 
agx::Vector< TextureDataRefm_textureDatas
 
agx::StringVector m_texturePaths
 
float m_transparency
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Class for storing rendering material.

Definition at line 33 of file RenderMaterial.h.

Member Enumeration Documentation

◆ TextureMode

Enumerator
DIFFUSE_TEXTURE 
NORMALMAP_TEXTURE 
HEIGHTMAP_TEXTURE 
ROUGHNESS_TEXTURE 
METALLIC_TEXTURE 
NUM_TEXTURE_MODES 

Definition at line 37 of file RenderMaterial.h.

Constructor & Destructor Documentation

◆ RenderMaterial()

agxCollide::RenderMaterial::RenderMaterial ( )

Constructor.

◆ ~RenderMaterial()

virtual agxCollide::RenderMaterial::~RenderMaterial ( )
protectedvirtual

Member Function Documentation

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agxCollide::RenderMaterial::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agxCollide::RenderMaterial  )

◆ clone()

RenderMaterial * agxCollide::RenderMaterial::clone ( ) const

Returns a cloned copy of the RenderMaterial.

◆ compare()

int agxCollide::RenderMaterial::compare ( const RenderMaterial other) const

Slow string comparison function that uses the toString() method to convert each material to a string.

Parameters
other- Material to compare to
Returns
0 if materials are equal, -1 if this is string wise larger, and 1 if other is string wise larger

◆ create()

static agxStream::Serializable * agxCollide::RenderMaterial::create ( agxStream::InputArchive )
inlinestatic

Definition at line 167 of file RenderMaterial.h.

◆ equal()

bool agxCollide::RenderMaterial::equal ( const RenderMaterial other) const
Parameters
other- Material to compare to
Returns
true if the two materials are content wise equal to each other. Fast comparison

◆ getAmbientColor()

agx::Vec4f agxCollide::RenderMaterial::getAmbientColor ( ) const
Returns
the current ambient color

◆ getDiffuseColor()

agx::Vec4f agxCollide::RenderMaterial::getDiffuseColor ( ) const
Returns
the current diffuse color

◆ getEmissiveColor()

agx::Vec4f agxCollide::RenderMaterial::getEmissiveColor ( ) const
Returns
the current emissive color

◆ getHash()

agx::UInt32 agxCollide::RenderMaterial::getHash ( ) const
Returns
Hash value calculated from the string where all attributes are concatenated.

◆ getMaterialSpecification()

agx::String agxCollide::RenderMaterial::getMaterialSpecification ( ) const
Returns
a stored material specification

◆ getMetallic()

float agxCollide::RenderMaterial::getMetallic ( ) const
Returns
the metallic

◆ getName()

agx::String agxCollide::RenderMaterial::getName ( ) const
Returns
the name of the material

◆ getRoughness()

float agxCollide::RenderMaterial::getRoughness ( ) const
Returns
the roughness

◆ getShininess()

float agxCollide::RenderMaterial::getShininess ( ) const
Returns
the shininess

◆ getSpecularColor()

agx::Vec4f agxCollide::RenderMaterial::getSpecularColor ( ) const
Returns
the current diffuse color

◆ getTextureData()

TextureDataRef agxCollide::RenderMaterial::getTextureData ( TextureMode  mode = DIFFUSE_TEXTURE) const
Returns
the data of a texture used for the specified texturing mode (default DIFFUSE)

◆ getTexturePath()

agx::String agxCollide::RenderMaterial::getTexturePath ( TextureMode  mode = DIFFUSE_TEXTURE) const
Returns
the path to a texture for the specified texturing mode (default DIFFUSE)

◆ getTransparency()

float agxCollide::RenderMaterial::getTransparency ( ) const
Returns
transparency of material

◆ hasAmbientColor()

bool agxCollide::RenderMaterial::hasAmbientColor ( ) const
Returns
true if the ambient color is different from -1,-1,-1 (which is default)

◆ hasDiffuseColor()

bool agxCollide::RenderMaterial::hasDiffuseColor ( ) const
Returns
true if the diffuse color is different from -1,-1,-1 (which is default)

◆ hasEmissiveColor()

bool agxCollide::RenderMaterial::hasEmissiveColor ( ) const
Returns
true if the emissive color is different from -1,-1,-1 (which is default)

◆ hasMaterialSpecification()

bool agxCollide::RenderMaterial::hasMaterialSpecification ( ) const
Returns
true if a material specification is specified

◆ hasMetallic()

bool agxCollide::RenderMaterial::hasMetallic ( ) const
Returns
true if metallic != -1, which is default

◆ hasRoughness()

bool agxCollide::RenderMaterial::hasRoughness ( ) const
Returns
true if roughness != -1, which is default

◆ hasSpecularColor()

bool agxCollide::RenderMaterial::hasSpecularColor ( ) const
Returns
true if the diffuse color is different from -1,-1,-1 (which is default)

◆ hasTextureData()

bool agxCollide::RenderMaterial::hasTextureData ( TextureMode  mode = DIFFUSE_TEXTURE) const
Returns
true if the specified mode has a texture specified

◆ hasTexturePath()

bool agxCollide::RenderMaterial::hasTexturePath ( TextureMode  mode = DIFFUSE_TEXTURE) const
Returns
true if the specified mode has a texture specified

◆ hasTransparency()

bool agxCollide::RenderMaterial::hasTransparency ( ) const
Returns
true if transparency != -1

◆ operator==()

bool agxCollide::RenderMaterial::operator== ( const RenderMaterial other) const
Returns
true if the materials has equal value (uses equal method)

◆ setAmbientColor()

void agxCollide::RenderMaterial::setAmbientColor ( const agx::Vec4f color)

Set the ambient color.

◆ setDiffuseColor()

void agxCollide::RenderMaterial::setDiffuseColor ( const agx::Vec4f color)

Set the diffuse color.

◆ setEmissiveColor()

void agxCollide::RenderMaterial::setEmissiveColor ( const agx::Vec4f color)

Set the emissive color.

◆ setMaterialSpecification()

void agxCollide::RenderMaterial::setMaterialSpecification ( const agx::String material)

Store a string with a material specification, for example Keyshot material string.

◆ setMetallic()

void agxCollide::RenderMaterial::setMetallic ( float  metallic)

Set the metallic of the material.

◆ setName()

void agxCollide::RenderMaterial::setName ( const agx::String name)

Set the name of this material.

◆ setRoughness()

void agxCollide::RenderMaterial::setRoughness ( float  roughness)

Set the roughness of the material.

◆ setSpecularColor()

void agxCollide::RenderMaterial::setSpecularColor ( const agx::Vec4f color)

Set the specular color.

◆ setTextureData()

void agxCollide::RenderMaterial::setTextureData ( TextureDataRef  data,
TextureMode  mode = DIFFUSE_TEXTURE 
)

Set the data of a texture used for the specified texturing mode (default DIFFUSE)

Parameters
data- the data to use for the given mode
mode- texturing mode

◆ setTexturePath()

void agxCollide::RenderMaterial::setTexturePath ( const agx::String path,
TextureMode  mode = DIFFUSE_TEXTURE 
)

Set the path to a texture for the specified texturing mode (default DIFFUSE)

Parameters
path- path to the texture
mode- texturing mode

◆ setTransparency()

void agxCollide::RenderMaterial::setTransparency ( float  transparency)

Set the transparency of the material 1 - transparent, 0 - opaque.

◆ toString()

agx::String agxCollide::RenderMaterial::toString ( ) const
protected
Returns
a concatenated string of all attributes of this class

Member Data Documentation

◆ m_ambientColor

agx::Vec4f agxCollide::RenderMaterial::m_ambientColor
protected

Definition at line 210 of file RenderMaterial.h.

◆ m_diffuseColor

agx::Vec4f agxCollide::RenderMaterial::m_diffuseColor
protected

Definition at line 208 of file RenderMaterial.h.

◆ m_emissiveColor

agx::Vec4f agxCollide::RenderMaterial::m_emissiveColor
protected

Definition at line 211 of file RenderMaterial.h.

◆ m_materialSpecification

agx::String agxCollide::RenderMaterial::m_materialSpecification
protected

Definition at line 207 of file RenderMaterial.h.

◆ m_metallic

float agxCollide::RenderMaterial::m_metallic
protected

Definition at line 214 of file RenderMaterial.h.

◆ m_name

agx::String agxCollide::RenderMaterial::m_name
protected

Definition at line 215 of file RenderMaterial.h.

◆ m_roughness

float agxCollide::RenderMaterial::m_roughness
protected

Definition at line 213 of file RenderMaterial.h.

◆ m_specularColor

agx::Vec4f agxCollide::RenderMaterial::m_specularColor
protected

Definition at line 209 of file RenderMaterial.h.

◆ m_textureDatas

agx::Vector<TextureDataRef> agxCollide::RenderMaterial::m_textureDatas
protected

Definition at line 217 of file RenderMaterial.h.

◆ m_texturePaths

agx::StringVector agxCollide::RenderMaterial::m_texturePaths
protected

Definition at line 216 of file RenderMaterial.h.

◆ m_transparency

float agxCollide::RenderMaterial::m_transparency
protected

Definition at line 212 of file RenderMaterial.h.


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