Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
nirt::scene::ITriangleSelector Class Referenceabstract

Interface to return triangles with specific properties. More...

#include <nirtcpp/core/engine/ITriangleSelector.hpp>

Inheritance diagram for nirt::scene::ITriangleSelector:
Inheritance graph
Collaboration diagram for nirt::scene::ITriangleSelector:
Collaboration graph

Public Member Functions

virtual s32 getTriangleCount () const =0
 Get amount of all available triangles in this selector.
 
virtual void getTriangles (core::triangle3df *triangles, s32 arraySize, s32 &outTriangleCount, const core::matrix4 *transform=0, bool useNodeTransform=true, nirt::core::array< SCollisionTriangleRange > *outTriangleInfo=0) const =0
 Gets the triangles for one associated node.
 
virtual void getTriangles (core::triangle3df *triangles, s32 arraySize, s32 &outTriangleCount, const core::aabbox3d< f32 > &box, const core::matrix4 *transform=0, bool useNodeTransform=true, nirt::core::array< SCollisionTriangleRange > *outTriangleInfo=0) const =0
 Gets the triangles for one associated node which may lie within a specific bounding box.
 
virtual void getTriangles (core::triangle3df *triangles, s32 arraySize, s32 &outTriangleCount, const core::line3d< f32 > &line, const core::matrix4 *transform=0, bool useNodeTransform=true, nirt::core::array< SCollisionTriangleRange > *outTriangleInfo=0) const =0
 Gets the triangles for one associated node which have or may have contact with a 3d line.
 
virtual u32 getSelectorCount () const =0
 Get number of TriangleSelectors that are part of this one.
 
virtual ITriangleSelectorgetSelector (u32 index)=0
 Get TriangleSelector based on index based on getSelectorCount.
 
virtual const ITriangleSelectorgetSelector (u32 index) const =0
 Get TriangleSelector based on index based on getSelectorCount.
 
virtual ISceneNodegetSceneNodeForTriangle (u32 triangleIndex) const =0
 Get scene node associated with a given triangle.
 
- Public Member Functions inherited from nirt::IReferenceCounted
 IReferenceCounted ()
 Constructor.
 
virtual ~IReferenceCounted ()
 Destructor.
 
void grab () const
 Grabs the object. Increments the reference counter by one.
 
bool drop () const
 Drops the object. Decrements the reference counter by one.
 
s32 getReferenceCount () const
 Get the reference count.
 
const c8getDebugName () const
 Returns the debug name of the object.
 

Additional Inherited Members

- Protected Member Functions inherited from nirt::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object.
 

Detailed Description

Interface to return triangles with specific properties.

Every ISceneNode may have a triangle selector, available with ISceneNode::getTriangleSelector() or ISceneManager::createTriangleSelector. This is used for doing collision detection: For example if you know, that a collision may have happened in the area between (1,1,1) and (10,10,10), you can get all triangles of the scene node in this area with the ITriangleSelector easily and check every triangle if it collided.

Member Function Documentation

◆ getSceneNodeForTriangle()

virtual ISceneNode * nirt::scene::ITriangleSelector::getSceneNodeForTriangle ( u32  triangleIndex) const
pure virtual

Get scene node associated with a given triangle.

With CMetaTriangleSelector-selectors it's possible to find out a node belonging to a certain triangle index. NOTE: triangleIndex has nothing to do with the order of triangles returned by getTriangles functions! So you can not use this function to find out anything about to which node returned triangles belong. Use STriangleCollisionInfo class for that.

Parameters
triangleIndexthe index of the triangle for which you want to find.
Returns
The scene node associated with that triangle.

◆ getSelector() [1/2]

virtual const ITriangleSelector * nirt::scene::ITriangleSelector::getSelector ( u32  index) const
pure virtual

Get TriangleSelector based on index based on getSelectorCount.

Only useful for MetaTriangleSelector, others return 'this' or 0

◆ getSelector() [2/2]

virtual ITriangleSelector * nirt::scene::ITriangleSelector::getSelector ( u32  index)
pure virtual

Get TriangleSelector based on index based on getSelectorCount.

Only useful for MetaTriangleSelector, others return 'this' or 0

◆ getSelectorCount()

