chai3d::cMaterial Class Reference

This class models material properties. More...

#include <CMaterial.h>

Public Member Functions

 cMaterial ()
 Constructor of cMaterial. More...
 
virtual ~cMaterial ()
 Destructor of cMaterial. More...
 
cMaterialPtr copy ()
 This method creates a copy itself. More...
 
void setModificationFlags (const bool a_value)
 This method set a value value to all modification flags. More...
 
void copyTo (cMaterialPtr a_material)
 This method copies all modified members (the ones which are flagged) to another material object. More...
 
void setShininess (const GLuint a_shininess)
 This method sets the shininess (the exponent used for specular lighting). More...
 
GLuint getShininess () const
 This method returns the shininess level. More...
 
void setTransparencyLevel (const float a_levelTransparency)
 This method sets the transparency level (alpha value) to all color components. More...
 
bool isTransparent () const
 This method returns true if the material includes partial or full transparency color components. More...
 
void backupColors ()
 This method creates a backup of its color properties. Any previous backup is lost. More...
 
void restoreColors ()
 This method restores the color properties from values stored in the backup members. More...
 
virtual void render (cRenderOptions &a_options)
 This method render the material using OpenGL. More...
 
void setStiffness (const double a_stiffness)
 This method set the stiffness level [N/m]. More...
 
double getStiffness () const
 This method returns the stiffness level [N/m]. More...
 
void setViscosity (const double a_viscosity)
 This method sets the level of viscosity. More...
 
double getViscosity () const
 This method returns the level of viscosity. More...
 
void setVibrationFrequency (const double a_vibrationFrequency)
 This method set the vibration frequency [Hz]. More...
 
double getVibrationFrequency () const
 This method returns the vibration frequency [Hz]. More...
 
void setVibrationAmplitude (const double a_vibrationAmplitude)
 This method sets the vibration force amplitude [N]. More...
 
double getVibrationAmplitude () const
 This method returns the vibration force amplitude [N]. More...
 
void setMagnetMaxForce (const double a_magnetMaxForce)
 This method sets the maximum force applied by the magnet effect [N]. More...
 
double getMagnetMaxForce () const
 This method returns the maximum force applied by the magnet effect[N]. More...
 
void setMagnetMaxDistance (const double a_magnetMaxDistance)
 This method sets the maximum distance threshold from which magnetic forces are perceived [m]. More...
 
double getMagnetMaxDistance () const
 This method returns the maximum distance threshold from which magnetic forces are perceived [m]. More...
 
void setStickSlipForceMax (const double a_stickSlipForceMax)
 This method sets the maximum force threshold of a stick and slip model [N]. More...
 
double getStickSlipForceMax () const
 This method returns the maximum force threshold of a stick and slip model [N]. More...
 
void setStickSlipStiffness (double const a_stickSlipStiffness)
 This method sets the stiffness of the stick and slip model [N/m]. More...
 
double getStickSlipStiffness () const
 This method sets the stiffness of the stick and slip model [N/m]. More...
 
void setDamping (const double a_dampingCoefficient)
 This method sets the damping coefficient. More...
 
double getDamping () const
 This method returns the damping coefficient. More...
 
void setUseHapticFriction (const bool a_useHapticFriction)
 This method enables or disables haptic friction. (Applies to polygonal objects only). More...
 
bool getUseHapticFriction () const
 This method returns the status of haptic friction. (Applies to polygonal objects only). More...
 
void setStaticFriction (const double a_friction)
 This method sets the static friction level [N]. More...
 
double getStaticFriction () const
 This method returns the static friction level [N]. More...
 
void setDynamicFriction (const double a_friction)
 This method sets the dynamic friction level. More...
 
double getDynamicFriction () const
 This method returns the dynamic friction level. More...
 
void setUseHapticTexture (const bool a_useHapticTexture)
 This method enables or disables haptic texture rendering. (Applies to polygonal objects only). More...
 
bool getUseHapticTexture () const
 This method returns the status of haptic texture rendering. (Applies to polygonal objects only). More...
 
void setTextureLevel (const double a_textureLevel)
 This method sets the haptic texture level. More...
 
double getTextureLevel () const
 This method returns the haptic texture level. More...
 
void setUseHapticShading (const bool a_useHapticShading)
 This method enables or disables haptic shading. (Applies to polygonal objects only). More...
 
bool getUseHapticShading () const
 This method retruns the status of haptic shading. (Applies to polygonal objects only). More...
 
void setHapticTriangleFrontSide (const bool a_enabled)
 This method enables or disables haptic rendering on the front side of mesh triangles. More...
 
bool getHapticTriangleFrontSide () const
 This method returns the status about front side triangle haptic rendering. (Applies to polygonal objects only). More...
 
void setHapticTriangleBackSide (const bool a_enabled)
 This method enables or disables haptic rendering of back side of mesh triangles. More...
 
bool getHapticTriangleBackSide () const
 This method returns the status about back side triangle haptic rendering. (Applies to polygonal objects only). More...
 
void setHapticTriangleSides (const bool a_enableFrontSide, const bool a_enableBackSide)
 This method enables or disables haptic rendering of front and back sides of mesh triangles. More...
 
void setAudioImpactBuffer (cAudioBuffer *a_audioImpactBuffer)
 This method sets an audio buffer associated to impacts between a tool and an object. More...
 
cAudioBuffergetAudioImpactBuffer ()
 This method returns a pointer to the audio buffer associated with impacts. More...
 
void setAudioImpactGain (const double a_audioImpactGain)
 This method sets the audio gain for sounds associated with impacts. More...
 
double getAudioImpactGain () const
 This method returns the gain value for sounds associated with impacts. More...
 
void setAudioFrictionBuffer (cAudioBuffer *a_audioFrictionBuffer)
 This method sets an audio buffer associated with friction. More...
 
cAudioBuffergetAudioFrictionBuffer ()
 This method returns a pointer to the audio buffer associated with friction. More...
 
