Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8186 in orxonox.OLD


Ignore:
Timestamp:
Jun 7, 2006, 2:40:46 PM (18 years ago)
Author:
bensch
Message:

trunk: merged the branche bsp_model back here

Location:
trunk/src
Files:
8 edited
10 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r8068 r8186  
    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,
  • trunk/src/lib/collision_detection/cd_engine.cc

    r7739 r8186  
    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
  • trunk/src/lib/collision_detection/cd_engine.h

    r7739 r8186  
    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
  • trunk/src/lib/coord/p_node.h

    r7954 r8186  
    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();
  • trunk/src/lib/graphics/importer/Makefile.am

    r6532 r8186  
    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                           bsp_tree_node.cc \
     23                           bsp_tree_leaf.cc
     24
     25
    1926
    2027libtc_a_SOURCES  = tc.cc
    2128
    2229
    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
     30noinst_HEADERS = \
     31                model.h \
     32                tc.h \
     33                vertex_array_model.h \
     34                grid.h \
     35                static_model.h \
     36                objModel.h \
     37                primitive_model.h \
     38                md2Model.h \
     39                material.h \
     40                texture.h \
     41                texture_sequence.h \
     42                height_map.h \
     43                anorms.h \
     44                anormtab.h \
     45                media_container.h \
     46                movie_player.h\
     47                \
     48                bsp_manager.h \
     49                bsp_file.h \
     50                bsp_tree_node.h \
     51                bsp_tree_leaf.h
  • trunk/src/world_entities/WorldEntities.am

    r8068 r8186  
    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 \
  • trunk/src/world_entities/world_entity.cc

    r8037 r8186  
    312312
    313313/**
     314 *  this function is called, when two entities collide
     315 * @param entity: the world entity with whom it collides
     316 *
     317 * Implement behaviour like damage application or other miscellaneous collision stuff in this function
     318 */
     319void WorldEntity::collidesWithGround(const Vector& location)
     320{
     321  PRINTF(0)("BSP_GROUND: %s collides \n", this->getClassName() );
     322}
     323
     324void WorldEntity::collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2)
     325{
     326 
     327  // PRINTF(0)("BSP_GROUND: Player collides \n", this->getClassName() );
     328 
     329  Vector v = this->getAbsDirX();
     330  v.x *= 10;
     331  v.y *= 10;
     332  v.z *= 10;
     333  Vector u = this->getAbsDirY();
     334 
     335  if(feet.x == (u.x+this->getAbsCoor().x) &&  feet.y == u.y +this->getAbsCoor().y && feet.z == this->getAbsCoor().z)
     336  {
     337   
     338  this->setAbsCoor(ray_2 - v);
     339  }
     340  else
     341  {
     342    if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z)
     343    {
     344      this->setAbsCoor(feet -u ); 
     345    }
     346     
     347    this->setAbsCoor(ray_2 - v); 
     348   
     349  }
     350}
     351
     352/**
    314353 *  this is called immediately after the Entity has been constructed, initialized and then Spawned into the World
    315354 *
  • trunk/src/world_entities/world_entity.h

    r8037 r8186  
    6363  bool buildObbTree(int depth);
    6464  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    65   /** @returns a reference to the obb tree of this worldentity */
     65  virtual void collidesWithGround(const Vector& location);
     66  virtual void collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2);
     67
     68
     69/** @returns a reference to the obb tree of this worldentity */
    6670  inline BVTree* getOBBTree() const { return this->obbTree; };
    6771  void drawBVTree(int depth, int drawMode) const;
Note: See TracChangeset for help on using the changeset viewer.