Blue Brain BioExplorer
core::Material Class Referenceabstract

The class that represents the material object. This class is derived from PropertyObject and provides all relevant properties for a Material object. It also provides functions to work with textures. More...

#include <Material.h>

Inheritance diagram for core::Material:
Collaboration diagram for core::Material:

Public Member Functions

virtual PLATFORM_API void commit ()=0
 Called after material change. More...
 
PLATFORM_API Material (const PropertyMap &properties={})
 Constructs a Material object. More...
 
PLATFORM_API const std::string & getName () const
 Returns the name of the material. More...
 
PLATFORM_API void setName (const std::string &value)
 Sets the name of the material. More...
 
PLATFORM_API void setDiffuseColor (const Vector3d &value)
 Sets the color of the diffuse component of the material. More...
 
PLATFORM_API const Vector3dgetDiffuseColor () const
 Returns the color of the diffuse component of the material. More...
 
PLATFORM_API void setSpecularColor (const Vector3d &value)
 Sets the color of the specular component of the material. More...
 
PLATFORM_API const Vector3dgetSpecularColor () const
 Returns the color of the specular component of the material. More...
 
PLATFORM_API void setSpecularExponent (const double value)
 Sets the specular exponent of the material. More...
 
PLATFORM_API double getSpecularExponent () const
 Returns the specular exponent of the material. More...
 
PLATFORM_API void setReflectionIndex (const double value)
 Sets the reflection index of the material. More...
 
PLATFORM_API double getReflectionIndex () const
 Returns the reflection index of the material. More...
 
PLATFORM_API void setOpacity (const double value)
 Sets the opacity of the material. More...
 
PLATFORM_API double getOpacity () const
 Returns the opacity of the material. More...
 
PLATFORM_API void setRefractionIndex (const double value)
 Sets the refraction index of the material. More...
 
PLATFORM_API double getRefractionIndex () const
 Returns the refraction index of the material. More...
 
PLATFORM_API void setEmission (double value)
 Sets the emission of the material. More...
 
PLATFORM_API double getEmission () const
 Returns the emission of the material. More...
 
PLATFORM_API void setGlossiness (const double value)
 Sets the glossiness of the material. More...
 
PLATFORM_API double getGlossiness () const
 Returns the glossiness of the material. More...
 
PLATFORM_API void setShadingMode (const MaterialShadingMode value)
 Sets the shading mode of the material. More...
 
PLATFORM_API MaterialShadingMode getShadingMode () const
 Returns the shading mode of the material. More...
 
PLATFORM_API void setUserParameter (const double value)
 Sets the user parameter of the material. More...
 
PLATFORM_API double getUserParameter () const
 Returns the user parameter of the material. More...
 
PLATFORM_API void setCastUserData (const bool value)
 Sets the cast user data of the material. More...
 
PLATFORM_API double getCastUserData () const
 Returns the cast user data of the material. More...
 
PLATFORM_API void setClippingMode (const MaterialClippingMode value)
 Sets the clipping mode of the material. More...
 
PLATFORM_API MaterialClippingMode getClippingMode () const
 Returns the clipping mode of the material. More...
 
PLATFORM_API void setChameleonMode (const MaterialChameleonMode value)
 Sets the chameleon mode of the material. More...
 
PLATFORM_API MaterialChameleonMode getChameleonMode () const
 Returns the chameleon mode of the material. More...
 
PLATFORM_API void setNodeId (const int32_t value)
 Sets the cast user data of the material. More...
 
PLATFORM_API int32_t getNodeId () const
 Returns the cast user data of the material. More...
 
PLATFORM_API const TextureDescriptorsgetTextureDescriptors () const
 Returns the texture descriptors of the material. More...
 
PLATFORM_API void setTexture (const std::string &fileName, const TextureType type)
 Sets the texture of the material for the specified texture type. More...
 
PLATFORM_API void removeTexture (const TextureType type)
 Removes the texture of the material for the specified texture type. More...
 
PLATFORM_API Texture2DPtr getTexture (const TextureType type) const
 Returns the texture of the material for the specified texture type. More...
 
PLATFORM_API bool hasTexture (const TextureType type) const
 Checks if the material has a texture for the specified texture type. More...
 
PLATFORM_API void clearTextures ()
 Clears all textures from the material object. More...
 
- Public Member Functions inherited from core::PropertyObject
void setCurrentType (const std::string &type)
 
const std::string & getCurrentType () const
 