void setAudioFrictionGain (const double a_audioFrictionGain)
 This method sets the audio gain for sounds associated with friction. More...
 
double getAudioFrictionGain () const
 This method returns the audio gain for sounds associated with friction. More...
 
void setAudioFrictionPitchGain (const double a_audioFrictionPitchGain)
 This method sets the audio pitch gain for sounds associated with friction. More...
 
double getAudioFrictionPitchGain () const
 This method returns the audio pitch gain for sounds associated with friction. More...
 
void setAudioFrictionPitchOffset (const double a_audioFrictionPitchOffset)
 This method sets the audio pitch offset for sounds associated with friction. More...
 
double getAudioFrictionPitchOffset () const
 This method returns the audio pitch offset for sounds associated with friction. More...
 
void setColor (cColorf &a_color)
 This method defines a color property for this material. More...
 
void setColor (cColorb &a_color)
 This method defines a color property for this material. More...
 
void setColorf (const GLfloat a_red, const GLfloat a_green, const GLfloat a_blue, const GLfloat a_alpha=1.0f)
 This method defines a color property for this material. More...
 
void setRedIndian ()
 This method sets the color to Red Indian. More...
 
void setRedLightCoral ()
 This method sets the color to Light Coral Red. More...
 
void setRedSalmon ()
 This method sets the color to Red Salmon. More...
 
void setRedDarkSalmon ()
 This method sets the color to Dark Red Salmon. More...
 
void setRedLightSalmon ()
 This method sets the color to Light Red Salmon. More...
 
void setRedCrimson ()
 This method sets the color to Red Crimson. More...
 
void setRed ()
 This method sets the color to Red. More...
 
void setRedFireBrick ()
 This method sets the color to Red Fire Brick. More...
 
void setRedDark ()
 This method sets the color to Dark Red. More...
 
void setPink ()
 This method sets the color to Pink. More...
 
void setPinkLight ()
 This method sets the color to Light Pink. More...
 
void setPinkHot ()
 This method sets the color to Hot Pink. More...
 
void setPinkDeep ()
 This method sets the color to Deep Pink. More...
 
void setPinkMediumVioletRed ()
 This method sets the color to Medium Violet Red. More...
 
void setPinkPaleVioletRed ()
 This method sets the color to Pale Violet Red. More...
 
void setOrangeLightSalmon ()
 This method sets the color to Orange Light Salmon. More...
 
void setOrangeCoral ()
 This method sets the color to Orange Coral. More...
 
void setOrangeTomato ()
 This method sets the color to Orange Tomato. More...
 
void setOrangeRed ()
 This method sets the color to Orange Red. More...
 
void setOrangeDark ()
 This method sets the color to Dark Orange. More...
 
void setOrange ()
 This method sets the color to Orange. More...
 
void setYellowGold ()
 This method sets the color to Gold. More...
 
void setYellow ()
 This method sets the color to Yellow. More...
 
void setYellowLight ()
 This method sets the color to Light Yellow. More...
 
void setYellowLemonChiffon ()
 This method sets the color to Lemon Chiffon. More...
 
void setYellowLightGoldenrod ()
 This method sets the color to Light Goldenrod. More...
 
void setYellowPapayaWhip ()
 This method sets the color to Papaya Whip. More...
 
void setYellowMoccasin ()
 This method sets the color to Moccasin. More...
 
void setYellowPeachPuff ()
 This method sets the color to Peach Puff. More...
 
void setYellowPaleGoldenrod ()
 This method sets the color to Pale Goldenrod. More...
 
void setYellowKhaki ()
 This method sets the color to Khaki. More...
 
void setYellowDarkKhaki ()
 This method sets the color to Dark Khaki. More...
 
void setPurpleLavender ()
 This method sets the color to Lavendar. More...
 
void setPurpleThistle ()
 This method sets the color to Thistle. More...
 
void setPurplePlum ()
 This method sets the color to Plum. More...
 
void setPurpleViolet ()
 This method sets the color to Violet. More...
 
void setPurpleOrchid ()
 This method sets the color to Orchid. More...
 
void setPurpleFuchsia ()
 This method sets the color to Fuchsia. More...
 
void setPurpleMagenta ()
 This method sets the color to Magenta. More...
 
void setPurpleMediumOrchid ()
 This method sets the color to Medium Orchid. More...
 
void setPurpleMedium ()
 This method sets the color to Medium Purple. More...
 
void setPurpleAmethyst ()
 This method sets the color to Amethyst. More...
 
void setPurpleBlueViolet ()
 This method sets the color to Blue Violet. More...
 
void setPurpleDarkViolet ()
 This method sets the color to Dark Violet. More...
 
void setPurpleDarkOrchid ()
 This method sets the color to Dark Orchid. More...
 
void setPurpleDarkMagenta ()
 This method sets the color to Dark Magenta. More...
 
void setPurple ()
 This method sets the color to Purple. More...
 
void setPurpleIndigo ()
 This method sets the color to Indigo. More...
 
void setPurpleSlateBlue ()
 This method sets the color to Slate Blue. More...
 
void setPurpleDarkSlateBlue ()
 This method sets the color to Dark Slate Blue. More...
 
void setPurpleMediumSlateBlue ()
 This method sets the color to Medium Slate Blue. More...
 
void setGreenYellow ()
 This method sets the color to Green Yellow. More...
 
void setGreenChartreuse ()
 This method sets the color to Chartreuse. More...
 
void setGreenLawn ()
 This method sets the color to Lawn Green. More...
 
void setGreenLime ()
 This method sets the color to Lime. More...
 
void setGreenLimeGreen ()
 This method sets the color to Lime Green. More...
 
void setGreenPale ()
 This method sets the color to Pale Green. More...
 
void setGreenLight ()
 This method sets the color to Light Green. More...
 
void setGreenMediumSpring ()
 This method sets the color to Medium Spring Green. More...
 
void setGreenSpring ()
 This method sets the color to Spring Green. More...
 
