#include <coldetimpl.h>
Inheritance diagram for CollisionModel3DImpl:
Public Types | |
enum | { Models, Ray, Sphere } |
Public Methods | |
CollisionModel3DImpl (bool Static) | |
void | setTriangleNumber (int num) |
void | addTriangle (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) |
void | addTriangle (float v1[3], float v2[3], float v3[3]) |
void | addTriangle (const Vector3D& v1, const Vector3D& v2, const Vector3D& v3) |
void | finalize () |
void | setTransform (float m[16]) |
void | setTransform (const Matrix3D& m) |
bool | collision (CollisionModel3D* other, int AccuracyDepth, int MaxProcessingTime, float* other_transform) |
bool | rayCollision (float origin[3], float direction[3], bool closest, float segmin, float segmax) |
bool | sphereCollision (float origin[3], float radius) |
bool | getCollidingTriangles (float t1[9], float t2[9], bool ModelSpace) |
bool | getCollidingTriangles (int& t1, int& t2) |
bool | getCollisionPoint (float p[3], bool ModelSpace) |
int | getTriangleIndex (BoxedTriangle* bt) |
Public Attributes | |
std::vector<BoxedTriangle> | m_Triangles |
BoxTreeInnerNode | m_Root |
Matrix3D | m_Transform |
Matrix3D | m_InvTransform |
Triangle | m_ColTri1 |
Triangle | m_ColTri2 |
int | m_iColTri1 |
int | m_iColTri2 |
Vector3D | m_ColPoint |
enum CollisionModel3DImpl:: { ... } | m_ColType |
bool | m_Final |
bool | m_Static |
|
Type of the last collision test |
|
|
|
|
|
Reimplemented from CollisionModel3D. |
|
Use any of the forms of this functions to enter the coordinates of the model's triangles. Reimplemented from CollisionModel3D. |
|
Check for collision with another model. Do not mix model types here. MaxProcessingTime determines the maximum time in milliseconds to check for collision. If a rejection is not found by that time, the function will return true. AccuracyDepth is not yet supported. other_transform allows overriding the other model's transform, by supplying an alternative one. This can be useful when testing a model against itself with different orientations. Reimplemented from CollisionModel3D. |
|
All triangles have been added, process model. Reimplemented from CollisionModel3D. |
|
Retrieve the pair of triangles indices that collided. Only valid after a call to collision() that returned true. t1 belongs to _this_ model, while t2 is in the other one. Reimplemented from CollisionModel3D. |
|
Retrieve the pair of triangles that collided. Only valid after a call to collision() that returned true. t1 is this model's triangle and t2 is the other one. In case of ray or sphere collision, only t1 will be valid. The coordinates will be in _this_ model's coordinate space, unless ModelSpace is false, in which case, coordinates will be transformed by the model's current transform to world space. Reimplemented from CollisionModel3D. |
|
Retrieve the detected collision point. Only valid after a call to collision() that returned true. The coordinates will be in _this_ model's coordinate space, unless ModelSpace is false, in which case, coordinates will be transformed by the model's current transform to world space. Reimplemented from CollisionModel3D. |
|
|
|
Returns true if the ray given in world space coordinates intersects with the object. getCollidingTriangles() and getCollisionPoint() can be used to retrieve information about a collision. If closest if false, the first triangle that collides with the ray is used. Otherwise the closest one will be used. Closest triangle searching will slow the test considerably. The default ray is a standard infinite ray. However, using segmin and segmax you can define a line segment along the ray. Reimplemented from CollisionModel3D. |
|
|
|
The the current affine matrix for the model. See transform.txt for format information Reimplemented from CollisionModel3D. |
|
Optional: Optimization for construction speed. If you know the number of triangles. Reimplemented from CollisionModel3D. |
|
Returns true if the given sphere collides with the model. getCollidingTriangles() and getCollisionPoint() can be used to retrieve information about a collision. Reimplemented from CollisionModel3D. |
|
The collision point of the last test |
|
The triangles that last collided |
|
The triangles that last collided |
|
Type of the last collision test |
|
Flag for indicating the model is finalized. |
|
The current transform and its inverse |
|
Root of the hierarchy tree |
|
Static models will maintain the same transform for a while so the inverse transform is calculated each set instead of in the collision test. |
|
The current transform and its inverse |
|
Stores all the actual triangles. Other objects will use pointers into this array. |
|
The indices of the triangles that last collided |
|
The indices of the triangles that last collided |