template<typename T >
void updateProperty (const std::string &name, const T &value, const bool triggerCallback=true)
 
bool hasProperty (const std::string &name) const
 
template<typename T >
getProperty (const std::string &name) const
 
template<typename T >
getPropertyOrValue (const std::string &name, T val) const
 
void setProperties (const PropertyMap &properties)
 
void setProperties (const std::string &type, const PropertyMap &properties)
 
void updateProperties (const PropertyMap &properties)
 
const auto & getPropertyMap () const
 
const auto & getPropertyMap (const std::string &type) const
 
strings getTypes () const
 
void clonePropertiesFrom (const PropertyObject &obj)
 
- Public Member Functions inherited from core::BaseObject
 BaseObject ()=default
 
virtual ~BaseObject ()=default
 
 BaseObject (const BaseObject &)
 
BaseObjectoperator= (const BaseObject &rhs)
 
bool isModified () const
 
void resetModified ()
 
void markModified (const bool triggerCallback=true)
 
void onModified (const ModifiedCallback &callback)
 
void clearModifiedCallback ()
 

Protected Member Functions

bool _loadTexture (const std::string &fileName, const TextureType type)
 Loads the texture for the specified texture type. More...
 
- Protected Member Functions inherited from core::BaseObject
template<typename T >
void _updateValue (T &member, const T &newValue, const bool triggerCallback=true)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if<!std::is_floating_point< T >::value >::type *=0)
 

Protected Attributes

std::string _name {"undefined"}
 
Vector3d _diffuseColor {1., 1., 1.}
 
Vector3d _specularColor {1., 1., 1.}
 
double _specularExponent {10.}
 
double _reflectionIndex {0.}
 
double _opacity {1.}
 
double _refractionIndex {1.}
 
double _emission {0.}
 
double _glossiness {1.}
 
TexturesMap _textures
 
TextureDescriptors _textureDescriptors
 
double _userParameter {1.}
 
MaterialShadingMode _shadingMode {MaterialShadingMode::undefined_shading_mode}
 
bool _castUserData {false}
 
MaterialClippingMode _clippingMode {MaterialClippingMode::no_clipping}
 
int32_t _nodeId
 
MaterialChameleonMode _chameleonMode {MaterialChameleonMode::undefined_chameleon_mode}
 
- Protected Attributes inherited from core::PropertyObject
std::string _currentType
 
std::map< std::string, PropertyMap_properties
 

Additional Inherited Members

- Public Types inherited from core::BaseObject
using ModifiedCallback = std::function< void(const BaseObject &)>
 

Detailed Description

The class that represents the material object. This class is derived from PropertyObject and provides all relevant properties for a Material object. It also provides functions to work with textures.

Definition at line 46 of file Material.h.

Constructor & Destructor Documentation

◆ Material()

core::Material::Material ( const PropertyMap properties = {})

Constructs a Material object.

Parameters
propertiesThe PropertyMap object to initialize the Material object with.

Definition at line 31 of file Material.cpp.

Member Function Documentation

◆ _loadTexture()

bool core::Material::_loadTexture ( const std::string &  fileName,
const TextureType  type 
)
protected

Loads the texture for the specified texture type.

Parameters
fileNameThe file name of the texture to load.
typeThe texture type to load it for.
Returns
bool whether or not the texture was loaded successfully.

Definition at line 51 of file Material.cpp.

◆ clearTextures()

void core::Material::clearTextures ( )

Clears all textures from the material object.

Definition at line 45 of file Material.cpp.

◆ commit()

virtual PLATFORM_API void core::Material::commit ( )
pure virtual

Called after material change.

Implemented in core::engine::ospray::OSPRayMaterial, and core::engine::optix::OptiXMaterial.

◆ getCastUserData()

PLATFORM_API double core::Material::getCastUserData ( ) const
inline

Returns the cast user data of the material.

Definition at line 180 of file Material.h.

◆ getChameleonMode()

PLATFORM_API MaterialChameleonMode core::Material::getChameleonMode ( ) const
inline

Returns the chameleon mode of the material.

Definition at line 200 of file Material.h.

◆ getClippingMode()

PLATFORM_API MaterialClippingMode core::Material::getClippingMode ( ) const
inline

Returns the clipping mode of the material.

Definition at line 190 of file Material.h.

◆ getDiffuseColor()

PLATFORM_API const Vector3d& core::Material::getDiffuseColor ( ) const
inline

