Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8081 in orxonox.OLD for branches/bsp_model


Ignore:
Timestamp:
Jun 1, 2006, 4:42:01 PM (19 years ago)
Author:
bottac
Message:

Loadable from .oxw

Location:
branches/bsp_model/src
Files:
7 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/defs/class_id.h

    r7256 r8081  
    173173  CL_PLANET                     =    0x00000309,
    174174  CL_BUILDING                   =    0x00000310,
     175  CL_BSP_ENTITY                 =    0x00000311,
    175176
    176177  // Playables
     
    248249  CL_OBB                        =    0x00720000,
    249250  CL_BOUNDING_SPHERE            =    0x00740000,
     251 
    250252
    251253
     
    273275  CL_HEIGHT_MAP                 =    0x0000090a,
    274276  CL_GRID                       =    0x0000090b,
    275 
     277  CL_BSP_MODEL                  =    0x0000090c, //!FIXME
     278 
    276279  CL_MATERIAL                   =    0x00000810,
    277280  CL_SHADER                     =    0x00000811,
  • branches/bsp_model/src/lib/graphics/importer/bsp_file.cc

    r8030 r8081  
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
     13   
     14   Inspired by:
     15   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
     16   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
     17   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
    1318*/
    1419
     
    4348int BspFile::read(const char* name)
    4449{
    45   this->scale = 0.4;
     50  //this->scale = 0.4;
    4651  int offset;
    4752  int size;
     
    592597  int      mipmapLevel = 0;         //!< the maximum mipmap level for this texture
    593598  int      mipmapWidth = 0;         //!< the width of the mipmap
    594   int      mipmapHight = 0;         //!< the height of the mipmap
    595 
     599  int      mipmapHight = 0;         //!< the height of the mipmap3
    596600  float sc, scale, temp;
    597601  for(int i = 0; i < 128*128*3 ; i++)
     
    599603  sc =  ((unsigned char *)(&lightMapTexture))[i];
    600604  sc *= 1/255.0;
    601   scale = 1.4;
     605  scale = 2.0;
    602606  if(sc > 1.0f && (temp = (1.0f/sc)) < scale) scale=temp;
    603607  scale*=255.0;
     
    606610    ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc + 75;
    607611  else
    608     ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc;
     612    ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc ;
    609613  }
    610614 
     
    982986}
    983987
     988//!TODO: This is a good place to do LittleEndian to BigEndian conversion!
    984989void BspFile::swapAllBspCoordinates()
    985990{
     
    10151020  }
    10161021 
    1017    
    1018  
    1019 
    1020  
    10211022}
    10221023
    10231024void BspFile::swapCoords(int *array)
    10241025{
     1026  if( scale < 1)
     1027  {
    10251028  int sto  =  array[0];
    10261029  array[0] =  array[1] / (int) ( 1/ scale);
    10271030  array[1] = array[2] / (int) (1/scale);
    10281031  array[2] =  sto / (int) (1/scale);
     1032  }
     1033  else
     1034  {
     1035    int sto  =  array[0];
     1036    array[0] =  scale * array[1] ;
     1037    array[1] =  scale * array[2];
     1038    array[2] =  scale * sto ;
     1039  }
    10291040 
    10301041}
  • branches/bsp_model/src/lib/graphics/importer/bsp_file.h

    r8030 r8081  
    1111 ### File Specific:
    1212 main-programmer: bottac@ee.ethz.ch
     13 
     14  Inspired by:
     15  Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
     16  Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
     17  Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
    1318*/
    1419
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r8030 r8081  
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
     13   
     14   Inspired by:
     15   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
     16   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
     17   
     18   Collision detection adapted from:
     19   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
    1320*/
    1421
     
    3643#include "world_entity.h"
    3744
     45#include "util/loading/load_param.h"
     46#include "util/loading/factory.h"
     47
     48
     49//CREATE_FACTORY( BspManager, CL_BSP_MODEL);
     50
    3851BspManager::BspManager()
    3952{
    40   // open a BSP file
     53  /*// open a BSP file
    4154  this->bspFile = new BspFile();
     55  this->bspFile->scale = 0.4f;
    4256  this->bspFile->read(ResourceManager::getFullName("test.bsp").c_str());
    4357  this->bspFile->build_tree();
    4458  this->root  = this->bspFile->get_root();
    4559  this->alreadyVisible = new bool [this->bspFile->numFaces];
    46 
     60  */
    4761  CDEngine::getInstance()->setBSPModel(this);
    48 }
    49 
    50 void BspManager::draw()
    51 {
    52 
    53 
     62 
     63 
     64 
     65}
     66
     67
     68/*
     69BspManager::BspManager(const TiXmlElement* root)
     70{
     71
     72 
     73  if( root != NULL)
     74    this->loadParams(root);
     75 
     76  CDEngine::getInstance()->setBSPModel(this);
     77} */
     78
     79void BspManager::load(const char* fileName, float scale)
     80{
     81  //this->setClassID(CL_BSP_MODEL, "BspManager");
     82    // open a BSP file
     83  this->bspFile = new BspFile();
     84  this->bspFile->scale =  scale;
     85  this->bspFile->read(ResourceManager::getFullName(fileName).c_str());
     86  this->bspFile->build_tree();
     87  this->root  = this->bspFile->get_root();
     88  this->alreadyVisible = new bool [this->bspFile->numFaces];
     89
     90
     91}
     92/*
     93BspManager::BspManager(const char* fileName, float scale)
     94{
     95  // open a BSP file
     96  this->bspFile = new BspFile();
     97  this->bspFile->scale =  scale;
     98  this->bspFile->read(fileName);
     99  this->bspFile->build_tree();
     100  this->root  = this->bspFile->get_root();
     101  this->alreadyVisible = new bool [this->bspFile->numFaces];
     102
     103  CDEngine::getInstance()->setBSPModel(this);
     104}
     105*/
     106
     107const void BspManager::draw()
     108{
     109
     110  /*
    54111  this->drawDebugCube(&this->out);
    55112  this->out1 = this->out;
     
    67124  this->drawDebugCube(&this->out1);
    68125  this->drawDebugCube(&this->out2);
    69  
     126  */
    70127  // Draw Debug Terrain
    71128  /*
     
    192249        const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist;
    193250
    194         if(dMins < -100.0 && dMaxs < -  100.0) {
     251        if(dMins < -50.0 && dMaxs < -  50.0) {
    195252          continue;
    196253        }
     
    223280    this->trasparent.pop_back();
    224281  }
     282  //glEnable(GL_TEXTURE_2D);
    225283  glActiveTextureARB(GL_TEXTURE1_ARB);
    226284  glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap);
    227   glEnable(GL_TEXTURE_2D);
     285 
     286 
    228287
    229288}//draw
     
    479538      if (fraction > startFraction)
    480539        startFraction = fraction;
     540      // don't store plane
     541      // this->collPlane = &curPlane;
     542     
     543    } else {   // line is leaving the brush
     544      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     545      if (fraction < endFraction)
     546        endFraction = fraction;
     547      // don't store plane
     548      //this->collPlane = & curPlane;
     549     
     550    }
     551
     552  }
     553  if (startsOut == false) {
     554    this->outputStartsOut = false;
     555    if (endsOut == false)
     556      this->outputAllSolid = true;
     557    return;
     558  }
     559
     560  if (startFraction < endFraction) {
     561    if (startFraction > -1.0f && startFraction < outputFraction) {
     562      if (startFraction < 0)
     563        startFraction = 0;
     564      this->outputFraction = startFraction;
     565    }
     566  }
     567
     568}
     569
     570void BspManager::checkBrushRayN(brush* curBrush)
     571{
     572  float EPSILON = 0.000001;
     573  float startDistance;
     574  float endDistance;
     575
     576  float startFraction = -1.0f;
     577  float endFraction = 1.0f;
     578  bool startsOut = false;
     579  bool endsOut = false;
     580
     581  Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor();
     582  Vector inputEnd   = State::getCameraTargetNode()->getAbsCoor();
     583
     584  for (int i = 0; i < curBrush->n_brushsides; i++) {
     585    brushside& curBrushSide =   this->bspFile->brushSides[curBrush->brushside + i]   ;
     586    plane& curPlane  =   this->bspFile->planes[curBrushSide.plane] ;
     587
     588    startDistance = inputStart.x * curPlane.x + inputStart.y * curPlane.y+ inputStart.z * curPlane.z - curPlane.d;
     589    endDistance = inputEnd.x * curPlane.x +inputEnd.y * curPlane.y +inputEnd.z * curPlane.z -curPlane.d;
     590
     591    if (startDistance > 0)
     592      startsOut = true;
     593    if (endDistance > 0)
     594      endsOut = true;
     595
     596    // make sure the trace isn't completely on one side of the brush
     597    if (startDistance > 0 && endDistance > 0) {   // both are in front of the plane, its outside of this brush
     598      return;
     599    }
     600    if (startDistance <= 0 && endDistance <= 0) {   // both are behind this plane, it will get clipped by another one
     601      continue;
     602    }
     603
     604    // MMM... BEEFY
     605    if (startDistance > endDistance) {   // line is entering into the brush
     606      float fraction = (startDistance - EPSILON) / (startDistance - endDistance);  // *
     607      if (fraction > startFraction)
     608        startFraction = fraction;
    481609      // store plane
    482610      this->collPlane = &curPlane;
     
    508636
    509637}
     638
    510639
    511640void BspManager::checkCollisionRay(BspTreeNode* node, float startFraction, float endFraction, Vector* start, Vector* end)
     
    604733
    605734
     735
     736void BspManager::checkCollisionRayN(BspTreeNode* node, float startFraction, float endFraction, Vector* start, Vector* end)
     737{
     738
     739
     740  float EPSILON = 0.000001;
     741  float  endDistance = (end)->x * (node->plane.x) +(end)->y * (node->plane.y) +(end)->z * (node->plane.z)  - node->d;
     742  float  startDistance = (start)->x * (node->plane.x)+ (start)->y * (node->plane.y)+ (start)->z * (node->plane.z)- node->d;
     743
     744
     745  if(node->isLeaf) {
     746    leaf& curLeaf = this->bspFile->leaves[node->leafIndex];
     747    for (int i = 0; i <  curLeaf.n_leafbrushes ; i++) {
     748      brush& curBrush = this->bspFile->brushes[((int*)(this->bspFile->leafBrushes))[curLeaf.leafbrush_first+i]];
     749      //object *brush = &BSP.brushes[BSP.leafBrushes[leaf->firstLeafBrush + i]];
     750      if (curBrush.n_brushsides > 0   &&
     751          ((((BspTexture*)(this->bspFile->textures))[curBrush.texture]).contents & 1))
     752        // CheckBrush( brush );
     753        this->checkBrushRayN(&curBrush);
     754      if(curBrush.n_brushsides <=0) this->outputAllSolid = true;
     755    }
     756    return;
     757  }
     758
     759
     760  if (startDistance >= 0 && endDistance >= 0)     // A
     761  {   // both points are in front of the plane
     762    // so check the front child
     763    this->checkCollisionRayN(node->left,0,0,start,end);
     764  } else if (startDistance < 0 && endDistance < 0)  // B
     765  {   // both points are behind the plane
     766    // so check the back child
     767    this->checkCollisionRayN(node->right,0,0,start,end);
     768  } else                                            // C
     769  {   // the line spans the splitting plane
     770    int side;
     771    float fraction1, fraction2, middleFraction;
     772    Vector middle;
     773
     774    // STEP 1: split the segment into two
     775    if (startDistance < endDistance) {
     776      side = 1; // back
     777      float inverseDistance = 1.0f / (startDistance - endDistance);
     778      fraction1 = (startDistance + EPSILON) * inverseDistance;
     779      fraction2 = (startDistance + EPSILON) * inverseDistance;
     780    } else if (endDistance < startDistance) {
     781      side = 0; // front(start)->x * (node->plane.x)+
     782      float inverseDistance = 1.0f / (startDistance - endDistance);
     783      fraction1 = (startDistance + EPSILON) * inverseDistance;
     784      fraction2 = (startDistance - EPSILON) * inverseDistance;
     785    } else {
     786      side = 0; // front
     787      fraction1 = 1.0f;
     788      fraction2 = 0.0f;
     789    }
     790
     791    // STEP 2: make sure the numbers are valid
     792    if (fraction1 < 0.0f) fraction1 = 0.0f;
     793    else if (fraction1 > 1.0f) fraction1 = 1.0f;
     794    if (fraction2 < 0.0f) fraction2 = 0.0f;
     795    else if (fraction2 > 1.0f) fraction2 = 1.0f;
     796
     797    // STEP 3: calculate the middle point for the first side
     798    middleFraction = startFraction +
     799        (endFraction - startFraction) * fraction1;
     800
     801    middle.x = start->x + fraction1 * (end->x - start->x);
     802    middle.y = start->y + fraction1 * (end->y - start->y);
     803    middle.z = start->z + fraction1 * (end->z - start->z);
     804
     805    // STEP 4: check the first side
     806    //CheckNode( node->children[side], startFraction, middleFraction, start, middle );
     807    if(side == 0) this->checkCollisionRayN(node->left,startFraction, middleFraction, start, &middle );
     808
     809    else this->checkCollisionRayN(node->right,startFraction, middleFraction,
     810                                 start, &middle );
     811
     812    // STEP 5: calculate the middle point for the second side
     813    middleFraction = startFraction +
     814        (endFraction - startFraction) * fraction2;
     815
     816    middle.x = start->x + fraction2 * (end->x - start->x);
     817    middle.y = start->y + fraction2 * (end->y - start->y);
     818    middle.z = start->z + fraction2 * (end->z - start->z);
     819
     820    // STEP 6: check the second side
     821    if(side == 1)this->checkCollisionRayN(node->left,middleFraction, endFraction, &middle, end);
     822
     823    else this->checkCollisionRayN(node->right,middleFraction, endFraction,&middle, end );
     824
     825
     826  }
     827
     828}
     829
    606830void BspManager::checkCollision(WorldEntity* worldEntity)
    607831{
    608  // return;
     832  return;
    609833 
    610834  Vector position = worldEntity->getAbsCoor();
     
    623847  Vector out = Vector(-1875.0,-1875.0,-1875.0);
    624848  if(!worldEntity->isA(CL_PLAYABLE)) {
     849   
     850   
     851   
     852 
    625853  }
    626854  else {
     
    634862    Vector out2;
    635863
    636     this->checkCollisionRay(this->root,0.0f,1.0f, &position1, &dest1 );
     864    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
    637865    if(this->outputFraction == 1.0f)  out1 = dest;
    638866    else {
     
    644872    }
    645873
    646     this->checkCollisionRay(this->root,0.0f,1.0f, &position2, &dest2 );
     874    this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
    647875    if(this->outputFraction == 1.0f) out2= dest;
    648876    else
     
    655883    }
    656884   
    657     this->checkCollisionRay(this->root,0.0f,1.0f, &position, &dest );
     885    this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
    658886    if(this->outputFraction == 1.0f) out = dest;
    659887    else
     
    664892    out.z = position.z + (dest.z -position.z) * this->outputFraction;
    665893   
    666     Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
    667     this->out = out;
    668     this->out1 = out1;
    669     this->out2 = out2;
     894    //Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
     895    //this->out = out;
     896    //this->out1 = out1;
     897    //this->out2 = out2;
    670898    //this->drawDebugCube(&out1);
    671899    //this->drawDebugCube(&out2);
     
    675903    }
    676904   
    677    // if(collision) worldEntity->collidesWithGround(out,out1,out2);
     905    // Return the normal here: Normal's stored in this->collPlane;
     906    if(collision) worldEntity->collidesWithGround(out,out1,out2);
    678907 
    679908  }
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.h

    r8030 r8081  
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
     13   
     14   Inspired by:
     15   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
     16   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
     17   
     18   Collision detection adapted from:
     19   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
    1320*/
    1421
    1522#include <vector>
    1623#include <deque>
    17 
    1824
    1925// FORWARD DECLARATIONS
     
    2935class WorldEntity;
    3036
     37struct BspCollisionEvent
     38{
     39  Vector normal; //!< normal Vector, length 1
     40  Vector place;  //!< Absoloute coordinates of collision
     41};
     42
    3143class BspManager
    3244{
     
    3446  // Constructors
    3547  BspManager();
     48 
     49  BspManager(const char* fileName, float scale = 0.4f);
     50  void load(const char* fileName, float scale);
    3651
    3752  // Functions
    38   void draw();
     53  const void draw();
    3954  void draw_debug_face(int Face);
    4055  void draw_face(int Face);
    4156  void draw_patch(face* Face);
     57 
    4258
    4359  void checkCollision(WorldEntity* worldEntity);
     
    4864  void  checkCollision(BspTreeNode* node, Vector* cam);
    4965  void  checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
     66  void  checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
    5067  void  checkBrushRay(brush* curBrush);
     68  void  checkBrushRayN(brush* curBrush);
    5169  void drawDebugCube(Vector* cam);
    5270  bool isAlreadyVisible(int Face);
  • branches/bsp_model/src/world_entities/WorldEntities.am

    r7167 r8081  
    1515                world_entities/test_entity.cc \
    1616                world_entities/planet.cc \
     17                world_entities/bsp_entity.cc \
    1718                \
    1819                world_entities/weapons/test_gun.cc \
     
    6566                test_entity.h \
    6667                planet.h \
     68                bsp_entity.h \
    6769                \
    6870                weapons/test_gun.h \
  • branches/bsp_model/src/world_entities/bsp_entity.cc

    r7540 r8081  
    1414*/
    1515
    16 #include "proto_world_entity.h"
    17 
     16#include "bsp_entity.h"
     17#include "util/loading/resource_manager.h"
    1818using namespace std;
    1919
    20 
     20CREATE_FACTORY(BSPEntity, CL_BSP_ENTITY);
    2121/**
    22  * constructs and loads a ProtoWorldEntity from a XML-element
     22 * constructs and loads a BSPEntity from a XML-element
    2323 * @param root the XML-element to load from
    2424 */
    25 ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root)
     25BSPEntity::BSPEntity(const TiXmlElement* root)
    2626{
    2727  this->init();
     
    3434 * standard deconstructor
    3535 */
    36 ProtoWorldEntity::~ProtoWorldEntity ()
     36BSPEntity::~BSPEntity ()
    3737{
    3838
    3939}
    4040
     41void BSPEntity::setName(const std::string& name)
     42{
     43  printf("+++++++++++ LOADING NAME %s\n", name.c_str());
     44 
     45  this->bspManager->load(name.c_str(), 0.1f);
     46}
     47
     48
    4149
    4250/**
    43  * initializes the ProtoWorldEntity
     51 * initializes the BSPEntity
    4452 * @todo change this to what you wish
    4553 */
    46 void ProtoWorldEntity::init()
     54void BSPEntity::init()
    4755{
    48   this->setClassID(CL_PROTO_WORLD_ENTITY, "ProtoWorldEntity");
     56  this->bspManager = new BspManager();
     57  this->setClassID(CL_BSP_ENTITY, "BSPEntity");
    4958
     59  this->toList(OM_ENVIRON);
     60 
    5061  /**
    51    * @todo: Write CL_PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition)
     62   * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
    5263   */
    5364
     
    5667
    5768/**
    58  * loads a ProtoWorldEntity from a XML-element
     69 * loads a BSPEntity from a XML-element
    5970 * @param root the XML-element to load from
    6071 * @todo make the class Loadable
    6172 */
    62 void ProtoWorldEntity::loadParams(const TiXmlElement* root)
     73void BSPEntity::loadParams(const TiXmlElement* root)
    6374{
    6475  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
    65   WorldEntity::loadParam(root);
     76 // WorldEntity::loadParam(root);
     77 
     78  LoadParam(root, "Name", this, BSPEntity, setName)
     79      .describe("Sets the of the BSP file.");
    6680
     81/*  LoadParam(root, "Scale", this, BSpEntity, setScale)
     82      .describe("Sets the scale factore of the bsp level.");
     83*/
    6784
    6885  /**
     
    7390
    7491/**
    75  * advances the ProtoWorldEntity about time seconds
     92 * advances the BSPEntity about time seconds
    7693 * @param time the Time to step
    7794 */
    78 ProtoWorldEntity::tick(float time)
     95void BSPEntity::tick(float time)
    7996{
    8097
    8198}
    8299
     100
    83101/**
    84102 * draws this worldEntity
    85103 */
    86 void ProtoWorldEntity::draw () const
     104void BSPEntity::draw () const
    87105{
    88   glMatrixMode(GL_MODELVIEW);
    89   glPushMatrix();
    90   float matrix[4][4];
    91 
    92   /* translate */
    93   glTranslatef (this->getAbsCoor ().x,
    94                 this->getAbsCoor ().y,
    95                 this->getAbsCoor ().z);
    96   /* rotate */
    97   this->getAbsDir().matrix(matrix);
    98   glMultMatrixf((float*)matrix);
    99 
    100   if (model)
    101     model->draw();
    102   glPopMatrix();
     106  this->bspManager->draw();
    103107}
    104108
     
    108112 *
    109113 */
    110 void ProtoWorldEntity::collidesWith (WorldEntity* entity, const Vector& location)
     114void BSPEntity::collidesWith (WorldEntity* entity, const Vector& location)
    111115{
    112116
  • branches/bsp_model/src/world_entities/bsp_entity.h

    r7540 r8081  
    11/*!
    2  * @file proto_world_entity.h
     2 * @file bsp_entity.h
    33 * @brief description
    44*/
    55
    6 #ifndef _PROTO_WORLD_ENTITY_H
    7 #define _PROTO_WORLD_ENTITY_H
     6#ifndef _BSP_ENTITY_H
     7#define _BSP_ENTITY_H
    88
    99#include "world_entity.h"
     10#include "bsp_manager.h"
     11
     12#include "util/loading/factory.h"
     13#include "util/loading/load_param.h"
     14
     15
    1016
    1117//! A Class to ...
    12 class ProtoWorldEntity : public WorldEntity
     18class BSPEntity : public WorldEntity
    1319{
    14 
     20 
    1521 public:
    16   ProtoWorldEntity(const TiXmlElement* root = NULL);
    17   virtual ~ProtoWorldEntity();
     22  BSPEntity(const TiXmlElement* root = NULL);
     23  virtual ~BSPEntity();
    1824
    1925  virtual void loadParams(const TiXmlElement* root);
     26 
     27  void setName(const std::string& name);
     28
    2029  void init();
    21 
    22   virtual void postSpawn ();
    23   virtual void leftWorld ();
    24 
    2530
    2631  virtual void draw() const;
     
    2934
    3035 private:
     36   BspManager* bspManager;
    3137
    3238};
    3339
    34 #endif /* _PROTO_WORLD_ENTITY_H */
     40#endif /* _BSP_ENTITY_H */
  • branches/bsp_model/src/world_entities/terrain.cc

    r7352 r8081  
    117117       
    118118  this->bspManager = new BspManager();
     119  this->bspManager->load("test.bsp", 0.4);
    119120  //this->loadTexture("maps/wall1.jpeg");
    120121}
     
    208209  // Vector tmpRot = this->getAbsDir().getSpacialAxis();
    209210  //glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    210 /*
     211
    211212  if (this->objectList)
    212213    glCallList(this->objectList);
     
    226227  }
    227228
    228 */
    229 
    230   this->bspManager->draw();
     229
     230
     231 // this->bspManager->draw();
    231232  glPopMatrix();
    232233
Note: See TracChangeset for help on using the changeset viewer.