Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
ISceneCollisionManager.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_SCENE_COLLISION_MANAGER_HPP_INCLUDED
6#define NIRT_I_SCENE_COLLISION_MANAGER_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IReferenceCounted.hpp>
9#include <nirtcpp/core/engine/vector3d.hpp>
10#include <nirtcpp/core/engine/triangle3d.hpp>
11#include <nirtcpp/core/engine/position2d.hpp>
12#include <nirtcpp/core/engine/line3d.hpp>
13
14namespace nirt
15{
16
17namespace scene
18{
19 class ISceneNode;
20 class ICameraSceneNode;
21 class ITriangleSelector;
22 class IMeshBuffer;
23
49
52 {
53 public:
54
56
60 virtual bool getCollisionPoint(SCollisionHit& hitResult, const core::line3d<f32>& ray,
61 ITriangleSelector* selector) = 0;
62
64
76 virtual bool getCollisionPoint(const core::line3d<f32>& ray,
77 ITriangleSelector* selector, core::vector3df& outCollisionPoint,
78 core::triangle3df& outTriangle, ISceneNode*& outNode)
79 {
80 SCollisionHit hitResult;
81 if ( getCollisionPoint(hitResult, ray, selector) )
82 {
83 outCollisionPoint = hitResult.Intersection;
84 outTriangle = hitResult.Triangle;
85 outNode = hitResult.Node;
86 return true;
87 }
88 return false;
89 }
90
92
115 ITriangleSelector* selector,
116 const core::vector3df &ellipsoidPosition,
117 const core::vector3df& ellipsoidRadius,
118 const core::vector3df& ellipsoidDirectionAndSpeed,
119 core::triangle3df& triout,
120 core::vector3df& hitPosition,
121 bool& outFalling,
122 ISceneNode*& outNode,
123 f32 slidingSpeed = 0.0005f,
124 const core::vector3df& gravityDirectionAndSpeed
125 = core::vector3df(0.0f, 0.0f, 0.0f)) = 0;
126
128
135 const core::position2d<s32>& pos, const ICameraSceneNode* camera = 0) = 0;
136
138
153 const core::vector3df& pos, const ICameraSceneNode* camera=0, bool useViewPort=false) = 0;
154
156
172 s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0;
173
175
188 s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0;
189
191
208 s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
209
210
212
239 SCollisionHit& hitResult,
240 const core::line3df& ray,
241 s32 idBitMask = 0,
242 ISceneNode * collisionRootNode = 0,
243 bool noDebugObjects = false) = 0;
244
246
264 const core::line3df& ray,
265 core::vector3df& outCollisionPoint,
266 core::triangle3df& outTriangle,
267 s32 idBitMask = 0,
268 ISceneNode * collisionRootNode = 0,
269 bool noDebugObjects = false)
270 {
271 SCollisionHit hitResult;
272 ISceneNode* node = getSceneNodeAndCollisionPointFromRay(hitResult, ray, idBitMask, collisionRootNode, noDebugObjects);
273 if ( node )
274 {
275 outCollisionPoint = hitResult.Intersection;
276 outTriangle = hitResult.Triangle;
277 }
278 return node;
279 }
280
281 };
282
283} // end namespace scene
284} // end namespace nirt
285
286#endif
Base class of most objects of the Nirtcpp Engine.
Definition IReferenceCounted.hpp:46
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
Scene Node which is a (controllable) camera.
Definition ICameraSceneNode.hpp:24
Class for holding a mesh with a single material.
Definition IMeshBuffer.hpp:41
The Scene Collision Manager provides methods for performing collision tests and picking on scene node...
Definition ISceneCollisionManager.hpp:52
virtual ISceneNode * getSceneNodeAndCollisionPointFromRay(SCollisionHit &hitResult, const core::line3df &ray, s32 idBitMask=0, ISceneNode *collisionRootNode=0, bool noDebugObjects=false)=0
Perform a ray/box and ray/triangle collision check on a hierarchy of scene nodes.
virtual ISceneNode * getSceneNodeFromCameraBB(const ICameraSceneNode *camera, s32 idBitMask=0, bool bNoDebugObjects=false)=0
Get the scene node, which the given camera is looking at and whose id matches the bitmask.
virtual core::vector3df getCollisionResultPosition(ITriangleSelector *selector, const core::vector3df &ellipsoidPosition, const core::vector3df &ellipsoidRadius, const core::vector3df &ellipsoidDirectionAndSpeed, core::triangle3df &triout, core::vector3df &hitPosition, bool &outFalling, ISceneNode *&outNode, f32 slidingSpeed=0.0005f, const core::vector3df &gravityDirectionAndSpeed=core::vector3df(0.0f, 0.0f, 0.0f))=0
Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of th...
virtual ISceneNode * getSceneNodeAndCollisionPointFromRay(const core::line3df &ray, core::vector3df &outCollisionPoint, core::triangle3df &outTriangle, s32 idBitMask=0, ISceneNode *collisionRootNode=0, bool noDebugObjects=false)
Perform a ray/box and ray/triangle collision check on a hierarchy of scene nodes.
Definition ISceneCollisionManager.hpp:263
virtual core::position2d< s32 > getScreenCoordinatesFrom3DPosition(const core::vector3df &pos, const ICameraSceneNode *camera=0, bool useViewPort=false)=0
Calculates 2d screen position from a 3d position.
virtual ISceneNode * getSceneNodeFromRayBB(const core::line3d< f32 > &ray, s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode *root=0)=0
Returns the nearest scene node which collides with a 3d ray and whose id matches a bitmask.
virtual core::line3d< f32 > getRayFromScreenCoordinates(const core::position2d< s32 > &pos, const ICameraSceneNode *camera=0)=0
Returns a 3d ray which would go through the 2d screen coordinates.
virtual bool getCollisionPoint(const core::line3d< f32 > &ray, ITriangleSelector *selector, core::vector3df &outCollisionPoint, core::triangle3df &outTriangle, ISceneNode *&outNode)
Finds the nearest collision point of a line and lots of triangles, if there is one.
Definition ISceneCollisionManager.hpp:76
virtual bool getCollisionPoint(SCollisionHit &hitResult, const core::line3d< f32 > &ray, ITriangleSelector *selector)=0
Finds the nearest collision point of a line and lots of triangles, if there is one.
virtual ISceneNode * getSceneNodeFromScreenCoordinatesBB(const core::position2d< s32 > &pos, s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode *root=0)=0
Gets the scene node, which is currently visible under the given screen coordinates,...
Scene node interface.
Definition ISceneNode.hpp:43
Interface to return triangles with specific properties.
Definition ITriangleSelector.hpp:74
Definition ISceneCollisionManager.hpp:25
ISceneNode * Node
Node which contained the triangle (is 0 when selector doesn't have that information)
Definition ISceneCollisionManager.hpp:37
nirt::u32 MaterialIndex
Index of selected material of the triangle in the SceneNode. Usually only valid when MeshBuffer is al...
Definition ISceneCollisionManager.hpp:43
const IMeshBuffer * MeshBuffer
Meshbuffer which contained the triangle (is 0 when the selector doesn't have that information,...
Definition ISceneCollisionManager.hpp:40
const ITriangleSelector * TriangleSelector
Triangle selector which contained the colliding triangle (useful when having MetaTriangleSelector)
Definition ISceneCollisionManager.hpp:34
core::triangle3df Triangle
Triangle with which we collided.
Definition ISceneCollisionManager.hpp:31
core::vector3df Intersection
Point of collision.
Definition ISceneCollisionManager.hpp:28
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110

Nirtcpp    @cppfx.xyz

Esvcpp    esv::print