ScummVM API documentation
dgAABBPolygonSoup.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 * File Name : Bitmap.C
25 * Visual C++ 4.0 base by Julio Jerez
26 *
27 ****************************************************************************/
28 #ifndef __dgAABBCollisionGeometry0x2341753767__
29 #define __dgAABBCollisionGeometry0x2341753767__
30 
31 #include "dgStdafx.h"
32 #include "dgPolygonSoupDatabase.h"
33 
34 
36 
38 public:
39  dgInt32 GetIndexCount() const {
40  return m_indexCount;
41  }
42 
43  dgInt32 *GetIndexPool() const {
44  return m_indices;
45  }
46 
47  virtual void GetAABB(dgVector &p0, dgVector &p1) const;
48  virtual void Serialize(dgSerialize callback, void *const userData) const;
49  virtual void Deserialize(dgDeserialize callback, void *const userData);
50 
51 protected:
54 
55  void *GetRootNode() const;
56  const void *GetBackNode(const void *const root) const;
57  const void *GetFrontNode(const void *const root) const;
58  void GetNodeAABB(const void *const root, dgVector &p0, dgVector &p1) const;
59 
60  void Create(const dgPolygonSoupDatabaseBuilder &builder, bool optimizedBuild);
61  virtual void ForAllSectors(const dgVector &min, const dgVector &max, dgAABBIntersectCallback callback, void *const context) const;
62  virtual void ForAllSectorsSimd(const dgVector &min, const dgVector &max, dgAABBIntersectCallback callback, void *const context) const;
63  virtual void ForAllSectorsRayHit(const dgFastRayTest &ray, dgRayIntersectCallback callback, void *const context) const;
64  virtual void ForAllSectorsRayHitSimd(const dgFastRayTest &ray, dgRayIntersectCallback callback, void *const context) const;
65  virtual dgVector ForAllSectorsSupportVectex(const dgVector &dir) const;
66 
67  dgFloat32 CalculateFaceMaxSize(dgTriplex *const vertex, dgInt32 indexCount, const dgInt32 *const indexArray) const;
68 
69 private:
70  static dgIntersectStatus CalculateThisFaceEdgeNormals(void *context, const dgFloat32 *const polygon, dgInt32 strideInBytes, const dgInt32 *const indexArray, dgInt32 indexCount);
71  static dgIntersectStatus CalculateAllFaceEdgeNormals(void *context, const dgFloat32 *const polygon, dgInt32 strideInBytes, const dgInt32 *const indexArray, dgInt32 indexCount);
72 
73 
74  dgInt32 m_nodesCount;
75  dgInt32 m_indexCount;
76  dgInt32 *m_indices;
77  void *m_aabb;
78 
79 };
80 
81 
82 
83 #endif
Definition: dgPolygonSoupDatabase.h:40
Definition: dgIntersections.h:35
Definition: dgVector.h:86
Definition: dgPolygonSoupBuilder.h:45
Definition: dgAABBPolygonSoup.h:37
Definition: dgTypes.h:70