Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 15, 2006, 9:34:48 PM (18 years ago)
Author:
patrick
Message:

merged the bsp branche back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/bsp_manager.h

    r8186 r8490  
    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/
    2020*/
    2121
     22#ifndef _BSP_MANAGER_H
     23#define _BSP_MANAGER_H
     24
     25
    2226#include <vector>
    2327#include <deque>
     28
     29
    2430
    2531// FORWARD DECLARATIONS
     
    4551public:
    4652  // Constructors
    47   BspManager();
    48  
     53  BspManager(WorldEntity* parent);
     54
    4955  BspManager(const char* fileName, float scale = 0.4f);
    5056  void load(const char* fileName, float scale);
     
    5258  // Functions
    5359  const void draw();
    54   void draw_debug_face(int Face);
     60  const void tick(float time);
     61  void draw_debug_face(int Face);
    5562  void draw_face(int Face);
    5663  void draw_patch(face* Face);
    57  
    5864
    59   void checkCollision(WorldEntity* worldEntity);
     65
     66  void checkCollision(WorldEntity* worldEntity); /*!< WorldEntities use this function to check wheter they collided with the BspEntity.
     67                                                      If a collision has been detected, the collides-function of worldEntity will be called.*/
    6068
    6169private:
    6270  // Functions
    6371  BspTreeNode* getLeaf(BspTreeNode*  node,   Vector* cam) ;  //!< Traverses the tree
    64   void  checkCollision(BspTreeNode* node, Vector* cam);
    65   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);
     72  void  checkCollision(BspTreeNode* node, Vector* cam); //!< Obsolete. Use this function for debugging only!
     73  void  checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
     74  void  checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
     75  void TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs );
     76  void  checkCollisionBox(void);
    6777  void  checkBrushRay(brush* curBrush);
    6878  void  checkBrushRayN(brush* curBrush);
     79  void   checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd);
     80
    6981  void drawDebugCube(Vector* cam);
    7082  bool isAlreadyVisible(int Face);
    7183  void addFace(int Face);
    72  
     84
    7385  // Data
    7486  BspFile*  bspFile;
     
    7991  plane* collPlane;
    8092  int lastTex;
    81  
    82   //obsolete
     93
     94  //obsolete: global variables for collision detection
    8395  bool  outputStartsOut;
    8496  bool  outputAllSolid;
    8597  float outputFraction;
     98  Vector inputStart;
     99  Vector inputEnd;
    86100 
     101  Vector traceMins; //!< Mins of current bbox
     102  Vector traceMaxs; //!< Maxs of current bbox
     103  Vector traceExtents; /*!< Stores the maximum of the absolute value of each axis in the box.
     104                            For example, if traceMins was (-100,-3,-15) and traceMaxs was (55,22,7), traceExtents */
     105
     106  WorldEntity* parent;          //!< the parent entity of the bspManager: interface to this
     107
    87108  bool * alreadyVisible;
    88109  // Deques to store the visible faces
     
    90111  ::std::deque<int> opal; //!< the others here.
    91112
    92   Vector out;
    93   Vector out1;
    94   Vector out2;
     113  Vector out;  //!< For debugging only
     114  Vector out1; //!< For debugging only
     115  Vector out2; //!< For debugging only
     116                       
     117  int tgl;
    95118};
    96119
     120#endif /* _BSP_MANAGER_H */
Note: See TracChangeset for help on using the changeset viewer.