virtual u32 nirt::scene::ITriangleSelector::getSelectorCount ( ) const
pure virtual

Get number of TriangleSelectors that are part of this one.

Only useful for MetaTriangleSelector, others return 1

◆ getTriangles() [1/3]

virtual void nirt::scene::ITriangleSelector::getTriangles ( core::triangle3df triangles,
s32  arraySize,
s32 outTriangleCount,
const core::aabbox3d< f32 > &  box,
const core::matrix4 transform = 0,
bool  useNodeTransform = true,
nirt::core::array< SCollisionTriangleRange > *  outTriangleInfo = 0 
) const
pure virtual

Gets the triangles for one associated node which may lie within a specific bounding box.

This returns all triangles for one scene node associated with this selector. If there is more than one scene node associated (e.g. for an IMetaTriangleSelector) this this function may be called multiple times to retrieve all triangles.

This method will return at least the triangles that intersect the box, but may return other triangles as well.

Parameters
trianglesArray where the resulting triangles will be written to.
arraySizeSize of the target array.
outTriangleCountAmount of triangles which have been written into the array.
boxOnly triangles which are in this axis aligned bounding box will be written into the array.
transformPointer to matrix for transforming the triangles before they are returned. Useful for example to scale all triangles down into an ellipsoid space.
useNodeTransformWhen the selector has a node then transform the triangles by that node's transformation matrix.
outTriangleInfoWhen a pointer to an array is passed then that array is filled with additional information about the returned triangles. One element of SCollisionTriangleRange added for each range of triangles which has distinguishable information. For example one range per meshbuffer.

◆ getTriangles() [2/3]

virtual void nirt::scene::ITriangleSelector::getTriangles ( core::triangle3df triangles,
s32  arraySize,
s32 outTriangleCount,
const core::line3d< f32 > &  line,
const core::matrix4 transform = 0,
bool  useNodeTransform = true,
nirt::core::array< SCollisionTriangleRange > *  outTriangleInfo = 0 
) const
pure virtual

Gets the triangles for one associated node which have or may have contact with a 3d line.

This returns all triangles for one scene node associated with this selector. If there is more than one scene node associated (e.g. for an IMetaTriangleSelector) this this function may be called multiple times to retrieve all triangles.

Please note that unoptimized triangle selectors also may return triangles which are not in contact at all with the 3d line.

Parameters
trianglesArray where the resulting triangles will be written to.
arraySizeSize of the target array.
outTriangleCountAmount of triangles which have been written into the array.
lineOnly triangles which may be in contact with this 3d line will be written into the array.
transformPointer to matrix for transforming the triangles before they are returned. Useful for example to scale all triangles down into an ellipsoid space.
useNodeTransformWhen the selector has a node then transform the triangles by that node's transformation matrix.
outTriangleInfoWhen a pointer to an array is passed then that array is filled with additional information about the returned triangles. One element of SCollisionTriangleRange added for each range of triangles which has distinguishable information. For example one range per meshbuffer.

◆ getTriangles() [3/3]

virtual void nirt::scene::ITriangleSelector::getTriangles ( core::triangle3df triangles,
s32  arraySize,
s32 outTriangleCount,
const core::matrix4 transform = 0,
bool  useNodeTransform = true,
nirt::core::array< SCollisionTriangleRange > *  outTriangleInfo = 0 
) const
pure virtual

Gets the triangles for one associated node.

This returns all triangles for one scene node associated with this selector. If there is more than one scene node associated (e.g. for an IMetaTriangleSelector) this this function may be called multiple times to retrieve all triangles.

Parameters
trianglesArray where the resulting triangles will be written to.
arraySizeSize of the target array.
outTriangleCountAmount of triangles which have been written into the array.
transformPointer to matrix for transforming the triangles before they are returned. Useful for example to scale all triangles down into an ellipsoid space.
useNodeTransformWhen the selector has a node then transform the triangles by that node's transformation matrix.
outTriangleInfoWhen a pointer to an array is passed then that array is filled with additional information about the returned triangles. One element of SCollisionTriangleRange added for each range of triangles which has distinguishable information. For example one range per meshbuffer.

The documentation for this class was generated from the following file:

Nirtcpp    @cppfx.xyz

Esvcpp    esv::print