ScummVM API documentation
dgCollisionConvexModifier.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_DGCOLLISIONCONVEX_MODIFIER_H__4969D514_69A9_4D96_82B2_E5B0EA3D413F__INCLUDED_)
23 #define AFX_DGCOLLISIONCONVEX_MODIFIER_H__4969D514_69A9_4D96_82B2_E5B0EA3D413F__INCLUDED_
24 
25 
26 
27 
28 
29 #include "dgCollisionConvex.h"
30 
31 
33 public:
35  dgCollisionConvexModifier(dgWorld *const world, dgDeserialize deserialization, void *const userData);
36  virtual ~dgCollisionConvexModifier();
37 
38  virtual dgMatrix ModifierGetMatrix() const;
39  virtual void ModifierSetMatrix(const dgMatrix &matrix);
40 
41 protected:
42  virtual dgFloat32 GetVolume() const;
43  virtual bool OOBBTest(const dgMatrix &matrix, const dgCollisionConvex *const shape, void *const cacheOrder) const;
44 
45  virtual dgVector SupportVertex(const dgVector &dir) const;
46  virtual dgVector SupportVertexSimd(const dgVector &dir) const;
47 
48  virtual void CalcAABB(const dgMatrix &matrix, dgVector &p0, dgVector &p1) const;
49  virtual void CalcAABBSimd(const dgMatrix &matrix, dgVector &p0, dgVector &p1) const;
50 // virtual void DebugCollision (const dgBody& myBody, DebugCollisionMeshCallback callback) const;
51  virtual void DebugCollision(const dgMatrix &matrix, OnDebugCollisionMeshCallback callback, void *const userData) const;
52  virtual dgFloat32 RayCast(const dgVector &localP0, const dgVector &localP1, dgContactPoint &contactOut, OnRayPrecastAction preFilter, const dgBody *const body, void *const userData) const;
53  virtual dgFloat32 RayCastSimd(const dgVector &localP0, const dgVector &localP1, dgContactPoint &contactOut, OnRayPrecastAction preFilter, const dgBody *const body, void *const userData) const;
54 
55  virtual dgVector CalculateVolumeIntegral(const dgMatrix &globalMatrix, GetBuoyancyPlane bouyancyPlane, void *const context) const;
56 
57 private:
58  virtual dgInt32 CalculateSignature() const;
59  virtual void SetCollisionBBox(const dgVector &p0, const dgVector &p1);
60 
61  virtual dgFloat32 GetBoxMinRadius() const;
62  virtual dgFloat32 GetBoxMaxRadius() const;
63 
64  virtual dgInt32 CalculatePlaneIntersection(const dgVector &normal, const dgVector &point, dgVector *const contactsOut) const;
65  virtual dgInt32 CalculatePlaneIntersectionSimd(const dgVector &normal, const dgVector &point, dgVector *const contactsOut) const;
66 
67  virtual void GetCollisionInfo(dgCollisionInfo *info) const;
68  virtual void Serialize(dgSerialize callback, void *const userData) const;
69 
70 
71  dgMatrix m_modifierMatrix;
72  dgMatrix m_modifierInvMatrix;
73 
74  dgWorld *m_world;
75  dgCollisionConvex *m_convexCollision;
76  dgFloat32 m_det;
77 
78 
79  friend class dgCollisionCompound;
80 };
81 
82 
83 #endif
84 
Definition: dgCollision.h:73
Definition: dgBody.h:85
Definition: dgVector.h:86
Definition: dgContact.h:88
Definition: dgCollisionConvex.h:39
Definition: dgCollisionConvexModifier.h:32
Definition: dgMatrix.h:41
Definition: dgWorld.h:118
Definition: dgCollisionCompound.h:31