24 #ifndef GIMPACT_TRIANGLE_SHAPE_EX_H 25 #define GIMPACT_TRIANGLE_SHAPE_EX_H 33 #define MAX_TRI_CLIPPING 16 82 btVector3 normal = (m_vertices[1] - m_vertices[0]).cross(m_vertices[2] - m_vertices[0]);
84 m_plane.
setValue(normal[0], normal[1], normal[2], m_vertices[0].
dot(normal));
96 const btVector3& e0 = m_vertices[edge_index];
97 const btVector3& e1 = m_vertices[(edge_index + 1) % 3];
103 m_vertices[0] = t(m_vertices[0]);
104 m_vertices[1] = t(m_vertices[1]);
105 m_vertices[2] = t(m_vertices[2]);
147 btAABB trianglebox(tv0, tv1, tv2, m_collisionMargin);
148 aabbMin = trianglebox.
m_min;
149 aabbMax = trianglebox.
m_max;
154 m_vertices1[0] = t(m_vertices1[0]);
155 m_vertices1[1] = t(m_vertices1[1]);
156 m_vertices1[2] = t(m_vertices1[2]);
161 btVector3 normal = (m_vertices1[1] - m_vertices1[0]).cross(m_vertices1[2] - m_vertices1[0]);
163 plane.
setValue(normal[0], normal[1], normal[2], m_vertices1[0].
dot(normal));
169 #endif //GIMPACT_TRIANGLE_MESH_SHAPE_H btTriangleShapeEx(const btVector3 &p0, const btVector3 &p1, const btVector3 &p2)
Helper class for colliding Bullet Triangle Shapes.
void bt_edge_plane(const btVector3 &e1, const btVector3 &e2, const btVector3 &normal, btVector4 &plane)
Calc a plane from a triangle edge an a normal. plane is a vec4f.
void get_edge_plane(int edge_index, btVector4 &plane) const
Calcs the plane which is paralele to the edge and perpendicular to the triangle plane.
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
getAabb's default implementation is brute force, expected derived classes to implement a fast dedicat...
void applyTransform(const btTransform &t)
#define SIMD_FORCE_INLINE
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
btVector3 can be used to represent 3D points and vectors.
void buildTriPlane(btVector4 &plane) const
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
btTriangleShapeEx(const btTriangleShapeEx &other)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void applyTransform(const btTransform &t)
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
Set x,y,z and zero w.