Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/bsp_manager.h @ 8465

Last change on this file since 8465 was 8186, checked in by bensch, 19 years ago

trunk: merged the branche bsp_model back here

File size: 2.4 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3 
4   Copyright (C) 2006 orx
5 
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10 
11   ### File Specific:
12   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/
20*/
21
22#include <vector>
23#include <deque>
24
25// FORWARD DECLARATIONS
26class  BspFile;
27class BspTreeLeaf;
28class BspTreeNode;
29class Vector;
30class set;
31struct face;
32struct brush;
33struct plane;
34
35class WorldEntity;
36
37struct BspCollisionEvent
38{
39  Vector normal; //!< normal Vector, length 1
40  Vector place;  //!< Absoloute coordinates of collision
41};
42
43class BspManager
44{
45public:
46  // Constructors
47  BspManager();
48 
49  BspManager(const char* fileName, float scale = 0.4f);
50  void load(const char* fileName, float scale);
51
52  // Functions
53  const void draw();
54  void draw_debug_face(int Face); 
55  void draw_face(int Face);
56  void draw_patch(face* Face);
57 
58
59  void checkCollision(WorldEntity* worldEntity);
60
61private:
62  // Functions
63  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); 
67  void  checkBrushRay(brush* curBrush);
68  void  checkBrushRayN(brush* curBrush);
69  void drawDebugCube(Vector* cam);
70  bool isAlreadyVisible(int Face);
71  void addFace(int Face);
72 
73  // Data
74  BspFile*  bspFile;
75  BspTreeNode* root;
76  Vector cam;
77  Vector ship;
78  Vector  viewDir;
79  plane* collPlane;
80  int lastTex;
81 
82  //obsolete
83  bool  outputStartsOut;
84  bool  outputAllSolid;
85  float outputFraction;
86 
87  bool * alreadyVisible;
88  // Deques to store the visible faces
89  ::std::deque<int> trasparent; //!< the ones with transparancy go here
90  ::std::deque<int> opal; //!< the others here.
91
92  Vector out;
93  Vector out1;
94  Vector out2;
95};
96
Note: See TracBrowser for help on using the repository browser.