Returns the color of the diffuse component of the material.

Definition at line 79 of file Material.h.

◆ getEmission()

PLATFORM_API double core::Material::getEmission ( ) const
inline

Returns the emission of the material.

Definition at line 140 of file Material.h.

◆ getGlossiness()

PLATFORM_API double core::Material::getGlossiness ( ) const
inline

Returns the glossiness of the material.

Definition at line 150 of file Material.h.

◆ getName()

PLATFORM_API const std::string& core::Material::getName ( ) const
inline

Returns the name of the material.

Definition at line 63 of file Material.h.

◆ getNodeId()

PLATFORM_API int32_t core::Material::getNodeId ( ) const
inline

Returns the cast user data of the material.

Definition at line 210 of file Material.h.

◆ getOpacity()

PLATFORM_API double core::Material::getOpacity ( ) const
inline

Returns the opacity of the material.

Definition at line 120 of file Material.h.

◆ getReflectionIndex()

PLATFORM_API double core::Material::getReflectionIndex ( ) const
inline

Returns the reflection index of the material.

Definition at line 110 of file Material.h.

◆ getRefractionIndex()

PLATFORM_API double core::Material::getRefractionIndex ( ) const
inline

Returns the refraction index of the material.

Definition at line 130 of file Material.h.

◆ getShadingMode()

PLATFORM_API MaterialShadingMode core::Material::getShadingMode ( ) const
inline

Returns the shading mode of the material.

Definition at line 160 of file Material.h.

◆ getSpecularColor()

PLATFORM_API const Vector3d& core::Material::getSpecularColor ( ) const
inline

Returns the color of the specular component of the material.

Definition at line 90 of file Material.h.

◆ getSpecularExponent()

PLATFORM_API double core::Material::getSpecularExponent ( ) const
inline

Returns the specular exponent of the material.

Parameters
valueThe specular exponent to set.

Definition at line 100 of file Material.h.

◆ getTexture()

Texture2DPtr core::Material::getTexture ( const TextureType  type) const

Returns the texture of the material for the specified texture type.

Parameters
typeThe texture type to get.
Returns
The Texture2D object of the material for the specified texture type.

Definition at line 37 of file Material.cpp.

◆ getTextureDescriptors()

PLATFORM_API const TextureDescriptors& core::Material::getTextureDescriptors ( ) const
inline

Returns the texture descriptors of the material.

Definition at line 215 of file Material.h.

◆ getUserParameter()

PLATFORM_API double core::Material::getUserParameter ( ) const
inline

Returns the user parameter of the material.

Definition at line 170 of file Material.h.

◆ hasTexture()

PLATFORM_API bool core::Material::hasTexture ( const TextureType  type) const
inline

Checks if the material has a texture for the specified texture type.

Parameters
typeThe texture type to check.
Returns
bool Whether or not the material has a texture for the specified texture type.

Definition at line 239 of file Material.h.

◆ removeTexture()

void core::Material::removeTexture ( const TextureType  type)

Removes the texture of the material for the specified texture type.

Definition at line 79 of file Material.cpp.

◆ setCastUserData()

PLATFORM_API void core::Material::setCastUserData ( const bool  value)
inline

Sets the cast user data of the material.

Parameters
Thevalue to set for the cast user data

Definition at line 176 of file Material.h.

◆ setChameleonMode()

PLATFORM_API void core::Material::setChameleonMode ( const MaterialChameleonMode  value)
inline

Sets the chameleon mode of the material.

Parameters
valueThe chameleon mode to set.

Definition at line 196 of file Material.h.

◆ setClippingMode()

PLATFORM_API void core::Material::setClippingMode ( const MaterialClippingMode  value)
inline

Sets the clipping mode of the material.

Parameters
valueThe clipping mode to set.

Definition at line 186 of file Material.h.

◆ setDiffuseColor()

PLATFORM_API void core::Material::setDiffuseColor ( const Vector3d value)
inline

Sets the color of the diffuse component of the material.

Parameters
valueThe Vector3d object representing the color.

Definition at line 75 of file Material.h.

◆ setEmission()

PLATFORM_API void core::Material::setEmission ( double  value)
inline

Sets the emission of the material.

Parameters
valueThe emission to set.

Definition at line 136 of file Material.h.

◆ setGlossiness()

PLATFORM_API void core::Material::setGlossiness ( const double  value)
inline

Sets the glossiness of the material.

Parameters
valueThe glossiness to set.

