1 | #ifndef NX_UTIL_LIB
|
---|
2 | #define NX_UTIL_LIB
|
---|
3 |
|
---|
4 | #include "NxFoundation.h"
|
---|
5 | #include "Nxp.h"
|
---|
6 | class NxJointDesc;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | \brief Abstract interface used to expose utility functions
|
---|
10 |
|
---|
11 | The functions contained withint NxUtil were previously exposed as static exports from NxPhysics.dll.
|
---|
12 | However to allow a switchable PhysXCore, they are now exposed through this interface.
|
---|
13 | */
|
---|
14 | class NxUtilLib
|
---|
15 | {
|
---|
16 |
|
---|
17 | public:
|
---|
18 |
|
---|
19 | /*
|
---|
20 | ** From NxExportedUtils.h
|
---|
21 | */
|
---|
22 | /***************************************************************************/
|
---|
23 | /**
|
---|
24 | \brief Test if an oriented box contains a point.
|
---|
25 |
|
---|
26 | \param[in] box Oriented Box to test point against.
|
---|
27 | \param[in] p Point to test.
|
---|
28 |
|
---|
29 | \return True if the box contains p.
|
---|
30 |
|
---|
31 | <b>Platform:</b>
|
---|
32 | \li PC SW: Yes
|
---|
33 | \li PPU : Yes
|
---|
34 | \li PS3 : Yes
|
---|
35 | \li XB360: Yes
|
---|
36 |
|
---|
37 | @see NxBox
|
---|
38 | */
|
---|
39 | virtual bool NxBoxContainsPoint(const NxBox& box, const NxVec3& p)=0;
|
---|
40 |
|
---|
41 | /**
|
---|
42 |
|
---|
43 | \brief Create an oriented box from an axis aligned box and a transformaton.
|
---|
44 |
|
---|
45 | \param[out] box Used to store the oriented box.
|
---|
46 | \param[in] aabb Axis aligned box.
|
---|
47 | \param[in] mat Transformation to apply to the axis aligned box.
|
---|
48 |
|
---|
49 | <b>Platform:</b>
|
---|
50 | \li PC SW: Yes
|
---|
51 | \li PPU : Yes
|
---|
52 | \li PS3 : Yes
|
---|
53 | \li XB360: Yes
|
---|
54 |
|
---|
55 | @see NxBox NxBounds3
|
---|
56 | */
|
---|
57 | virtual void NxCreateBox(NxBox& box, const NxBounds3& aabb, const NxMat34& mat)=0;
|
---|
58 |
|
---|
59 | /**
|
---|
60 |
|
---|
61 | \brief Computes plane equation for each face of an oriented boc.
|
---|
62 |
|
---|
63 | \param[in] box The oriented box.
|
---|
64 | \param[out] planes Array to recieve the computed planes(should be large enough to hold 6 planes)
|
---|
65 |
|
---|
66 | \return True on success.
|
---|
67 |
|
---|
68 | <b>Platform:</b>
|
---|
69 | \li PC SW: Yes
|
---|
70 | \li PPU : Yes
|
---|
71 | \li PS3 : Yes
|
---|
72 | \li XB360: Yes
|
---|
73 |
|
---|
74 | @see NxBox NxPlane
|
---|
75 | */
|
---|
76 | virtual bool NxComputeBoxPlanes(const NxBox& box, NxPlane* planes)=0;
|
---|
77 |
|
---|
78 | /**
|
---|
79 |
|
---|
80 | \brief Compute the corner points of an oriented box.
|
---|
81 |
|
---|
82 | \param[in] box The oriented box.
|
---|
83 | \param[out] pts Array to recieve the box point (should be large enough to hold 8 points)
|
---|
84 |
|
---|
85 | \return True on success.
|
---|
86 |
|
---|
87 | <b>Platform:</b>
|
---|
88 | \li PC SW: Yes
|
---|
89 | \li PPU : Yes
|
---|
90 | \li PS3 : Yes
|
---|
91 | \li XB360: Yes
|
---|
92 |
|
---|
93 | @see NxBox
|
---|
94 | */
|
---|
95 | virtual bool NxComputeBoxPoints(const NxBox& box, NxVec3* pts)=0;
|
---|
96 |
|
---|
97 | /**
|
---|
98 |
|
---|
99 | \brief Compute the vertex normals of an oriented box. These are smooth normals, ie averaged from the faces of the box.
|
---|
100 |
|
---|
101 | \param[in] box The oriented box.
|
---|
102 | \param[out] pts The normals for each vertex(should be large enough to hold 8 normals).
|
---|
103 |
|
---|
104 | \return True on success.
|
---|
105 |
|
---|
106 | <b>Platform:</b>
|
---|
107 | \li PC SW: Yes
|
---|
108 | \li PPU : Yes
|
---|
109 | \li PS3 : Yes
|
---|
110 | \li XB360: Yes
|
---|
111 |
|
---|
112 | @see NxBox
|
---|
113 | */
|
---|
114 | virtual bool NxComputeBoxVertexNormals(const NxBox& box, NxVec3* pts)=0;
|
---|
115 |
|
---|
116 | /**
|
---|
117 | \brief Return a list of edge indices.
|
---|
118 |
|
---|
119 | \return List of edge indices.
|
---|
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 NxComputeBoxPoints
|
---|
128 | */
|
---|
129 | virtual const NxU32* NxGetBoxEdges()=0;
|
---|
130 |
|
---|
131 | /**
|
---|
132 | \brief Return a list of box edge axes.
|
---|
133 |
|
---|
134 | \return List of box edge axes.
|
---|
135 |
|
---|
136 | <b>Platform:</b>
|
---|
137 | \li PC SW: Yes
|
---|
138 | \li PPU : Yes
|
---|
139 | \li PS3 : Yes
|
---|
140 | \li XB360: Yes
|
---|
141 |
|
---|
142 | @see NxComputeBoxPoints
|
---|
143 | */
|
---|
144 | virtual const NxI32* NxGetBoxEdgesAxes()=0;
|
---|
145 |
|
---|
146 | /**
|
---|
147 | \brief Return a set of triangle indices suitable for use with #NxComputeBoxPoints.
|
---|
148 |
|
---|
149 | \return List of box triangles.
|
---|
150 |
|
---|
151 | <b>Platform:</b>
|
---|
152 | \li PC SW: Yes
|
---|
153 | \li PPU : Yes
|
---|
154 | \li PS3 : Yes
|
---|
155 | \li XB360: Yes
|
---|
156 |
|
---|
157 | @see NxComputeBoxPoints
|
---|
158 | */
|
---|
159 | virtual const NxU32* NxGetBoxTriangles()=0;
|
---|
160 |
|
---|
161 | /**
|
---|
162 | \brief Returns a list of local space edge normals.
|
---|
163 |
|
---|
164 | \return List of edge normals.
|
---|
165 |
|
---|
166 | <b>Platform:</b>
|
---|
167 | \li PC SW: Yes
|
---|
168 | \li PPU : Yes
|
---|
169 | \li PS3 : Yes
|
---|
170 | \li XB360: Yes
|
---|
171 | */
|
---|
172 | virtual const NxVec3* NxGetBoxLocalEdgeNormals()=0;
|
---|
173 |
|
---|
174 | /**
|
---|
175 | \brief Compute and edge normals for an oriented box.
|
---|
176 |
|
---|
177 | This is an averaged normal, from the two faces sharing the edge.
|
---|
178 |
|
---|
179 | The edge index should be from 0 to 11 (ie a box has 12 edges).
|
---|
180 |
|
---|
181 | Edge ordering:
|
---|
182 |
|
---|
183 | \image html boxEdgeDiagram.png
|
---|
184 |
|
---|
185 | \param[in] box The oriented box.
|
---|
186 | \param[in] edge_index The index of the edge to compute a normal for.
|
---|
187 | \param[out] world_normal The computed normal.
|
---|
188 |
|
---|
189 | <b>Platform:</b>
|
---|
190 | \li PC SW: Yes
|
---|
191 | \li PPU : Yes
|
---|
192 | \li PS3 : Yes
|
---|
193 | \li XB360: Yes
|
---|
194 | */
|
---|
195 | virtual void NxComputeBoxWorldEdgeNormal(const NxBox& box, NxU32 edge_index, NxVec3& world_normal)=0;
|
---|
196 |
|
---|
197 | /**
|
---|
198 |
|
---|
199 | \brief Compute a capsule which encloses a box.
|
---|
200 |
|
---|
201 | \param box Box to generate capsule for.
|
---|
202 | \param capsule Stores the capsule which is generated.
|
---|
203 |
|
---|
204 | <b>Platform:</b>
|
---|
205 | \li PC SW: Yes
|
---|
206 | \li PPU : Yes
|
---|
207 | \li PS3 : Yes
|
---|
208 | \li XB360: Yes
|
---|
209 |
|
---|
210 | @see NxBox NxCapsule NxComputeBoxAroundCapsule
|
---|
211 | */
|
---|
212 | virtual void NxComputeCapsuleAroundBox(const NxBox& box, NxCapsule& capsule)=0;
|
---|
213 |
|
---|
214 | /**
|
---|
215 | \brief Test if box A is inside another box B.
|
---|
216 |
|
---|
217 | \param a Box A
|
---|
218 | \param b Box B
|
---|
219 |
|
---|
220 | \return True if box A is inside box B.
|
---|
221 |
|
---|
222 | <b>Platform:</b>
|
---|
223 | \li PC SW: Yes
|
---|
224 | \li PPU : Yes
|
---|
225 | \li PS3 : Yes
|
---|
226 | \li XB360: Yes
|
---|
227 |
|
---|
228 | @see NxBox
|
---|
229 | */
|
---|
230 | virtual bool NxIsBoxAInsideBoxB(const NxBox& a, const NxBox& b)=0;
|
---|
231 |
|
---|
232 | /**
|
---|
233 | \brief Get a list of indices representing the box as quads.
|
---|
234 |
|
---|
235 | \return List of quad indices.
|
---|
236 |
|
---|
237 | <b>Platform:</b>
|
---|
238 | \li PC SW: Yes
|
---|
239 | \li PPU : Yes
|
---|
240 | \li PS3 : Yes
|
---|
241 | \li XB360: Yes
|
---|
242 |
|
---|
243 | @see NxComputeBoxPoints()
|
---|
244 | */
|
---|
245 | virtual const NxU32* NxGetBoxQuads()=0;
|
---|
246 |
|
---|
247 | /**
|
---|
248 | \brief Returns a list of quad indices sharing the vertex index.
|
---|
249 |
|
---|
250 | \param vertexIndex Vertex Index.
|
---|
251 | \return List of quad indices sharing the vertex index.
|
---|
252 |
|
---|
253 | <b>Platform:</b>
|
---|
254 | \li PC SW: Yes
|
---|
255 | \li PPU : Yes
|
---|
256 | \li PS3 : Yes
|
---|
257 | \li XB360: Yes
|
---|
258 |
|
---|
259 | @see NxComputeBoxPoints() NxGetBoxQuads()
|
---|
260 | */
|
---|
261 | virtual const NxU32* NxBoxVertexToQuad(NxU32 vertexIndex)=0;
|
---|
262 |
|
---|
263 | /**
|
---|
264 | \brief Compute a box which encloses a capsule.
|
---|
265 |
|
---|
266 | \param capsule Capsule to generate an enclosing box for.
|
---|
267 | \param box Generated box.
|
---|
268 |
|
---|
269 | <b>Platform:</b>
|
---|
270 | \li PC SW: Yes
|
---|
271 | \li PPU : Yes
|
---|
272 | \li PS3 : Yes
|
---|
273 | \li XB360: Yes
|
---|
274 |
|
---|
275 | @see NxComputeCapsuleAroundBox
|
---|
276 | */
|
---|
277 | virtual void NxComputeBoxAroundCapsule(const NxCapsule& capsule, NxBox& box)=0;
|
---|
278 |
|
---|
279 | /**
|
---|
280 | \brief Set FPU precision.
|
---|
281 |
|
---|
282 | <b>Platform:</b>
|
---|
283 | \li PC SW: Yes
|
---|
284 | \li PPU : Yes
|
---|
285 | \li PS3 : Yes
|
---|
286 | \li XB360: Yes
|
---|
287 | */
|
---|
288 | virtual void NxSetFPUPrecision24()=0;
|
---|
289 |
|
---|
290 | /**
|
---|
291 | \brief Set FPU precision.
|
---|
292 |
|
---|
293 | <b>Platform:</b>
|
---|
294 | \li PC SW: Yes
|
---|
295 | \li PPU : Yes
|
---|
296 | \li PS3 : Yes
|
---|
297 | \li XB360: Yes
|
---|
298 | */
|
---|
299 | virtual void NxSetFPUPrecision53()=0;
|
---|
300 |
|
---|
301 | /**
|
---|
302 | \brief Set FPU precision
|
---|
303 |
|
---|
304 | <b>Platform:</b>
|
---|
305 | \li PC SW: Yes
|
---|
306 | \li PPU : Yes
|
---|
307 | \li PS3 : Yes
|
---|
308 | \li XB360: Yes
|
---|
309 | */
|
---|
310 | virtual void NxSetFPUPrecision64()=0;
|
---|
311 |
|
---|
312 | /**
|
---|
313 | \brief Set FPU precision.
|
---|
314 |
|
---|
315 | <b>Platform:</b>
|
---|
316 | \li PC SW: Yes
|
---|
317 | \li PPU : Yes
|
---|
318 | \li PS3 : Yes
|
---|
319 | \li XB360: Yes
|
---|
320 | */
|
---|
321 | virtual void NxSetFPURoundingChop()=0;
|
---|
322 |
|
---|
323 | /**
|
---|
324 | \brief Set FPU rounding mode.
|
---|
325 |
|
---|
326 | <b>Platform:</b>
|
---|
327 | \li PC SW: Yes
|
---|
328 | \li PPU : Yes
|
---|
329 | \li PS3 : Yes
|
---|
330 | \li XB360: Yes
|
---|
331 | */
|
---|
332 | virtual void NxSetFPURoundingUp()=0;
|
---|
333 |
|
---|
334 | /**
|
---|
335 | \brief Set FPU rounding mode.
|
---|
336 |
|
---|
337 | <b>Platform:</b>
|
---|
338 | \li PC SW: Yes
|
---|
339 | \li PPU : Yes
|
---|
340 | \li PS3 : Yes
|
---|
341 | \li XB360: Yes
|
---|
342 | */
|
---|
343 | virtual void NxSetFPURoundingDown()=0;
|
---|
344 |
|
---|
345 | /**
|
---|
346 | \brief Set FPU rounding mode.
|
---|
347 |
|
---|
348 | <b>Platform:</b>
|
---|
349 | \li PC SW: Yes
|
---|
350 | \li PPU : Yes
|
---|
351 | \li PS3 : Yes
|
---|
352 | \li XB360: Yes
|
---|
353 | */
|
---|
354 | virtual void NxSetFPURoundingNear()=0;
|
---|
355 |
|
---|
356 | /**
|
---|
357 | \brief Enable/Disable FPU exception.
|
---|
358 |
|
---|
359 | \param b True to enable exception.
|
---|
360 |
|
---|
361 | <b>Platform:</b>
|
---|
362 | \li PC SW: Yes
|
---|
363 | \li PPU : Yes
|
---|
364 | \li PS3 : Yes
|
---|
365 | \li XB360: Yes
|
---|
366 | */
|
---|
367 | virtual void NxSetFPUExceptions(bool b)=0;
|
---|
368 |
|
---|
369 | /**
|
---|
370 | \brief Convert a floating point number to an integer.
|
---|
371 |
|
---|
372 | \param f Floating point number.
|
---|
373 |
|
---|
374 | \return The result.
|
---|
375 |
|
---|
376 | <b>Platform:</b>
|
---|
377 | \li PC SW: Yes
|
---|
378 | \li PPU : Yes
|
---|
379 | \li PS3 : Yes
|
---|
380 | \li XB360: Yes
|
---|
381 | */
|
---|
382 | virtual int NxIntChop(const NxF32& f)=0;
|
---|
383 |
|
---|
384 | /**
|
---|
385 | \brief Convert a floating point number to an integer.
|
---|
386 |
|
---|
387 | \param f Floating point number.
|
---|
388 |
|
---|
389 | \return The result.
|
---|
390 |
|
---|
391 | <b>Platform:</b>
|
---|
392 | \li PC SW: Yes
|
---|
393 | \li PPU : Yes
|
---|
394 | \li PS3 : Yes
|
---|
395 | \li XB360: Yes
|
---|
396 | */
|
---|
397 | virtual int NxIntFloor(const NxF32& f)=0;
|
---|
398 |
|
---|
399 | /**
|
---|
400 | \brief Convert a floating point number to an integer.
|
---|
401 |
|
---|
402 | \param f Floating point number.
|
---|
403 |
|
---|
404 | \return The result.
|
---|
405 |
|
---|
406 | <b>Platform:</b>
|
---|
407 | \li PC SW: Yes
|
---|
408 | \li PPU : Yes
|
---|
409 | \li PS3 : Yes
|
---|
410 | \li XB360: Yes
|
---|
411 | */
|
---|
412 | virtual int NxIntCeil(const NxF32& f)=0;
|
---|
413 |
|
---|
414 | /**
|
---|
415 | \brief Compute the distance squared from a point to a ray.
|
---|
416 |
|
---|
417 | \param ray The ray.
|
---|
418 | \param point The point.
|
---|
419 | \param t Used to retrieve the closest parameter value on the ray.
|
---|
420 |
|
---|
421 | \return The squared distance.
|
---|
422 |
|
---|
423 | <b>Platform:</b>
|
---|
424 | \li PC SW: Yes
|
---|
425 | \li PPU : Yes
|
---|
426 | \li PS3 : Yes
|
---|
427 | \li XB360: Yes
|
---|
428 |
|
---|
429 | @see NxRay
|
---|
430 | */
|
---|
431 | virtual NxF32 NxComputeDistanceSquared(const NxRay& ray, const NxVec3& point, NxF32* t)=0;
|
---|
432 |
|
---|
433 | /**
|
---|
434 | \brief Compute the distance squared from a point to a line segment.
|
---|
435 |
|
---|
436 | \param seg The line segment.
|
---|
437 | \param point The point.
|
---|
438 | \param t Used to retrieve the closest parameter value on the line segment.
|
---|
439 |
|
---|
440 | \return The squared distance.
|
---|
441 |
|
---|
442 | <b>Platform:</b>
|
---|
443 | \li PC SW: Yes
|
---|
444 | \li PPU : Yes
|
---|
445 | \li PS3 : Yes
|
---|
446 | \li XB360: Yes
|
---|
447 |
|
---|
448 | @see NxSegment
|
---|
449 | */
|
---|
450 | virtual NxF32 NxComputeSquareDistance(const NxSegment& seg, const NxVec3& point, NxF32* t)=0;
|
---|
451 |
|
---|
452 | /**
|
---|
453 | \brief Compute a bounding sphere for a point cloud.
|
---|
454 |
|
---|
455 | \param sphere The computed sphere.
|
---|
456 | \param nb_verts Number of points.
|
---|
457 | \param verts Array of points.
|
---|
458 |
|
---|
459 | \return The method used to compute the sphere, see #NxBSphereMethod.
|
---|
460 |
|
---|
461 | <b>Platform:</b>
|
---|
462 | \li PC SW: Yes
|
---|
463 | \li PPU : Yes
|
---|
464 | \li PS3 : Yes
|
---|
465 | \li XB360: Yes
|
---|
466 |
|
---|
467 | @see NxSphere NxFastComputeSphere
|
---|
468 | */
|
---|
469 | virtual NxBSphereMethod NxComputeSphere(NxSphere& sphere, unsigned nb_verts, const NxVec3* verts)=0;
|
---|
470 | /**
|
---|
471 | \brief Compute a bounding sphere for a point cloud.
|
---|
472 |
|
---|
473 | The sphere may not be as tight as #NxComputeSphere
|
---|
474 |
|
---|
475 | \param sphere The computed sphere.
|
---|
476 | \param nb_verts Number of points.
|
---|
477 | \param verts Array of points.
|
---|
478 |
|
---|
479 | \return True on success.
|
---|
480 |
|
---|
481 | <b>Platform:</b>
|
---|
482 | \li PC SW: Yes
|
---|
483 | \li PPU : Yes
|
---|
484 | \li PS3 : Yes
|
---|
485 | \li XB360: Yes
|
---|
486 |
|
---|
487 | @see NxSphere NxComputeSphere
|
---|
488 | */
|
---|
489 | virtual bool NxFastComputeSphere(NxSphere& sphere, unsigned nb_verts, const NxVec3* verts)=0;
|
---|
490 |
|
---|
491 | /**
|
---|
492 | \brief Compute an overall bounding sphere for a pair of spheres.
|
---|
493 |
|
---|
494 | \param merged The computed sphere.
|
---|
495 | \param sphere0 First sphere.
|
---|
496 | \param sphere1 Second sphere.
|
---|
497 |
|
---|
498 | <b>Platform:</b>
|
---|
499 | \li PC SW: Yes
|
---|
500 | \li PPU : Yes
|
---|
501 | \li PS3 : Yes
|
---|
502 | \li XB360: Yes
|
---|
503 |
|
---|
504 | @see NxSphere NxComputeSphere
|
---|
505 | */
|
---|
506 | virtual void NxMergeSpheres(NxSphere& merged, const NxSphere& sphere0, const NxSphere& sphere1)=0;
|
---|
507 |
|
---|
508 | /**
|
---|
509 | \brief Get the tangent vectors associated with a normal.
|
---|
510 |
|
---|
511 | \param n Normal vector
|
---|
512 | \param t1 First tangent
|
---|
513 | \param t2 Second tangent
|
---|
514 |
|
---|
515 | <b>Platform:</b>
|
---|
516 | \li PC SW: Yes
|
---|
517 | \li PPU : Yes
|
---|
518 | \li PS3 : Yes
|
---|
519 | \li XB360: Yes
|
---|
520 | */
|
---|
521 | virtual void NxNormalToTangents(const NxVec3 & n, NxVec3 & t1, NxVec3 & t2)=0;
|
---|
522 |
|
---|
523 | /**
|
---|
524 | \brief Rotates a 3x3 symmetric inertia tensor I into a space R where it can be represented with the diagonal matrix D.
|
---|
525 |
|
---|
526 | I = R * D * R'
|
---|
527 |
|
---|
528 | Returns false on failure.
|
---|
529 |
|
---|
530 | \param denseInertia The dense inertia tensor.
|
---|
531 | \param diagonalInertia The diagnalised inertia tensor.
|
---|
532 | \param rotation Rotation for the frame of the diagonalized inertia tensor.
|
---|
533 |
|
---|
534 | \return True if the inertia tensor can be diagonalized.
|
---|
535 |
|
---|
536 | <b>Platform:</b>
|
---|
537 | \li PC SW: Yes
|
---|
538 | \li PPU : Yes
|
---|
539 | \li PS3 : Yes
|
---|
540 | \li XB360: Yes
|
---|
541 | */
|
---|
542 |
|
---|
543 | virtual bool NxDiagonalizeInertiaTensor(const NxMat33 & denseInertia, NxVec3 & diagonalInertia, NxMat33 & rotation)=0;
|
---|
544 |
|
---|
545 | /**
|
---|
546 | \brief Computes a rotation matrix.
|
---|
547 |
|
---|
548 | computes rotation matrix M so that:
|
---|
549 |
|
---|
550 | M * x = b
|
---|
551 |
|
---|
552 | x and b are unit vectors.
|
---|
553 |
|
---|
554 | \param x Vector.
|
---|
555 | \param b Vector.
|
---|
556 | \param M Computed rotation matrix.
|
---|
557 |
|
---|
558 | <b>Platform:</b>
|
---|
559 | \li PC SW: Yes
|
---|
560 | \li PPU : Yes
|
---|
561 | \li PS3 : Yes
|
---|
562 | \li XB360: Yes
|
---|
563 | */
|
---|
564 | virtual void NxFindRotationMatrix(const NxVec3 & x, const NxVec3 & b, NxMat33 & M)=0;
|
---|
565 |
|
---|
566 | /**
|
---|
567 | \brief Computes bounds of an array of vertices
|
---|
568 |
|
---|
569 | \param min Computed minimum of the bounds.
|
---|
570 | \param max Maximum
|
---|
571 | \param nbVerts Number of input vertices.
|
---|
572 | \param verts Array of vertices.
|
---|
573 |
|
---|
574 | <b>Platform:</b>
|
---|
575 | \li PC SW: Yes
|
---|
576 | \li PPU : Yes
|
---|
577 | \li PS3 : Yes
|
---|
578 | \li XB360: Yes
|
---|
579 |
|
---|
580 | @see NxBounds3
|
---|
581 | */
|
---|
582 | virtual void NxComputeBounds(NxVec3& min, NxVec3& max, NxU32 nbVerts, const NxVec3* verts)=0;
|
---|
583 |
|
---|
584 |
|
---|
585 | /**
|
---|
586 | \brief Computes CRC of input buffer
|
---|
587 |
|
---|
588 | \param buffer Input buffer.
|
---|
589 | \param nbBytes Number of bytes in in the input buffer.
|
---|
590 | \return The computed CRC.
|
---|
591 |
|
---|
592 | <b>Platform:</b>
|
---|
593 | \li PC SW: Yes
|
---|
594 | \li PPU : Yes
|
---|
595 | \li PS3 : Yes
|
---|
596 | \li XB360: Yes
|
---|
597 | */
|
---|
598 | virtual NxU32 NxCrc32(const void* buffer, NxU32 nbBytes)=0;
|
---|
599 | /*
|
---|
600 | ** From NxInertiaTensor.h
|
---|
601 | */
|
---|
602 | /***************************************************************************/
|
---|
603 | /**
|
---|
604 | \brief Computes mass of a homogeneous sphere according to sphere density.
|
---|
605 |
|
---|
606 | \param[in] radius Radius of the sphere. <b>Range:</b> (0,inf)
|
---|
607 | \param[in] density Density of the sphere. <b>Range:</b> (0,inf)
|
---|
608 |
|
---|
609 | \return The mass of the sphere.
|
---|
610 |
|
---|
611 | <b>Platform:</b>
|
---|
612 | \li PC SW: Yes
|
---|
613 | \li PPU : Yes
|
---|
614 | \li PS3 : Yes
|
---|
615 | \li XB360: Yes
|
---|
616 | */
|
---|
617 | virtual NxReal NxComputeSphereMass (NxReal radius, NxReal density)=0;
|
---|
618 |
|
---|
619 | /**
|
---|
620 | \brief Computes density of a homogeneous sphere according to sphere mass.
|
---|
621 |
|
---|
622 | \param[in] radius Radius of the sphere. <b>Range:</b> (0,inf)
|
---|
623 | \param[in] mass Mass of the sphere. <b>Range:</b> (0,inf)
|
---|
624 |
|
---|
625 | \return The density of the sphere.
|
---|
626 |
|
---|
627 | <b>Platform:</b>
|
---|
628 | \li PC SW: Yes
|
---|
629 | \li PPU : Yes
|
---|
630 | \li PS3 : Yes
|
---|
631 | \li XB360: Yes
|
---|
632 | */
|
---|
633 | virtual NxReal NxComputeSphereDensity (NxReal radius, NxReal mass)=0;
|
---|
634 |
|
---|
635 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
636 |
|
---|
637 | /**
|
---|
638 | \brief Computes mass of a homogeneous box according to box density.
|
---|
639 |
|
---|
640 | \param[in] extents The extents/radii of the box. <b>Range:</b> direction vector
|
---|
641 | \param[in] density The density of the box. <b>Range:</b> (0,inf)
|
---|
642 |
|
---|
643 | \return The mass of the box.
|
---|
644 |
|
---|
645 | <b>Platform:</b>
|
---|
646 | \li PC SW: Yes
|
---|
647 | \li PPU : Yes
|
---|
648 | \li PS3 : Yes
|
---|
649 | \li XB360: Yes
|
---|
650 | */
|
---|
651 | virtual NxReal NxComputeBoxMass (const NxVec3& extents, NxReal density)=0;
|
---|
652 |
|
---|
653 | /**
|
---|
654 | \brief Computes density of a homogeneous box according to box mass.
|
---|
655 |
|
---|
656 | \param[in] extents The extents/radii of the box. <b>Range:</b> direction vector
|
---|
657 | \param[in] mass The mass of the box. <b>Range:</b> (0,inf)
|
---|
658 |
|
---|
659 | \return The density of the box.
|
---|
660 |
|
---|
661 | <b>Platform:</b>
|
---|
662 | \li PC SW: Yes
|
---|
663 | \li PPU : Yes
|
---|
664 | \li PS3 : Yes
|
---|
665 | \li XB360: Yes
|
---|
666 | */
|
---|
667 | virtual NxReal NxComputeBoxDensity (const NxVec3& extents, NxReal mass)=0;
|
---|
668 |
|
---|
669 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
670 |
|
---|
671 | /**
|
---|
672 | \brief Computes mass of a homogeneous ellipsoid according to ellipsoid density.
|
---|
673 |
|
---|
674 | \param[in] extents The extents/radii of the ellopsoid. <b>Range:</b> direction vector
|
---|
675 | \param[in] density The density of the ellipsoid. <b>Range:</b> (0,inf)
|
---|
676 |
|
---|
677 | \return The mass of the ellipsoid.
|
---|
678 |
|
---|
679 | <b>Platform:</b>
|
---|
680 | \li PC SW: Yes
|
---|
681 | \li PPU : Yes
|
---|
682 | \li PS3 : Yes
|
---|
683 | \li XB360: Yes
|
---|
684 | */
|
---|
685 | virtual NxReal NxComputeEllipsoidMass (const NxVec3& extents, NxReal density)=0;
|
---|
686 |
|
---|
687 | /**
|
---|
688 | \brief Computes density of a homogeneous ellipsoid according to ellipsoid mass.
|
---|
689 |
|
---|
690 | \param[in] extents The extents/radii of the ellopsoid. <b>Range:</b> direction vector
|
---|
691 | \param[in] mass The mass of the ellipsoid. <b>Range:</b> (0,inf)
|
---|
692 |
|
---|
693 | \return The density of the ellipsoid.
|
---|
694 |
|
---|
695 | <b>Platform:</b>
|
---|
696 | \li PC SW: Yes
|
---|
697 | \li PPU : Yes
|
---|
698 | \li PS3 : Yes
|
---|
699 | \li XB360: Yes
|
---|
700 | */
|
---|
701 | virtual NxReal NxComputeEllipsoidDensity (const NxVec3& extents, NxReal mass)=0;
|
---|
702 |
|
---|
703 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
704 |
|
---|
705 | /**
|
---|
706 | \brief Computes mass of a homogeneous cylinder according to cylinder density.
|
---|
707 |
|
---|
708 | \param[in] radius The radius of the cylinder. <b>Range:</b> (0,inf)
|
---|
709 | \param[in] length The length. <b>Range:</b> (0,inf)
|
---|
710 | \param[in] density The density. <b>Range:</b> (0,inf)
|
---|
711 |
|
---|
712 | \return The mass.
|
---|
713 |
|
---|
714 | <b>Platform:</b>
|
---|
715 | \li PC SW: Yes
|
---|
716 | \li PPU : Yes
|
---|
717 | \li PS3 : Yes
|
---|
718 | \li XB360: Yes
|
---|
719 | */
|
---|
720 | virtual NxReal NxComputeCylinderMass (NxReal radius, NxReal length, NxReal density)=0;
|
---|
721 |
|
---|
722 | /**
|
---|
723 | \brief Computes density of a homogeneous cylinder according to cylinder mass.
|
---|
724 |
|
---|
725 | \param[in] radius The radius of the cylinder. <b>Range:</b> (0,inf)
|
---|
726 | \param[in] length The length. <b>Range:</b> (0,inf)
|
---|
727 | \param[in] mass The mass. <b>Range:</b> (0,inf)
|
---|
728 |
|
---|
729 | \return The density.
|
---|
730 |
|
---|
731 | <b>Platform:</b>
|
---|
732 | \li PC SW: Yes
|
---|
733 | \li PPU : Yes
|
---|
734 | \li PS3 : Yes
|
---|
735 | \li XB360: Yes
|
---|
736 | */
|
---|
737 | virtual NxReal NxComputeCylinderDensity (NxReal radius, NxReal length, NxReal mass)=0;
|
---|
738 |
|
---|
739 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
740 |
|
---|
741 | /**
|
---|
742 | \brief Computes mass of a homogeneous cone according to cone density.
|
---|
743 |
|
---|
744 | \param[in] radius The radius of the cone. <b>Range:</b> (0,inf)
|
---|
745 | \param[in] length The length. <b>Range:</b> (0,inf)
|
---|
746 | \param[in] density The density. <b>Range:</b> (0,inf)
|
---|
747 |
|
---|
748 | \return The mass.
|
---|
749 |
|
---|
750 | <b>Platform:</b>
|
---|
751 | \li PC SW: Yes
|
---|
752 | \li PPU : Yes
|
---|
753 | \li PS3 : Yes
|
---|
754 | \li XB360: Yes
|
---|
755 | */
|
---|
756 | virtual NxReal NxComputeConeMass (NxReal radius, NxReal length, NxReal density)=0;
|
---|
757 |
|
---|
758 | /**
|
---|
759 | \brief Computes density of a homogeneous cone according to cone mass.
|
---|
760 |
|
---|
761 | \param[in] radius The radius of the cone. <b>Range:</b> (0,inf)
|
---|
762 | \param[in] length The length. <b>Range:</b> (0,inf)
|
---|
763 | \param[in] mass The mass. <b>Range:</b> (0,inf)
|
---|
764 |
|
---|
765 | \return The density.
|
---|
766 |
|
---|
767 | <b>Platform:</b>
|
---|
768 | \li PC SW: Yes
|
---|
769 | \li PPU : Yes
|
---|
770 | \li PS3 : Yes
|
---|
771 | \li XB360: Yes
|
---|
772 | */
|
---|
773 | virtual NxReal NxComputeConeDensity (NxReal radius, NxReal length, NxReal mass)=0;
|
---|
774 |
|
---|
775 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
776 |
|
---|
777 | /**
|
---|
778 | \brief Computes diagonalized inertia tensor for a box.
|
---|
779 |
|
---|
780 | \param[out] diagInertia The diagonalised inertia tensor.
|
---|
781 | \param[in] mass The mass of the box. <b>Range:</b> (0,inf)
|
---|
782 | \param[in] xlength The width of the box. <b>Range:</b> (-inf,inf)
|
---|
783 | \param[in] ylength The height. <b>Range:</b> (-inf,inf)
|
---|
784 | \param[in] zlength The depth. <b>Range:</b> (-inf,inf)
|
---|
785 |
|
---|
786 | <b>Platform:</b>
|
---|
787 | \li PC SW: Yes
|
---|
788 | \li PPU : Yes
|
---|
789 | \li PS3 : Yes
|
---|
790 | \li XB360: Yes
|
---|
791 | */
|
---|
792 | virtual void NxComputeBoxInertiaTensor (NxVec3& diagInertia, NxReal mass, NxReal xlength, NxReal ylength, NxReal zlength)=0;
|
---|
793 |
|
---|
794 | /**
|
---|
795 | \brief Computes diagonalized inertia tensor for a sphere.
|
---|
796 |
|
---|
797 | \param[out] diagInertia The diagonalised inertia tensor.
|
---|
798 | \param[in] mass The mass. <b>Range:</b> (0,inf)
|
---|
799 | \param[in] radius The radius. <b>Range:</b> (-inf,inf)
|
---|
800 | \param[in] hollow True to treat the sphere as a hollow shell.
|
---|
801 |
|
---|
802 | <b>Platform:</b>
|
---|
803 | \li PC SW: Yes
|
---|
804 | \li PPU : Yes
|
---|
805 | \li PS3 : Yes
|
---|
806 | \li XB360: Yes
|
---|
807 | */
|
---|
808 | virtual void NxComputeSphereInertiaTensor(NxVec3& diagInertia, NxReal mass, NxReal radius, bool hollow)=0;
|
---|
809 |
|
---|
810 | /*
|
---|
811 | ** From NxJointDesc.h
|
---|
812 | */
|
---|
813 | /*************************************************************/
|
---|
814 | /**
|
---|
815 | \brief Set the local anchor stored in a #NxJointDesc from a global anchor point.
|
---|
816 |
|
---|
817 | \param dis Joint desc to update.
|
---|
818 | \param wsAnchor Anchor point in the global frame. <b>Range:</b> position vector
|
---|
819 |
|
---|
820 | <b>Platform:</b>
|
---|
821 | \li PC SW: Yes
|
---|
822 | \li PPU : Yes
|
---|
823 | \li PS3 : Yes
|
---|
824 | \li XB360: Yes
|
---|
825 |
|
---|
826 | @see NxJointDesc.setGlobalAnchor()
|
---|
827 | */
|
---|
828 | virtual void NxJointDesc_SetGlobalAnchor(NxJointDesc & dis, const NxVec3 & wsAnchor)=0;
|
---|
829 |
|
---|
830 | /**
|
---|
831 | \brief Set the local axis stored in a #NxJointDesc from a global axis.
|
---|
832 |
|
---|
833 | \param dis Joint desc to update.
|
---|
834 | \param wsAxis Axis in the global frame. <b>Range:</b> direction vector
|
---|
835 |
|
---|
836 | <b>Platform:</b>
|
---|
837 | \li PC SW: Yes
|
---|
838 | \li PPU : Yes
|
---|
839 | \li PS3 : Yes
|
---|
840 | \li XB360: Yes
|
---|
841 |
|
---|
842 | @see NxJointDesc.setGlobalAxis()
|
---|
843 | */
|
---|
844 | virtual void NxJointDesc_SetGlobalAxis(NxJointDesc & dis, const NxVec3 & wsAxis)=0;
|
---|
845 |
|
---|
846 |
|
---|
847 | /*
|
---|
848 | ** From NxIntersectionBoxBox.h
|
---|
849 | */
|
---|
850 | /******************************************************************/
|
---|
851 |
|
---|
852 | /**
|
---|
853 | \brief Boolean intersection test between two OBBs.
|
---|
854 |
|
---|
855 | Uses the separating axis theorem. Disabling 'full_test' only performs 6 axis tests out of 15.
|
---|
856 |
|
---|
857 | \param[in] extents0 Extents/radii of first box before transformation. <b>Range:</b> direction vector
|
---|
858 | \param[in] center0 Centre of first box. <b>Range:</b> position vector
|
---|
859 | \param[in] rotation0 Rotatation to apply to first box (before translation). <b>Range:</b> rotation matrix
|
---|
860 | \param[in] extents1 Extents/radii of second box before transformation <b>Range:</b> direction vector
|
---|
861 | \param[in] center1 Centre of second box. <b>Range:</b> position vector
|
---|
862 | \param[in] rotation1 Rotatation to apply to second box(before translation). <b>Range:</b> rotation matrix
|
---|
863 | \param[in] fullTest If false test only the first 6 axis.
|
---|
864 |
|
---|
865 | \return true on intersection
|
---|
866 |
|
---|
867 | <b>Platform:</b>
|
---|
868 | \li PC SW: Yes
|
---|
869 | \li PPU : Yes
|
---|
870 | \li PS3 : Yes
|
---|
871 | \li XB360: Yes
|
---|
872 | */
|
---|
873 | virtual bool NxBoxBoxIntersect( const NxVec3& extents0, const NxVec3& center0, const NxMat33& rotation0,
|
---|
874 | const NxVec3& extents1, const NxVec3& center1, const NxMat33& rotation1,
|
---|
875 | bool fullTest)=0;
|
---|
876 |
|
---|
877 |
|
---|
878 |
|
---|
879 | /*
|
---|
880 | \brief Boolean intersection test between a triangle and an AABB.
|
---|
881 |
|
---|
882 | \param[in] vertex0 First vertex of triangle. <b>Range:</b> position vector
|
---|
883 | \param[in] vertex1 Second Vertex of triangle. <b>Range:</b> position vector
|
---|
884 | \param[in] vertex2 Third Vertex of triangle. <b>Range:</b> position vector
|
---|
885 | \param[in] center Centre of Axis Aligned bounding box. <b>Range:</b> position vector
|
---|
886 | \param[in] extents Extents/radii of AABB. <b>Range:</b> direction vector
|
---|
887 |
|
---|
888 | \return true on intersection.
|
---|
889 |
|
---|
890 | <b>Platform:</b>
|
---|
891 | \li PC SW: Yes
|
---|
892 | \li PPU : Yes
|
---|
893 | \li PS3 : Yes
|
---|
894 | \li XB360: Yes
|
---|
895 | */
|
---|
896 | virtual bool NxTriBoxIntersect(const NxVec3 & vertex0, const NxVec3 & vertex1, const NxVec3 & vertex2, const NxVec3 & center, const NxVec3& extents)=0;
|
---|
897 |
|
---|
898 | /**
|
---|
899 | \brief Computes the separating axis between two OBBs.
|
---|
900 |
|
---|
901 | \param[in] extents0 Extents/radii of first box before transformation. <b>Range:</b> direction vector
|
---|
902 | \param[in] center0 Centre of box first box. <b>Range:</b> position vector
|
---|
903 | \param[in] rotation0 Rotatation to apply to first box (before translation). <b>Range:</b> rotation matrix
|
---|
904 | \param[in] extents1 Extents/radii of second box before transformation. <b>Range:</b> direction vector
|
---|
905 | \param[in] center1 Centre of second box. <b>Range:</b> position vector
|
---|
906 | \param[in] rotation1 Rotatation to apply to second box (before translation). <b>Range:</b> rotation matrix
|
---|
907 | \param[in] fullTest If false test only the first 6 axis.
|
---|
908 |
|
---|
909 | \return The separating axis or NX_SEP_AXIS_OVERLAP for an overlap.
|
---|
910 |
|
---|
911 | <b>Platform:</b>
|
---|
912 | \li PC SW: Yes
|
---|
913 | \li PPU : Yes
|
---|
914 | \li PS3 : Yes
|
---|
915 | \li XB360: Yes
|
---|
916 |
|
---|
917 | @see NxSepAxis
|
---|
918 | */
|
---|
919 | virtual NxSepAxis NxSeparatingAxis( const NxVec3& extents0, const NxVec3& center0, const NxMat33& rotation0,
|
---|
920 | const NxVec3& extents1, const NxVec3& center1, const NxMat33& rotation1,
|
---|
921 | bool fullTest=true)=0;
|
---|
922 |
|
---|
923 | /*
|
---|
924 | ** From NxIntersectionRayPlane.h
|
---|
925 | */
|
---|
926 | /*************************************************************************/
|
---|
927 |
|
---|
928 | /**
|
---|
929 | \brief Segment-plane intersection test.
|
---|
930 |
|
---|
931 | Returns distance between v1 and impact point, as well as impact point on plane.
|
---|
932 |
|
---|
933 | \param[in] v1 First vertex of segment. <b>Range:</b> position vector
|
---|
934 | \param[in] v2 Second vertex of segment. <b>Range:</b> position vector
|
---|
935 | \param[in] plane Plane to test against. <b>Range:</b> See #NxPlane
|
---|
936 | \param[out] dist Distance from v1 to impact point (so pointOnPlane=Normalize(v2-v1)*dist).
|
---|
937 | \param[out] pointOnPlane Imapct point on plane.
|
---|
938 |
|
---|
939 | <b>Platform:</b>
|
---|
940 | \li PC SW: Yes
|
---|
941 | \li PPU : Yes
|
---|
942 | \li PS3 : Yes
|
---|
943 | \li XB360: Yes
|
---|
944 | */
|
---|
945 | virtual void NX_CALL_CONV NxSegmentPlaneIntersect(const NxVec3& v1, const NxVec3& v2,
|
---|
946 | const NxPlane& plane, NxReal& dist, NxVec3& pointOnPlane)=0;
|
---|
947 |
|
---|
948 | /**
|
---|
949 | \brief Ray-plane intersection test.
|
---|
950 |
|
---|
951 | Returns distance between ray origin and impact point, as well as impact point on plane.
|
---|
952 |
|
---|
953 | \param[in] ray Ray to test against plane. <b>Range:</b> See #NxRay
|
---|
954 | \param[in] plane Plane to test. <b>Range:</b> See #NxPlane
|
---|
955 | \param[out] dist Distance along ray to impact point (so pointOnPlane=Normalize(v2-v1)*dist).
|
---|
956 | \param[out] pointOnPlane Impact point on the plane.
|
---|
957 |
|
---|
958 | \return True on intersection.
|
---|
959 |
|
---|
960 | <b>Platform:</b>
|
---|
961 | \li PC SW: Yes
|
---|
962 | \li PPU : Yes
|
---|
963 | \li PS3 : Yes
|
---|
964 | \li XB360: Yes
|
---|
965 | */
|
---|
966 | virtual bool NX_CALL_CONV NxRayPlaneIntersect(const NxRay& ray, const NxPlane& plane,
|
---|
967 | NxReal& dist, NxVec3& pointOnPlane)=0;
|
---|
968 |
|
---|
969 | /*
|
---|
970 | ** From NxIntersectionRaySphere.h
|
---|
971 | */
|
---|
972 | /**************************************************************************/
|
---|
973 |
|
---|
974 | /**
|
---|
975 | \brief Ray-sphere intersection test.
|
---|
976 |
|
---|
977 | Returns true if the ray intersects the sphere, and the impact point if needed.
|
---|
978 |
|
---|
979 | \param[in] origin Origin of the ray. <b>Range:</b> position vector
|
---|
980 | \param[in] dir Direction of the ray. <b>Range:</b> direction vector
|
---|
981 | \param[in] center Center of the sphere. <b>Range:</b> position vector
|
---|
982 | \param[in] radius Sphere radius. <b>Range:</b> (0,inf)
|
---|
983 | \param[out] coord Point of intersection between ray and sphere.
|
---|
984 |
|
---|
985 | \return True on intersection.
|
---|
986 |
|
---|
987 | <b>Platform:</b>
|
---|
988 | \li PC SW: Yes
|
---|
989 | \li PPU : Yes
|
---|
990 | \li PS3 : Yes
|
---|
991 | \li XB360: Yes
|
---|
992 | */
|
---|
993 | virtual bool NxRaySphereIntersect(const NxVec3& origin, const NxVec3& dir, const NxVec3& center, NxReal radius, NxVec3* coord=NULL)=0;
|
---|
994 |
|
---|
995 | /*
|
---|
996 | ** From NxIntersectionSegmentBox
|
---|
997 | */
|
---|
998 | /**************************************************************************/
|
---|
999 |
|
---|
1000 | /**
|
---|
1001 | \brief Segment-AABB intersection test.
|
---|
1002 |
|
---|
1003 | Also computes intersection point.
|
---|
1004 |
|
---|
1005 | \param[in] p1 First point of line segment. <b>Range:</b> position vector
|
---|
1006 | \param[in] p2 Second point of line segment. <b>Range:</b> position vector
|
---|
1007 | \param[in] bbox_min Minimum extent of AABB. <b>Range:</b> position vector
|
---|
1008 | \param[in] bbox_max Max extent of AABB. <b>Range:</b> position vector
|
---|
1009 | \param[out] intercept Intersection point between segment and box.
|
---|
1010 |
|
---|
1011 | \return True if the segment and AABB intersect.
|
---|
1012 |
|
---|
1013 | <b>Platform:</b>
|
---|
1014 | \li PC SW: Yes
|
---|
1015 | \li PPU : Yes
|
---|
1016 | \li PS3 : Yes
|
---|
1017 | \li XB360: Yes
|
---|
1018 | */
|
---|
1019 | virtual bool NxSegmentBoxIntersect(const NxVec3& p1, const NxVec3& p2,
|
---|
1020 | const NxVec3& bbox_min,const NxVec3& bbox_max, NxVec3& intercept)=0;
|
---|
1021 |
|
---|
1022 | /**
|
---|
1023 | \brief Ray-AABB intersection test.
|
---|
1024 |
|
---|
1025 | Also computes intersection point.
|
---|
1026 |
|
---|
1027 | \param[in] min Minimum extent of AABB. <b>Range:</b> position vector
|
---|
1028 | \param[in] max Maximum extent of AABB. <b>Range:</b> position vector
|
---|
1029 | \param[in] origin Origin of ray. <b>Range:</b> position vector
|
---|
1030 | \param[in] dir Direction of ray. <b>Range:</b> direction vector
|
---|
1031 | \param[out] coord Intersection point.
|
---|
1032 |
|
---|
1033 | \return True if the ray and AABB intersect.
|
---|
1034 |
|
---|
1035 | <b>Platform:</b>
|
---|
1036 | \li PC SW: Yes
|
---|
1037 | \li PPU : Yes
|
---|
1038 | \li PS3 : Yes
|
---|
1039 | \li XB360: Yes
|
---|
1040 | */
|
---|
1041 | virtual bool NxRayAABBIntersect(const NxVec3& min, const NxVec3& max,
|
---|
1042 | const NxVec3& origin, const NxVec3& dir, NxVec3& coord)=0;
|
---|
1043 |
|
---|
1044 | /**
|
---|
1045 | \brief Extended Ray-AABB intersection test.
|
---|
1046 |
|
---|
1047 | Also computes intersection point, and parameter and returns contacted box axis index+1. Rays starting from inside the box are ignored.
|
---|
1048 |
|
---|
1049 |
|
---|
1050 | \param[in] min Minimum extent of AABB. <b>Range:</b> position vector
|
---|
1051 | \param[in] max Maximum extent of AABB. <b>Range:</b> position vector
|
---|
1052 | \param[in] origin Origin of ray. <b>Range:</b> position vector
|
---|
1053 | \param[in] dir Direction of ray. <b>Range:</b> direction vector
|
---|
1054 | \param[out] coord Intersection point.
|
---|
1055 | \param[out] t Ray paraemeter corresponding to contact point.
|
---|
1056 |
|
---|
1057 | \return Box axis index.
|
---|
1058 |
|
---|
1059 | <b>Platform:</b>
|
---|
1060 | \li PC SW: Yes
|
---|
1061 | \li PPU : Yes
|
---|
1062 | \li PS3 : Yes
|
---|
1063 | \li XB360: Yes
|
---|
1064 | */
|
---|
1065 | virtual NxU32 NxRayAABBIntersect2(const NxVec3& min, const NxVec3& max,
|
---|
1066 | const NxVec3& origin, const NxVec3& dir, NxVec3& coord, NxReal & t)=0;
|
---|
1067 |
|
---|
1068 | /**
|
---|
1069 | \brief Boolean segment-OBB intersection test.
|
---|
1070 |
|
---|
1071 | Based on separating axis theorem.
|
---|
1072 |
|
---|
1073 | \param[in] p0 First point of line segment. <b>Range:</b> position vector
|
---|
1074 | \param[in] p1 Second point of line segment. <b>Range:</b> position vector
|
---|
1075 | \param[in] center Centre point of OBB. <b>Range:</b> position vector
|
---|
1076 | \param[in] extents Extent/Radii of the OBB. <b>Range:</b> direction vector
|
---|
1077 | \param[in] rot Rotation of the OBB(applied before translation). <b>Range:</b> rotation matrix
|
---|
1078 |
|
---|
1079 | \return true if the segment and OBB intersect.
|
---|
1080 |
|
---|
1081 | <b>Platform:</b>
|
---|
1082 | \li PC SW: Yes
|
---|
1083 | \li PPU : Yes
|
---|
1084 | \li PS3 : Yes
|
---|
1085 | \li XB360: Yes
|
---|
1086 | */
|
---|
1087 | virtual bool NxSegmentOBBIntersect(const NxVec3& p0, const NxVec3& p1,
|
---|
1088 | const NxVec3& center, const NxVec3& extents, const NxMat33& rot)=0;
|
---|
1089 |
|
---|
1090 | /**
|
---|
1091 | \brief Boolean segment-AABB intersection test.
|
---|
1092 |
|
---|
1093 | Based on separating axis theorem.
|
---|
1094 |
|
---|
1095 | \param[in] p0 First point of line segment. <b>Range:</b> position vector
|
---|
1096 | \param[in] p1 Second point of line segment. <b>Range:</b> position vector
|
---|
1097 | \param[in] min Minimum extent of AABB. <b>Range:</b> position vector
|
---|
1098 | \param[in] max Maximum extent of AABB. <b>Range:</b> position vector
|
---|
1099 |
|
---|
1100 | \return True if the segment and AABB intersect.
|
---|
1101 |
|
---|
1102 | <b>Platform:</b>
|
---|
1103 | \li PC SW: Yes
|
---|
1104 | \li PPU : Yes
|
---|
1105 | \li PS3 : Yes
|
---|
1106 | \li XB360: Yes
|
---|
1107 | */
|
---|
1108 | virtual bool NxSegmentAABBIntersect(const NxVec3& p0, const NxVec3& p1,
|
---|
1109 | const NxVec3& min, const NxVec3& max)=0;
|
---|
1110 |
|
---|
1111 | /**
|
---|
1112 | \brief Boolean ray-OBB intersection test.
|
---|
1113 |
|
---|
1114 | Based on separating axis theorem.
|
---|
1115 |
|
---|
1116 | \param[in] ray Ray to test against OBB. <b>Range:</b> See #NxRay
|
---|
1117 | \param[in] center Centre pointy of OBB. <b>Range:</b> position vector
|
---|
1118 | \param[in] extents Extent/Radii of the OBB. <b>Range:</b> direction vector
|
---|
1119 | \param[in] rot Rotation of the OBB(applied before translation). <b>Range:</b> rotation matrix
|
---|
1120 |
|
---|
1121 | \return True on intersection.
|
---|
1122 |
|
---|
1123 | <b>Platform:</b>
|
---|
1124 | \li PC SW: Yes
|
---|
1125 | \li PPU : Yes
|
---|
1126 | \li PS3 : Yes
|
---|
1127 | \li XB360: Yes
|
---|
1128 | */
|
---|
1129 | virtual bool NxRayOBBIntersect(const NxRay& ray, const NxVec3& center,
|
---|
1130 | const NxVec3& extents, const NxMat33& rot)=0;
|
---|
1131 |
|
---|
1132 | /*
|
---|
1133 | ** From NxIntersectionSegmentCapsule.h
|
---|
1134 | */
|
---|
1135 | /*************************************************************************/
|
---|
1136 |
|
---|
1137 | /**
|
---|
1138 | \brief Ray-capsule intersection test.
|
---|
1139 |
|
---|
1140 | Returns number of intersection points (0,1 or 2) and corresponding parameters along the ray.
|
---|
1141 |
|
---|
1142 | \param[in] origin Origin of ray. <b>Range:</b> position vector
|
---|
1143 | \param[in] dir Direction of ray. <b>Range:</b> direction vector
|
---|
1144 | \param[in] capsule Capsule to test. <b>Range:</b> see #NxCapsule
|
---|
1145 | \param[out] t Parameter of intersection on the ray.
|
---|
1146 |
|
---|
1147 | \return Number of intersection points.
|
---|
1148 |
|
---|
1149 | <b>Platform:</b>
|
---|
1150 | \li PC SW: Yes
|
---|
1151 | \li PPU : Yes
|
---|
1152 | \li PS3 : Yes
|
---|
1153 | \li XB360: Yes
|
---|
1154 |
|
---|
1155 | @see NxRay NxCapsule
|
---|
1156 | */
|
---|
1157 | virtual NxU32 NxRayCapsuleIntersect(const NxVec3& origin, const NxVec3& dir,
|
---|
1158 | const NxCapsule& capsule, NxReal t[2])=0;
|
---|
1159 |
|
---|
1160 | /*
|
---|
1161 | ** From NxIntersectionSweptSpheres.h
|
---|
1162 | */
|
---|
1163 | /***************************************************************************/
|
---|
1164 |
|
---|
1165 | /**
|
---|
1166 | \brief Sphere-sphere sweep test.
|
---|
1167 |
|
---|
1168 | Returns true if spheres intersect during their linear motion along provided velocity vectors.
|
---|
1169 |
|
---|
1170 | \param[in] sphere0 First sphere to test. <b>Range:</b> See #NxSphere
|
---|
1171 | \param[in] velocity0 Velocity of the first sphere(ie the vector to sweep the sphere along). <b>Range:</b> velocity/direction vector
|
---|
1172 | \param[in] sphere1 Second sphere to test <b>Range:</b> See #NxSphere
|
---|
1173 | \param[in] velocity1 Velocity of the second sphere(ie the vector to sweep the sphere along). <b>Range:</b> velocity/direction vector
|
---|
1174 |
|
---|
1175 | \return True if spheres intersect.
|
---|
1176 |
|
---|
1177 | <b>Platform:</b>
|
---|
1178 | \li PC SW: Yes
|
---|
1179 | \li PPU : Yes
|
---|
1180 | \li PS3 : Yes
|
---|
1181 | \li XB360: Yes
|
---|
1182 |
|
---|
1183 | @see NxSphere
|
---|
1184 | */
|
---|
1185 | virtual bool NxSweptSpheresIntersect( const NxSphere& sphere0, const NxVec3& velocity0,
|
---|
1186 | const NxSphere& sphere1, const NxVec3& velocity1)=0;
|
---|
1187 |
|
---|
1188 | /*
|
---|
1189 | ** From NxRayTryIntersect.h
|
---|
1190 | */
|
---|
1191 |
|
---|
1192 | /**
|
---|
1193 | \brief Ray-triangle intersection test.
|
---|
1194 |
|
---|
1195 | Returns impact distance (t) as well as barycentric coordinates (u,v) of impact point.
|
---|
1196 | Use NxComputeBarycentricPoint() in Foundation to compute the impact point from the barycentric coordinates.
|
---|
1197 | The test performs back face culling or not according to 'cull'.
|
---|
1198 |
|
---|
1199 | \param[in] orig Origin of the ray. <b>Range:</b> position vector
|
---|
1200 | \param[in] dir Direction of the ray. <b>Range:</b> direction vector
|
---|
1201 | \param[in] vert0 First vertex of triangle. <b>Range:</b> position vector
|
---|
1202 | \param[in] vert1 Second vertex of triangle. <b>Range:</b> position vector
|
---|
1203 | \param[in] vert2 Third vertex of triangle. <b>Range:</b> position vector
|
---|
1204 | \param[out] t Distance along the ray from the origin to the impact point.
|
---|
1205 | \param[out] u Barycentric coordinate.
|
---|
1206 | \param[out] v Barycentric coordinate.
|
---|
1207 | \param[in] cull Cull backfaces.
|
---|
1208 |
|
---|
1209 | <b>Platform:</b>
|
---|
1210 | \li PC SW: Yes
|
---|
1211 | \li PPU : Yes
|
---|
1212 | \li PS3 : Yes
|
---|
1213 | \li XB360: Yes
|
---|
1214 | */
|
---|
1215 | virtual bool NxRayTriIntersect(const NxVec3& orig, const NxVec3& dir, const NxVec3& vert0, const NxVec3& vert1, const NxVec3& vert2, float& t, float& u, float& v, bool cull)=0;
|
---|
1216 |
|
---|
1217 | /***************************************************************/
|
---|
1218 | /*
|
---|
1219 | ** From NxBuildSmoothNormals.h
|
---|
1220 | /**
|
---|
1221 | \brief Builds smooth vertex normals over a mesh.
|
---|
1222 |
|
---|
1223 | - "smooth" because smoothing groups are not supported here
|
---|
1224 | - takes angles into account for correct cube normals computation
|
---|
1225 |
|
---|
1226 | To use 32bit indices pass a pointer in dFaces and set wFaces to zero. Alternativly pass a pointer to
|
---|
1227 | wFaces and set dFaces to zero.
|
---|
1228 |
|
---|
1229 | \param[in] nbTris Number of triangles
|
---|
1230 | \param[in] nbVerts Number of vertices
|
---|
1231 | \param[in] verts Array of vertices
|
---|
1232 | \param[in] dFaces Array of dword triangle indices, or null
|
---|
1233 | \param[in] wFaces Array of word triangle indices, or null
|
---|
1234 | \param[out] normals Array of computed normals (assumes nbVerts vectors)
|
---|
1235 | \param[in] flip Flips the normals or not
|
---|
1236 |
|
---|
1237 | \return True on success.
|
---|
1238 |
|
---|
1239 | <b>Platform:</b>
|
---|
1240 | \li PC SW: Yes
|
---|
1241 | \li PPU : Yes
|
---|
1242 | \li PS3 : Yes
|
---|
1243 | \li XB360: Yes
|
---|
1244 | */
|
---|
1245 | virtual bool NxBuildSmoothNormals(
|
---|
1246 | NxU32 nbTris,
|
---|
1247 | NxU32 nbVerts,
|
---|
1248 | const NxVec3* verts,
|
---|
1249 | const NxU32* dFaces,
|
---|
1250 | const NxU16* wFaces,
|
---|
1251 | NxVec3* normals,
|
---|
1252 | bool flip=false
|
---|
1253 | )=0;
|
---|
1254 |
|
---|
1255 | };
|
---|
1256 | #endif
|
---|
1257 |
|
---|
1258 | //AGCOPYRIGHTBEGIN
|
---|
1259 | ///////////////////////////////////////////////////////////////////////////
|
---|
1260 | // Copyright © 2005 AGEIA Technologies.
|
---|
1261 | // All rights reserved. www.ageia.com
|
---|
1262 | ///////////////////////////////////////////////////////////////////////////
|
---|
1263 | //AGCOPYRIGHTEND
|
---|
1264 |
|
---|