My Project: dynamics.mod/NewtonDynamics/source/core/dgPolygonSoupDatabase.h Source File

My Project

dgPolygonSoupDatabase.h
Go to the documentation of this file.
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 __dgPolygonSoupDatabase_H_
28 #define __dgPolygonSoupDatabase_H_
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
41 {
42 public:
43 dgFloat32 GetRadius() const;
44 dgInt32 GetVertexCount() const;
45 dgInt32 GetStrideInBytes() const;
46 dgFloat32* GetLocalVertexPool() const;
47
48 dgUnsigned32 GetTagId(const dgInt32* const face, dgInt32 indexCount) const;
49 void SetTagId(const dgInt32* const face, dgInt32 indexCount, dgUnsigned32 newID) const;
50
51 virtual void Serialize (dgSerialize callback, void* const userData) const = 0;
52 virtual void Deserialize (dgDeserialize callback, void* const userData) = 0;
53
54
55 protected:
56 dgPolygonSoupDatabase(const char* const name = NULL);
57 virtual ~dgPolygonSoupDatabase ();
58
59 dgInt32 m_vertexCount;
60 dgInt32 m_strideInBytes;
61 dgFloat32* m_localVertex;
62 };
63
64
65 inline dgPolygonSoupDatabase::dgPolygonSoupDatabase(const char* const name)
66 {
67 m_vertexCount = 0;
68 m_strideInBytes = 0;
69 m_localVertex = NULL;
70 }
71
72 inline dgPolygonSoupDatabase::~dgPolygonSoupDatabase ()
73 {
74 if (m_localVertex) {
75 dgFreeStack (m_localVertex);
76 }
77 }
78
79
80 inline dgUnsigned32 dgPolygonSoupDatabase::GetTagId(const dgInt32* const face, dgInt32 indexCount) const
81 {
82 return dgUnsigned32 (face[indexCount]);
83 }
84
85 inline void dgPolygonSoupDatabase::SetTagId(const dgInt32* const facePtr, dgInt32 indexCount, dgUnsigned32 newID) const
86 {
87 dgUnsigned32* const face = (dgUnsigned32*) facePtr;
88 face[indexCount] = newID;
89 }
90
91 inline dgInt32 dgPolygonSoupDatabase::GetVertexCount() const
92 {
93 return m_vertexCount;
94 }
95
96 inline dgFloat32* dgPolygonSoupDatabase::GetLocalVertexPool() const
97 {
98 return m_localVertex;
99 }
100
101 inline dgInt32 dgPolygonSoupDatabase::GetStrideInBytes() const
102 {
103 return m_strideInBytes;
104 }
105
106 inline dgFloat32 dgPolygonSoupDatabase::GetRadius() const
107 {
108 return 0.0f;
109 }
110
111
112 #endif
113
dgPolygonSoupDatabase::m_strideInBytes
dgInt32 m_strideInBytes
Definition: dgPolygonSoupDatabase.h:60
dgPolygonSoupDatabase::~dgPolygonSoupDatabase
virtual ~dgPolygonSoupDatabase()
Definition: dgPolygonSoupDatabase.h:72
dgFreeStack
void dgApi dgFreeStack(void *const ptr)
Definition: dgMemory.cpp:430
dgPolygonSoupDatabase::Serialize
virtual void Serialize(dgSerialize callback, void *const userData) const =0
dgPolygonSoupDatabase
Definition: dgPolygonSoupDatabase.h:40
dgPolygonSoupDatabase::GetLocalVertexPool
dgFloat32 * GetLocalVertexPool() const
Definition: dgPolygonSoupDatabase.h:96
userData
void *const userData
Definition: dgBroadPhase.h:35
dgFloat32
float dgFloat32
Definition: dgTypes.h:233
dgInt32
int dgInt32
Definition: dgTypes.h:218
dgPolygonSoupDatabase::GetTagId
dgUnsigned32 GetTagId(const dgInt32 *const face, dgInt32 indexCount) const
Definition: dgPolygonSoupDatabase.h:80
dgPolygonSoupDatabase::SetTagId
void SetTagId(const dgInt32 *const face, dgInt32 indexCount, dgUnsigned32 newID) const
Definition: dgPolygonSoupDatabase.h:85
dgSerialize
void(dgApi * dgSerialize)(void *const userData, const void *const buffer, size_t size)
Definition: dgTypes.h:280
dgStdafx.h
dgDeserialize
void(dgApi * dgDeserialize)(void *const userData, void *buffer, size_t size)
Definition: dgTypes.h:279
dgPolygonSoupDatabase::m_localVertex
dgFloat32 * m_localVertex
Definition: dgPolygonSoupDatabase.h:61
dgPolygonSoupDatabase::dgPolygonSoupDatabase
dgPolygonSoupDatabase(const char *const name=NULL)
Definition: dgPolygonSoupDatabase.h:65
dgPolygonSoupDatabase::Deserialize
virtual void Deserialize(dgDeserialize callback, void *const userData)=0
dgPolygonSoupDatabase::GetStrideInBytes
dgInt32 GetStrideInBytes() const
Definition: dgPolygonSoupDatabase.h:101
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgPolygonSoupDatabase::GetVertexCount
dgInt32 GetVertexCount() const
Definition: dgPolygonSoupDatabase.h:91
dgMatrix
Definition: dgMatrix.h:40
dgPolygonSoupDatabase::GetRadius
dgFloat32 GetRadius() const
Definition: dgPolygonSoupDatabase.h:106
dgIntersections.h
dgArray.h
dgRef.h
dgPolygonSoupDatabase::m_vertexCount
dgInt32 m_vertexCount
Definition: dgPolygonSoupDatabase.h:59