Changeset 2842 in orxonox.OLD for orxonox/trunk/importer
- Timestamp:
- Nov 12, 2004, 6:51:15 PM (20 years ago)
- Location:
- orxonox/trunk/importer
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/importer/array.cc
r2823 r2842 16 16 #include "array.h" 17 17 18 /** 19 \brief creates a new Array 20 */ 18 21 Array::Array () 19 22 { 20 createArray ();23 initializeArray (); 21 24 } 22 25 23 void Array::createArray () 26 /** 27 \brief initializes an Array 28 the Function does this by setting up a fistEntry, and setting the entryCount. 29 */ 30 void Array::initializeArray () 24 31 { 25 32 if (verbose >= 2) … … 33 40 } 34 41 42 /** 43 \brief finalizes an array. 44 This Function creates the array, and makes it ready to be sent to the application. 45 */ 35 46 void Array::finalizeArray (void) 36 47 { … … 49 60 } 50 61 51 62 /** 63 \brief adds a new Entry to the Array 64 \param entry Entry to add. 65 */ 52 66 void Array::addEntry (GLfloat entry) 53 67 { … … 68 82 } 69 83 84 /** 85 \brief Adds 3 entries at once (convenience) 86 */ 70 87 void Array::addEntry (GLfloat entry0, GLfloat entry1, GLfloat entry2) 71 88 { … … 75 92 } 76 93 77 94 /** 95 \brief Gives back the array !! MUST be executed AFTER finalize. 96 \returns The created array. 97 */ 78 98 GLfloat* Array::getArray () 79 99 { … … 81 101 } 82 102 103 /** 104 \returns The Count of entries in the Array 105 */ 83 106 int Array::getCount() 84 107 { … … 86 109 } 87 110 88 89 111 /** 112 \brief Simple debug info about the Array 113 */ 90 114 void Array::debug () 91 115 { -
orxonox/trunk/importer/array.h
r2823 r2842 1 /*! 2 \file array.h 3 \brief Contains the Array Class that handles float arrays. 4 this class creates a Array of a semi-Dynamic length. 5 beware, that after finalizing the array may not be resized again. 6 */ 7 1 8 #ifndef _ARRAY_H 2 9 #define _ARRAY_H 3 10 4 extern int verbose; 11 extern int verbose; //!< will be obsolete soon 5 12 6 13 #include <GL/gl.h> 7 14 #include <GL/glu.h> 8 15 #include <fstream> 16 17 18 //! Array Class that handles dynamic-float arrays. 9 19 class Array 10 20 { … … 12 22 Array (); 13 23 14 void createArray ();24 void initializeArray (); 15 25 void finalizeArray (void); 16 26 void addEntry (GLfloat entry); -
orxonox/trunk/importer/material.cc
r2837 r2842 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 adds a new Material to the List. 42 this Function will append a new Material to the end of a Material List. 43 \param mtlName The name of the Material to be added. 44 */ 32 45 Material* Material::addMaterial(char* mtlName) 33 46 { … … 45 58 } 46 59 60 /** 61 \brief initializes a new Material with its default Values 62 */ 47 63 void Material::init(void) 48 64 { … … 60 76 } 61 77 62 78 /** 79 \brief Set the Name of the Material. (Important for searching) 80 \param mtlName the Name of the Material to be set. 81 */ 63 82 void Material::setName (char* mtlName) 64 83 { … … 69 88 70 89 } 90 /** 91 \returns The Name of The Material 92 */ 71 93 char* Material::getName (void) 72 94 { … … 74 96 } 75 97 76 98 /** 99 \brief Sets the Material Illumination Model. 100 \brief illu illumination Model in int form 101 */ 77 102 void Material::setIllum (int illum) 78 103 { … … 82 107 // printf ("setting illumModel to: %i\n", illumModel); 83 108 } 84 void Material::setIllum (char* illum) 109 /** 110 \brief Sets the Material Illumination Model. 111 \brief illu illumination Model in char* form 112 */void Material::setIllum (char* illum) 85 113 { 86 114 setIllum (atoi(illum)); 87 115 } 88 116 117 /** 118 \brief Sets the Material Diffuse Color. 119 \param r Red Color Channel. 120 \param g Green Color Channel. 121 \param b Blue Color Channel. 122 */ 89 123 void Material::setDiffuse (float r, float g, float b) 90 124 { … … 97 131 98 132 } 133 /** 134 \brief Sets the Material Diffuse Color. 135 \param rgb The red, green, blue channel in char format (with spaces between them) 136 */ 99 137 void Material::setDiffuse (char* rgb) 100 138 { … … 104 142 } 105 143 144 /** 145 \brief Sets the Material Ambient Color. 146 \param r Red Color Channel. 147 \param g Green Color Channel. 148 \param b Blue Color Channel. 149 */ 106 150 void Material::setAmbient (float r, float g, float b) 107 151 { … … 113 157 ambient[3] = 1.0; 114 158 } 159 /** 160 \brief Sets the Material Ambient Color. 161 \param rgb The red, green, blue channel in char format (with spaces between them) 162 */ 115 163 void Material::setAmbient (char* rgb) 116 164 { … … 120 168 } 121 169 170 /** 171 \brief Sets the Material Specular Color. 172 \param r Red Color Channel. 173 \param g Green Color Channel. 174 \param b Blue Color Channel. 175 */ 122 176 void Material::setSpecular (float r, float g, float b) 123 177 { … … 129 183 specular[3] = 1.0; 130 184 } 185 /** 186 \brief Sets the Material Specular Color. 187 \param rgb The red, green, blue channel in char format (with spaces between them) 188 */ 131 189 void Material::setSpecular (char* rgb) 132 190 { … … 136 194 } 137 195 196 /** 197 \brief Sets the Material Shininess. 198 \param shini stes the Shininess from float. 199 */ 138 200 void Material::setShininess (float shini) 139 201 { 140 202 shininess = shini; 141 203 } 204 /** 205 \brief Sets the Material Shininess. 206 \param shini stes the Shininess from char*. 207 */ 142 208 void Material::setShininess (char* shini) 143 209 { … … 145 211 } 146 212 213 /** 214 \brief Sets the Material Transparency. 215 \param trans stes the Transparency from int. 216 */ 147 217 void Material::setTransparency (float trans) 148 218 { … … 151 221 transparency = trans; 152 222 } 223 /** 224 \brief Sets the Material Transparency. 225 \param trans stes the Transparency from char*. 226 */ 153 227 void Material::setTransparency (char* trans) 154 228 { … … 158 232 } 159 233 160 234 /** 235 \brief Search for a Material called mtlName 236 \param mtlName the Name of the Material to search for 237 \returns Material named mtlName if it is found. NULL otherwise. 238 */ 161 239 Material* Material::search (char* mtlName) 162 240 { … … 179 257 } 180 258 259 /** 260 \brief sets the material with which the following Faces will be painted 261 */ 181 262 bool Material::select (void) 182 263 { -
orxonox/trunk/importer/material.h
r2836 r2842 1 /*! 2 \file material.h 3 \brief Contains the Material Class that handles Material for 3D-Objects. 4 */ 5 1 6 #ifndef _MATERIAL_H 2 7 #define _MATERIAL_H 3 8 4 extern int verbose; 9 extern int verbose; //!< will be obsolete soon. 5 10 6 11 #include <GL/gl.h> … … 9 14 #include <fstream> 10 15 16 //! Class to handle Materials. 11 17 class Material 12 18 { … … 39 45 bool select (void); 40 46 41 Material* nextMat; 47 Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. 42 48 43 49 private: -
orxonox/trunk/importer/object.cc
r2837 r2842 16 16 #include "object.h" 17 17 18 /** 19 \brief Creates a 3D-Object, but does not load any 3D-models 20 pretty useless 21 */ 18 22 Object::Object () 19 23 { 20 24 21 25 initialize(); 22 23 importFile (" reaphigh.obj");26 27 importFile (""); 24 28 25 29 finalize(); 26 30 } 27 31 32 /** 33 \brief Crates a 3D-Object and loads in a File 34 \param fileName file to parse and load (must be a .obj file) 35 */ 28 36 Object::Object(char* fileName) 29 37 { … … 34 42 finalize(); 35 43 } 44 45 /** 46 \brief Crates a 3D-Object, loads in a File and scales it. 47 \param fileName file to parse and load (must be a .obj file) 48 \param scaling The factor that the object will be scaled with. 49 */ 36 50 37 51 Object::Object(char* fileName, float scaling) … … 45 59 } 46 60 61 /** 62 \brief initializes the Object 63 This Function initializes all the needed arrays, Lists and clientStates 64 */ 47 65 bool Object::initialize (void) 48 66 { … … 70 88 } 71 89 90 /** 91 \brief Imports a obj file and handles the the relative location 92 \param fileName The file to import 93 */ 72 94 bool Object::importFile (char* fileName) 73 95 { … … 79 101 } 80 102 103 /** 104 \brief finalizes an Object. 105 This funcion is needed, to close the glList and all the other lists. 106 */ 81 107 bool Object::finalize(void) 82 108 { … … 89 115 } 90 116 117 /** 118 \brief Draws the Object 119 It does this by just calling the List that must have been created earlier. 120 */ 91 121 void Object::draw (void) 92 122 { … … 96 126 } 97 127 98 128 /** 129 \brief Reads in the .obj File and sets all the Values. 130 This function does read the file, parses it for the occurence of things like vertices, faces and so on, and executes the specific tasks 131 \param fileName the File that will be parsed (.obj-file) 132 */ 99 133 bool Object::readFromObjFile (char* fileName) 100 134 { … … 158 192 } 159 193 160 194 /** 195 \brief parses a vertex-String 196 If a vertex line is found this function will inject it into the vertex-Array 197 \param vertexString The String that will be parsed. 198 */ 161 199 bool Object::readVertex (char* vertexString) 162 200 { … … 172 210 } 173 211 212 /** 213 \brief parses a face-string 214 If a face line is found this function will add it to the glList. 215 The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe. 216 \param faceString The String that will be parsed. 217 */ 174 218 bool Object::readFace (char* faceString) 175 219 { … … 225 269 } 226 270 271 /** 272 \brief Adds a Face-element (one vertex of a face) with all its information. 273 It does this by searching: 274 1. The Vertex itself 275 2. The VertexNormale 276 3. The VertexTextureCoordinate 277 merging this information, the face will be drawn. 278 279 */ 227 280 bool Object::addGLElement (char* elementString) 228 281 { … … 249 302 } 250 303 304 /** 305 \brief parses a vertexNormal-String 306 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 307 \param normalString The String that will be parsed. 308 */ 251 309 bool Object::readVertexNormal (char* normalString) 252 310 { … … 262 320 } 263 321 322 /** 323 \brief parses a vertexTextureCoordinate-String 324 If a vertexTextureCoordinate line is found this function will inject it into the vertexTexture-Array 325 \param vTextureString The String that will be parsed. 326 */ 264 327 bool Object::readVertexTexture (char* vTextureString) 265 328 { … … 275 338 } 276 339 277 340 /** 341 \brief Function to read in a mtl File. 342 this Function parses all Lines of an mtl File 343 \param mtlFile The .mtl file to read 344 */ 278 345 bool Object::readMtlLib (char* mtlFile) 279 346 { … … 345 412 } 346 413 414 /** 415 \brief Function that selects a material, if changed in the obj file. 416 \param matString the Material that will be set. 417 */ 418 347 419 bool Object::readUseMtl (char* matString) 348 420 { … … 362 434 } 363 435 364 436 /** 437 \brief Includes a default object 438 This will inject a Cube, because this is the most basic object. 439 */ 365 440 void Object::BoxObject(void) 366 441 { -
orxonox/trunk/importer/object.h
r2833 r2842 1 1 /*! 2 \file object.h3 \brief Contains the Object Class that handles 3D-Objects2 \file object.h 3 \brief Contains the Object Class that handles 3D-Objects 4 4 */ 5 5 … … 15 15 16 16 using namespace std; 17 extern int verbose; 17 18 extern int verbose; //!< fill be removed and added again as a verbose-class 19 18 20 19 21 //! Class that handles 3D-Objects. it can also read them in and display them.
Note: See TracChangeset
for help on using the changeset viewer.