00001 //=========================================================================== 00002 /* 00003 This file is part of the CHAI 3D visualization and haptics libraries. 00004 Copyright (C) 2003-2009 by CHAI 3D. All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License("GPL") version 2 00008 as published by the Free Software Foundation. 00009 00010 For using the CHAI 3D libraries with software that can not be combined 00011 with the GNU GPL, and for taking advantage of the additional benefits 00012 of our support services, please contact CHAI 3D about acquiring a 00013 Professional Edition License. 00014 00015 \author <http://www.chai3d.org> 00016 \author Francois Conti 00017 \version 2.0.0 $Rev: 251 $ 00018 */ 00019 //=========================================================================== 00020 00021 //--------------------------------------------------------------------------- 00022 #ifndef CMaterialH 00023 #define CMaterialH 00024 //--------------------------------------------------------------------------- 00025 #include "graphics/CColor.h" 00026 //--------------------------------------------------------------------------- 00027 00028 //=========================================================================== 00036 //=========================================================================== 00037 00038 //=========================================================================== 00054 //=========================================================================== 00055 struct cMaterial 00056 { 00057 public: 00058 00059 //----------------------------------------------------------------------- 00060 // CONSTRUCTOR & DESTRUCTOR: 00061 //----------------------------------------------------------------------- 00062 00064 cMaterial(); 00065 00067 ~cMaterial() {}; 00068 00070 virtual void render(); 00071 00072 00073 //----------------------------------------------------------------------- 00074 // METHODS - GRAPHIC PROPERTIES: 00075 //----------------------------------------------------------------------- 00076 00078 void setShininess(GLuint a_shininess); 00079 00081 GLuint getShininess() { return (m_shininess); } 00082 00084 void setTransparencyLevel(float a_levelTransparency); 00085 00087 inline bool isTransparent() const 00088 { 00089 return (m_ambient[4] < 1.0 || 00090 m_diffuse[4] < 1.0 || 00091 m_specular[4] < 1.0 || 00092 m_emission[4]); 00093 } 00094 00095 00096 //----------------------------------------------------------------------- 00097 // MEMBERS - GRAPHIC PROPERTIES: 00098 //----------------------------------------------------------------------- 00099 00101 cColorf m_ambient; 00102 00104 cColorf m_diffuse; 00105 00107 cColorf m_specular; 00108 00110 cColorf m_emission; 00111 00112 00113 //----------------------------------------------------------------------- 00114 // METHODS - HAPTIC PROPERTIES: 00115 //----------------------------------------------------------------------- 00116 00118 void setStiffness(double a_stiffness); 00119 00121 inline double getStiffness() const { return (m_stiffness); } 00122 00124 void setStaticFriction(double a_friction); 00125 00127 inline double getStaticFriction() const { return (m_static_friction); } 00128 00130 void setDynamicFriction(double a_friction); 00131 00133 inline double getDynamicFriction() const { return (m_dynamic_friction); } 00134 00136 void setViscosity(double a_viscosity); 00137 00139 inline double getViscosity() { return (m_viscosity); } 00140 00142 void setVibrationFrequency(double a_vibrationFrequency); 00143 00145 inline double getVibrationFrequency() {return (m_vibrationFrequency); } 00146 00148 void setVibrationAmplitude(double a_vibrationAmplitude); 00149 00151 inline double getVibrationAmplitude() {return (m_vibrationAmplitude); } 00152 00154 void setMagnetMaxForce(double a_magnetMaxForce); 00155 00157 inline double getMagnetMaxForce() { return (m_magnetMaxForce); } 00158 00160 void setMagnetMaxDistance(double a_magnetMaxDistance); 00161 00163 inline double getMagnetMaxDistance() { return (m_magnetMaxDistance); } 00164 00166 void setStickSlipForceMax(double a_stickSlipForceMax); 00167 00169 inline double getStickSlipForceMax() { return (m_stickSlipForceMax); } 00170 00172 void setStickSlipStiffness(double a_stickSlipStiffness); 00173 00175 inline double getStickSlipStiffness() { return (m_stickSlipStiffness); } 00176 00177 00178 protected: 00179 00180 //----------------------------------------------------------------------- 00181 // MEMBERS - GRAPHICS PROPERTIES: 00182 //----------------------------------------------------------------------- 00183 00185 GLuint m_shininess; 00186 00187 00188 //----------------------------------------------------------------------- 00189 // MEMBERS - HAPTIC PROPERTIES: 00190 //----------------------------------------------------------------------- 00191 00193 double m_viscosity; 00194 00196 double m_stiffness; 00197 00199 double m_static_friction; 00200 00202 double m_dynamic_friction; 00203 00205 double m_vibrationFrequency; 00206 00208 double m_vibrationAmplitude; 00209 00211 double m_magnetMaxForce; 00212 00214 double m_magnetMaxDistance; 00215 00217 double m_stickSlipForceMax; 00218 00220 double m_stickSlipStiffness; 00221 }; 00222 00223 //--------------------------------------------------------------------------- 00224 #endif 00225 //--------------------------------------------------------------------------- 00226