void setGreenMediumSea ()
 This method sets the color to Medium Sea Green. More...
 
void setGreenSea ()
 This method sets the color to Sea Green. More...
 
void setGreenForest ()
 This method sets the color to Forest Green. More...
 
void setGreen ()
 This method sets the color to Green. More...
 
void setGreenDark ()
 This method sets the color to Dark Green. More...
 
void setGreenYellowGreen ()
 This method sets the color to Yellow Green. More...
 
void setGreenOliveDrab ()
 This method sets the color to Olive Drab. More...
 
void setGreenOlive ()
 This method sets the color to Olive. More...
 
void setGreenDarkOlive ()
 This method sets the color to Dark Olive Green. More...
 
void setGreenMediumAquamarine ()
 This method sets the color to Medium Aquamarine. More...
 
void setGreenDarkSea ()
 This method sets the color to Dark Sea Green. More...
 
void setGreenLightSea ()
 This method sets the color to Light Sea Green. More...
 
void setGreenDarkCyan ()
 This method sets the color to Dark Cyan. More...
 
void setGreenTeal ()
 This method sets the color to Teal. More...
 
void setBlueAqua ()
 This method sets the color to Aqua. More...
 
void setBlueCyan ()
 This method sets the color to Cyan. More...
 
void setBlueLightCyan ()
 This method sets the color to Light Cyan. More...
 
void setBluePaleTurquoise ()
 This method sets the color to Pale Turquoise. More...
 
void setBlueAquamarine ()
 This method sets the color to Aquamarine. More...
 
void setBlueTurquoise ()
 This method sets the color to Turquoise. More...
 
void setBlueMediumTurquoise ()
 This method sets the color to Medium Turquoise. More...
 
void setBlueDarkTurquoise ()
 This method sets the color to Dark Turquoise. More...
 
void setBlueCadet ()
 This method sets the color to Cadet Blue. More...
 
void setBlueSteel ()
 This method sets the color to Steel Blue. More...
 
void setBlueLightSteel ()
 This method sets the color to Light Steel Blue. More...
 
void setBluePowder ()
 This method sets the color to Powder Blue. More...
 
void setBlueLight ()
 This method sets the color to Light Blue. More...
 
void setBlueSky ()
 This method sets the color to Sky Blue. More...
 
void setBlueLightSky ()
 This method sets the color to Light Sky Blue. More...
 
void setBlueDeepSky ()
 This method sets the color to Deep Sky Blue. More...
 
void setBlueDodger ()
 This method sets the color to Doger Blue. More...
 
void setBlueCornflower ()
 This method sets the color to Cornflower Blue. More...
 
void setBlueMediumSlate ()
 This method sets the color to Medium Slate Blue. More...
 
void setBlueRoyal ()
 This method sets the color to Royal Blue. More...
 
void setBlue ()
 This method sets the color to Blue. More...
 
void setBlueMedium ()
 This method sets the color to Medium Blue. More...
 
void setBlueDark ()
 This method sets the color to Dark Blue. More...
 
void setBlueNavy ()
 This method sets the color to Navy. More...
 
void setBlueMidnight ()
 This method sets the color to Midnight Blue. More...
 
void setBrownCornsilk ()
 This method sets the color to Cornsilk. More...
 
void setBrownBlanchedAlmond ()
 This method sets the color to Blanched Almond. More...
 
void setBrownBisque ()
 This method sets the color to Bisque. More...
 
void setBrownNavajoWhite ()
 This method sets the color to Navajo White. More...
 
void setBrownWheat ()
 This method sets the color to Wheat. More...
 
void setBrownBurlyWood ()
 This method sets the color to Burly Wood. More...
 
void setBrownTan ()
 This method sets the color to Tan. More...
 
void setBrownRosy ()
 This method sets the color to Rosy Brown. More...
 
void setBrownSandy ()
 This method sets the color to Sandy Brown. More...
 
void setBrownGoldenrod ()
 This method sets the color to Brown Goldenrod. More...
 
void setBrownDarkGoldenrod ()
 This method sets the color to Dark Brown Goldenrod. More...
 
void setBrownPeru ()
 This method sets the color to Peru. More...
 
void setBrownChocolate ()
 This method sets the color to Chocolate. More...
 
void setBrownSaddle ()
 This method sets the color to Saddle Brown. More...
 
void setBrownSienna ()
 This method sets the color to Sienna. More...
 
void setBrown ()
 This method sets the color to Brown. More...
 
void setBrownMaroon ()
 This method sets the color to Maroon. More...
 
void setWhite ()
 This method sets the color to White. More...
 
void setWhiteSnow ()
 This method sets the color to White Snow. More...
 
void setWhiteHoneydew ()
 This method sets the color to Honeydew. More...
 
void setWhiteMintCream ()
 This method sets the color to Mint Cream. More...
 
void setWhiteAzure ()
 This method sets the color to Azure. More...
 
void setWhiteAliceBlue ()
 This method sets the color to Alice Blue. More...
 
void setWhiteGhost ()
 This method sets the color to Ghost White. More...
 
void setWhiteSmoke ()
 This method sets the color to White Smoke. More...
 
void setWhiteSeashell ()
 This method sets the color to Seashell. More...
 
void setWhiteBeige ()
 This method sets the color to Beige. More...
 
void setWhiteOldLace ()
 This method sets the color to Old Lace. More...
 
void setWhiteFloral ()
 This method sets the color to Floral White. More...
 
void setWhiteIvory ()
 This method sets the color to Ivory. More...
 
void setWhiteAntique ()
 This method sets the color to Antique White. More...
 
void setWhiteLinen ()
 This method sets the color to Linen. More...
 
void setWhiteLavenderBlush ()
 This method sets the color to Lavender Blush. More...
 
void setWhiteMistyRose ()
 This method sets the color to Misty Rose. More...
 
void setGrayGainsboro ()
 This method sets the color to Gainsboro. More...
 
void setGrayLight ()
 This method sets the color to Light Gray. More...
 
