![]() |
Blue Brain BioExplorer
|
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>
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 Vector3d & | getDiffuseColor () 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 Vector3d & | getSpecularColor () 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 TextureDescriptors & | getTextureDescriptors () 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... | |
![]() | |
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 > | |
T | getProperty (const std::string &name) const |
template<typename T > | |
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) |
![]() | |
BaseObject ()=default | |
virtual | ~BaseObject ()=default |
BaseObject (const BaseObject &) | |
BaseObject & | operator= (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... | |
![]() | |
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} |
![]() | |
std::string | _currentType |
std::map< std::string, PropertyMap > | _properties |
Additional Inherited Members | |
![]() | |
using | ModifiedCallback = std::function< void(const BaseObject &)> |
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.
core::Material::Material | ( | const PropertyMap & | properties = {} | ) |
Constructs a Material object.
properties | The PropertyMap object to initialize the Material object with. |
Definition at line 31 of file Material.cpp.
|
protected |
Loads the texture for the specified texture type.
fileName | The file name of the texture to load. |
type | The texture type to load it for. |
Definition at line 51 of file Material.cpp.
void core::Material::clearTextures | ( | ) |
Clears all textures from the material object.
Definition at line 45 of file Material.cpp.
|
pure virtual |
Called after material change.
Implemented in core::engine::ospray::OSPRayMaterial, and core::engine::optix::OptiXMaterial.
|
inline |
Returns the cast user data of the material.
Definition at line 180 of file Material.h.
|
inline |
Returns the chameleon mode of the material.
Definition at line 200 of file Material.h.
|
inline |
Returns the clipping mode of the material.
Definition at line 190 of file Material.h.
|
inline |
Returns the color of the diffuse component of the material.
Definition at line 79 of file Material.h.
|
inline |
Returns the emission of the material.
Definition at line 140 of file Material.h.
|
inline |
Returns the glossiness of the material.
Definition at line 150 of file Material.h.
|
inline |
Returns the name of the material.
Definition at line 63 of file Material.h.
|
inline |
Returns the cast user data of the material.
Definition at line 210 of file Material.h.
|
inline |
Returns the opacity of the material.
Definition at line 120 of file Material.h.
|
inline |
Returns the reflection index of the material.
Definition at line 110 of file Material.h.
|
inline |
Returns the refraction index of the material.
Definition at line 130 of file Material.h.
|
inline |
Returns the shading mode of the material.
Definition at line 160 of file Material.h.
|
inline |
Returns the color of the specular component of the material.
Definition at line 90 of file Material.h.
|
inline |
Returns the specular exponent of the material.
value | The specular exponent to set. |
Definition at line 100 of file Material.h.
Texture2DPtr core::Material::getTexture | ( | const TextureType | type | ) | const |
Returns the texture of the material for the specified texture type.
type | The texture type to get. |
Definition at line 37 of file Material.cpp.
|
inline |
Returns the texture descriptors of the material.
Definition at line 215 of file Material.h.
|
inline |
Returns the user parameter of the material.
Definition at line 170 of file Material.h.
|
inline |
Checks if the material has a texture for the specified texture type.
type | The texture type to check. |
Definition at line 239 of file Material.h.
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.
|
inline |
Sets the cast user data of the material.
The | value to set for the cast user data |
Definition at line 176 of file Material.h.
|
inline |
Sets the chameleon mode of the material.
value | The chameleon mode to set. |
Definition at line 196 of file Material.h.
|
inline |
Sets the clipping mode of the material.
value | The clipping mode to set. |
Definition at line 186 of file Material.h.
|
inline |
Sets the color of the diffuse component of the material.
value | The Vector3d object representing the color. |
Definition at line 75 of file Material.h.
|
inline |
Sets the emission of the material.
value | The emission to set. |
Definition at line 136 of file Material.h.
|
inline |
Sets the glossiness of the material.
value | The glossiness to set. |
Definition at line 146 of file Material.h.
|
inline |
Sets the name of the material.
value | The value to set the name to. |
Definition at line 69 of file Material.h.
|
inline |
Sets the cast user data of the material.
The | value to set for the cast user data |
Definition at line 206 of file Material.h.
|
inline |
Sets the opacity of the material.
value | The opacity to set. |
Definition at line 116 of file Material.h.
|
inline |
Sets the reflection index of the material.
value | The reflection index to set. |
Definition at line 106 of file Material.h.
|
inline |
Sets the refraction index of the material.
value | The refraction index to set. |
Definition at line 126 of file Material.h.
|
inline |
Sets the shading mode of the material.
value | The shading mode to set. |
Definition at line 156 of file Material.h.
|
inline |
Sets the color of the specular component of the material.
value | The Vector3d object representing the color. |
Definition at line 85 of file Material.h.
|
inline |
Sets the specular exponent of the material.
Definition at line 95 of file Material.h.
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.
|
inline |
Sets the user parameter of the material.
value | The user parameter to set. |
Definition at line 166 of file Material.h.
|
protected |
Definition at line 268 of file Material.h.
|
protected |
Definition at line 271 of file Material.h.
|
protected |
Definition at line 269 of file Material.h.
|
protected |
Definition at line 256 of file Material.h.
|
protected |
Definition at line 262 of file Material.h.
|
protected |
Definition at line 263 of file Material.h.
|
protected |
Definition at line 255 of file Material.h.
|
protected |
Definition at line 270 of file Material.h.
|
protected |
Definition at line 260 of file Material.h.
|
protected |
Definition at line 259 of file Material.h.
|
protected |
Definition at line 261 of file Material.h.
|
protected |
Definition at line 267 of file Material.h.
|
protected |
Definition at line 257 of file Material.h.
|
protected |
Definition at line 258 of file Material.h.
|
protected |
Definition at line 265 of file Material.h.
|
protected |
Definition at line 264 of file Material.h.
|
protected |
Definition at line 266 of file Material.h.