Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8087 in orxonox.OLD for branches/bsp_model


Ignore:
Timestamp:
Jun 1, 2006, 5:10:54 PM (18 years ago)
Author:
bensch
Message:

merges some merges

Location:
branches/bsp_model/src
Files:
6 edited
10 copied

Legend:

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

    r8068 r8087  
    182182  CL_BUILDING                   =    0x00000310,
    183183  CL_MAPPED_WATER               =    0x00000311,
     184  CL_BSP_ENTITY                 =    0x00000312,
    184185
    185186  // Playables
     
    259260  CL_OBB                        =    0x00720000,
    260261  CL_BOUNDING_SPHERE            =    0x00740000,
     262 
    261263
    262264
     
    285287  CL_HEIGHT_MAP                 =    0x0000090a,
    286288  CL_GRID                       =    0x0000090b,
    287 
     289  CL_BSP_MODEL                  =    0x0000090c, //!FIXME
     290 
    288291  CL_MATERIAL                   =    0x00000810,
    289292  CL_SHADER                     =    0x00000811,
  • branches/bsp_model/src/lib/collision_detection/cd_engine.cc

    r7739 r8087  
    2929#include "quadtree_node.h"
    3030
    31 
     31#include "bsp_manager.h"
    3232
    3333using namespace std;
     
    9595 *  this checks the collisions with the ground
    9696 */
    97 void CDEngine::checkCollisionGround()
     97void CDEngine::checkCollisionGround(std::list<WorldEntity*>& list1)
    9898{
    9999  if( likely( this->terrain != NULL))
    100100  {
    101101    Quadtree* q = dynamic_cast<Terrain*>(this->terrain)->ssp->getQuadtree();
    102 
    103102//    QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
    104103  }
    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  }
    106117}
    107118
  • branches/bsp_model/src/lib/collision_detection/cd_engine.h

    r7739 r8087  
    1717class OBBTree;
    1818class Terrain;
     19class BspManager;
    1920//class Player;
    2021
     
    5051
    5152  inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
     53  inline void setBSPModel(BspManager* bspManager) { this->bspManager = bspManager; }
    5254
    5355  void checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2);
     56  void checkCollisionGround(std::list<WorldEntity*>& list1);
    5457
    5558  void drawBV(const std::list<WorldEntity*>& drawList, int level) const;
     
    6972
    7073  void checkCollisionObjects();
    71   void checkCollisionGround();
     74
    7275
    7376  void debugSpawnTree(int depth, sVec3D* vertices, int numVertices);
     
    8184
    8285  Terrain*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
     86  BspManager*             bspManager;
    8387};
    8488
  • branches/bsp_model/src/lib/coord/p_node.h

    r7954 r8087  
    191191  /** tells the child that the parent's Direction has changed */
    192192  inline void parentDirChanged () { this->bRelDirChanged = true; }
     193 public:
    193194  /** @returns the last calculated coordinate */
    194195  inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; }
    195 
     196 private:
    196197  static PNode* createNullParent();
    197198  void reparent();
  • branches/bsp_model/src/lib/graphics/importer/Makefile.am

    r6532 r8087  
    1616                           height_map.cc \
    1717                           media_container.cc \
    18                            movie_player.cc
     18                           movie_player.cc \
     19                           \
     20                           bsp_manager.cc \
     21                           bsp_file.cc
     22
     23
    1924
    2025libtc_a_SOURCES  = tc.cc
    2126
    2227
    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
     28noinst_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  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
    13    
     13
    1414   Inspired by:
    1515   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
    1616   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
    17    
     17
    1818   Collision detection adapted from:
    1919   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
     
    6060  */
    6161  CDEngine::getInstance()->setBSPModel(this);
    62  
    63  
    64  
    6562}
    6663
     
    7067{
    7168
    72  
     69
    7370  if( root != NULL)
    7471    this->loadParams(root);
    75  
     72
    7673  CDEngine::getInstance()->setBSPModel(this);
    7774} */
     
    117114  this->out1.y += this->collPlane->y*5.0;
    118115  this->out1.z += this->collPlane->z*5.0;
    119  
     116
    120117  this->out2.x += this->collPlane->x*10.0;
    121118  this->out2.y += this->collPlane->y*10.0;
     
    124121  this->drawDebugCube(&this->out1);
    125122  this->drawDebugCube(&this->out2);
    126   */ 
     123  */
    127124  // Draw Debug Terrain
    128125  /*
    129   this->bspFile->Materials[0]->select(); 
     126  this->bspFile->Materials[0]->select();
    130127  for(int i = 0; i <  this->bspFile->numPatches ; i++)
    131         {
    132                 this->bspFile->VertexArrayModels[i]->draw();
    133    
    134         }
     128        {
     129                this->bspFile->VertexArrayModels[i]->draw();
     130
     131        }
    135132  */
    136133
     
    283280  glActiveTextureARB(GL_TEXTURE1_ARB);
    284281  glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap);
    285  
    286  
     282
     283
    287284
    288285}//draw
     
    540537      // don't store plane
    541538      // this->collPlane = &curPlane;
    542      
     539
    543540    } else {   // line is leaving the brush
    544541      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     
    547544      // don't store plane
    548545      //this->collPlane = & curPlane;
    549      
     546
    550547    }
    551548
     
    562559      if (startFraction < 0)
    563560        startFraction = 0;
    564       this->outputFraction = startFraction; 
     561      this->outputFraction = startFraction;
    565562    }
    566563  }
     
    609606      // store plane
    610607      this->collPlane = &curPlane;
    611      
     608
    612609    } else {   // line is leaving the brush
    613610      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     
    616613      // store plane
    617614      this->collPlane = & curPlane;
    618      
     615
    619616    }
    620617
     
    631628      if (startFraction < 0)
    632629        startFraction = 0;
    633       this->outputFraction = startFraction; 
     630      this->outputFraction = startFraction;
    634631    }
    635632  }
     
    831828{
    832829  return;
    833  
     830
    834831  Vector position = worldEntity->getAbsCoor();
    835832
     
    839836  forwardDir.y =2.0*forwardDir.y;
    840837  forwardDir.z =2.0*forwardDir.z;
    841  
     838
    842839  Vector upDir = worldEntity->getAbsDirY();
    843840  Vector dest = position;
     
    847844  Vector out = Vector(-1875.0,-1875.0,-1875.0);
    848845  if(!worldEntity->isA(CL_PLAYABLE)) {
    849    
    850    
    851    
    852  
     846
     847
     848
     849
    853850  }
    854851  else {
     
    882879
    883880    }
    884    
     881
    885882    this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
    886883    if(this->outputFraction == 1.0f) out = dest;
     
    891888    out.y = position.y + (dest.y -position.y) * this->outputFraction;
    892889    out.z = position.z + (dest.z -position.z) * this->outputFraction;
    893    
     890
    894891    //Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
    895892    //this->out = out;
     
    898895    //this->drawDebugCube(&out1);
    899896    //this->drawDebugCube(&out2);
    900    
     897
    901898    //this->drawDebugCube(&out3);
    902  
    903     }
    904    
     899
     900    }
     901
    905902    // Return the normal here: Normal's stored in this->collPlane;
    906903    if(collision) worldEntity->collidesWithGround(out,out1,out2);
    907  
     904
    908905  }
    909906
     
    947944
    948945    /*
    949         for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
    950         {
    951                 brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
    952                 if(curBrush.n_brushsides < 0) return;
    953                 for(int j = 0; j < curBrush.n_brushsides; j++)
    954                 {
    955                 float dist = -0.1;
    956                 brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
    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                 if(dist < -0.01f) dist = -1.0f *dist;
    961                 if(dist < 1.0f){
    962                                 this->drawDebugCube(&this->cam);
    963                                 return;
    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        } */
    968965
    969966  }
  • branches/bsp_model/src/world_entities/WorldEntities.am

    r8068 r8087  
    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 \
     
    6768                test_entity.h \
    6869                planet.h \
     70                bsp_entity.h \
    6971                \
    7072                weapons/test_gun.h \
  • branches/bsp_model/src/world_entities/bsp_entity.cc

    r8083 r8087  
    1616#include "bsp_entity.h"
    1717#include "util/loading/resource_manager.h"
    18 using namespace std;
    1918
    2019CREATE_FACTORY(BSPEntity, CL_BSP_ENTITY);
     20
     21
    2122/**
    2223 * constructs and loads a BSPEntity from a XML-element
     
    4243{
    4344  printf("+++++++++++ LOADING NAME %s\n", name.c_str());
    44  
     45
    4546  this->bspManager->load(name.c_str(), 0.1f);
    4647}
     
    5859
    5960  this->toList(OM_ENVIRON);
    60  
     61
    6162  /**
    6263   * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
     
    7576  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
    7677 // WorldEntity::loadParam(root);
    77  
     78
    7879  LoadParam(root, "Name", this, BSPEntity, setName)
    7980      .describe("Sets the of the BSP file.");
Note: See TracChangeset for help on using the changeset viewer.