void setGraySilver ()
 This method sets the color to Silver. More...
 
void setGrayDark ()
 This method sets the color to Dark Gray. More...
 
void setGray ()
 This method sets the color to Gray. More...
 
void setGrayDim ()
 This method sets the color to Dim Gray. More...
 
void setGrayLightSlate ()
 This method sets the color to Light Slate Gray. More...
 
void setGraySlate ()
 This method sets the color to Slate Gray. More...
 
void setGrayDarkSlate ()
 This method sets the color to Dark Slate Gray. More...
 
void setBlack ()
 This method sets the color to Black. More...
 
void setGrayLevel (const GLfloat a_level)
 

Static Public Member Functions

static cMaterialPtr create ()
 Shared cMaterial allocator. More...
 

Public Attributes

cColorf m_ambient
 Ambient color. More...
 
cColorf m_diffuse
 Diffuse color. More...
 
cColorf m_specular
 Specular color. More...
 
cColorf m_emission
 Emission color. More...
 
cColorf m_ambientBackup
 Ambient color. (Backup) More...
 
cColorf m_diffuseBackup
 Diffuse color. (Backup) More...
 
cColorf m_specularBackup
 Specular color. (Backup) More...
 
cColorf m_emissionBackup
 Emission color. (Backup) More...
 

Protected Member Functions

void updateColors ()
 This method takes the current diffuse color and updates ambient and specular components. More...
 

Protected Attributes

GLuint m_shininess
 Material shininess level. More...
 
bool m_flag_shininess
 Flag to track if related member has been modified. More...
 
double m_stiffness
 Stiffness [N/m]. More...
 
bool m_flag_stiffness
 Flag to track if related member has been modified. More...
 
double m_damping
 
bool m_flag_damping
 Flag to track if related member has been modified. More...
 
double m_viscosity
 Level of viscosity. More...
 
bool m_flag_viscosity
 Flag to track if related member has been modified. More...
 
double m_staticFriction
 Static friction constant [N]. More...
 
bool m_flag_staticFriction
 Flag to track if related member has been modified. More...
 
double m_dynamicFriction
 Dynamic friction constant [N]. More...
 
bool m_flag_dynamicFriction
 Flag to track if related member has been modified. More...
 
double m_textureLevel
 Texture level constant. More...
 
bool m_flag_textureLevel
 Flag to track if related member has been modified. More...
 
double m_vibrationFrequency
 Frequency of vibrations [Hz]. More...
 
bool m_flag_vibrationFrequency
 Flag to track if related member has been modified. More...
 
double m_vibrationAmplitude
 Amplitude of vibrations [Hz]. More...
 
bool m_flag_vibrationAmplitude
 Flag to track if related member has been modified. More...
 
double m_magnetMaxForce
 Maximum force applied by magnetic effect [N]. More...
 
bool m_flag_magnetMaxForce
 Flag to track if related member has been modified. More...
 
double m_magnetMaxDistance
 Maximum distance from which magnetic forces can be perceived. More...
 
bool m_flag_magnetMaxDistance
 Flag to track if related member has been modified. More...
 
double m_stickSlipForceMax
 Force threshold for stick and slip effect [N]. More...
 
bool m_flag_stickSlipForceMax
 Flag to track if related member has been modified. More...
 
double m_stickSlipStiffness
 Stiffness of stick slip model. More...
 
bool m_flag_stickSlipStiffness
 Flag to track if related member has been modified. More...
 
bool m_useHapticFriction
 If true, haptic friction rendering is enabled. More...
 
bool m_flag_useHapticFriction
 Flag to track if related member has been modified. More...
 
bool m_useHapticTexture
 If true, haptic texture rendering is enabled. More...
 
bool m_flag_useHapticTexture
 Flag to track if related member has been modified. More...
 
bool m_useHapticShading
 If true, haptic shading is enabled. More...
 
bool m_flag_useHapticShading
 Flag to track if related member has been modified. More...
 
bool m_hapticFrontSideOfTriangles
 If true, then front side of triangles are rendered haptically (used by the proxy algorithm). More...
 
bool m_flag_hapticFrontSideOfTriangles
 Flag to track if related member has been modified. More...
 
bool m_hapticBackSideOfTriangles
 If true, then back side of triangles are rendered haptically (used by the proxy algorithm). More...
 
bool m_flag_hapticBackSideOfTriangles
 Flag to track if related member has been modified. More...
 
cAudioBufferm_audioImpactBuffer
 Sound buffer associated with impacts. More...
 
bool m_flag_audioImpactBuffer
 Flag to track if related member has been modified. More...
 
cAudioBufferm_audioFrictionBuffer
 Sound buffer associated with friction. More...
 
bool m_flag_audioFrictionBuffer
 Flag to track if related member has been modified. More...
 
double m_audioImpactGain
 General gain for sound associated with impacts. More...
 
bool m_flag_audioImpactGain
 Flag to track if related member has been modified. More...
 
double m_audioFrictionGain
 General gain for sounds associated with friction. More...
 
bool m_flag_audioFrictionGain
 Flag to track if related member has been modified. More...
 
double m_audioFrictionPitchGain
 General pitch gain for sounds associated with friction. More...
 
bool m_flag_audioFrictionPitchGain
 Flag to track if related member has been modified. More...
 
double m_audioFrictionPitchOffset
 General pitch offset for sounds associated with friction. More...
 
bool m_flag_audioFrictionPitchOffset
 Flag to track if related member has been modified. More...
 

Detailed Description

This class provides a description for handling OpenGL graphic material properties. These include: ambient color, diffuse color, specular color, emissive color, and shininess.

Haptic properties are also defined in this class. Properties include stiffness, dynamic friction, and static friction, viscosity, vibration and magnetic effects. Force rendering algorithms will lookup the material properties of an object to compute the desired force rendering effect.

cMaterial also allows the programmer to backup the current materials colors by calling method backup(). These colors can later be retrieved by calling the method restore().

