ScummVM API documentation
dgCollisionConvexHull.h
1 /* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #if !defined(AFX_DGCOLLISIONCONVEXHULL_H__AS235640FER__INCLUDED_)
23 #define AFX_DGCOLLISIONCONVEXHULL_H__AS235640FER__INCLUDED_
24 
25 #include "dgCollisionConvex.h"
26 
27 
29 public:
30  dgCollisionConvexHull(dgMemoryAllocator *const allocator, dgUnsigned32 signature, dgInt32 count, dgInt32 strideInBytes, dgFloat32 tolerance, const dgFloat32 *vertexArray, const dgMatrix &matrix);
31  dgCollisionConvexHull(dgWorld *const world, dgDeserialize deserialization, void *const userData);
32  virtual ~dgCollisionConvexHull();
33 
34  dgInt32 GetFaceIndices(dgInt32 index, dgInt32 *indices) const;
35 private:
36 
37  bool Create(dgInt32 count, dgInt32 strideInBytes, const dgFloat32 *const vertexArray, dgFloat32 tolerance);
38 
39  bool RemoveCoplanarEdge(dgPolyhedra &convex, const dgBigVector *const hullVertexArray) const;
40  dgBigVector FaceNormal(const dgEdge *face, const dgBigVector *const pool) const;
41  bool CheckConvex(dgPolyhedra &polyhedra, const dgBigVector *hullVertexArray) const;
42 
43  virtual dgInt32 CalculateSignature() const;
44  virtual void SetCollisionBBox(const dgVector &p0, const dgVector &p1);
45  virtual void DebugCollision(const dgMatrix &matrix, OnDebugCollisionMeshCallback callback, void *const userData) const;
46  virtual void GetCollisionInfo(dgCollisionInfo *info) const;
47  virtual void Serialize(dgSerialize callback, void *const userData) const;
48  virtual bool OOBBTest(const dgMatrix &matrix, const dgCollisionConvex *const shape, void *const cacheOrder) const;
49 
50  virtual void SetBreakImpulse(dgFloat32 force);
51  virtual dgFloat32 GetBreakImpulse() const;
52 
53  dgFloat32 m_destructionImpulse;
54  dgInt32 m_faceCount;
55  dgInt32 m_boundPlanesCount;
56  dgConvexSimplexEdge **m_faceArray;
57 
58  friend class dgWorld;
59  friend class dgCollisionConvex;
60 };
61 
62 #endif
63 
Definition: dgCollision.h:73
Definition: dgCollisionConvex.h:29
Definition: dgVector.h:86
Definition: dgPolyhedra.h:61
Definition: dgPolyhedra.h:76
Definition: dgCollisionConvex.h:39
Definition: dgMatrix.h:41
Definition: dgMemory.h:80
Definition: dgWorld.h:118
Definition: dgCollisionConvexHull.h:28
Definition: dgVector.h:104