ScummVM API documentation
dgCollisionBox.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_DGCOLLISIONBOX_H__364692C2_5F23_41AE_A167_7A92E2D2DA5F__INCLUDED_)
23 #define AFX_DGCOLLISIONBOX_H__364692C2_5F23_41AE_A167_7A92E2D2DA5F__INCLUDED_
24 
25 
26 #include "dgCollisionConvex.h"
27 
28 class dgCollisionBox;
29 
30 
32 public:
33 
34  dgCollisionBox(dgMemoryAllocator *const allocator, dgUnsigned32 signature, dgFloat32 size_x, dgFloat32 size_y, dgFloat32 size_z, const dgMatrix &matrix);
35  dgCollisionBox(dgWorld *const world, dgDeserialize deserialization, void *const userData);
36  virtual ~dgCollisionBox();
37 
38 protected:
39  void Init(dgFloat32 size_x, dgFloat32 size_y, dgFloat32 size_z);
40  virtual void CalcAABB(const dgMatrix &matrix, dgVector &p0, dgVector &p1) const;
41  virtual void CalcAABBSimd(const dgMatrix &matrix, dgVector &p0, dgVector &p1) const;
42  virtual dgFloat32 RayCast(const dgVector &localP0, const dgVector &localP1, dgContactPoint &contactOut, OnRayPrecastAction preFilter, const dgBody *const body, void *const userData) const;
43  virtual dgFloat32 RayCastSimd(const dgVector &localP0, const dgVector &localP1, dgContactPoint &contactOut, OnRayPrecastAction preFilter, const dgBody *const body, void *const userData) const;
44 
45  virtual dgVector SupportVertex(const dgVector &dir) const;
46  virtual dgVector SupportVertexSimd(const dgVector &dir) const;
47 
48  virtual dgInt32 CalculatePlaneIntersection(const dgVector &normal, const dgVector &point, dgVector *const contactsOut) const;
49  virtual dgInt32 CalculatePlaneIntersectionSimd(const dgVector &normal, const dgVector &point, dgVector *const contactsOut) const;
50 
51  virtual dgInt32 CalculateSignature() const;
52  virtual void SetCollisionBBox(const dgVector &p0, const dgVector &p1);
53  virtual dgFloat32 CalculateMassProperties(dgVector &inertia, dgVector &crossInertia, dgVector &centerOfMass) const;
54 
55  virtual void GetCollisionInfo(dgCollisionInfo *info) const;
56  virtual void Serialize(dgSerialize callback, void *const userData) const;
57 
58  virtual void SetBreakImpulse(dgFloat32 force);
59  virtual dgFloat32 GetBreakImpulse() const;
60 
61 
62  dgVector m_size[2];
63  dgVector m_vertex[8];
64  dgVector m_vertex_sse[6];
65  dgFloat32 m_destructionImpulse;
66 
67  static dgConvexSimplexEdge m_edgeArray[];
68  friend class dgWorld;
69 };
70 
71 #endif // !defined(AFX_DGCOLLISIONBOX_H__364692C2_5F23_41AE_A167_7A92E2D2DA5F__INCLUDED_)
72 
Definition: dgCollision.h:73
Definition: dgBody.h:85
Definition: dgCollisionConvex.h:29
Definition: dgVector.h:86
Definition: dgContact.h:88
Definition: dgCollisionBox.h:31
Definition: dgCollisionConvex.h:39
Definition: dgMatrix.h:41
Definition: dgMemory.h:80
Definition: dgWorld.h:118