Version: 9.12.0
Material_Model Class Reference

#include <Material_Model.h>

Classes

struct  ReflectionData
 

Public Types

enum  ReflectionType { Ambient , Diffuse , Specular , Emissive }
 Reflection type. More...
 

Public Member Functions

 Material_Model ()
 Constructor. More...
 
virtual ~Material_Model ()
 Destructor. More...
 
void fromProperties (const QString &)
 Initialize material data from the given properties list. More...
 
QString toProperties ()
 Get material properties string representation. More...
 
void fromResources (const QString &=QString(), Material_ResourceMgr *=0)
 Initialize material model from the resources. More...
 
void toResources (const QString &, Material_ResourceMgr *)
 Save material properties to the resource file. More...
 
bool isPhysical () const
 Get material type. More...
 
void setPhysical (bool)
 Set material type. More...
 
bool hasReflection (ReflectionType) const
 Check if given reflection is enabled. More...
 
void setReflection (ReflectionType, bool)
 Enable/disable given reflection type. More...
 
QColor color (ReflectionType) const
 Get color value for the given reflection type. More...
 
void setColor (ReflectionType, const QColor &)
 Set color value for the given reflection type. More...
 
double reflection (ReflectionType, bool=true) const
 Get coefficient value for the given reflection type. More...
 
void setReflection (ReflectionType, double, bool=true)
 Set coefficient value for the given reflection type. More...
 
double shininess (bool=true) const
 Get shininess value. More...
 
void setShininess (double, bool=true)
 Set shininess value. More...
 
double transparency () const
 Get transparency value. More...
 
void setTransparency (double)
 Set transparency value. More...
 
Graphic3d_MaterialAspect getMaterialOCCAspect (bool=true)
 Construct OCCT material aspect from material model. More...
 
GEOM_VTKPropertyMaterialgetMaterialVTKProperty (bool=true)
 Construct VTK property from material model. More...
 

Private Types

typedef QVector< ReflectionDataReflectionList
 

Private Member Functions

void init ()
 Initialize material model with default values. More...
 
void read (const QString &, Material_ResourceMgr *)
 

Private Attributes

bool myIsPhysical
 
double myFrontShininess
 
double myBackShininess
 
double myTransparency
 
ReflectionList myReflection
 

Member Typedef Documentation

◆ ReflectionList

Member Enumeration Documentation

◆ ReflectionType

Enumerator
Ambient 

Ambient.

Diffuse 

Diffuse.

Specular 

Specular.

Emissive 

Emissive.

Constructor & Destructor Documentation

◆ Material_Model()

Material_Model::Material_Model ( )

Create new SALOME material model with default properties.

References init(), and myReflection.

◆ ~Material_Model()

Material_Model::~Material_Model ( )
virtual

Member Function Documentation

◆ color()

QColor Material_Model::color ( ReflectionType  type) const
Parameters
typereflection type
Returns
color associated with the specified reflection type
See also
setColor()

References isPhysical(), and myReflection.

◆ fromProperties()

void Material_Model::fromProperties ( const QString &  props)
Parameters
propsmaterial properties
See also
toProperties()

References Ambient, Diffuse, Emissive, init(), setColor(), setPhysical(), setReflection(), setShininess(), setTransparency(), and Specular.

◆ fromResources()

void Material_Model::fromResources ( const QString &  material = QString(),
Material_ResourceMgr resMgr = 0 
)

This function can be used to retrieve material properties from the resource file.

Parameters
materialmaterial name (if not specified, model is initialized by default material)
resMgrresource manager (if not specified, new resources manager is created)
See also
toResources()

References init(), Material_ResourceMgr::myMutex, read(), and Material_ResourceMgr::resourceMgr().

◆ getMaterialOCCAspect()

Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect ( bool  theIsFront = true)
Parameters
theIsFrontboolean flag for choosing side
Returns
material aspect object with corresponding properties

References Ambient, color(), Diffuse, Emissive, hasReflection(), isPhysical(), reflection(), shininess(), Specular, and transparency().

