# cMaterial Class Reference
[Graphics]

cMaterial provide a description for handling OpenGL graphic material properties. These include: ambient color, diffuse color, specular color, emissive color, and shininess.
More...

`#include <CMaterial.h>`

List of all members.

## Public Member Functions
| cMaterial ()
| Constructor of cMaterial.
| ~cMaterial ()
| Destructor of cMaterial.
virtual void | render ()
| Render the material in OpenGL.
void | setShininess (GLuint a_shininess)
| Set shininess (the exponent used for specular lighting).
GLuint | getShininess ()
| Get shininess.
void | setTransparencyLevel (float a_levelTransparency)
| set transparency level (sets the alpha value for all color properties).
bool | isTransparent () const
| tells you whether this material includes partial transparency.
void | setStiffness (double a_stiffness)
| Set stiffness level [N/m].
double | getStiffness () const
| Get stiffness level [N/m].
void | setStaticFriction (double a_friction)
| Set static friction level.
double | getStaticFriction () const
| Get static friction level.
void | setDynamicFriction (double a_friction)
| Set dynamic friction level.
double | getDynamicFriction () const
| Get dynamic friction level.
void | setViscosity (double a_viscosity)
| Set level of viscosity.
double | getViscosity ()
| Get level of viscosity.
void | setVibrationFrequency (double a_vibrationFrequency)
| Set vibration frequency [Hz].
double | getVibrationFrequency ()
| Get vibration frequency [Hz].
void | setVibrationAmplitude (double a_vibrationAmplitude)
| Set vibration amplitude [max N].
double | getVibrationAmplitude ()
| Get vibration amplitude [max N].
void | setMagnetMaxForce (double a_magnetMaxForce)
| Set the maximum force applied by the magnet [N].
double | getMagnetMaxForce ()
| Get the maximum force applied by the magnet [N].
void | setMagnetMaxDistance (double a_magnetMaxDistance)
| Set the maximum distance from the object where the force can be perceived [m].
double | getMagnetMaxDistance ()
| Get the maximum distance from the object where the force can be perceived [m].
void | setStickSlipForceMax (double a_stickSlipForceMax)
| Set the maximum force threshold for the stick and slip model [N].
double | getStickSlipForceMax ()
| Get the maximum force threshold for the stick and slip model [N].
void | setStickSlipStiffness (double a_stickSlipStiffness)
| Set the stiffness for the stick and slip model [N/m].
double | getStickSlipStiffness ()
| Get the stiffness for the stick and slip model [N/m].
## Public Attributes
cColorf | m_ambient
| Ambient color.
cColorf | m_diffuse
| Diffuse color.
cColorf | m_specular
| Specular color.
cColorf | m_emission
| Emissive color.
## Protected Attributes
GLuint | m_shininess
| OpenGL shininess.
double | m_viscosity
| Level of viscosity.
double | m_stiffness
| Stiffness [Netwons per meter].
double | m_static_friction
| Static friction constant.
double | m_dynamic_friction
| Dynamic friction constant.
double | m_vibrationFrequency
| Frequency of vibrations.
double | m_vibrationAmplitude
| Amplitude of vibrations.
double | m_magnetMaxForce
| Maximum force applied by magnet effect.
double | m_magnetMaxDistance
| Maximum distance from the object where the magnetic force can be perceived.
double | m_stickSlipForceMax
| Force threshold for stick and slip effect.
double | m_stickSlipStiffness
| Spring stiffness of stick slip model.

## Detailed Description

cMaterial provide 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.

## Member Function Documentation

void cMaterial::render | ( |  | ) | `[virtual]`

Render the material in OpenGL.

Render this material in OpenGL.

void cMaterial::setDynamicFriction | ( | double | a_friction | ) |

Set dynamic friction level.

Set the level of dynamic friction. Clamped to be a non-negative value.

Parameters:

  | a_friction | Level of friction.

void cMaterial::setMagnetMaxDistance | ( | double | a_magnetMaxDistance | ) |

Set the maximum distance from the object where the force can be perceived [m].

Set the maximum distance from the object where the force can be perceived [m]

Parameters:

  | a_magnetMaxDistance | Maximum distance from object where magnet is active.

void cMaterial::setMagnetMaxForce | ( | double | a_magnetMaxForce | ) |

Set the maximum force applied by the magnet [N].

Set the maximum force applied by the magnet [N].

Parameters:

  | a_magnetMaxForce | Maximum force of magnet.

void cMaterial::setShininess | ( | GLuint | a_shininess | ) |

Set shininess (the exponent used for specular lighting).

Set the level of shininess. Value are clamped to range from 0 --> 128.

Parameters:

  | a_shininess | Level of shininess

void cMaterial::setStaticFriction | ( | double | a_friction | ) |

Set static friction level.

Set the level of static friction. Clamped to be a non-negative value.

Parameters:

  | a_friction | Level of friction.

void cMaterial::setStickSlipForceMax | ( | double | a_stickSlipForceMax | ) |

Set the maximum force threshold for the stick and slip model [N].

Set the maximum force threshold for the stick and slip model [N].

Parameters:

  | a_stickSlipForceMax | Maximum force threshold.

void cMaterial::setStickSlipStiffness | ( | double | a_stickSlipStiffness | ) |

Set the stiffness for the stick and slip model [N/m].

Set the stiffness for the stick and slip model [N/m]

Parameters:

  | a_stickSlipStiffness | Stiffness property.

void cMaterial::setStiffness | ( | double | a_stiffness | ) |

Set stiffness level [N/m].

Set the level of stiffness. Clamped to be a non-negative value.

Parameters:

  | a_stiffness | Level of stiffness.

void cMaterial::setTransparencyLevel | ( | float | a_levelTransparency | ) |

set transparency level (sets the alpha value for all color properties).

Set the transparency level (by setting the alpha value for all color properties).

Parameters:

  | a_levelTransparency | Level of transparency.

void cMaterial::setVibrationAmplitude | ( | double | a_vibrationAmplitude | ) |

Set vibration amplitude [max N].

Set the amplitude of vibration. Clamped to be a non-negative value.

Parameters:

  | a_vibrationAmplitude | Amplitude of vibration [N].

void cMaterial::setVibrationFrequency | ( | double | a_vibrationFrequency | ) |

Set vibration frequency [Hz].

Set the frequency of vibration. Clamped to be a non-negative value.

Parameters:

  | a_vibrationFrequency | Frequency of vibration [Hz].

void cMaterial::setViscosity | ( | double | a_viscosity | ) |

Set level of viscosity.

Set the level of viscosity. Clamped to be a non-negative value.

Parameters:

  | a_viscosity | Level of viscosity.

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

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/graphics/CMaterial.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/graphics/CMaterial.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.