This capability can be very useful when implementing a selection procedure where objects change color when being being selected by a computer mouse for instance. A different color can be applied to the selected object and then restored to the original color once the selection has been completed.

Constructor & Destructor Documentation

chai3d::cMaterial::cMaterial ( )

Constructor of cMaterial.

virtual chai3d::cMaterial::~cMaterial ( )
inlinevirtual

Member Function Documentation

static cMaterialPtr chai3d::cMaterial::create ( )
inlinestatic
cMaterialPtr chai3d::cMaterial::copy ( )

This method creates a copy of itself.

Returns
Pointer to new instance.
void chai3d::cMaterial::setModificationFlags ( const bool  a_value)

This method sets all the modification flags to a desired value.

Parameters
a_valueValue to be assigned to modification flags.
void chai3d::cMaterial::copyTo ( cMaterialPtr  a_material)

This method copies all modified variables to material object passed as argument.

Parameters
a_materialDestination material where values are copied to.
void chai3d::cMaterial::setShininess ( const GLuint  a_shininess)

This method sets the level of shininess. The value is clamped to range from 0 to 128.

Parameters
a_shininessLevel of shininess
GLuint chai3d::cMaterial::getShininess ( ) const
inline
void chai3d::cMaterial::setTransparencyLevel ( const float  a_levelTransparency)

This method sets the transparency level by setting the alpha value to all color members including ambient, diffuse, specular, and emission.

Parameters
a_levelTransparencyLevel of transparency.
bool chai3d::cMaterial::isTransparent ( ) const
inline
void chai3d::cMaterial::backupColors ( )
inline
void chai3d::cMaterial::restoreColors ( )
inline
void chai3d::cMaterial::render ( cRenderOptions a_options)
virtual

This method renders this material using OpenGL.

Parameters
a_optionsRendering options.
void chai3d::cMaterial::setStiffness ( const double  a_stiffness)

This method sets the level of stiffness for this material. The value is clamped to be a non-negative value.

Parameters
a_stiffnessLevel of stiffness.
double chai3d::cMaterial::getStiffness ( ) const
inline
void chai3d::cMaterial::setViscosity ( const double  a_viscosity)

This method sets the level of viscosity. The value is clamped to be a non-negative value.

Parameters
a_viscosityLevel of viscosity.
double chai3d::cMaterial::getViscosity ( ) const
inline
void chai3d::cMaterial::setVibrationFrequency ( const double  a_vibrationFrequency)

This method sets the frequency of vibration. The value is clamped to be a non-negative value.

Parameters
a_vibrationFrequencyFrequency of vibration [Hz].
double chai3d::cMaterial::getVibrationFrequency ( ) const
inline
void chai3d::cMaterial::setVibrationAmplitude ( const double  a_vibrationAmplitude)

This method set the amplitude of vibration. The value is clamped to be a non-negative value.

Parameters
a_vibrationAmplitudeAmplitude of vibrations [N].
double chai3d::cMaterial::getVibrationAmplitude ( ) const
inline
void chai3d::cMaterial::setMagnetMaxForce ( const double  a_magnetMaxForce)

This method sets the maximum force applied by the magnet [N]. The value is clamped to be a non-negative value.

Parameters
a_magnetMaxForceMaximum force of magnet.
double chai3d::cMaterial::getMagnetMaxForce ( ) const
inline
void chai3d::cMaterial::setMagnetMaxDistance ( const double  a_magnetMaxDistance)

This method sets the maximum distance from which the magnetic force can be perceived [m]

Parameters
a_magnetMaxDistanceMaximum distance from object where magnet is active.
double chai3d::cMaterial::getMagnetMaxDistance ( ) const
inline
void chai3d::cMaterial::setStickSlipForceMax ( const double  a_stickSlipForceMax)

This method sets the maximum force threshold for the stick and slip model [N]. The value is clamped to be a non-negative value.

Parameters
a_stickSlipForceMaxMaximum force threshold.
double chai3d::cMaterial::getStickSlipForceMax ( ) const
inline
void chai3d::cMaterial::setStickSlipStiffness ( double const  a_stickSlipStiffness)

This method sets the stiffness for the stick and slip model [N/m].

Parameters
a_stickSlipStiffnessStiffness property.
double chai3d::cMaterial::getStickSlipStiffness ( ) const
inline
void chai3d::cMaterial::setDamping ( const double  a_damping)

This method sets the level of damping.

Parameters
a_dampingLevel of damping.
double chai3d::cMaterial::getDamping ( ) const
inline
void chai3d::cMaterial::setUseHapticFriction ( const bool  a_useHapticFriction)

This method enables or disables rendering of haptic friction.

Parameters
a_useHapticFrictionIf true, haptic friction rendering in enabled.
bool chai3d::cMaterial::getUseHapticFriction ( ) const
inline
void chai3d::cMaterial::setStaticFriction ( const double  a_friction)

This method sets the level of static friction. The value is clamped to be a non-negative value.

Parameters
a_frictionLevel of friction.
double chai3d::cMaterial::getStaticFriction ( ) const
inline
void chai3d::cMaterial::setDynamicFriction ( const double  a_friction)

This method sets the level of dynamic friction. The value is clamped to be a non-negative value.

Parameters
a_frictionLevel of friction.
double chai3d::cMaterial::getDynamicFriction ( ) const
inline
void chai3d::cMaterial::setUseHapticTexture ( const bool  a_useHapticTexture)

This method enables or disables haptic texture rendering.

Parameters
a_useHapticTextureIf true, haptic texture rendering in enabled.
bool chai3d::cMaterial::getUseHapticTexture ( ) const
inline
void chai3d::cMaterial::setTextureLevel ( const double  a_textureLevel)

This method sets the intensity at which the texture map of an object is perceived.

Parameters
a_textureLevelIntensity level.
double chai3d::cMaterial::getTextureLevel ( ) const
inline
void chai3d::cMaterial::setUseHapticShading ( const bool  a_useHapticShading)

