diff options
Diffstat (limited to 'libraries/irrlicht-1.8.1/include/ISceneCollisionManager.h')
-rw-r--r-- | libraries/irrlicht-1.8.1/include/ISceneCollisionManager.h | 205 |
1 files changed, 0 insertions, 205 deletions
diff --git a/libraries/irrlicht-1.8.1/include/ISceneCollisionManager.h b/libraries/irrlicht-1.8.1/include/ISceneCollisionManager.h deleted file mode 100644 index 5da7d9f..0000000 --- a/libraries/irrlicht-1.8.1/include/ISceneCollisionManager.h +++ /dev/null | |||
@@ -1,205 +0,0 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #ifndef __I_SCENE_COLLISION_MANAGER_H_INCLUDED__ | ||
6 | #define __I_SCENE_COLLISION_MANAGER_H_INCLUDED__ | ||
7 | |||
8 | #include "IReferenceCounted.h" | ||
9 | #include "vector3d.h" | ||
10 | #include "triangle3d.h" | ||
11 | #include "position2d.h" | ||
12 | #include "line3d.h" | ||
13 | |||
14 | namespace irr | ||
15 | { | ||
16 | |||
17 | namespace scene | ||
18 | { | ||
19 | class ISceneNode; | ||
20 | class ICameraSceneNode; | ||
21 | class ITriangleSelector; | ||
22 | |||
23 | //! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes. | ||
24 | class ISceneCollisionManager : public virtual IReferenceCounted | ||
25 | { | ||
26 | public: | ||
27 | |||
28 | //! Finds the nearest collision point of a line and lots of triangles, if there is one. | ||
29 | /** \param ray: Line with which collisions are tested. | ||
30 | \param selector: TriangleSelector containing the triangles. It | ||
31 | can be created for example using | ||
32 | ISceneManager::createTriangleSelector() or | ||
33 | ISceneManager::createTriangleOctreeSelector(). | ||
34 | \param outCollisionPoint: If a collision is detected, this will | ||
35 | contain the position of the nearest collision to the line-start. | ||
36 | \param outTriangle: If a collision is detected, this will | ||
37 | contain the triangle with which the ray collided. | ||
38 | \param outNode: If a collision is detected, this will contain | ||
39 | the scene node associated with the triangle that was hit. | ||
40 | \return True if a collision was detected and false if not. */ | ||
41 | virtual bool getCollisionPoint(const core::line3d<f32>& ray, | ||
42 | ITriangleSelector* selector, core::vector3df& outCollisionPoint, | ||
43 | core::triangle3df& outTriangle, ISceneNode*& outNode) =0; | ||
44 | |||
45 | //! Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of the ellipsoid. | ||
46 | /** This can be used for moving a character in a 3d world: The | ||
47 | character will slide at walls and is able to walk up stairs. | ||
48 | The method used how to calculate the collision result position | ||
49 | is based on the paper "Improved Collision detection and | ||
50 | Response" by Kasper Fauerby. | ||
51 | \param selector: TriangleSelector containing the triangles of | ||
52 | the world. It can be created for example using | ||
53 | ISceneManager::createTriangleSelector() or | ||
54 | ISceneManager::createTriangleOctreeSelector(). | ||
55 | \param ellipsoidPosition: Position of the ellipsoid. | ||
56 | \param ellipsoidRadius: Radius of the ellipsoid. | ||
57 | \param ellipsoidDirectionAndSpeed: Direction and speed of the | ||
58 | movement of the ellipsoid. | ||
59 | \param triout: Optional parameter where the last triangle | ||
60 | causing a collision is stored, if there is a collision. | ||
61 | \param hitPosition: Return value for the position of the collision | ||
62 | \param outFalling: Is set to true if the ellipsoid is falling | ||
63 | down, caused by gravity. | ||
64 | \param outNode: the node with which the ellipoid collided (if any) | ||
65 | \param slidingSpeed: DOCUMENTATION NEEDED. | ||
66 | \param gravityDirectionAndSpeed: Direction and force of gravity. | ||
67 | \return New position of the ellipsoid. */ | ||
68 | virtual core::vector3df getCollisionResultPosition( | ||
69 | ITriangleSelector* selector, | ||
70 | const core::vector3df &ellipsoidPosition, | ||
71 | const core::vector3df& ellipsoidRadius, | ||
72 | const core::vector3df& ellipsoidDirectionAndSpeed, | ||
73 | core::triangle3df& triout, | ||
74 | core::vector3df& hitPosition, | ||
75 | bool& outFalling, | ||
76 | ISceneNode*& outNode, | ||
77 | f32 slidingSpeed = 0.0005f, | ||
78 | const core::vector3df& gravityDirectionAndSpeed | ||
79 | = core::vector3df(0.0f, 0.0f, 0.0f)) = 0; | ||
80 | |||
81 | //! Returns a 3d ray which would go through the 2d screen coodinates. | ||
82 | /** \param pos: Screen coordinates in pixels. | ||
83 | \param camera: Camera from which the ray starts. If null, the | ||
84 | active camera is used. | ||
85 | \return Ray starting from the position of the camera and ending | ||
86 | at a length of the far value of the camera at a position which | ||
87 | would be behind the 2d screen coodinates. */ | ||
88 | virtual core::line3d<f32> getRayFromScreenCoordinates( | ||
89 | const core::position2d<s32>& pos, ICameraSceneNode* camera = 0) = 0; | ||
90 | |||
91 | //! Calculates 2d screen position from a 3d position. | ||
92 | /** \param pos: 3D position in world space to be transformed | ||
93 | into 2d. | ||
94 | \param camera: Camera to be used. If null, the currently active | ||
95 | camera is used. | ||
96 | \param useViewPort: Calculate screen coordinates relative to | ||
97 | the current view port. Please note that unless the driver does | ||
98 | not take care of the view port, it is usually best to get the | ||
99 | result in absolute screen coordinates (flag=false). | ||
100 | \return 2d screen coordinates which a object in the 3d world | ||
101 | would have if it would be rendered to the screen. If the 3d | ||
102 | position is behind the camera, it is set to (-1000,-1000). In | ||
103 | most cases you can ignore this fact, because if you use this | ||
104 | method for drawing a decorator over a 3d object, it will be | ||
105 | clipped by the screen borders. */ | ||
106 | virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition( | ||
107 | const core::vector3df& pos, ICameraSceneNode* camera=0, bool useViewPort=false) = 0; | ||
108 | |||
109 | //! Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera. | ||
110 | /** The collision tests are done using a bounding box for each | ||
111 | scene node. You can limit the recursive search so just all children of the specified root are tested. | ||
112 | \param pos: Position in pixel screen coordinates, under which | ||
113 | the returned scene node will be. | ||
114 | \param idBitMask: Only scene nodes with an id with bits set | ||
115 | like in this mask will be tested. If the BitMask is 0, this | ||
116 | feature is disabled. | ||
117 | Please note that the default node id of -1 will match with | ||
118 | every bitmask != 0 | ||
119 | \param bNoDebugObjects: Doesn't take debug objects into account | ||
120 | when true. These are scene nodes with IsDebugObject() = true. | ||
121 | \param root If different from 0, the search is limited to the children of this node. | ||
122 | \return Visible scene node under screen coordinates with | ||
123 | matching bits in its id. If there is no scene node under this | ||
124 | position, 0 is returned. */ | ||
125 | virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(const core::position2d<s32>& pos, | ||
126 | s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0; | ||
127 | |||
128 | //! Returns the nearest scene node which collides with a 3d ray and whose id matches a bitmask. | ||
129 | /** The collision tests are done using a bounding box for each | ||
130 | scene node. The recursive search can be limited be specifying a scene node. | ||
131 | \param ray Line with which collisions are tested. | ||
132 | \param idBitMask Only scene nodes with an id which matches at | ||
133 | least one of the bits contained in this mask will be tested. | ||
134 | However, if this parameter is 0, then all nodes are checked. | ||
135 | \param bNoDebugObjects: Doesn't take debug objects into account when true. These | ||
136 | are scene nodes with IsDebugObject() = true. | ||
137 | \param root If different from 0, the search is limited to the children of this node. | ||
138 | \return Scene node nearest to ray.start, which collides with | ||
139 | the ray and matches the idBitMask, if the mask is not null. If | ||
140 | no scene node is found, 0 is returned. */ | ||
141 | virtual ISceneNode* getSceneNodeFromRayBB(const core::line3d<f32>& ray, | ||
142 | s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0; | ||
143 | |||
144 | //! Get the scene node, which the given camera is looking at and whose id matches the bitmask. | ||
145 | /** A ray is simply casted from the position of the camera to | ||
146 | the view target position, and all scene nodes are tested | ||
147 | against this ray. The collision tests are done using a bounding | ||
148 | box for each scene node. | ||
149 | \param camera: Camera from which the ray is casted. | ||
150 | \param idBitMask: Only scene nodes with an id which matches at least one of the | ||
151 | bits contained in this mask will be tested. However, if this parameter is 0, then | ||
152 | all nodes are checked. | ||
153 | feature is disabled. | ||
154 | Please note that the default node id of -1 will match with | ||
155 | every bitmask != 0 | ||
156 | \param bNoDebugObjects: Doesn't take debug objects into account | ||
157 | when true. These are scene nodes with IsDebugObject() = true. | ||
158 | \return Scene node nearest to the camera, which collides with | ||
159 | the ray and matches the idBitMask, if the mask is not null. If | ||
160 | no scene node is found, 0 is returned. */ | ||
161 | virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera, | ||
162 | s32 idBitMask=0, bool bNoDebugObjects = false) = 0; | ||
163 | |||
164 | //! Perform a ray/box and ray/triangle collision check on a heirarchy of scene nodes. | ||
165 | /** This checks all scene nodes under the specified one, first by ray/bounding | ||
166 | box, and then by accurate ray/triangle collision, finding the nearest collision, | ||
167 | and the scene node containg it. It returns the node hit, and (via output | ||
168 | parameters) the position of the collision, and the triangle that was hit. | ||
169 | |||
170 | All scene nodes in the hierarchy tree under the specified node are checked. Only | ||
171 | nodes that are visible, with an ID that matches at least one bit in the supplied | ||
172 | bitmask, and which have a triangle selector are considered as candidates for being hit. | ||
173 | You do not have to build a meta triangle selector; the individual triangle selectors | ||
174 | of each candidate scene node are used automatically. | ||
175 | |||
176 | \param ray: Line with which collisions are tested. | ||
177 | \param outCollisionPoint: If a collision is detected, this will contain the | ||
178 | position of the nearest collision. | ||
179 | \param outTriangle: If a collision is detected, this will contain the triangle | ||
180 | with which the ray collided. | ||
181 | \param idBitMask: Only scene nodes with an id which matches at least one of the | ||
182 | bits contained in this mask will be tested. However, if this parameter is 0, then | ||
183 | all nodes are checked. | ||
184 | \param collisionRootNode: the scene node at which to begin checking. Only this | ||
185 | node and its children will be checked. If you want to check the entire scene, | ||
186 | pass 0, and the root scene node will be used (this is the default). | ||
187 | \param noDebugObjects: when true, debug objects are not considered viable targets. | ||
188 | Debug objects are scene nodes with IsDebugObject() = true. | ||
189 | \return Returns the scene node containing the hit triangle nearest to ray.start. | ||
190 | If no collision is detected, then 0 is returned. */ | ||
191 | virtual ISceneNode* getSceneNodeAndCollisionPointFromRay( | ||
192 | core::line3df ray, | ||
193 | core::vector3df & outCollisionPoint, | ||
194 | core::triangle3df & outTriangle, | ||
195 | s32 idBitMask = 0, | ||
196 | ISceneNode * collisionRootNode = 0, | ||
197 | bool noDebugObjects = false) = 0; | ||
198 | }; | ||
199 | |||
200 | |||
201 | } // end namespace scene | ||
202 | } // end namespace irr | ||
203 | |||
204 | #endif | ||
205 | |||