Changeset 2853 in orxonox.OLD for orxonox/trunk/src/material.cc
- Timestamp:
- Nov 14, 2004, 6:41:02 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/material.cc
r2835 r2853 16 16 #include "material.h" 17 17 18 /** 19 \brief creates a default Material with no Name 20 normally you call this to create a material List (for an obj-file) and then append with addMaterial() 21 */ 18 22 Material::Material() 19 23 { … … 23 27 } 24 28 29 /** 30 \brief creates a Material. 31 \param mtlName Name of the Material to be added to the Material List 32 */ 25 33 Material::Material (char* mtlName) 26 34 { … … 30 38 } 31 39 40 /** 41 \brief deletes a Material 42 */ 43 Material::~Material() 44 { 45 if (verbose >= 2) 46 printf ("delete Material %s\n", name); 47 if (nextMat != NULL) 48 delete nextMat; 49 } 50 51 /** 52 \brief adds a new Material to the List. 53 this Function will append a new Material to the end of a Material List. 54 \param mtlName The name of the Material to be added. 55 */ 32 56 Material* Material::addMaterial(char* mtlName) 33 57 { … … 45 69 } 46 70 71 /** 72 \brief initializes a new Material with its default Values 73 */ 47 74 void Material::init(void) 48 75 { … … 55 82 setAmbient(0,0,0); 56 83 setSpecular(0,0,0); 84 setShininess(2.0); 57 85 setTransparency(0.0); 58 } 59 60 86 87 } 88 89 /** 90 \brief Set the Name of the Material. (Important for searching) 91 \param mtlName the Name of the Material to be set. 92 */ 61 93 void Material::setName (char* mtlName) 62 94 { … … 67 99 68 100 } 101 /** 102 \returns The Name of The Material 103 */ 69 104 char* Material::getName (void) 70 105 { … … 72 107 } 73 108 74 109 /** 110 \brief Sets the Material Illumination Model. 111 \brief illu illumination Model in int form 112 */ 75 113 void Material::setIllum (int illum) 76 114 { … … 80 118 // printf ("setting illumModel to: %i\n", illumModel); 81 119 } 82 void Material::setIllum (char* illum) 120 /** 121 \brief Sets the Material Illumination Model. 122 \brief illu illumination Model in char* form 123 */void Material::setIllum (char* illum) 83 124 { 84 125 setIllum (atoi(illum)); 85 126 } 86 127 128 /** 129 \brief Sets the Material Diffuse Color. 130 \param r Red Color Channel. 131 \param g Green Color Channel. 132 \param b Blue Color Channel. 133 */ 87 134 void Material::setDiffuse (float r, float g, float b) 88 135 { … … 95 142 96 143 } 144 /** 145 \brief Sets the Material Diffuse Color. 146 \param rgb The red, green, blue channel in char format (with spaces between them) 147 */ 97 148 void Material::setDiffuse (char* rgb) 98 149 { … … 102 153 } 103 154 155 /** 156 \brief Sets the Material Ambient Color. 157 \param r Red Color Channel. 158 \param g Green Color Channel. 159 \param b Blue Color Channel. 160 */ 104 161 void Material::setAmbient (float r, float g, float b) 105 162 { … … 111 168 ambient[3] = 1.0; 112 169 } 170 /** 171 \brief Sets the Material Ambient Color. 172 \param rgb The red, green, blue channel in char format (with spaces between them) 173 */ 113 174 void Material::setAmbient (char* rgb) 114 175 { … … 118 179 } 119 180 181 /** 182 \brief Sets the Material Specular Color. 183 \param r Red Color Channel. 184 \param g Green Color Channel. 185 \param b Blue Color Channel. 186 */ 120 187 void Material::setSpecular (float r, float g, float b) 121 188 { … … 127 194 specular[3] = 1.0; 128 195 } 196 /** 197 \brief Sets the Material Specular Color. 198 \param rgb The red, green, blue channel in char format (with spaces between them) 199 */ 129 200 void Material::setSpecular (char* rgb) 130 201 { … … 134 205 } 135 206 136 207 /** 208 \brief Sets the Material Shininess. 209 \param shini stes the Shininess from float. 210 */ 211 void Material::setShininess (float shini) 212 { 213 shininess = shini; 214 } 215 /** 216 \brief Sets the Material Shininess. 217 \param shini stes the Shininess from char*. 218 */ 219 void Material::setShininess (char* shini) 220 { 221 setShininess (atof(shini)); 222 } 223 224 /** 225 \brief Sets the Material Transparency. 226 \param trans stes the Transparency from int. 227 */ 137 228 void Material::setTransparency (float trans) 138 229 { … … 141 232 transparency = trans; 142 233 } 234 /** 235 \brief Sets the Material Transparency. 236 \param trans stes the Transparency from char*. 237 */ 143 238 void Material::setTransparency (char* trans) 144 239 { … … 148 243 } 149 244 150 245 /** 246 \brief Search for a Material called mtlName 247 \param mtlName the Name of the Material to search for 248 \returns Material named mtlName if it is found. NULL otherwise. 249 */ 151 250 Material* Material::search (char* mtlName) 152 251 { … … 169 268 } 170 269 270 /** 271 \brief sets the material with which the following Faces will be painted 272 */ 171 273 bool Material::select (void) 172 274 { … … 180 282 // setting up Sprecular 181 283 glMaterialfv(GL_FRONT, GL_SPECULAR, specular); 284 285 // setting up Shininess 286 glMaterialf(GL_FRONT, GL_SHININESS, shininess); 182 287 183 288 // setting illumination Model
Note: See TracChangeset
for help on using the changeset viewer.