ScummVM API documentation
dgPolygonSoupDatabase.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 /****************************************************************************
23 *
24 * Visual C++ 6.0 created by: Julio Jerez
25 *
26 ****************************************************************************/
27 #ifndef __dgPolygonSoupDatabase0x23413452233__
28 #define __dgPolygonSoupDatabase0x23413452233__
29 
30 
31 #include "dgStdafx.h"
32 #include "dgRef.h"
33 #include "dgArray.h"
34 #include "dgIntersections.h"
35 
36 class dgMatrix;
37 
38 
39 
40 class dgPolygonSoupDatabase { //: public dgRef
41 public:
42  dgFloat32 GetRadius() const;
43  dgInt32 GetVertexCount() const;
44  dgInt32 GetStrideInBytes() const;
45  dgFloat32 *GetLocalVertexPool() const;
46 
47  dgUnsigned32 GetTagId(const dgInt32 *face) const;
48  void SetTagId(const dgInt32 *face, dgUnsigned32 newID) const;
49 
50  virtual void Serialize(dgSerialize callback, void *const userData) const = 0;
51  virtual void Deserialize(dgDeserialize callback, void *const userData) = 0;
52 
53 
54  virtual void GetAABB(dgVector &p0, dgVector &p1) const;
55 // bool RayTest (const dgVector& p0, const dgVector& p1) const;
56 // dgFloat32 RayHit (const dgVector& p0, const dgVector& p1, dgVector& unNormalizeNormal) const;
57 
58 
59 protected:
60  virtual void ForAllSectors(const dgVector &min, const dgVector &max, dgAABBIntersectCallback callback, void *const context) const;
61  virtual void ForAllSectorsSimd(const dgVector &min, const dgVector &max, dgAABBIntersectCallback callback, void *const context) const;
62  virtual void ForAllSectorsRayHit(const dgFastRayTest &ray, dgRayIntersectCallback callback, void *const context) const;
63  virtual void ForAllSectorsRayHitSimd(const dgFastRayTest &ray, dgRayIntersectCallback callback, void *const context) const;
64 
65  dgPolygonSoupDatabase(const char *name = NULL);
66  virtual ~dgPolygonSoupDatabase();
67 
68 // dgAddRtti(dgRef);
69 
70  dgInt32 m_vertexCount;
71  dgInt32 m_strideInBytes;
72  dgFloat32 *m_localVertex;
73 };
74 
75 
76 inline dgPolygonSoupDatabase::dgPolygonSoupDatabase(const char *name)
77 // :dgRef(name)
78 {
79  m_vertexCount = 0;
80  m_strideInBytes = 0;
81  m_localVertex = NULL;
82 }
83 
84 inline dgPolygonSoupDatabase::~dgPolygonSoupDatabase() {
85  if (m_localVertex) {
86  dgFreeStack(m_localVertex);
87  }
88 }
89 
90 
91 inline dgUnsigned32 dgPolygonSoupDatabase::GetTagId(const dgInt32 *face) const {
92  return dgUnsigned32(face[-1]);
93 }
94 
95 inline void dgPolygonSoupDatabase::SetTagId(const dgInt32 *facePtr, dgUnsigned32 newID) const {
96  dgUnsigned32 *face;
97  face = const_cast<dgUnsigned32 *>((const dgUnsigned32 *)facePtr);
98  face[-1] = newID;
99 }
100 
101 inline dgInt32 dgPolygonSoupDatabase::GetVertexCount() const {
102  return m_vertexCount;
103 }
104 
105 inline dgFloat32 *dgPolygonSoupDatabase::GetLocalVertexPool() const {
106  return m_localVertex;
107 }
108 
109 inline dgInt32 dgPolygonSoupDatabase::GetStrideInBytes() const {
110  return m_strideInBytes;
111 }
112 
113 inline dgFloat32 dgPolygonSoupDatabase::GetRadius() const {
114  return 0.0f;
115 }
116 
117 inline void dgPolygonSoupDatabase::ForAllSectorsSimd(const dgVector &min, const dgVector &max, dgAABBIntersectCallback callback, void *const context) const {
118  NEWTON_ASSERT(0);
119 }
120 
121 
122 
123 inline void dgPolygonSoupDatabase::ForAllSectors(const dgVector &min, const dgVector &max, dgAABBIntersectCallback callback, void *const context) const {
124  NEWTON_ASSERT(0);
125 }
126 
127 
128 inline void dgPolygonSoupDatabase::GetAABB(dgVector &p0, dgVector &p1) const {
129 }
130 
131 
132 inline void dgPolygonSoupDatabase::ForAllSectorsRayHit(const dgFastRayTest &ray, dgRayIntersectCallback callback, void *const context) const {
133  NEWTON_ASSERT(0);
134 }
135 
136 inline void dgPolygonSoupDatabase::ForAllSectorsRayHitSimd(const dgFastRayTest &ray, dgRayIntersectCallback callback, void *const context) const {
137  NEWTON_ASSERT(0);
138 }
139 
140 #endif
Definition: dgPolygonSoupDatabase.h:40
Definition: dgIntersections.h:35
Definition: dgVector.h:86
Definition: dgMatrix.h:41