Changeset 7511 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
- Timestamp:
- May 3, 2006, 2:51:12 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r7510 r7511 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: bottac@ee.ethz.ch … … 51 51 // Draw Debug Terrain 52 52 /* 53 this->bspFile->Materials[0]->select(); 53 this->bspFile->Materials[0]->select(); 54 54 for(int i = 0; i < this->bspFile->numPatches ; i++) 55 56 57 58 55 { 56 this->bspFile->VertexArrayModels[i]->draw(); 57 58 } 59 59 */ 60 60 … … 103 103 if (f >=0 && !this->isAlreadyVisible(f)) { 104 104 this->alreadyVisible[f] = true; 105 /* 106 107 108 109 110 }105 /* if(ActLeaf->leafIndex == i)public final double readLEDouble() 106 { 107 this->alreadyVisible[i] = false; 108 this->draw_debug_face(f); 109 this->alreadyVisible[i] = true; 110 } 111 111 else */ 112 112 addFace(f); // "visibleFaces.append(f)" … … 131 131 leaf& curLeaf = (this->bspFile->leaves)[i] ; 132 132 cluster = curLeaf.cluster; 133 133 134 134 if(cluster <0) continue; 135 135 v = ((viscluster * ( ((int *)this->bspFile->visData)[1]) ) + (cluster / 8)); 136 136 visSet =((unsigned char*) (this->bspFile->visData))[v+8]; 137 138 137 138 139 139 if( ((visSet) & ((unsigned char)1 <<(unsigned char) (cluster & 7))) == 0 ) 140 140 { … … 194 194 // this->lastTex = curFace.texture; 195 195 //} 196 197 if(curFace.lm_index < 0) 196 197 if(curFace.lm_index < 0) 198 198 { 199 199 glActiveTextureARB(GL_TEXTURE1_ARB); 200 glBindTexture(GL_TEXTURE_2D, this->bspFile-> glLightMapTextures[this->bspFile->whiteLightMap]);200 glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap ); 201 201 glEnable(GL_TEXTURE_2D); 202 202 } … … 207 207 glEnable(GL_TEXTURE_2D); 208 208 } 209 209 210 210 glColor4f(3.0,3.0,3.0,0.9); 211 glEnableClientState(GL_VERTEX_ARRAY ); 211 glEnableClientState(GL_VERTEX_ARRAY ); 212 212 //glEnableClientState(GL_TEXTURE_COORD_ARRAY ); 213 213 glEnableClientState(GL_NORMAL_ARRAY ); 214 214 // glEnableClientState(GL_COLOR_ARRAY); 215 215 216 216 217 217 glVertexPointer(3, GL_FLOAT, stride, &(curVertex[offset].position[0])); 218 218 219 219 glClientActiveTextureARB(GL_TEXTURE0_ARB); 220 220 glTexCoordPointer(2, GL_FLOAT, stride, &(curVertex[offset].texcoord[0])); 221 221 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 222 222 223 223 glClientActiveTextureARB(GL_TEXTURE1_ARB); 224 224 glTexCoordPointer(2, GL_FLOAT, stride, &(curVertex[offset].texcoord[1])); 225 225 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 226 226 227 227 228 228 glNormalPointer( GL_FLOAT, stride, &(curVertex[offset].normal[0])); 229 229 // glColorPointer(4, GL_BYTE, stride, &(curVertex[offset].color[0])); … … 287 287 void BspManager::draw_patch(face* Face) 288 288 { 289 if(this->lastTex != Face->texture) {289 //if(this->lastTex != Face->texture) { 290 290 this->bspFile->Materials[Face->texture].mat->select(); 291 this->lastTex = Face->texture;292 }293 294 295 296 if(Face->lm_index < 0) 291 //this->lastTex = Face->texture; 292 //} 293 294 295 296 if(Face->lm_index < 0) 297 297 { 298 298 glActiveTextureARB(GL_TEXTURE1_ARB); 299 glBindTexture(GL_TEXTURE_2D, this->bspFile-> glLightMapTextures[this->bspFile->whiteLightMap]);299 glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap); 300 300 glEnable(GL_TEXTURE_2D); 301 301 } … … 307 307 } 308 308 glColor4f(3.0,3.0,3.0,0.9); 309 309 310 310 glEnable( GL_AUTO_NORMAL); 311 311 glEnableClientState(GL_VERTEX_ARRAY ); … … 314 314 glFrontFace(GL_CW); 315 315 //PRINTF(0)("BSP Manager: Face->size[0]: %i . \n", Face->size[0]); 316 317 316 317 318 318 glEnableClientState(GL_NORMAL_ARRAY ); 319 319 320 320 glVertexPointer(3, GL_FLOAT,44, &((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).position[0])); 321 322 321 322 323 323 glClientActiveTextureARB(GL_TEXTURE0_ARB); 324 324 glTexCoordPointer(2, GL_FLOAT, 44, &((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).texcoord[0][0])); 325 325 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 326 326 327 327 328 328 glClientActiveTextureARB(GL_TEXTURE1_ARB); 329 329 glTexCoordPointer(2, GL_FLOAT, 44, &((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).texcoord[1][0])); 330 330 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 331 331 332 332 333 333 glNormalPointer( GL_FLOAT, 44,&((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).normal[0]) ); 334 334 335 // We'll need multitexture suport for lightning 336 //glClientActiveTextureARB(GL_TEXTURE0_ARB); 337 //glTexCoordPointer(2, GL_FLOAT,0, &vertex[0].textureCoord); 338 //glClientActiveTextureARB(GL_TEXTURE1_ARB); 339 //glTexCoordPointer(2, GL_FLOAT, sizeof(BSPVertex), &vertex[0].lightmapCoord); 335 340 336 341 337 … … 344 340 & ( (((GLuint*) (this->bspFile->patchIndexes))[7*8*2*(Face->meshvert+i)+ row*2*8] )) ); 345 341 } 346 342 347 343 glFrontFace(GL_CCW); 348 344 } … … 352 348 glDisableClientState(GL_VERTEX_ARRAY ); 353 349 glDisableClientState(GL_TEXTURE_COORD_ARRAY ); 354 350 355 351 glBegin(GL_QUADS); 356 352 357 353 glEnd(); 358 354 } … … 406 402 407 403 /* 408 409 410 411 412 413 414 415 416 plane&testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];417 dist = testPlane.x * this->cam.x + testPlane.y * this->cam.y + testPlane.z * this->cam.z -testPlane.d ;418 419 420 421 422 423 424 425 426 404 for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ ) 405 { 406 brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes]; 407 if(curBrush.n_brushsides < 0) return; 408 for(int j = 0; j < curBrush.n_brushsides; j++) 409 { 410 float dist = -0.1; 411 brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides]; 412 plane& testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes]; 413 dist = testPlane.x * this->cam.x + testPlane.y * this->cam.y + testPlane.z * this->cam.z -testPlane.d ; 414 415 if(dist < -0.01f) dist = -1.0f *dist; 416 if(dist < 1.0f){ 417 this->drawDebugCube(&this->cam); 418 return; 419 } 420 } 421 422 } */ 427 423 428 424 }
Note: See TracChangeset
for help on using the changeset viewer.