Changeset 4678 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jun 23, 2005, 11:32:19 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/model.h
r4677 r4678 111 111 inline const GLfloat* getVertexArray(void) const { return this->vertices->getArray(); }; 112 112 /** \returns the VertexCount of this Model */ 113 inline unsigned int getVertex ArrayCount(void) const { return this->vertexCount; };113 inline unsigned int getVertexCount(void) const { return this->vertexCount; }; 114 114 115 115 /** \returns a Pointer to the Normals-Array, if it was deleted it returns NULL */ 116 116 inline const GLfloat* getNormalsArray(void) const { return this->normals->getArray(); }; 117 117 /** \returns the NormalsCount of this Model */ 118 inline unsigned int getNormals ArrayCount(void) const { return this->normalCount; };118 inline unsigned int getNormalsCount(void) const { return this->normalCount; }; 119 119 120 120 /** \returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */ 121 121 inline const GLfloat* getTexCoordArray(void) const { return this->vTexture->getArray(); }; 122 122 /** \returns the TexCoord-Count of this Model */ 123 inline unsigned int getTexCoordArrayCount(void) const { return this->texCoordCount; }; 123 inline unsigned int getTexCoordCount(void) const { return this->texCoordCount; }; 124 125 /** \returns the Count of Faces of this Model */ 126 inline unsigned int getFaceCount() const { return this->faceCount; }; 124 127 125 128 … … 140 143 void finalize(void); 141 144 142 /** \returns The number of Vertices of the Model */143 inline int getVertexCount(void) const { return this->vertexCount; };144 /** \returns The number of Normals of the Model */145 inline int getNormalCount(void) const { return this->normalCount; };146 /** \returns The number of Texture Coordinates of the Model */147 inline int getTexCoordCount(void) const { return this->texCoordCount; };148 /** \returns The number of Faces of the entire Model */149 inline unsigned int getFaceCount() const { return this->faceCount; };150 145 151 146 protected: -
orxonox/trunk/src/lib/graphics/importer/primitive_model.cc
r4468 r4678 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 28 28 29 29 if you want to just display a Cube/Sphere/Cylinder/... without any material. 30 30 31 31 \todo implement Cube/Sphere/Cylinder/... 32 32 */ … … 59 59 60 60 */ 61 PrimitiveModel::~PrimitiveModel () 61 PrimitiveModel::~PrimitiveModel () 62 62 { 63 63 // delete what has to be deleted here … … 71 71 void PrimitiveModel::sphereModel(float size, unsigned int detail) 72 72 { 73 if (detail <= 0) 73 if (detail <= 0) 74 74 detail = 1; 75 75 size /= 2; 76 76 // detail = 2; // make it even 77 77 float df = (float)detail; 78 78 79 79 // defining the Vertices 80 80 for (float i = 0; i < df *2.0; i+=1.0) … … 82 82 float vi = i/df *PI; 83 83 for (float j = -df / 2.0 +1.0; j < df / 2.0; j+=1.0 *df/(df+1.0)) 84 85 86 87 88 89 90 84 { 85 float vj = j/df *PI; 86 this->addVertex(size * cos(vi) * cos(vj), 87 size * sin(vj), 88 size * sin(vi) * cos(vj)); 89 this->addVertexTexture(i / (df *2.0), (j-1.0)/(df)+.5); 90 } 91 91 } 92 92 this->addVertex(0, -size, 0); … … 100 100 { 101 101 for (int j = 0; j <= detail; j++) 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 v1 = this->getVertexCount()-2;121 122 123 124 125 126 127 128 129 130 102 { 103 104 v1 = i*detail + j-1; 105 v4 = i*detail + j; 106 107 if (i == detail*2 -1) 108 { 109 v2 = j-1; 110 v3 = j; 111 } 112 else 113 { 114 v2 = (i+1)*detail + j-1; 115 v3 = (i+1)*detail + j; 116 } 117 118 if (j == 0) 119 { 120 v1 = this->getVertexCount() - 2; 121 this->addFace(3, VERTEX_TEXCOORD, v1, v1, v3, v3, v4, v4); 122 } 123 else if (j == detail) 124 { 125 v3 = this->getVertexCount()-1; 126 this->addFace(3, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3); 127 } 128 else 129 this->addFace(4, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4); 130 } 131 131 } 132 132 } … … 181 181 this->addVertex(0,-size,0); 182 182 this->addVertex(0,size,0); 183 if (detail <= 0) 183 if (detail <= 0) 184 184 detail = 1; 185 185 float df = (float)detail; 186 186 187 187 // defining the Vertices 188 188 for (float i = 0; i < df; i+=1.0) … … 190 190 float vi = i/df *2.0*PI; 191 191 this->addVertex(size* sin(vi), 192 193 192 -size, 193 size* cos(vi)); 194 194 } 195 195 … … 200 200 v1 = i+2; 201 201 if (i == detail -1) 202 202 v2 = 2; 203 203 else 204 204 v2 = i+3; 205 205 this->addFace(3, VERTEX_ONLY, 0, v1, v2); 206 this->addFace(3, VERTEX_ONLY, 1, v1, v2); 206 this->addFace(3, VERTEX_ONLY, 1, v1, v2); 207 207 } 208 208 } … … 219 219 for (int j = 0; j < detail; j++) 220 220 { 221 222 223 224 225 221 this->addVertex(((float)i/(float)(detail-1) -.5)*size, 222 0, 223 ((float)j/(float)(detail-1) -.5)*size); 224 this->addVertexTexture((float)i/(float)(detail-1), 225 (float)j/(float)(detail-1)); 226 226 } 227 227 //defining Faces … … 230 230 for (int j = 0; j < detail-1; j++) 231 231 { 232 233 234 235 236 232 v1 = i*detail + j; 233 v2 = (i+1)*detail + j; 234 v3 = (i+1)*detail + (j+1); 235 v4 = i*detail + (j+1); 236 this->addFace(4, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3, v4, v4); 237 237 } 238 238 } -
orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
r4675 r4678 58 58 59 59 mod = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 60 CDEngine::getInstance()->debugSpawnTree(9, (sVec3D*)mod->getVertexArray(), mod->getVertex ArrayCount());60 CDEngine::getInstance()->debugSpawnTree(9, (sVec3D*)mod->getVertexArray(), mod->getVertexCount()); 61 61 62 62 /* ligths */
Note: See TracChangeset
for help on using the changeset viewer.