aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h316
1 files changed, 158 insertions, 158 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h b/libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h
index c581a47..40ff8d4 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CSceneCollisionManager.h
@@ -1,158 +1,158 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __C_SCENE_COLLISION_MANAGER_H_INCLUDED__ 5#ifndef __C_SCENE_COLLISION_MANAGER_H_INCLUDED__
6#define __C_SCENE_COLLISION_MANAGER_H_INCLUDED__ 6#define __C_SCENE_COLLISION_MANAGER_H_INCLUDED__
7 7
8#include "ISceneCollisionManager.h" 8#include "ISceneCollisionManager.h"
9#include "ISceneManager.h" 9#include "ISceneManager.h"
10#include "IVideoDriver.h" 10#include "IVideoDriver.h"
11 11
12namespace irr 12namespace irr
13{ 13{
14namespace scene 14namespace scene
15{ 15{
16 16
17 //! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes. 17 //! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
18 class CSceneCollisionManager : public ISceneCollisionManager 18 class CSceneCollisionManager : public ISceneCollisionManager
19 { 19 {
20 public: 20 public:
21 21
22 //! constructor 22 //! constructor
23 CSceneCollisionManager(ISceneManager* smanager, video::IVideoDriver* driver); 23 CSceneCollisionManager(ISceneManager* smanager, video::IVideoDriver* driver);
24 24
25 //! destructor 25 //! destructor
26 virtual ~CSceneCollisionManager(); 26 virtual ~CSceneCollisionManager();
27 27
28 //! Returns the scene node, which is currently visible at the given 28 //! Returns the scene node, which is currently visible at the given
29 //! screen coordinates, viewed from the currently active camera. 29 //! screen coordinates, viewed from the currently active camera.
30 virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(const core::position2d<s32>& pos, 30 virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(const core::position2d<s32>& pos,
31 s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0); 31 s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0);
32 32
33 //! Returns the nearest scene node which collides with a 3d ray and 33 //! Returns the nearest scene node which collides with a 3d ray and
34 //! whose id matches a bitmask. 34 //! whose id matches a bitmask.
35 virtual ISceneNode* getSceneNodeFromRayBB(const core::line3d<f32>& ray, 35 virtual ISceneNode* getSceneNodeFromRayBB(const core::line3d<f32>& ray,
36 s32 idBitMask=0, bool bNoDebugObjects=false, 36 s32 idBitMask=0, bool bNoDebugObjects=false,
37 ISceneNode* root=0); 37 ISceneNode* root=0);
38 38
39 //! Returns the scene node, at which the overgiven camera is looking at and 39 //! Returns the scene node, at which the overgiven camera is looking at and
40 //! which id matches the bitmask. 40 //! which id matches the bitmask.
41 virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera, 41 virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera,
42 s32 idBitMask=0, bool bNoDebugObjects = false); 42 s32 idBitMask=0, bool bNoDebugObjects = false);
43 43
44 //! Finds the collision point of a line and lots of triangles, if there is one. 44 //! Finds the collision point of a line and lots of triangles, if there is one.
45 virtual bool getCollisionPoint(const core::line3d<f32>& ray, 45 virtual bool getCollisionPoint(const core::line3d<f32>& ray,
46 ITriangleSelector* selector, core::vector3df& outCollisionPoint, 46 ITriangleSelector* selector, core::vector3df& outCollisionPoint,
47 core::triangle3df& outTriangle, 47 core::triangle3df& outTriangle,
48 ISceneNode* & outNode); 48 ISceneNode* & outNode);
49 49
50 //! Collides a moving ellipsoid with a 3d world with gravity and returns 50 //! Collides a moving ellipsoid with a 3d world with gravity and returns
51 //! the resulting new position of the ellipsoid. 51 //! the resulting new position of the ellipsoid.
52 virtual core::vector3df getCollisionResultPosition( 52 virtual core::vector3df getCollisionResultPosition(
53 ITriangleSelector* selector, 53 ITriangleSelector* selector,
54 const core::vector3df &ellipsoidPosition, 54 const core::vector3df &ellipsoidPosition,
55 const core::vector3df& ellipsoidRadius, 55 const core::vector3df& ellipsoidRadius,
56 const core::vector3df& ellipsoidDirectionAndSpeed, 56 const core::vector3df& ellipsoidDirectionAndSpeed,
57 core::triangle3df& triout, 57 core::triangle3df& triout,
58 core::vector3df& hitPosition, 58 core::vector3df& hitPosition,
59 bool& outFalling, 59 bool& outFalling,
60 ISceneNode*& outNode, 60 ISceneNode*& outNode,
61 f32 slidingSpeed, 61 f32 slidingSpeed,
62 const core::vector3df& gravityDirectionAndSpeed); 62 const core::vector3df& gravityDirectionAndSpeed);
63 63
64 //! Returns a 3d ray which would go through the 2d screen coodinates. 64 //! Returns a 3d ray which would go through the 2d screen coodinates.
65 virtual core::line3d<f32> getRayFromScreenCoordinates( 65 virtual core::line3d<f32> getRayFromScreenCoordinates(
66 const core::position2d<s32> & pos, ICameraSceneNode* camera = 0); 66 const core::position2d<s32> & pos, ICameraSceneNode* camera = 0);
67 67
68 //! Calculates 2d screen position from a 3d position. 68 //! Calculates 2d screen position from a 3d position.
69 virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition( 69 virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
70 const core::vector3df & pos, ICameraSceneNode* camera=0, bool useViewPort=false); 70 const core::vector3df & pos, ICameraSceneNode* camera=0, bool useViewPort=false);
71 71
72 //! Gets the scene node and nearest collision point for a ray based on 72 //! Gets the scene node and nearest collision point for a ray based on
73 //! the nodes' id bitmasks, bounding boxes and triangle selectors. 73 //! the nodes' id bitmasks, bounding boxes and triangle selectors.
74 virtual ISceneNode* getSceneNodeAndCollisionPointFromRay( 74 virtual ISceneNode* getSceneNodeAndCollisionPointFromRay(
75 core::line3df ray, 75 core::line3df ray,
76 core::vector3df & outCollisionPoint, 76 core::vector3df & outCollisionPoint,
77 core::triangle3df & outTriangle, 77 core::triangle3df & outTriangle,
78 s32 idBitMask = 0, 78 s32 idBitMask = 0,
79 ISceneNode * collisionRootNode = 0, 79 ISceneNode * collisionRootNode = 0,
80 bool noDebugObjects = false); 80 bool noDebugObjects = false);
81 81
82 82
83 private: 83 private:
84 84
85 //! recursive method for going through all scene nodes 85 //! recursive method for going through all scene nodes
86 void getPickedNodeBB(ISceneNode* root, core::line3df& ray, s32 bits, 86 void getPickedNodeBB(ISceneNode* root, core::line3df& ray, s32 bits,
87 bool bNoDebugObjects, 87 bool bNoDebugObjects,
88 f32& outbestdistance, ISceneNode*& outbestnode); 88 f32& outbestdistance, ISceneNode*& outbestnode);
89 89
90 //! recursive method for going through all scene nodes 90 //! recursive method for going through all scene nodes
91 void getPickedNodeFromBBAndSelector(ISceneNode * root, 91 void getPickedNodeFromBBAndSelector(ISceneNode * root,
92 core::line3df & ray, 92 core::line3df & ray,
93 s32 bits, 93 s32 bits,
94 bool noDebugObjects, 94 bool noDebugObjects,
95 f32 & outBestDistanceSquared, 95 f32 & outBestDistanceSquared,
96 ISceneNode * & outBestNode, 96 ISceneNode * & outBestNode,
97 core::vector3df & outBestCollisionPoint, 97 core::vector3df & outBestCollisionPoint,
98 core::triangle3df & outBestTriangle); 98 core::triangle3df & outBestTriangle);
99 99
100 100
101 struct SCollisionData 101 struct SCollisionData
102 { 102 {
103 core::vector3df eRadius; 103 core::vector3df eRadius;
104 104
105 core::vector3df R3Velocity; 105 core::vector3df R3Velocity;
106 core::vector3df R3Position; 106 core::vector3df R3Position;
107 107
108 core::vector3df velocity; 108 core::vector3df velocity;
109 core::vector3df normalizedVelocity; 109 core::vector3df normalizedVelocity;
110 core::vector3df basePoint; 110 core::vector3df basePoint;
111 111
112 bool foundCollision; 112 bool foundCollision;
113 f32 nearestDistance; 113 f32 nearestDistance;
114 core::vector3df intersectionPoint; 114 core::vector3df intersectionPoint;
115 115
116 core::triangle3df intersectionTriangle; 116 core::triangle3df intersectionTriangle;
117 s32 triangleIndex; 117 s32 triangleIndex;
118 s32 triangleHits; 118 s32 triangleHits;
119 119
120 f32 slidingSpeed; 120 f32 slidingSpeed;
121 121
122 ITriangleSelector* selector; 122 ITriangleSelector* selector;
123 }; 123 };
124 124
125 //! Tests the current collision data against an individual triangle. 125 //! Tests the current collision data against an individual triangle.
126 /** 126 /**
127 \param colData: the collision data. 127 \param colData: the collision data.
128 \param triangle: the triangle to test against. 128 \param triangle: the triangle to test against.
129 \return true if the triangle is hit (and is the closest hit), false otherwise */ 129 \return true if the triangle is hit (and is the closest hit), false otherwise */
130 bool testTriangleIntersection(SCollisionData* colData, 130 bool testTriangleIntersection(SCollisionData* colData,
131 const core::triangle3df& triangle); 131 const core::triangle3df& triangle);
132 132
133 //! recursive method for doing collision response 133 //! recursive method for doing collision response
134 core::vector3df collideEllipsoidWithWorld(ITriangleSelector* selector, 134 core::vector3df collideEllipsoidWithWorld(ITriangleSelector* selector,
135 const core::vector3df &position, 135 const core::vector3df &position,
136 const core::vector3df& radius, const core::vector3df& velocity, 136 const core::vector3df& radius, const core::vector3df& velocity,
137 f32 slidingSpeed, 137 f32 slidingSpeed,
138 const core::vector3df& gravity, core::triangle3df& triout, 138 const core::vector3df& gravity, core::triangle3df& triout,
139 core::vector3df& hitPosition, 139 core::vector3df& hitPosition,
140 bool& outFalling, 140 bool& outFalling,
141 ISceneNode*& outNode); 141 ISceneNode*& outNode);
142 142
143 core::vector3df collideWithWorld(s32 recursionDepth, SCollisionData &colData, 143 core::vector3df collideWithWorld(s32 recursionDepth, SCollisionData &colData,
144 core::vector3df pos, core::vector3df vel); 144 core::vector3df pos, core::vector3df vel);
145 145
146 inline bool getLowestRoot(f32 a, f32 b, f32 c, f32 maxR, f32* root); 146 inline bool getLowestRoot(f32 a, f32 b, f32 c, f32 maxR, f32* root);
147 147
148 ISceneManager* SceneManager; 148 ISceneManager* SceneManager;
149 video::IVideoDriver* Driver; 149 video::IVideoDriver* Driver;
150 core::array<core::triangle3df> Triangles; // triangle buffer 150 core::array<core::triangle3df> Triangles; // triangle buffer
151 }; 151 };
152 152
153 153
154} // end namespace scene 154} // end namespace scene
155} // end namespace irr 155} // end namespace irr
156 156
157#endif 157#endif
158 158