ScummVM API documentation
dgCollisionChamferCylinder.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_DGCOLLISIONCHAMFERCYLINDER_H__AS235640FER__INCLUDED_)
23 #define AFX_DGCOLLISIONCHAMFERCYLINDER_H__AS235640FER__INCLUDED_
24 
25 #include "dgCollisionConvex.h"
26 
27 #define DG_CHAMFERCYLINDER_SLICES 4
28 #define DG_CHAMFERCYLINDER_BRAKES 8
29 
30 
32 public:
33  dgCollisionChamferCylinder(dgMemoryAllocator *const allocator, dgUnsigned32 signature, dgFloat32 radius, dgFloat32 height, const dgMatrix &matrix);
34  dgCollisionChamferCylinder(dgWorld *const world, dgDeserialize deserialization, void *const userData);
35  virtual ~dgCollisionChamferCylinder();
36 
37 
38 // private:
39 protected:
40  void Init(dgFloat32 radius, dgFloat32 height);
41 // bool IsInside (const dgPlane& plane, dgVector& point) const;
42 // bool GetPointOnSurface (const dgVector& origin, const dgVector& dir, dgVector& point) const;
43  virtual dgFloat32 RayCast(const dgVector &localP0, const dgVector &localP1, dgContactPoint &contactOut, OnRayPrecastAction preFilter, const dgBody *const body, void *const userData) const;
44  virtual dgFloat32 RayCastSimd(const dgVector &localP0, const dgVector &localP1, dgContactPoint &contactOut, OnRayPrecastAction preFilter, const dgBody *const body, void *const userData) const;
45 
46  virtual dgVector SupportVertex(const dgVector &dir) const;
47  virtual dgVector SupportVertexSimd(const dgVector &dir) const;
48 
49 
50 // dgVector ImplicitCylindexSupport (const dgVector& dir) const;
51 
52  virtual dgInt32 CalculatePlaneIntersection(const dgVector &normal, const dgVector &origin, dgVector *const contactsOut) const;
53  virtual dgInt32 CalculatePlaneIntersectionSimd(const dgVector &normal, const dgVector &point, dgVector *const contactsOut) const;
54 
55 // virtual void DebugCollision (const dgBody& myBody, DebugCollisionMeshCallback callback) const;
56  virtual void DebugCollision(const dgMatrix &matrix, OnDebugCollisionMeshCallback callback, void *const userData) const;
57  virtual dgInt32 CalculateSignature() const;
58  virtual void SetCollisionBBox(const dgVector &p0, const dgVector &p1);
59  virtual void GetCollisionInfo(dgCollisionInfo *info) const;
60  virtual void Serialize(dgSerialize callback, void *const userData) const;
61 
62 private:
63 // dgVector QuatizedSupportVertex (const dgVector& dir) const;
64 // dgVector QuatizedSupportVertexSimd (const dgVector& dir) const;
65 
66  dgFloat32 m_height;
67  dgFloat32 m_radius;
68 
69 // dgFloat32 m_delCosTetha;
70 // dgFloat32 m_delSinTetha;
71 // dgFloat32 m_tethaStep;
72 // dgFloat32 m_tethaStepInv;
73 
74  dgVector m_silhuette[4];
75  dgVector m_vertex[DG_CHAMFERCYLINDER_BRAKES * (DG_CHAMFERCYLINDER_SLICES + 1)];
76  static dgInt32 m_shapeRefCount;
77  static dgConvexSimplexEdge m_edgeArray[];
78 
79  friend class dgWorld;
80 };
81 
82 #endif
83 
Definition: dgCollision.h:73
Definition: dgBody.h:85
Definition: dgCollisionConvex.h:29
Definition: dgVector.h:86
Definition: dgContact.h:88
Definition: dgCollisionConvex.h:39
Definition: dgCollisionChamferCylinder.h:31
Definition: dgMatrix.h:41
Definition: dgMemory.h:80
Definition: dgWorld.h:118