Changeset 3193 in orxonox.OLD for orxonox/trunk/src/object.cc
- Timestamp:
- Dec 16, 2004, 4:00:43 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/object.cc
r3185 r3193 20 20 21 21 /** 22 \brief Creates a 3D-Object, but does not load any 3D-models 23 pretty useless 22 \brief Creates a 3D-Object, but does not load any 3D-models. 23 24 This Constructor is pretty useless, because why load no object in an object-loader?? 24 25 */ 25 26 Object::Object () … … 36 37 37 38 /** 38 \brief Crates a 3D-Object and loads in a File 39 \brief Crates a 3D-Object and loads in a File. 39 40 \param fileName file to parse and load (must be a .obj file) 40 41 */ … … 68 69 69 70 /** 70 \brief deletes an Object 71 \brief deletes an Object. 72 73 Looks if any from object allocated space is still in use, and if so deleted it. 71 74 */ 72 75 Object::~Object() … … 117 120 /** 118 121 \brief Draws the Object number groupNumber 122 \param groupNumber The number of the group that will be displayed. 123 119 124 It does this by just calling the List that must have been created earlier. 120 \param groupNumber The number of the group that will be displayed.121 125 */ 122 126 void Object::draw (int groupNumber) const … … 152 156 /** 153 157 \brief Draws the Object with a specific groupName 158 \param groupName The name of the group that will be displayed. 159 154 160 It does this by just calling the List that must have been created earlier. 155 \param groupName The name of the group that will be displayed.156 161 */ 157 162 void Object::draw (char* groupName) const … … 185 190 186 191 /** 187 \brief initializes the Object 188 This Function initializes all the needed arrays, Lists and clientStates 192 \brief initializes the Object. 193 194 This Function initializes all the needed arrays, Lists and clientStates. 195 It also defines default values. 189 196 */ 190 197 bool Object::initialize (void) … … 214 221 /** 215 222 \brief initializes a new Group object 223 \param group the group that should be initialized. 224 \todo Maybe Group should be a Class, because it does a lot of stuff 225 216 226 */ 217 227 bool Object::initGroup(Group* group) … … 231 241 /** 232 242 \brief initializes a new Face. (sets default Values) 243 \param face The face to initialize 233 244 */ 234 245 bool Object::initFace (Face* face) … … 285 296 286 297 /** 287 \brief Cleans up all Faces starting from face .288 \param face the first face to clean 298 \brief Cleans up all Faces starting from face until NULL is reached. 299 \param face the first face to clean. 289 300 */ 290 301 bool Object::cleanupFace (Face* face) … … 386 397 BoxObject(); 387 398 delete []fileName; 399 OBJ_FILE->close(); 388 400 return false; 389 401 } … … 450 462 /** 451 463 \brief parses a group String 464 \param groupString the new Group to create 465 452 466 This function initializes a new Group. 453 467 With it you should be able to import .obj-files with more than one Objects inside. 454 \param groupString the new Group to create455 468 */ 456 469 bool Object::readGroup (char* groupString) … … 476 489 /** 477 490 \brief parses a vertex-String 491 \param vertexString The String that will be parsed. 492 478 493 If a vertex line is found this function will inject it into the vertex-Array 479 \param vertexString The String that will be parsed.480 494 */ 481 495 bool Object::readVertex (char* vertexString) … … 493 507 /** 494 508 \brief parses a face-string 509 \param faceString The String that will be parsed. 510 495 511 If a face line is found this function will add it to the glList. 496 512 The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe. 497 \param faceString The String that will be parsed.498 513 */ 499 514 bool Object::readFace (char* faceString) … … 556 571 /** 557 572 \brief parses a vertexNormal-String 573 \param normalString The String that will be parsed. 574 558 575 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 559 \param normalString The String that will be parsed.560 576 */ 561 577 bool Object::readVertexNormal (char* normalString) … … 573 589 /** 574 590 \brief parses a vertexTextureCoordinate-String 575 If a vertexTextureCoordinate line is found this function will inject it into the vertexTexture-Array576 591 \param vTextureString The String that will be parsed. 592 593 If a vertexTextureCoordinate line is found, 594 this function will inject it into the vertexTexture-Array 577 595 */ 578 596 bool Object::readVertexTexture (char* vTextureString) … … 590 608 /** 591 609 \brief Function to read in a mtl File. 592 this Function parses all Lines of an mtl File593 610 \param mtlFile The .mtl file to read 611 612 This Function parses all Lines of an mtl File. 613 The reason for it not to be in the materials-class is, 614 that a material does not have to be able to read itself in from a File. 615 594 616 */ 595 617 bool Object::readMtlLib (char* mtlFile) … … 611 633 printf ("unable to open file: %s\n", fileName); 612 634 delete []fileName; 635 MTL_FILE->close(); 613 636 return false; 614 637 } … … 809 832 /** 810 833 \brief Adds a Face-element (one vertex of a face) with all its information. 834 \param elem The FaceElement to add to the OpenGL-environment. 835 811 836 It does this by searching: 812 837 1. The Vertex itself … … 814 839 3. The VertexTextureCoordinate 815 840 merging this information, the face will be drawn. 816 817 841 */ 818 842 bool Object::addGLElement (FaceElement* elem) … … 832 856 /** 833 857 \brief A routine that is able to create normals. 858 834 859 The algorithm does the following: 835 860 1. It calculates creates Vectors for each normale, and sets them to zero. … … 912 937 /** 913 938 \brief Includes a default object 939 914 940 This will inject a Cube, because this is the most basic object. 915 941 */ 916 942 void Object::BoxObject(void) 917 943 { 918 readVertex ("-0.5 00000 -0.500000 0.500000");919 readVertex ("0.5 00000 -0.500000 0.500000");920 readVertex ("-0.5 00000 0.500000 0.500000");921 readVertex ("0.5 00000 0.500000 0.500000");922 readVertex ("-0.5 00000 0.500000 -0.500000");923 readVertex ("0.5 00000 0.500000 -0.500000");924 readVertex ("-0.5 00000 -0.500000 -0.500000");925 readVertex ("0.5 00000 -0.500000 -0.500000");926 927 readVertexTexture ("0.0 00000 0.000000");928 readVertexTexture ("1.0 00000 0.000000");929 readVertexTexture ("0.0 00000 1.000000");930 readVertexTexture ("1.0 00000 1.000000");931 readVertexTexture ("0.0 00000 2.000000");932 readVertexTexture ("1.0 00000 2.000000");933 readVertexTexture ("0.0 00000 3.000000");934 readVertexTexture ("1.0 00000 3.000000");935 readVertexTexture ("0.0 00000 4.000000");936 readVertexTexture ("1.0 00000 4.000000");937 readVertexTexture ("2.0 00000 0.000000");938 readVertexTexture ("2.0 00000 1.000000");939 readVertexTexture ("-1.0 00000 0.000000");940 readVertexTexture ("-1.0 00000 1.000000");941 942 readVertexNormal ("0.0 00000 0.000000 1.000000");943 readVertexNormal ("0.0 00000 0.000000 1.000000");944 readVertexNormal ("0.0 00000 0.000000 1.000000");945 readVertexNormal ("0.0 00000 0.000000 1.000000");946 readVertexNormal ("0.0 00000 1.000000 0.000000");947 readVertexNormal ("0.0 00000 1.000000 0.000000");948 readVertexNormal ("0.0 00000 1.000000 0.000000");949 readVertexNormal ("0.0 00000 1.000000 0.000000");950 readVertexNormal ("0.0 00000 0.000000 -1.000000");951 readVertexNormal ("0.0 00000 0.000000 -1.000000");952 readVertexNormal ("0.0 00000 0.000000 -1.000000");953 readVertexNormal ("0.0 00000 0.000000 -1.000000");954 readVertexNormal ("0.0 00000 -1.000000 0.000000");955 readVertexNormal ("0.0 00000 -1.000000 0.000000");956 readVertexNormal ("0.0 00000 -1.000000 0.000000");957 readVertexNormal ("0.0 00000 -1.000000 0.000000");958 readVertexNormal ("1.0 00000 0.000000 0.000000");959 readVertexNormal ("1.0 00000 0.000000 0.000000");960 readVertexNormal ("1.0 00000 0.000000 0.000000");961 readVertexNormal ("1.0 00000 0.000000 0.000000");962 readVertexNormal ("-1.0 00000 0.000000 0.000000");963 readVertexNormal ("-1.0 00000 0.000000 0.000000");964 readVertexNormal ("-1.0 00000 0.000000 0.000000");965 readVertexNormal ("-1.0 00000 0.000000 0.000000");944 readVertex ("-0.5 -0.5 0.5"); 945 readVertex ("0.5 -0.5 0.5"); 946 readVertex ("-0.5 0.5 0.5"); 947 readVertex ("0.5 0.5 0.5"); 948 readVertex ("-0.5 0.5 -0.5"); 949 readVertex ("0.5 0.5 -0.5"); 950 readVertex ("-0.5 -0.5 -0.5"); 951 readVertex ("0.5 -0.5 -0.5"); 952 953 readVertexTexture ("0.0 0.0"); 954 readVertexTexture ("1.0 0.0"); 955 readVertexTexture ("0.0 1.0"); 956 readVertexTexture ("1.0 1.0"); 957 readVertexTexture ("0.0 2.0"); 958 readVertexTexture ("1.0 2.0"); 959 readVertexTexture ("0.0 3.0"); 960 readVertexTexture ("1.0 3.0"); 961 readVertexTexture ("0.0 4.0"); 962 readVertexTexture ("1.0 4.0"); 963 readVertexTexture ("2.0 0.0"); 964 readVertexTexture ("2.0 1.0"); 965 readVertexTexture ("-1.0 0.0"); 966 readVertexTexture ("-1.0 1.0"); 967 968 readVertexNormal ("0.0 0.0 1.0"); 969 readVertexNormal ("0.0 0.0 1.0"); 970 readVertexNormal ("0.0 0.0 1.0"); 971 readVertexNormal ("0.0 0.0 1.0"); 972 readVertexNormal ("0.0 1.0 0.0"); 973 readVertexNormal ("0.0 1.0 0.0"); 974 readVertexNormal ("0.0 1.0 0.0"); 975 readVertexNormal ("0.0 1.0 0.0"); 976 readVertexNormal ("0.0 0.0 -1.0"); 977 readVertexNormal ("0.0 0.0 -1.0"); 978 readVertexNormal ("0.0 0.0 -1.0"); 979 readVertexNormal ("0.0 0.0 -1.0"); 980 readVertexNormal ("0.0 -1.0 0.0"); 981 readVertexNormal ("0.0 -1.0 0.0"); 982 readVertexNormal ("0.0 -1.0 0.0"); 983 readVertexNormal ("0.0 -1.0 0.0"); 984 readVertexNormal ("1.0 0.0 0.0"); 985 readVertexNormal ("1.0 0.0 0.0"); 986 readVertexNormal ("1.0 0.0 0.0"); 987 readVertexNormal ("1.0 0.0 0.0"); 988 readVertexNormal ("-1.0 0.0 0.0"); 989 readVertexNormal ("-1.0 0.0 0.0"); 990 readVertexNormal ("-1.0 0.0 0.0"); 991 readVertexNormal ("-1.0 0.0 0.0"); 966 992 967 993 /* normaleLess-testingMode
Note: See TracChangeset
for help on using the changeset viewer.