Changeset 8087 in orxonox.OLD for branches/bsp_model/src/lib/graphics
- Timestamp:
- Jun 1, 2006, 5:10:54 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer
- Files:
-
- 1 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/Makefile.am
r6532 r8087 16 16 height_map.cc \ 17 17 media_container.cc \ 18 movie_player.cc 18 movie_player.cc \ 19 \ 20 bsp_manager.cc \ 21 bsp_file.cc 22 23 19 24 20 25 libtc_a_SOURCES = tc.cc 21 26 22 27 23 noinst_HEADERS = model.h \ 24 tc.h \ 25 vertex_array_model.h \ 26 grid.h \ 27 static_model.h \ 28 objModel.h \ 29 primitive_model.h \ 30 md2Model.h \ 31 material.h \ 32 texture.h \ 33 texture_sequence.h \ 34 height_map.h \ 35 anorms.h \ 36 anormtab.h \ 37 media_container.h \ 38 movie_player.h 28 noinst_HEADERS = \ 29 model.h \ 30 tc.h \ 31 vertex_array_model.h \ 32 grid.h \ 33 static_model.h \ 34 objModel.h \ 35 primitive_model.h \ 36 md2Model.h \ 37 material.h \ 38 texture.h \ 39 texture_sequence.h \ 40 height_map.h \ 41 anorms.h \ 42 anormtab.h \ 43 media_container.h \ 44 movie_player.h\ 45 \ 46 bsp_manager.h \ 47 bsp_file.h -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8083 r8087 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 13 13 14 14 Inspired by: 15 15 Rendering Q3 Maps by Morgan McGuire http://graphics.cs.brown.edu/games/quake/quake3.html 16 16 Unofficial Quake 3 Map Specs by Kekoa Proudfoot http://graphics.stanford.edu/~kekoa/q3/ 17 17 18 18 Collision detection adapted from: 19 19 Quake 3 Collision Detection by Nathan Ostgard http://www.devmaster.net/articles/quake3collision/ … … 60 60 */ 61 61 CDEngine::getInstance()->setBSPModel(this); 62 63 64 65 62 } 66 63 … … 70 67 { 71 68 72 69 73 70 if( root != NULL) 74 71 this->loadParams(root); 75 72 76 73 CDEngine::getInstance()->setBSPModel(this); 77 74 } */ … … 117 114 this->out1.y += this->collPlane->y*5.0; 118 115 this->out1.z += this->collPlane->z*5.0; 119 116 120 117 this->out2.x += this->collPlane->x*10.0; 121 118 this->out2.y += this->collPlane->y*10.0; … … 124 121 this->drawDebugCube(&this->out1); 125 122 this->drawDebugCube(&this->out2); 126 */ 123 */ 127 124 // Draw Debug Terrain 128 125 /* 129 this->bspFile->Materials[0]->select(); 126 this->bspFile->Materials[0]->select(); 130 127 for(int i = 0; i < this->bspFile->numPatches ; i++) 131 132 133 134 128 { 129 this->bspFile->VertexArrayModels[i]->draw(); 130 131 } 135 132 */ 136 133 … … 283 280 glActiveTextureARB(GL_TEXTURE1_ARB); 284 281 glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap); 285 286 282 283 287 284 288 285 }//draw … … 540 537 // don't store plane 541 538 // this->collPlane = &curPlane; 542 539 543 540 } else { // line is leaving the brush 544 541 float fraction = (startDistance + EPSILON) / (startDistance - endDistance); // * … … 547 544 // don't store plane 548 545 //this->collPlane = & curPlane; 549 546 550 547 } 551 548 … … 562 559 if (startFraction < 0) 563 560 startFraction = 0; 564 this->outputFraction = startFraction; 561 this->outputFraction = startFraction; 565 562 } 566 563 } … … 609 606 // store plane 610 607 this->collPlane = &curPlane; 611 608 612 609 } else { // line is leaving the brush 613 610 float fraction = (startDistance + EPSILON) / (startDistance - endDistance); // * … … 616 613 // store plane 617 614 this->collPlane = & curPlane; 618 615 619 616 } 620 617 … … 631 628 if (startFraction < 0) 632 629 startFraction = 0; 633 this->outputFraction = startFraction; 630 this->outputFraction = startFraction; 634 631 } 635 632 } … … 831 828 { 832 829 return; 833 830 834 831 Vector position = worldEntity->getAbsCoor(); 835 832 … … 839 836 forwardDir.y =2.0*forwardDir.y; 840 837 forwardDir.z =2.0*forwardDir.z; 841 838 842 839 Vector upDir = worldEntity->getAbsDirY(); 843 840 Vector dest = position; … … 847 844 Vector out = Vector(-1875.0,-1875.0,-1875.0); 848 845 if(!worldEntity->isA(CL_PLAYABLE)) { 849 850 851 852 846 847 848 849 853 850 } 854 851 else { … … 882 879 883 880 } 884 881 885 882 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 886 883 if(this->outputFraction == 1.0f) out = dest; … … 891 888 out.y = position.y + (dest.y -position.y) * this->outputFraction; 892 889 out.z = position.z + (dest.z -position.z) * this->outputFraction; 893 890 894 891 //Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 895 892 //this->out = out; … … 898 895 //this->drawDebugCube(&out1); 899 896 //this->drawDebugCube(&out2); 900 897 901 898 //this->drawDebugCube(&out3); 902 903 } 904 899 900 } 901 905 902 // Return the normal here: Normal's stored in this->collPlane; 906 903 if(collision) worldEntity->collidesWithGround(out,out1,out2); 907 904 908 905 } 909 906 … … 947 944 948 945 /* 949 950 951 952 953 954 955 956 957 plane&testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];958 dist = testPlane.x * this->cam.x + testPlane.y * this->cam.y + testPlane.z * this->cam.z -testPlane.d ;959 960 961 962 963 964 965 966 967 946 for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ ) 947 { 948 brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes]; 949 if(curBrush.n_brushsides < 0) return; 950 for(int j = 0; j < curBrush.n_brushsides; j++) 951 { 952 float dist = -0.1; 953 brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides]; 954 plane& testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes]; 955 dist = testPlane.x * this->cam.x + testPlane.y * this->cam.y + testPlane.z * this->cam.z -testPlane.d ; 956 957 if(dist < -0.01f) dist = -1.0f *dist; 958 if(dist < 1.0f){ 959 this->drawDebugCube(&this->cam); 960 return; 961 } 962 } 963 964 } */ 968 965 969 966 }
Note: See TracChangeset
for help on using the changeset viewer.