This method enables or disables haptic shading.

Parameters
a_useHapticShadingIf true, haptic shading in enabled.
bool chai3d::cMaterial::getUseHapticShading ( ) const
inline
void chai3d::cMaterial::setHapticTriangleFrontSide ( const bool  a_enabled)

This method enables or disables front side haptic rendering.
If a_enabled is set to true, then haptic rendering occurs on front side of triangles. This option applies to mesh objects which are rendered using the proxy force algorithm.

Parameters
a_enabledIf true, then haptic rendering is enabled.
bool chai3d::cMaterial::getHapticTriangleFrontSide ( ) const
inline
void chai3d::cMaterial::setHapticTriangleBackSide ( const bool  a_enabled)

This method enables or disables back side haptic rendering.
If a_enabled is set to true, then haptic rendering occurs on back side of triangles. This option applies to mesh objects which are rendered using the proxy force algorithm.

Parameters
a_enabledIf true, then haptic rendering is enabled.
bool chai3d::cMaterial::getHapticTriangleBackSide ( ) const
inline
void chai3d::cMaterial::setHapticTriangleSides ( const bool  a_enableFrontSide,
const bool  a_enableBackSide 
)

This method defines which sides haptic rendering must occur with triangles.

Parameters
a_enableFrontSideIf true, then haptic rendering is enabled for front sides.
a_enableBackSideIf true, then haptic rendering is enabled for back sides.
void chai3d::cMaterial::setAudioImpactBuffer ( cAudioBuffer a_audioImpactBuffer)

This method sets an audio buffer associated with any impacts between a haptic tool and an object.

Parameters
a_audioImpactBufferAudio buffer.
cAudioBuffer* chai3d::cMaterial::getAudioImpactBuffer ( )
inline
void chai3d::cMaterial::setAudioImpactGain ( const double  a_audioImpactGain)

This method sets the audio gain related to impact sounds.

Parameters
a_audioImpactGainAudio gain associated to impact.
double chai3d::cMaterial::getAudioImpactGain ( ) const
inline
void chai3d::cMaterial::setAudioFrictionBuffer ( cAudioBuffer a_audioFrictionBuffer)

This method sets an audio buffer associated with any friction caused by a haptic tool touching an object.

Parameters
a_audioFrictionBufferAudio buffer.
cAudioBuffer* chai3d::cMaterial::getAudioFrictionBuffer ( )
inline
void chai3d::cMaterial::setAudioFrictionGain ( const double  a_audioFrictionGain)

This method sets the audio gain related to friction sounds.

Parameters
a_audioFrictionGainAudio gain associated to friction.
double chai3d::cMaterial::getAudioFrictionGain ( ) const
inline
void chai3d::cMaterial::setAudioFrictionPitchGain ( const double  a_audioFrictionPitchGain)

This method sets the audio friction pitch gain.

Parameters
a_audioFrictionPitchGainAudio pitch gain associated to friction.
double chai3d::cMaterial::getAudioFrictionPitchGain ( ) const
inline
void chai3d::cMaterial::setAudioFrictionPitchOffset ( const double  a_audioFrictionPitchOffset)

This method sets the audio friction pitch offset.

Parameters
a_audioFrictionPitchOffsetAudio pitch offset associated to friction.
double chai3d::cMaterial::getAudioFrictionPitchOffset ( ) const
inline
void chai3d::cMaterial::setColor ( cColorf a_color)

This method defines a color property for this material.

Parameters
a_colorColor.
void chai3d::cMaterial::setColor ( cColorb a_color)

Define a color property for the material.

Parameters
a_colorColor.
void chai3d::cMaterial::setColorf ( const GLfloat  a_red,
const GLfloat  a_green,
const GLfloat  a_blue,
const GLfloat  a_alpha = 1.0f 
)

This method defines a color property for this material.