◆ getMaterialVTKProperty()

GEOM_VTKPropertyMaterial * Material_Model::getMaterialVTKProperty ( bool  theIsFront = true)
Parameters
theIsFrontboolean flag for choosing side
Returns
VTK property with correspondent material properties

References Ambient, color(), Diffuse, hasReflection(), isPhysical(), GEOM_VTKPropertyMaterial::New(), reflection(), shininess(), Specular, and transparency().

◆ hasReflection()

bool Material_Model::hasReflection ( ReflectionType  type) const
Parameters
typereflection type
Returns
true if specified reflection type is enabled or false otherwise
See also
setReflection(ReflectionType, bool)

References myReflection.

◆ init()

void Material_Model::init ( )
private

◆ isPhysical()

bool Material_Model::isPhysical ( ) const
Returns
true if material is physical or false otherwise
See also
setPhysical()

References myIsPhysical.

◆ read()

void Material_Model::read ( const QString &  material,
Material_ResourceMgr resMgr 
)
private

◆ reflection()

double Material_Model::reflection ( ReflectionType  type,
bool  theIsFront = true 
) const
Parameters
typereflection type
theIsFrontboolean flag for choosing side
Returns
coefficient value for the specified reflection type
See also
setReflection(ReflectionType, double, bool = true)

References myReflection.

◆ setColor()

void Material_Model::setColor ( ReflectionType  type,
const QColor &  value 
)
Parameters
typereflection type
valuecolor to be used for specified reflection type
See also
color()

References myReflection.

◆ setPhysical()

void Material_Model::setPhysical ( bool  value)
Parameters
valuetrue if material is physical or false otherwise
See also
isPhysical()

References myIsPhysical.

◆ setReflection() [1/2]

void Material_Model::setReflection ( ReflectionType  type,
bool  value 
)
Parameters
typereflection type
valueboolean flag
See also
hasReflection()

References myReflection.

◆ setReflection() [2/2]

void Material_Model::setReflection ( ReflectionType  type,
double  value,
bool  theIsFront = true 
)
Parameters
typereflection type
valuecoefficient to be used by the given reflection type
theIsFrontboolean flag for choosing side
See also
reflection( bool = true)

References myReflection.

◆ setShininess()

void Material_Model::setShininess ( double  value,
bool  theIsFront = true 
)
Parameters
valuenew shininess value
theIsFrontboolean flag for choosing side
See also
shininess( bool = true )

References myBackShininess, and myFrontShininess.

◆ setTransparency()

void Material_Model::setTransparency ( double  value)
Parameters
valuenew transparency value
See also
transparency()

References myTransparency.

◆ shininess()

double Material_Model::shininess ( bool  theIsFront = true) const
Parameters
theIsFrontboolean flag for choosing side
Returns
shininess value of the material
See also
setShininess( double, bool = true )

References myBackShininess, and myFrontShininess.

◆ toProperties()

QString Material_Model::toProperties ( )
Returns
string representing of material properties
See also
fromProperties()

References Ambient, color(), Diffuse, Emissive, hasReflection(), isPhysical(), reflection(), shininess(), Specular, and transparency().

◆ toResources()

void Material_Model::toResources ( const QString &  material,
Material_ResourceMgr resMgr 
)
Parameters
materialmaterial name
resMgrresource manager
See also
fromResources()

References Ambient, color(), Diffuse, Emissive, hasReflection(), isPhysical(), Material_ResourceMgr::myMutex, reflection(), shininess(), Specular, and transparency().

◆ transparency()

double Material_Model::transparency ( ) const
Returns
transparency value of the material
See also
setTransparency()

References myTransparency.

Member Data Documentation

◆ myBackShininess

double Material_Model::myBackShininess
private

◆ myFrontShininess

double Material_Model::myFrontShininess
private

◆ myIsPhysical

bool Material_Model::myIsPhysical
private

◆ myReflection

ReflectionList Material_Model::myReflection
private

◆ myTransparency

double Material_Model::myTransparency
private

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