Definition at line 146 of file Material.h.

◆ setName()

PLATFORM_API void core::Material::setName ( const std::string &  value)
inline

Sets the name of the material.

Parameters
valueThe value to set the name to.

Definition at line 69 of file Material.h.

◆ setNodeId()

PLATFORM_API void core::Material::setNodeId ( const int32_t  value)
inline

Sets the cast user data of the material.

Parameters
Thevalue to set for the cast user data

Definition at line 206 of file Material.h.

◆ setOpacity()

PLATFORM_API void core::Material::setOpacity ( const double  value)
inline

Sets the opacity of the material.

Parameters
valueThe opacity to set.

Definition at line 116 of file Material.h.

◆ setReflectionIndex()

PLATFORM_API void core::Material::setReflectionIndex ( const double  value)
inline

Sets the reflection index of the material.

Parameters
valueThe reflection index to set.

Definition at line 106 of file Material.h.

◆ setRefractionIndex()

PLATFORM_API void core::Material::setRefractionIndex ( const double  value)
inline

Sets the refraction index of the material.

Parameters
valueThe refraction index to set.

Definition at line 126 of file Material.h.

◆ setShadingMode()

PLATFORM_API void core::Material::setShadingMode ( const MaterialShadingMode  value)
inline

Sets the shading mode of the material.

Parameters
valueThe shading mode to set.

Definition at line 156 of file Material.h.

◆ setSpecularColor()

PLATFORM_API void core::Material::setSpecularColor ( const Vector3d value)
inline

Sets the color of the specular component of the material.

Parameters
valueThe Vector3d object representing the color.

Definition at line 85 of file Material.h.

◆ setSpecularExponent()

PLATFORM_API void core::Material::setSpecularExponent ( const double  value)
inline

Sets the specular exponent of the material.

Definition at line 95 of file Material.h.

◆ setTexture()

void core::Material::setTexture ( const std::string &  fileName,
const TextureType  type 
)

Sets the texture of the material for the specified texture type.

Definition at line 66 of file Material.cpp.

◆ setUserParameter()

PLATFORM_API void core::Material::setUserParameter ( const double  value)
inline

Sets the user parameter of the material.

Parameters
valueThe user parameter to set.

Definition at line 166 of file Material.h.

Member Data Documentation

◆ _castUserData

bool core::Material::_castUserData {false}
protected

Definition at line 268 of file Material.h.

◆ _chameleonMode

MaterialChameleonMode core::Material::_chameleonMode {MaterialChameleonMode::undefined_chameleon_mode}
protected

Definition at line 271 of file Material.h.

◆ _clippingMode

MaterialClippingMode core::Material::_clippingMode {MaterialClippingMode::no_clipping}
protected

Definition at line 269 of file Material.h.

◆ _diffuseColor

Vector3d core::Material::_diffuseColor {1., 1., 1.}
protected

Definition at line 256 of file Material.h.

◆ _emission

double core::Material::_emission {0.}
protected

Definition at line 262 of file Material.h.

◆ _glossiness

double core::Material::_glossiness {1.}
protected

Definition at line 263 of file Material.h.

◆ _name

std::string core::Material::_name {"undefined"}
protected

Definition at line 255 of file Material.h.

◆ _nodeId

int32_t core::Material::_nodeId
protected

Definition at line 270 of file Material.h.

◆ _opacity

double core::Material::_opacity {1.}
protected

Definition at line 260 of file Material.h.

◆ _reflectionIndex

double core::Material::_reflectionIndex {0.}
protected

Definition at line 259 of file Material.h.

◆ _refractionIndex

double core::Material::_refractionIndex {1.}
protected

Definition at line 261 of file Material.h.

◆ _shadingMode

MaterialShadingMode core::Material::_shadingMode {MaterialShadingMode::undefined_shading_mode}
protected

Definition at line 267 of file Material.h.

◆ _specularColor

Vector3d core::Material::_specularColor {1., 1., 1.}
protected

Definition at line 257 of file Material.h.

◆ _specularExponent

double core::Material::_specularExponent {10.}
protected

Definition at line 258 of file Material.h.

◆ _textureDescriptors

TextureDescriptors core::Material::_textureDescriptors
protected

Definition at line 265 of file Material.h.

◆ _textures

TexturesMap core::Material::_textures
protected

Definition at line 264 of file Material.h.

◆ _userParameter

double core::Material::_userParameter {1.}
protected

Definition at line 266 of file Material.h.


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