Parameters
a_redRed component
a_greenGreen component
a_blueBlue component
a_alphaAlpha component
void chai3d::cMaterial::setRedIndian ( )
inline
void chai3d::cMaterial::setRedLightCoral ( )
inline
void chai3d::cMaterial::setRedSalmon ( )
inline
void chai3d::cMaterial::setRedDarkSalmon ( )
inline
void chai3d::cMaterial::setRedLightSalmon ( )
inline
void chai3d::cMaterial::setRedCrimson ( )
inline
void chai3d::cMaterial::setRed ( )
inline
void chai3d::cMaterial::setRedFireBrick ( )
inline
void chai3d::cMaterial::setRedDark ( )
inline
void chai3d::cMaterial::setPink ( )
inline
void chai3d::cMaterial::setPinkLight ( )
inline
void chai3d::cMaterial::setPinkHot ( )
inline
void chai3d::cMaterial::setPinkDeep ( )
inline
void chai3d::cMaterial::setPinkMediumVioletRed ( )
inline
void chai3d::cMaterial::setPinkPaleVioletRed ( )
inline
void chai3d::cMaterial::setOrangeLightSalmon ( )
inline
void chai3d::cMaterial::setOrangeCoral ( )
inline
void chai3d::cMaterial::setOrangeTomato ( )
inline
void chai3d::cMaterial::setOrangeRed ( )
inline
void chai3d::cMaterial::setOrangeDark ( )
inline
void chai3d::cMaterial::setOrange ( )
inline
void chai3d::cMaterial::setYellowGold ( )
inline
void chai3d::cMaterial::setYellow ( )
inline
void chai3d::cMaterial::setYellowLight ( )
inline
void chai3d::cMaterial::setYellowLemonChiffon ( )
inline
void chai3d::cMaterial::setYellowLightGoldenrod ( )
inline
void chai3d::cMaterial::setYellowPapayaWhip ( )
inline
void chai3d::cMaterial::setYellowMoccasin ( )
inline
void chai3d::cMaterial::setYellowPeachPuff ( )
inline
void chai3d::cMaterial::setYellowPaleGoldenrod ( )
inline
void chai3d::cMaterial::setYellowKhaki ( )
inline
void chai3d::cMaterial::setYellowDarkKhaki ( )
inline
void chai3d::cMaterial::setPurpleLavender ( )
inline
void chai3d::cMaterial::setPurpleThistle ( )
inline
void chai3d::cMaterial::setPurplePlum ( )
inline
void chai3d::cMaterial::setPurpleViolet ( )
inline
void chai3d::cMaterial::setPurpleOrchid ( )
inline
void chai3d::cMaterial::setPurpleFuchsia ( )
inline
void chai3d::cMaterial::setPurpleMagenta ( )
inline
void chai3d::cMaterial::setPurpleMediumOrchid ( )
inline
void chai3d::cMaterial::setPurpleMedium ( )
inline
void chai3d::cMaterial::setPurpleAmethyst ( )
inline
void chai3d::cMaterial::setPurpleBlueViolet ( )
inline
void chai3d::cMaterial::setPurpleDarkViolet ( )
inline
void chai3d::cMaterial::setPurpleDarkOrchid ( )
inline
void chai3d::cMaterial::setPurpleDarkMagenta ( )
inline
void chai3d::cMaterial::setPurple ( )
inline
void chai3d::cMaterial::setPurpleIndigo ( )
inline
void chai3d::cMaterial::setPurpleSlateBlue ( )
inline
void chai3d::cMaterial::setPurpleDarkSlateBlue ( )
inline
void chai3d::cMaterial::setPurpleMediumSlateBlue ( )
inline
void chai3d::cMaterial::setGreenYellow ( )
inline
void chai3d::cMaterial::setGreenChartreuse ( )
inline
void chai3d::cMaterial::setGreenLawn ( )
inline
void chai3d::cMaterial::setGreenLime ( )
inline
void chai3d::cMaterial::setGreenLimeGreen ( )
inline
void chai3d::cMaterial::setGreenPale ( )
inline
void chai3d::cMaterial::setGreenLight ( )
inline
void chai3d::cMaterial::setGreenMediumSpring ( )
inline
void chai3d::cMaterial::setGreenSpring ( )
inline
void chai3d::cMaterial::setGreenMediumSea ( )
inline
void chai3d::cMaterial::setGreenSea ( )
inline
void chai3d::cMaterial::setGreenForest ( )
inline
void chai3d::cMaterial::setGreen ( )
inline
void chai3d::cMaterial::setGreenDark ( )
inline
void chai3d::cMaterial::setGreenYellowGreen ( )
inline
void chai3d::cMaterial::setGreenOliveDrab ( )
inline
void chai3d::cMaterial::setGreenOlive ( )
inline
void chai3d::cMaterial::setGreenDarkOlive ( )
inline
void chai3d::cMaterial::setGreenMediumAquamarine ( )
inline
void chai3d::cMaterial::setGreenDarkSea ( )
inline
void chai3d::cMaterial::setGreenLightSea ( )
inline
void chai3d::cMaterial::setGreenDarkCyan ( )
inline
void chai3d::cMaterial::setGreenTeal ( )
inline
void chai3d::cMaterial::setBlueAqua ( )
inline
void chai3d::cMaterial::setBlueCyan ( )
inline
void chai3d::cMaterial::setBlueLightCyan ( )
inline
void chai3d::cMaterial::setBluePaleTurquoise ( )
inline
void chai3d::cMaterial::setBlueAquamarine ( )
inline
void chai3d::cMaterial::setBlueTurquoise ( )
inline
void chai3d::cMaterial::setBlueMediumTurquoise ( )
inline
void chai3d::cMaterial::setBlueDarkTurquoise ( )
inline
void chai3d::cMaterial::setBlueCadet ( )
inline
void chai3d::cMaterial::setBlueSteel ( )
inline
void chai3d::cMaterial::setBlueLightSteel ( )
inline
void chai3d::cMaterial::setBluePowder ( )
inline
void chai3d::cMaterial::setBlueLight ( )
inline
void chai3d::cMaterial::setBlueSky ( )
inline
void chai3d::cMaterial::setBlueLightSky ( )
inline
void chai3d::cMaterial::setBlueDeepSky ( )
inline
void chai3d::cMaterial::setBlueDodger ( )
inline
void chai3d::cMaterial::setBlueCornflower ( )
inline
void chai3d::cMaterial::setBlueMediumSlate ( )
inline
void chai3d::cMaterial::setBlueRoyal ( )
inline
void chai3d::cMaterial::setBlue ( )
inline
void chai3d::cMaterial::setBlueMedium ( )
inline
void chai3d::cMaterial::setBlueDark ( )
inline
void chai3d::cMaterial::setBlueNavy ( )
inline
void chai3d::cMaterial::setBlueMidnight ( )
inline
void chai3d::cMaterial::setBrownCornsilk ( )
inline
void chai3d::cMaterial::setBrownBlanchedAlmond ( )
inline
void chai3d::cMaterial::setBrownBisque ( )
inline
void chai3d::cMaterial::setBrownNavajoWhite ( )
inline
void chai3d::cMaterial::setBrownWheat ( )
inline
void chai3d::cMaterial::setBrownBurlyWood ( )
inline
void chai3d::cMaterial::setBrownTan ( )
inline
void chai3d::cMaterial::setBrownRosy ( )
inline
void chai3d::cMaterial::setBrownSandy ( )
inline
void chai3d::cMaterial::setBrownGoldenrod ( )
inline
void chai3d::cMaterial::setBrownDarkGoldenrod ( )
inline
void chai3d::cMaterial::setBrownPeru ( )
inline
void chai3d::cMaterial::setBrownChocolate ( )
inline
void chai3d::cMaterial::setBrownSaddle ( )
inline
void chai3d::cMaterial::setBrownSienna ( )
inline
void chai3d::cMaterial::setBrown ( )
inline
void chai3d::cMaterial::setBrownMaroon ( )
inline
void chai3d::cMaterial::setWhite ( )
inline
void chai3d::cMaterial::setWhiteSnow ( )
inline
void chai3d::cMaterial::setWhiteHoneydew ( )
inline
void chai3d::cMaterial::setWhiteMintCream ( )
inline
void chai3d::cMaterial::setWhiteAzure ( )
inline
void chai3d::cMaterial::setWhiteAliceBlue ( )
inline
void chai3d::cMaterial::setWhiteGhost ( )
inline
void chai3d::cMaterial::setWhiteSmoke ( )
inline
void chai3d::cMaterial::setWhiteSeashell ( )
inline
void chai3d::cMaterial::setWhiteBeige ( )
inline
void chai3d::cMaterial::setWhiteOldLace ( )
inline
void chai3d::cMaterial::setWhiteFloral ( )
inline
void chai3d::cMaterial::setWhiteIvory ( )
inline
void chai3d::cMaterial::setWhiteAntique ( )
inline
void chai3d::cMaterial::setWhiteLinen ( )
inline
void chai3d::cMaterial::setWhiteLavenderBlush ( )
inline
void chai3d::cMaterial::setWhiteMistyRose ( )
inline
void chai3d::cMaterial::setGrayGainsboro ( )
inline
void chai3d::cMaterial::setGrayLight ( )
inline
void chai3d::cMaterial::setGraySilver ( )
inline
void chai3d::cMaterial::setGrayDark ( )
inline
void chai3d::cMaterial::setGray ( )
inline
void chai3d::cMaterial::setGrayDim ( )
inline
void chai3d::cMaterial::setGrayLightSlate ( )
inline
void chai3d::cMaterial::setGraySlate ( )
inline
void chai3d::cMaterial::setGrayDarkSlate ( )
inline
void chai3d::cMaterial::setBlack ( )
inline
void chai3d::cMaterial::setGrayLevel ( const GLfloat  a_level)
inline
void chai3d::cMaterial::updateColors ( )
protected

