1 | #ifndef NX_COLLISION_NXCONVEXMESH
|
---|
2 | #define NX_COLLISION_NXCONVEXMESH
|
---|
3 | /*----------------------------------------------------------------------------*\
|
---|
4 | |
|
---|
5 | | Public Interface to NovodeX Technology
|
---|
6 | |
|
---|
7 | | www.novodex.com
|
---|
8 | |
|
---|
9 | \*----------------------------------------------------------------------------*/
|
---|
10 | /** \addtogroup physics
|
---|
11 | @{
|
---|
12 | */
|
---|
13 |
|
---|
14 | #include "Nx.h"
|
---|
15 | #include "NxTriangleMesh.h"
|
---|
16 |
|
---|
17 | class NxSimpleTriangleMesh;
|
---|
18 | class NxConvexMeshDesc;
|
---|
19 | class NxStream;
|
---|
20 | #ifdef NX_SUPPORT_INTERNAL_FACES
|
---|
21 | class NxConvexMeshDesc2;
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /**
|
---|
25 | \brief A Convex Mesh.
|
---|
26 |
|
---|
27 | Internally represented as a list of convex polygons. The number
|
---|
28 | of polygons is limited to 256.
|
---|
29 |
|
---|
30 | To avoid duplicating data when you have several instances of a particular
|
---|
31 | mesh positioned differently, you do not use this class to represent a
|
---|
32 | convex object directly. Instead, you create an instance of this mesh via
|
---|
33 | the NxConvexShape class.
|
---|
34 |
|
---|
35 | <h3>Creation</h3>
|
---|
36 |
|
---|
37 | <h3>Creation</h3>
|
---|
38 |
|
---|
39 | To create an instance of this class call NxPhysicsSDK::createConvexMesh(),
|
---|
40 | and NxPhysicsSDK::releaseConvexMesh() to delete it. This is only possible
|
---|
41 | once you have released all of its #NxConvexShape instances.
|
---|
42 |
|
---|
43 | Example:
|
---|
44 |
|
---|
45 | \include NxConvexMesh_Create.cpp
|
---|
46 |
|
---|
47 | <h3>Visulizations:</h3>
|
---|
48 | \li #NX_VISUALIZE_COLLISION_AABBS
|
---|
49 | \li #NX_VISUALIZE_COLLISION_SHAPES
|
---|
50 | \li #NX_VISUALIZE_COLLISION_AXES
|
---|
51 | \li #NX_VISUALIZE_COLLISION_VNORMALS
|
---|
52 | \li #NX_VISUALIZE_COLLISION_FNORMALS
|
---|
53 | \li #NX_VISUALIZE_COLLISION_EDGES
|
---|
54 | \li #NX_VISUALIZE_COLLISION_SPHERES
|
---|
55 |
|
---|
56 | @see NxConvexMeshDesc NxPhysics.createConvexMesh()
|
---|
57 | */
|
---|
58 |
|
---|
59 | class NxConvexMesh
|
---|
60 | {
|
---|
61 | public:
|
---|
62 |
|
---|
63 | /**
|
---|
64 | \brief Saves the mesh to a descriptor.
|
---|
65 |
|
---|
66 | \param[out] desc Descriptor to store the state of the convex mesh into.
|
---|
67 |
|
---|
68 | \return true on success.
|
---|
69 |
|
---|
70 | <b>Platform:</b>
|
---|
71 | \li PC SW: Yes
|
---|
72 | \li PPU : Yes
|
---|
73 | \li PS3 : Yes
|
---|
74 | \li XB360: Yes
|
---|
75 |
|
---|
76 | @see NxConvexMeshDesc
|
---|
77 | */
|
---|
78 | virtual bool saveToDesc(NxConvexMeshDesc& desc) const = 0;
|
---|
79 |
|
---|
80 | /**
|
---|
81 | \brief Gets the number of internal submeshes for this mesh.
|
---|
82 |
|
---|
83 | \return The number of submeshes contained in this mesh.
|
---|
84 |
|
---|
85 | <b>Platform:</b>
|
---|
86 | \li PC SW: Yes
|
---|
87 | \li PPU : Yes
|
---|
88 | \li PS3 : Yes
|
---|
89 | \li XB360: Yes
|
---|
90 |
|
---|
91 | @see getCount() getFormat() getBase() getStride()
|
---|
92 | */
|
---|
93 | virtual NxU32 getSubmeshCount() const = 0;
|
---|
94 |
|
---|
95 | /**
|
---|
96 | \brief For a given submesh, retrieves the number of elements of a given internal array.
|
---|
97 |
|
---|
98 | \param[in] submeshIndex The submesh to query.
|
---|
99 | \param[in] intArray The internal array size to retrieve from the submesh(eg triangles, vertices etc). See #NxInternalArray.
|
---|
100 |
|
---|
101 | \return The number of elements in the internal array.
|
---|
102 |
|
---|
103 | <b>Platform:</b>
|
---|
104 | \li PC SW: Yes
|
---|
105 | \li PPU : Yes
|
---|
106 | \li PS3 : Yes
|
---|
107 | \li XB360: Yes
|
---|
108 |
|
---|
109 | @see getSubmeshCount() getFormat() getBase() getStride()
|
---|
110 | */
|
---|
111 | virtual NxU32 getCount(NxSubmeshIndex submeshIndex, NxInternalArray intArray) const = 0;
|
---|
112 |
|
---|
113 | /**
|
---|
114 | \brief For a given submesh, retrieves the format of a given internal array.
|
---|
115 |
|
---|
116 | \param[in] submeshIndex The submesh to query.
|
---|
117 | \param[in] intArray The internal array format to retrieve from the submesh(eg triangles, vertices etc). See #NxInternalArray.
|
---|
118 |
|
---|
119 | \return The format of the internal array. See #NxInternalFormat.
|
---|
120 |
|
---|
121 | <b>Platform:</b>
|
---|
122 | \li PC SW: Yes
|
---|
123 | \li PPU : Yes
|
---|
124 | \li PS3 : Yes
|
---|
125 | \li XB360: Yes
|
---|
126 |
|
---|
127 | @see getSubmeshCount() getCount() getBase() getStride()
|
---|
128 | */
|
---|
129 | virtual NxInternalFormat getFormat(NxSubmeshIndex submeshIndex, NxInternalArray intArray) const = 0;
|
---|
130 |
|
---|
131 | /**
|
---|
132 | \brief For a given submesh, retrieves the base pointer of a given internal array.
|
---|
133 |
|
---|
134 | Make sure you take into account the given format and stride.
|
---|
135 |
|
---|
136 | @see getStride
|
---|
137 | @see getFormat
|
---|
138 | @see getStride
|
---|
139 |
|
---|
140 | \param[in] submeshIndex The submesh to query.
|
---|
141 | \param[in] intArray The internal array pointer to retrieve from the submesh(eg triangles, vertices etc). See #NxInternalArray.
|
---|
142 |
|
---|
143 | \return A pointer to the first element of the internal array.
|
---|
144 |
|
---|
145 | <b>Platform:</b>
|
---|
146 | \li PC SW: Yes
|
---|
147 | \li PPU : Yes
|
---|
148 | \li PS3 : Yes
|
---|
149 | \li XB360: Yes
|
---|
150 |
|
---|
151 | @see getSubmeshCount() getCount() getFormat() getStride()
|
---|
152 | */
|
---|
153 | virtual const void* getBase(NxSubmeshIndex submeshIndex, NxInternalArray intArray) const = 0;
|
---|
154 |
|
---|
155 | /**
|
---|
156 | \brief For a given submesh, retrieves the stride value of a given internal array.
|
---|
157 |
|
---|
158 | The stride value is always a number of bytes. You have to skip this number of bytes
|
---|
159 | to go from one element to the other in an array, starting from the base.
|
---|
160 |
|
---|
161 | \param[in] submeshIndex The submesh to query.
|
---|
162 | \param[in] intArray The internal array stride to retrieve from the submesh(eg triangles, vertices etc). See #NxInternalArray.
|
---|
163 |
|
---|
164 | \return The stride(number of bytes from one element to the next) for the internal array.
|
---|
165 |
|
---|
166 | <b>Platform:</b>
|
---|
167 | \li PC SW: Yes
|
---|
168 | \li PPU : Yes
|
---|
169 | \li PS3 : Yes
|
---|
170 | \li XB360: Yes
|
---|
171 |
|
---|
172 | @see getSubmeshCount() getCount() getFormat() getBase()
|
---|
173 | */
|
---|
174 | virtual NxU32 getStride(NxSubmeshIndex submeshIndex, NxInternalArray intArray) const = 0;
|
---|
175 |
|
---|
176 | /**
|
---|
177 | \brief Load the contents of this mesh from the provided stream.
|
---|
178 |
|
---|
179 | A stream of an appropriate format can be creating with the cooking library.
|
---|
180 |
|
---|
181 | \param[in] stream Stream to load this mesh from. See #NxStream.
|
---|
182 |
|
---|
183 | \return True if successfully loaded. Otherwise False.
|
---|
184 | \param stream Stream to load this mesh from. See #NxStream.
|
---|
185 | \return True if successfully loaded. Otherwise False.
|
---|
186 |
|
---|
187 | <b>Platform:</b>
|
---|
188 | \li PC SW: Yes
|
---|
189 | \li PPU : Yes (With Limitations)
|
---|
190 | \li PS3 : Yes
|
---|
191 | \li XB360: Yes
|
---|
192 | */
|
---|
193 | virtual bool load(const NxStream& stream) = 0;
|
---|
194 |
|
---|
195 | // TODO(djs): remove
|
---|
196 | virtual void * getInternal() = 0;
|
---|
197 | };
|
---|
198 |
|
---|
199 | /** @} */
|
---|
200 | #endif
|
---|
201 |
|
---|
202 |
|
---|
203 | //AGCOPYRIGHTBEGIN
|
---|
204 | ///////////////////////////////////////////////////////////////////////////
|
---|
205 | // Copyright © 2005 AGEIA Technologies.
|
---|
206 | // All rights reserved. www.ageia.com
|
---|
207 | ///////////////////////////////////////////////////////////////////////////
|
---|
208 | //AGCOPYRIGHTEND
|
---|
209 |
|
---|