Changeset 8087 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 1, 2006, 5:10:54 PM (18 years ago)
- Location:
- branches/bsp_model/src
- Files:
-
- 6 edited
- 10 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/defs/class_id.h
r8068 r8087 182 182 CL_BUILDING = 0x00000310, 183 183 CL_MAPPED_WATER = 0x00000311, 184 CL_BSP_ENTITY = 0x00000312, 184 185 185 186 // Playables … … 259 260 CL_OBB = 0x00720000, 260 261 CL_BOUNDING_SPHERE = 0x00740000, 262 261 263 262 264 … … 285 287 CL_HEIGHT_MAP = 0x0000090a, 286 288 CL_GRID = 0x0000090b, 287 289 CL_BSP_MODEL = 0x0000090c, //!FIXME 290 288 291 CL_MATERIAL = 0x00000810, 289 292 CL_SHADER = 0x00000811, -
branches/bsp_model/src/lib/collision_detection/cd_engine.cc
r7739 r8087 29 29 #include "quadtree_node.h" 30 30 31 31 #include "bsp_manager.h" 32 32 33 33 using namespace std; … … 95 95 * this checks the collisions with the ground 96 96 */ 97 void CDEngine::checkCollisionGround( )97 void CDEngine::checkCollisionGround(std::list<WorldEntity*>& list1) 98 98 { 99 99 if( likely( this->terrain != NULL)) 100 100 { 101 101 Quadtree* q = dynamic_cast<Terrain*>(this->terrain)->ssp->getQuadtree(); 102 103 102 // QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor()); 104 103 } 105 //sTriangleExt* tri = q->getTriangleFromPosition(this->player->getAbsCoor()); 104 105 if( likely( this->bspManager != NULL)) 106 { 107 std::list<WorldEntity*>::iterator iterator; 108 PRINTF(3)("checking for collisions\n"); 109 110 iterator = list1.begin(); 111 while (iterator != list1.end()) 112 { 113 bspManager->checkCollision(*iterator); 114 iterator++; 115 } 116 } 106 117 } 107 118 -
branches/bsp_model/src/lib/collision_detection/cd_engine.h
r7739 r8087 17 17 class OBBTree; 18 18 class Terrain; 19 class BspManager; 19 20 //class Player; 20 21 … … 50 51 51 52 inline void setTerrain(Terrain* terrain) { this->terrain = terrain; } 53 inline void setBSPModel(BspManager* bspManager) { this->bspManager = bspManager; } 52 54 53 55 void checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2); 56 void checkCollisionGround(std::list<WorldEntity*>& list1); 54 57 55 58 void drawBV(const std::list<WorldEntity*>& drawList, int level) const; … … 69 72 70 73 void checkCollisionObjects(); 71 void checkCollisionGround(); 74 72 75 73 76 void debugSpawnTree(int depth, sVec3D* vertices, int numVertices); … … 81 84 82 85 Terrain* terrain; //!< this it a ref to the terrain, serving as a ground for all WE 86 BspManager* bspManager; 83 87 }; 84 88 -
branches/bsp_model/src/lib/coord/p_node.h
r7954 r8087 191 191 /** tells the child that the parent's Direction has changed */ 192 192 inline void parentDirChanged () { this->bRelDirChanged = true; } 193 public: 193 194 /** @returns the last calculated coordinate */ 194 195 inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; } 195 196 private: 196 197 static PNode* createNullParent(); 197 198 void reparent(); -
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 } -
branches/bsp_model/src/world_entities/WorldEntities.am
r8068 r8087 15 15 world_entities/test_entity.cc \ 16 16 world_entities/planet.cc \ 17 world_entities/bsp_entity.cc \ 17 18 \ 18 19 world_entities/weapons/test_gun.cc \ … … 67 68 test_entity.h \ 68 69 planet.h \ 70 bsp_entity.h \ 69 71 \ 70 72 weapons/test_gun.h \ -
branches/bsp_model/src/world_entities/bsp_entity.cc
r8083 r8087 16 16 #include "bsp_entity.h" 17 17 #include "util/loading/resource_manager.h" 18 using namespace std;19 18 20 19 CREATE_FACTORY(BSPEntity, CL_BSP_ENTITY); 20 21 21 22 /** 22 23 * constructs and loads a BSPEntity from a XML-element … … 42 43 { 43 44 printf("+++++++++++ LOADING NAME %s\n", name.c_str()); 44 45 45 46 this->bspManager->load(name.c_str(), 0.1f); 46 47 } … … 58 59 59 60 this->toList(OM_ENVIRON); 60 61 61 62 /** 62 63 * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) … … 75 76 // all the clases this Entity is directly derived from must be called in this way, to load all settings. 76 77 // WorldEntity::loadParam(root); 77 78 78 79 LoadParam(root, "Name", this, BSPEntity, setName) 79 80 .describe("Sets the of the BSP file.");
Note: See TracChangeset
for help on using the changeset viewer.