Changeset 3398 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Feb 6, 2005, 11:02:45 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/importer/framework.cc
r3396 r3398 15 15 16 16 #include "framework.h" 17 17 int verbose; 18 18 void DrawGLScene() 19 19 { … … 53 53 { 54 54 verbose = 2; 55 56 PRINTF(2)("This is The big verbose-Test %i, %s\n", 1, "cool");57 55 58 56 Uint8* keys; // This variable will be used in the keyboard routine … … 75 73 obj = new OBJModel(argv[1]); 76 74 else 77 obj = (OBJModel*) new Model(); 78 75 { 76 // This is an example, of how it is possible, to create a new Model, and adding some vertex-information. 77 // This also packs everything into a DisplayList, and can be handled exactly as any other model. 78 // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created). 79 80 obj = (OBJModel*) new Model(); 81 obj->setName("CUBE"); 82 obj->addVertex ("-0.5 -0.5 0.5"); 83 obj->addVertex ("0.5 -0.5 0.5"); 84 obj->addVertex ("-0.5 0.5 0.5"); 85 obj->addVertex ("0.5 0.5 0.5"); 86 obj->addVertex ("-0.5 0.5 -0.5"); 87 obj->addVertex ("0.5 0.5 -0.5"); 88 obj->addVertex ("-0.5 -0.5 -0.5"); 89 obj->addVertex ("0.5 -0.5 -0.5"); 90 91 obj->addVertexTexture ("0.0 0.0"); 92 obj->addVertexTexture ("1.0 0.0"); 93 obj->addVertexTexture ("0.0 1.0"); 94 obj->addVertexTexture ("1.0 1.0"); 95 obj->addVertexTexture ("0.0 2.0"); 96 obj->addVertexTexture ("1.0 2.0"); 97 obj->addVertexTexture ("0.0 3.0"); 98 obj->addVertexTexture ("1.0 3.0"); 99 obj->addVertexTexture ("0.0 4.0"); 100 obj->addVertexTexture ("1.0 4.0"); 101 obj->addVertexTexture ("2.0 0.0"); 102 obj->addVertexTexture ("2.0 1.0"); 103 obj->addVertexTexture ("-1.0 0.0"); 104 obj->addVertexTexture ("-1.0 1.0"); 105 106 obj->addFace ("1 2 4 3"); 107 obj->addFace ("3 4 6 5"); 108 obj->addFace ("5 6 8 7"); 109 obj->addFace ("7 8 2 1"); 110 obj->addFace ("2 8 6 4"); 111 obj->addFace ("7 1 3 5"); 112 obj->finalize(); 113 } 79 114 M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); 80 115 rotAxis = Vector (0.0,1.0,0.0); -
orxonox/trunk/src/importer/model.cc
r3397 r3398 15 15 16 16 #include "model.h" 17 int verbose = 1; //! \todo should be GLOBAL 17 18 18 using namespace std; 19 19 20 20 /** 21 \brief Creates a 3D-Model, but does not load any 3D-models. 22 23 This Constructor is pretty useless, because why load no model in an model-loader?? 24 */ 25 Model::Model () 26 { 27 21 \brief Creates a 3D-Model. 22 23 This only initializes a 3D-Model, but does not cleanup the Faces. 24 */ 25 Model::Model(void) 26 { 28 27 this->initialize(); 29 30 this->BoxModel(); 28 } 29 30 /** 31 \brief Creates a 3D-Model of Primitive-Type type 32 33 if you want to just display a Cube/Sphere/Cylinder/... without any material. 34 35 \todo implement Cube/Sphere/Cylinder/... 36 */ 37 Model::Model(PRIMITIVE type) 38 { 39 this->initialize(); 40 41 if (type == CUBE) 42 this->BoxModel(); 31 43 32 44 this->importToGL (); … … 36 48 37 49 /** 50 \brief Creates a 3D-Model. and assigns it a Name. 51 */ 52 Model::Model(char* modelName) 53 { 54 this->initialize(); 55 this->setName(modelName); 56 } 57 58 /** 38 59 \brief deletes an Model. 39 60 40 61 Looks if any from model allocated space is still in use, and if so deleted it. 41 62 */ 42 Model::~Model( )63 Model::~Model(void) 43 64 { 44 65 PRINTF(3)("Deleting Model "); … … 64 85 if (this->material) 65 86 delete this->material; 87 } 88 89 /** 90 \brief Finalizes an Object. This can be done outside of the Class. 91 */ 92 void Model::finalize(void) 93 { 94 this->importToGL (); 95 96 this->cleanup(); 97 98 this->finalized = true; 66 99 } 67 100 … … 157 190 158 191 this->name = NULL; 192 this->finalized = false; 159 193 // setting the start group; 160 194 this->firstGroup = new Group; … … 173 207 } 174 208 209 void Model::setName(const char* name) 210 { 211 if (this->name) 212 delete this->name; 213 this->name = new char[strlen(name)+1]; 214 strcpy(this->name, name); 215 } 175 216 /** 176 217 \brief initializes a new Group model -
orxonox/trunk/src/importer/model.h
r3396 r3398 15 15 using namespace std; 16 16 17 17 enum PRIMITIVE {PLANE, CUBE, SPHERE, CYLINDER}; 18 18 19 19 //! Class that handles 3D-Models. it can also read them in and display them. … … 22 22 public: 23 23 Model(void); 24 Model(PRIMITIVE type); 25 Model(char* modelName); 24 26 virtual ~Model(void); 27 28 void setName(const char* name); 25 29 26 30 void draw(void) const; … … 30 34 31 35 protected: 32 char* name; //!< This is the name of the Model; 36 char* name; //!< This is the name of the Model. 37 bool finalized; //!< Sets the Object to be finalized. 38 33 39 //! This is the placeholder of one Vertex beloning to a Face. 34 40 struct FaceElement … … 94 100 bool cleanupFaceElement(FaceElement* faceElem); 95 101 102 public: 96 103 bool addGroup (char* groupString); 97 104 bool addVertex (char* vertexString); … … 100 107 bool addVertexTexture (char* vTextureString); 101 108 bool addUseMtl (char* mtlString); 109 void finalize(void); 102 110 111 protected: 103 112 bool importToGL (void); 104 113 bool addGLElement (FaceElement* elem); -
orxonox/trunk/src/importer/objModel.cc
r3397 r3398 109 109 PRINTF(0)("Resolved file %s.\n", name); 110 110 111 if (this->name) delete this->name; 112 this->name = new char[strlen(name)+1]; 113 strcpy(this->name, name); 111 this->setName(name); 114 112 if (this->material) 115 113 this->material->addTexturePath(this->objPath); -
orxonox/trunk/src/orxonox.cc
r3365 r3398 31 31 #include "game_loader.h" 32 32 #include <string.h> 33 int verbose; 33 34 34 35 using namespace std;
Note: See TracChangeset
for help on using the changeset viewer.