When a new color is defined by calling methods such as setColorf() or setRed(), the selected color is first set to the diffuse component. This method updates the ambient component by setting it equal to 50% of the diffuse color. The specular color is finally set to pure white.

Member Data Documentation

cColorf chai3d::cMaterial::m_ambient
cColorf chai3d::cMaterial::m_diffuse
cColorf chai3d::cMaterial::m_specular
cColorf chai3d::cMaterial::m_emission
cColorf chai3d::cMaterial::m_ambientBackup
cColorf chai3d::cMaterial::m_diffuseBackup
cColorf chai3d::cMaterial::m_specularBackup
cColorf chai3d::cMaterial::m_emissionBackup
GLuint chai3d::cMaterial::m_shininess
protected
bool chai3d::cMaterial::m_flag_shininess
protected
double chai3d::cMaterial::m_stiffness
protected
bool chai3d::cMaterial::m_flag_stiffness
protected
double chai3d::cMaterial::m_damping
protected
bool chai3d::cMaterial::m_flag_damping
protected
double chai3d::cMaterial::m_viscosity
protected
bool chai3d::cMaterial::m_flag_viscosity
protected
double chai3d::cMaterial::m_staticFriction
protected
bool chai3d::cMaterial::m_flag_staticFriction
protected
double chai3d::cMaterial::m_dynamicFriction
protected
bool chai3d::cMaterial::m_flag_dynamicFriction
protected
double chai3d::cMaterial::m_textureLevel
protected
bool chai3d::cMaterial::m_flag_textureLevel
protected
double chai3d::cMaterial::m_vibrationFrequency
protected
bool chai3d::cMaterial::m_flag_vibrationFrequency
protected
double chai3d::cMaterial::m_vibrationAmplitude
protected
bool chai3d::cMaterial::m_flag_vibrationAmplitude
protected
double chai3d::cMaterial::m_magnetMaxForce
protected
bool chai3d::cMaterial::m_flag_magnetMaxForce
protected
double chai3d::cMaterial::m_magnetMaxDistance
protected
bool chai3d::cMaterial::m_flag_magnetMaxDistance
protected
double chai3d::cMaterial::m_stickSlipForceMax
protected
bool chai3d::cMaterial::m_flag_stickSlipForceMax
protected
double chai3d::cMaterial::m_stickSlipStiffness
protected
bool chai3d::cMaterial::m_flag_stickSlipStiffness
protected
bool chai3d::cMaterial::m_useHapticFriction
protected
bool chai3d::cMaterial::m_flag_useHapticFriction
protected
bool chai3d::cMaterial::m_useHapticTexture
protected
bool chai3d::cMaterial::m_flag_useHapticTexture
protected
bool chai3d::cMaterial::m_useHapticShading
protected
bool chai3d::cMaterial::m_flag_useHapticShading
protected
bool chai3d::cMaterial::m_hapticFrontSideOfTriangles
protected
bool chai3d::cMaterial::m_flag_hapticFrontSideOfTriangles
protected
bool chai3d::cMaterial::m_hapticBackSideOfTriangles
protected
bool chai3d::cMaterial::m_flag_hapticBackSideOfTriangles
protected
cAudioBuffer* chai3d::cMaterial::m_audioImpactBuffer
protected
bool chai3d::cMaterial::m_flag_audioImpactBuffer
protected
cAudioBuffer* chai3d::cMaterial::m_audioFrictionBuffer
protected
bool chai3d::cMaterial::m_flag_audioFrictionBuffer
protected
double chai3d::cMaterial::m_audioImpactGain
protected
bool chai3d::cMaterial::m_flag_audioImpactGain
protected
double chai3d::cMaterial::m_audioFrictionGain
protected
bool chai3d::cMaterial::m_flag_audioFrictionGain
protected
double chai3d::cMaterial::m_audioFrictionPitchGain
protected
bool chai3d::cMaterial::m_flag_audioFrictionPitchGain
protected
double chai3d::cMaterial::m_audioFrictionPitchOffset
protected
bool chai3d::cMaterial::m_flag_audioFrictionPitchOffset
protected

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