1 | #ifndef NX_PHYSICS_NX_SCENE
|
---|
2 | #define NX_PHYSICS_NX_SCENE
|
---|
3 | /*----------------------------------------------------------------------------*\
|
---|
4 | |
|
---|
5 | | Public Interface to NovodeX Technology
|
---|
6 | |
|
---|
7 | | www.novodex.com
|
---|
8 | |
|
---|
9 | \*----------------------------------------------------------------------------*/
|
---|
10 | /** \addtogroup physics
|
---|
11 | @{
|
---|
12 | */
|
---|
13 |
|
---|
14 | #include "Nxp.h"
|
---|
15 | #include "NxUserRaycastReport.h"
|
---|
16 | #include "NxUserEntityReport.h"
|
---|
17 | #include "NxSceneDesc.h"
|
---|
18 | #include "NxSceneStats.h"
|
---|
19 | #include "NxArray.h"
|
---|
20 | #include "NxProfiler.h"
|
---|
21 | #if NX_USE_FLUID_API
|
---|
22 | #include "fluids/NxFluid.h"
|
---|
23 | class NxUserFluidContactReport;
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | class NxActor;
|
---|
27 | class NxActorDescBase;
|
---|
28 | class NxJoint;
|
---|
29 | class NxJointDesc;
|
---|
30 | class NxEffector;
|
---|
31 | class NxShape;
|
---|
32 | class NxUserNotify;
|
---|
33 | class NxUserTriggerReport;
|
---|
34 | class NxUserContactReport;
|
---|
35 | class NxSpringAndDamperEffector;
|
---|
36 | class NxSpringAndDamperEffectorDesc;
|
---|
37 | class NxRay;
|
---|
38 | class NxBounds3;
|
---|
39 | class NxPlane;
|
---|
40 | class NxSphere;
|
---|
41 | class NxCapsule;
|
---|
42 | class NxThread;
|
---|
43 | class NxTriangle;
|
---|
44 | class NxPhysicsSDK;
|
---|
45 | class NxMaterialDesc;
|
---|
46 | class NxMaterial;
|
---|
47 | class NxDebugRenderable;
|
---|
48 |
|
---|
49 | /**
|
---|
50 | \brief Struct used by NxScene::getPairFlagArray().
|
---|
51 |
|
---|
52 | The high bit of each 32 bit flag field denotes whether a pair is a shape or an actor pair.
|
---|
53 | The flags are defined by the enum NxContactPairFlag.
|
---|
54 |
|
---|
55 | @see NxScene.getPairFlagArray
|
---|
56 | */
|
---|
57 | class NxPairFlag
|
---|
58 | {
|
---|
59 | public:
|
---|
60 | void* objects[2];
|
---|
61 | NxU32 flags;
|
---|
62 |
|
---|
63 | NX_INLINE NxU32 isActorPair() const { return flags & 0x80000000; }
|
---|
64 | };
|
---|
65 |
|
---|
66 |
|
---|
67 | /**
|
---|
68 | \brief Enum describing syncronization conditions.
|
---|
69 | */
|
---|
70 | enum NxStandardFences
|
---|
71 | {
|
---|
72 | NX_FENCE_RUN_FINISHED,
|
---|
73 | /*NX_SYNC_RAYCAST_FINISHED,*/
|
---|
74 | NX_NUM_STANDARD_FENCES,
|
---|
75 | };
|
---|
76 |
|
---|
77 | /**
|
---|
78 | enum to check if a certain part of the SDK has finished.
|
---|
79 | used in:
|
---|
80 | bool checkResults(NxSimulationStatus, bool block = false)
|
---|
81 | bool fetchResults(NxSimulationStatus, bool block = false)
|
---|
82 |
|
---|
83 | @see NxScene.checkResults() NxScene.fetchResults()
|
---|
84 | */
|
---|
85 | enum NxSimulationStatus
|
---|
86 | {
|
---|
87 | NX_RIGID_BODY_FINISHED = (1<<0),
|
---|
88 | };
|
---|
89 |
|
---|
90 | /**
|
---|
91 | \brief A scene is a collection of bodies, constraints, and effectors which can interact.
|
---|
92 |
|
---|
93 | The scene simulates the behavior of these objects over time. Several scenes may exist
|
---|
94 | at the same time, but each body, constraint, or effector object is specific to a scene
|
---|
95 | -- they may not be shared.
|
---|
96 |
|
---|
97 | For example, attempting to create a joint in one scene and then using it to attach
|
---|
98 | bodies from a different scene results in undefined behavior.
|
---|
99 |
|
---|
100 | <h3>Creation</h3>
|
---|
101 |
|
---|
102 | Example:
|
---|
103 |
|
---|
104 | \include NxScene_Create.cpp
|
---|
105 |
|
---|
106 | @see NxSceneDesc NxPhysicsSDK.createScene() NxPhysicsSDK.releaseScene()
|
---|
107 | */
|
---|
108 | class NxScene
|
---|
109 | {
|
---|
110 | protected:
|
---|
111 | NxScene() {}
|
---|
112 | virtual ~NxScene() {}
|
---|
113 |
|
---|
114 | public:
|
---|
115 |
|
---|
116 |
|
---|
117 | /**
|
---|
118 | \brief Saves the Scene descriptor.
|
---|
119 |
|
---|
120 | \param[out] desc The descriptor used to retrieve the state of the object.
|
---|
121 | \return True on success.
|
---|
122 |
|
---|
123 | <b>Platform:</b>
|
---|
124 | \li PC SW: Yes
|
---|
125 | \li PPU : Yes
|
---|
126 | \li PS3 : Yes
|
---|
127 | \li XB360: Yes
|
---|
128 |
|
---|
129 | @see NxSceneDesc
|
---|
130 | */
|
---|
131 | virtual bool saveToDesc(NxSceneDesc& desc) const = 0;
|
---|
132 |
|
---|
133 |
|
---|
134 | /**
|
---|
135 | \brief Gets a private interface to an internal debug object.
|
---|
136 |
|
---|
137 | <b>Platform:</b>
|
---|
138 | \li PC SW: Yes
|
---|
139 | \li PPU : Yes
|
---|
140 | \li PS3 : Yes
|
---|
141 | \li XB360: Yes
|
---|
142 | */
|
---|
143 | virtual void * getInternal(void) = 0;
|
---|
144 |
|
---|
145 | /**
|
---|
146 | \brief Sets a constant gravity for the entire scene.
|
---|
147 |
|
---|
148 | <b>Sleeping:</b> Does <b>NOT</b> wake the actor up automatically.
|
---|
149 |
|
---|
150 | \param[in] vec A new gravity vector(eg NxVec3(0.0f,-9.8f,0.0f) ) <b>Range:</b> force vector
|
---|
151 |
|
---|
152 | <b>Platform:</b>
|
---|
153 | \li PC SW: Yes
|
---|
154 | \li PPU : Yes
|
---|
155 | \li PS3 : Yes
|
---|
156 | \li XB360: Yes
|
---|
157 |
|
---|
158 | @see NxSceneDesc.gravity getGravity()
|
---|
159 | */
|
---|
160 | virtual void setGravity(const NxVec3& vec) = 0;
|
---|
161 |
|
---|
162 | /**
|
---|
163 | \brief Retrieves the current gravity setting.
|
---|
164 |
|
---|
165 | \param[out] vec Used to retrieve the current gravity for the scene.
|
---|
166 |
|
---|
167 | <b>Platform:</b>
|
---|
168 | \li PC SW: Yes
|
---|
169 | \li PPU : Yes
|
---|
170 | \li PS3 : Yes
|
---|
171 | \li XB360: Yes
|
---|
172 |
|
---|
173 | @see setGravity() NxSceneDesc.gravity
|
---|
174 | */
|
---|
175 | virtual void getGravity(NxVec3& vec) = 0;
|
---|
176 |
|
---|
177 | /************************************************************************************************/
|
---|
178 |
|
---|
179 | /** @name Create/Release Objects
|
---|
180 | */
|
---|
181 | //@{
|
---|
182 |
|
---|
183 | /**
|
---|
184 | \brief Creates an actor in this scene.
|
---|
185 |
|
---|
186 | NxActorDesc::isValid() must return true.
|
---|
187 |
|
---|
188 | <b>Sleeping:</b> This call wakes the actors if they are sleeping.
|
---|
189 |
|
---|
190 | \param[in] desc Descriptor for actor to create. See #NxActorDescBase
|
---|
191 | \return The new actor.
|
---|
192 |
|
---|
193 | <b>Platform:</b>
|
---|
194 | \li PC SW: Yes
|
---|
195 | \li PPU : Yes (Limits on numbers and types of actors)
|
---|
196 | \li PS3 : Yes
|
---|
197 | \li XB360: Yes
|
---|
198 |
|
---|
199 | @see NxActor NxActorDesc NxActorDescBase releaseActor()
|
---|
200 | */
|
---|
201 | virtual NxActor* createActor(const NxActorDescBase& desc) = 0;
|
---|
202 |
|
---|
203 | /**
|
---|
204 | \brief Deletes the specified actor.
|
---|
205 |
|
---|
206 | The actor must be in this scene.
|
---|
207 | Do not keep a reference to the deleted instance.
|
---|
208 |
|
---|
209 | Note: deleting a static actor will not wake up any sleeping objects that were
|
---|
210 | sitting on it. Use a kinematic actor instead to get this behavior.
|
---|
211 |
|
---|
212 | <b>Sleeping:</b> This call wakes the actors if they are sleeping.
|
---|
213 |
|
---|
214 | \param[in] actor The actor to release.
|
---|
215 |
|
---|
216 | <b>Platform:</b>
|
---|
217 | \li PC SW: Yes
|
---|
218 | \li PPU : Yes
|
---|
219 | \li PS3 : Yes
|
---|
220 | \li XB360: Yes
|
---|
221 |
|
---|
222 | @see createActor() NxActor
|
---|
223 | */
|
---|
224 | virtual void releaseActor(NxActor& actor) = 0;
|
---|
225 |
|
---|
226 | /**
|
---|
227 | \brief Creates a joint.
|
---|
228 |
|
---|
229 | The joint type depends on the type of joint desc passed in.
|
---|
230 |
|
---|
231 | <b>Sleeping:</b> This call wakes the actor(s) if they are sleeping.
|
---|
232 |
|
---|
233 | \param[in] jointDesc The descriptor for the joint to create. Eg #NxSphericalJointDesc,#NxRevoluteJointDesc etc
|
---|
234 | \return The new joint.
|
---|
235 |
|
---|
236 | <b>Platform:</b>
|
---|
237 | \li PC SW: Yes
|
---|
238 | \li PPU : No
|
---|
239 | \li PS3 : Yes
|
---|
240 | \li XB360: Yes
|
---|
241 |
|
---|
242 | @see NxJoint NxJointDesc releaseJoint() NxJoint
|
---|
243 | @see NxRevoluteJoint NxSphericalJoint NxPrismaticJoint NxCylindricalJoint NxD6Joint NxDistanceJoint
|
---|
244 | NxFixedJoint NxPointInPlaneJoint NxPointOnLineJoint
|
---|
245 | */
|
---|
246 | virtual NxJoint * createJoint(const NxJointDesc &jointDesc) = 0;
|
---|
247 |
|
---|
248 | /**
|
---|
249 | \brief Deletes the specified joint.
|
---|
250 |
|
---|
251 | The joint must be in this scene.
|
---|
252 | Do not keep a reference to the deleted instance.
|
---|
253 |
|
---|
254 | <b>Sleeping:</b> This call wakes the actor(s) if they are sleeping.
|
---|
255 |
|
---|
256 | \param[in] joint The joint to release.
|
---|
257 |
|
---|
258 | <b>Platform:</b>
|
---|
259 | \li PC SW: Yes
|
---|
260 | \li PPU : No
|
---|
261 | \li PS3 : Yes
|
---|
262 | \li XB360: Yes
|
---|
263 | */
|
---|
264 | virtual void releaseJoint(NxJoint &joint) = 0;
|
---|
265 |
|
---|
266 | /**
|
---|
267 | \brief Creates a spring and damper effector.
|
---|
268 |
|
---|
269 | <b>Sleeping:</b> Does <b>NOT</b> wake the actor up automatically.
|
---|
270 |
|
---|
271 | \param[in] springDesc The descriptor for the spring and damper effector to create. See #NxSpringAndDamperEffectorDesc.
|
---|
272 | \return The new spring and damper.
|
---|
273 |
|
---|
274 | <b>Platform:</b>
|
---|
275 | \li PC SW: Yes
|
---|
276 | \li PPU : No
|
---|
277 | \li PS3 : Yes
|
---|
278 | \li XB360: Yes
|
---|
279 |
|
---|
280 | @see NxSpringAndDamperEffectorDesc NxSpringAndDamperEffector releaseEffector()
|
---|
281 | */
|
---|
282 | virtual NxSpringAndDamperEffector* createSpringAndDamperEffector(const NxSpringAndDamperEffectorDesc& springDesc) = 0;
|
---|
283 |
|
---|
284 | /**
|
---|
285 | \brief Deletes the effector passed.
|
---|
286 |
|
---|
287 | Do not keep a reference to the deleted instance.
|
---|
288 |
|
---|
289 | <b>Sleeping:</b> Does <b>NOT</b> wake the actor up automatically.
|
---|
290 |
|
---|
291 | \param[in] effector The effector to delete.
|
---|
292 |
|
---|
293 | <b>Platform:</b>
|
---|
294 | \li PC SW: Yes
|
---|
295 | \li PPU : No
|
---|
296 | \li PS3 : Yes
|
---|
297 | \li XB360: Yes
|
---|
298 |
|
---|
299 | @see createSpringAndDamperEffector NxSpringAndDamperEffector
|
---|
300 | */
|
---|
301 | virtual void releaseEffector(NxEffector& effector) = 0;
|
---|
302 |
|
---|
303 | /**
|
---|
304 | \brief Creates a new NxMaterial.
|
---|
305 |
|
---|
306 | The material library consists of an array of material objects. Each
|
---|
307 | material has a well defined index that can be used to refer to it.
|
---|
308 | If an object (shape or triangle) references an undefined material,
|
---|
309 | the default material with index 0 is used instead.
|
---|
310 |
|
---|
311 | \param[in] matDesc The material desc to use to create a material. See #NxMaterialDesc.
|
---|
312 | \return The new material.
|
---|
313 |
|
---|
314 | <b>Platform:</b>
|
---|
315 | \li PC SW: Yes
|
---|
316 | \li PPU : Yes
|
---|
317 | \li PS3 : Yes
|
---|
318 | \li XB360: Yes
|
---|
319 |
|
---|
320 | @see NxMaterial NxMaterialDesc releaseMaterial()
|
---|
321 | */
|
---|
322 | virtual NxMaterial * createMaterial(const NxMaterialDesc &matDesc) = 0;
|
---|
323 |
|
---|
324 | /**
|
---|
325 | \brief Deletes the specified material.
|
---|
326 |
|
---|
327 | The material must be in this scene.
|
---|
328 | Don not keep a reference to the deleted instance.
|
---|
329 | If you release a material while shapes or meshes are referencing its material index,
|
---|
330 | the material assignment of these objects becomes undefined.
|
---|
331 |
|
---|
332 | \param[in] material The material to release.
|
---|
333 |
|
---|
334 | <b>Platform:</b>
|
---|
335 | \li PC SW: Yes
|
---|
336 | \li PPU : Yes
|
---|
337 | \li PS3 : Yes
|
---|
338 | \li XB360: Yes
|
---|
339 |
|
---|
340 | @see createMaterial() NxMaterial
|
---|
341 | */
|
---|
342 | virtual void releaseMaterial(NxMaterial &material) = 0;
|
---|
343 | //@}
|
---|
344 | /************************************************************************************************/
|
---|
345 |
|
---|
346 | /** @name Collision Filtering and Grouping
|
---|
347 | */
|
---|
348 | //@{
|
---|
349 |
|
---|
350 | /**
|
---|
351 | \brief Sets the pair flags for the given pair of actors.
|
---|
352 |
|
---|
353 | The pair flags are a combination of bits
|
---|
354 | defined by ::NxContactPairFlag. Calling this on an actor that has no shape(s) has no effect.
|
---|
355 | The two actor references must not reference the same actor.
|
---|
356 |
|
---|
357 | It is important to note that the SDK stores pair flags per shape, even for actor pair flags.
|
---|
358 | This means that shapes should be created before actor pair flags are set, otherwise the pair
|
---|
359 | flags will be ignored.
|
---|
360 |
|
---|
361 | <b>Sleeping:</b> Does <b>NOT</b> wake the actors up automatically.
|
---|
362 |
|
---|
363 | \param[in] actorA Actor A
|
---|
364 | \param[in] actorB Actor B
|
---|
365 | \param[in] nxContactPairFlag New set of contact pair flags. See #NxContactPairFlag
|
---|
366 |
|
---|
367 | <b>Platform:</b>
|
---|
368 | \li PC SW: Yes
|
---|
369 | \li PPU : No
|
---|
370 | \li PS3 : Yes
|
---|
371 | \li XB360: Yes
|
---|
372 |
|
---|
373 | @see getActorPairFlags() NxContactPairFlag
|
---|
374 | */
|
---|
375 | virtual void setActorPairFlags(NxActor& actorA, NxActor& actorB, NxU32 nxContactPairFlag) = 0;
|
---|
376 |
|
---|
377 | /**
|
---|
378 | \brief Retrieves the pair flags for the given pair of actors.
|
---|
379 |
|
---|
380 | The pair flags are a combination of bits
|
---|
381 | defined by ::NxContactPairFlag. If no pair record is found, zero is returned.
|
---|
382 | The two actor references must not reference the same actor.
|
---|
383 |
|
---|
384 | \param[in] actorA Actor A
|
---|
385 | \param[in] actorB Actor B
|
---|
386 | \return The actor pair flags.
|
---|
387 |
|
---|
388 | <b>Platform:</b>
|
---|
389 | \li PC SW: Yes
|
---|
390 | \li PPU : No
|
---|
391 | \li PS3 : Yes
|
---|
392 | \li XB360: Yes
|
---|
393 |
|
---|
394 | @see setActorPairFlags() NxContactPairFlag
|
---|
395 | */
|
---|
396 | virtual NxU32 getActorPairFlags(NxActor& actorA, NxActor& actorB) const = 0;
|
---|
397 |
|
---|
398 | /**
|
---|
399 | \brief Similar to #setActorPairFlags(), but for a pair of shapes.
|
---|
400 |
|
---|
401 | NX_IGNORE_PAIR is the only thing allowed
|
---|
402 | as a shape pair flag. All of the NX_NOTIFY flags should be used at the actor level.
|
---|
403 | The two shape references must not reference the same shape.
|
---|
404 |
|
---|
405 | <b>Sleeping:</b> Does <b>NOT</b> wake the associated actors up automatically.
|
---|
406 |
|
---|
407 | \param[in] shapeA Shape A
|
---|
408 | \param[in] shapeB Shape B
|
---|
409 | \param[in] nxContactPairFlag New set of shape contact pair flags.
|
---|
410 |
|
---|
411 | <b>Platform:</b>
|
---|
412 | \li PC SW: Yes
|
---|
413 | \li PPU : No
|
---|
414 | \li PS3 : Yes
|
---|
415 | \li XB360: Yes
|
---|
416 |
|
---|
417 | @see getShapePairFlags() NxContactPairFlag
|
---|
418 | */
|
---|
419 | virtual void setShapePairFlags(NxShape& shapeA, NxShape& shapeB, NxU32 nxContactPairFlag) = 0;
|
---|
420 |
|
---|
421 | /**
|
---|
422 | \brief Similar to getPairFlags(), but for a pair of shapes.
|
---|
423 |
|
---|
424 | The two shape references must not reference the same shape.
|
---|
425 |
|
---|
426 | \param[in] shapeA Shape A
|
---|
427 | \param[in] shapeB SHape B
|
---|
428 | \return The shape pair flags.
|
---|
429 |
|
---|
430 | <b>Platform:</b>
|
---|
431 | \li PC SW: Yes
|
---|
432 | \li PPU : No
|
---|
433 | \li PS3 : Yes
|
---|
434 | \li XB360: Yes
|
---|
435 |
|
---|
436 | @see setShapePairFlags() NxContactPairFlag
|
---|
437 | */
|
---|
438 | virtual NxU32 getShapePairFlags(NxShape& shapeA, NxShape& shapeB) const = 0;
|
---|
439 |
|
---|
440 | /**
|
---|
441 | \brief Returns the number of pairs for which pairFlags are defined.
|
---|
442 |
|
---|
443 | This includes actor and shape pairs.
|
---|
444 |
|
---|
445 | \return The number of pairs.
|
---|
446 |
|
---|
447 | <b>Platform:</b>
|
---|
448 | \li PC SW: Yes
|
---|
449 | \li PPU : No
|
---|
450 | \li PS3 : Yes
|
---|
451 | \li XB360: Yes
|
---|
452 |
|
---|
453 | @see NxContactPairFlag setShapePairFlags() setActorPairFlags() getPairFlagArray()
|
---|
454 | */
|
---|
455 | virtual NxU32 getNbPairs() const = 0;
|
---|
456 |
|
---|
457 | /**
|
---|
458 | \brief Retrieves the pair data.
|
---|
459 |
|
---|
460 | The high bit of each 32 bit flag field denotes whether a pair is a shape or
|
---|
461 | an actor pair. numPairs is the number of pairs the buffer can hold. The user is responsible for
|
---|
462 | allocating and deallocating the buffer. Call ::getNbPairs() to check what the number of pairs should be.
|
---|
463 |
|
---|
464 |
|
---|
465 | \param[out] userArray Pointer to user array to recieve pair flags. should be at least sizeof(NxPairFlag)*numPairs in size.
|
---|
466 | \param[in] numPairs Number of pairs the user buffer can hold.
|
---|
467 | \return The number of pairs written to userArray.
|
---|
468 |
|
---|
469 | <b>Platform:</b>
|
---|
470 | \li PC SW: Yes
|
---|
471 | \li PPU : No
|
---|
472 | \li PS3 : Yes
|
---|
473 | \li XB360: Yes
|
---|
474 |
|
---|
475 | @see NxContactPairFlag setShapePairFlags() setActorPairFlags() getNbPairs()
|
---|
476 | */
|
---|
477 | virtual NxU32 getPairFlagArray(NxPairFlag* userArray, NxU32 numPairs) const = 0;
|
---|
478 |
|
---|
479 | /**
|
---|
480 | \brief Specifies if collision should be performed by a pair of shape groups.
|
---|
481 |
|
---|
482 | It is possible to assign each shape to a collision groups using #NxShape::setGroup().
|
---|
483 | With this method one can set whether collisions should be detected between shapes
|
---|
484 | belonging to a given pair of groups. Initially all pairs are enabled.
|
---|
485 |
|
---|
486 | Collision detection between two shapes a and b occurs if:
|
---|
487 | getGroupCollisionFlag(a->getGroup(), b->getGroup()) && isEnabledPair(a,b) is true.
|
---|
488 |
|
---|
489 | Fluids can be assigned to collision groups as well.
|
---|
490 |
|
---|
491 | NxCollisionGroup is an integer between 0 and 31.
|
---|
492 |
|
---|
493 | <b>Sleeping:</b> Does <b>NOT</b> wake the associated actors up automatically.
|
---|
494 |
|
---|
495 | \param[in] group1 First group.
|
---|
496 | \param[in] group2 Second group.
|
---|
497 | \param[in] enable True to enable collision between the groups.
|
---|
498 |
|
---|
499 | <b>Platform:</b>
|
---|
500 | \li PC SW: Yes
|
---|
501 | \li PPU : No
|
---|
502 | \li PS3 : Yes
|
---|
503 | \li XB360: Yes
|
---|
504 |
|
---|
505 | @see NxCollisionGroup getGroupCollisionFlag() NxShape.setGroup() NxShape.getGroup()
|
---|
506 | */
|
---|
507 | virtual void setGroupCollisionFlag(NxCollisionGroup group1, NxCollisionGroup group2, bool enable) = 0;
|
---|
508 |
|
---|
509 | /**
|
---|
510 | \brief Determines if collision detection is performed between a pair of groups.
|
---|
511 |
|
---|
512 | NxCollisionGroup is an integer between 0 and 31.
|
---|
513 |
|
---|
514 | \param[in] group1 First Group.
|
---|
515 | \param[in] group2 Second Group.
|
---|
516 | \return True if the groups could collide.
|
---|
517 |
|
---|
518 | <b>Platform:</b>
|
---|
519 | \li PC SW: Yes
|
---|
520 | \li PPU : No
|
---|
521 | \li PS3 : Yes
|
---|
522 | \li XB360: Yes
|
---|
523 |
|
---|
524 | @see setGroupCollisionFlag() NxCollisionGroup NxShape.setGroup() NxShape.getGroup()
|
---|
525 | */
|
---|
526 | virtual bool getGroupCollisionFlag(NxCollisionGroup group1, NxCollisionGroup group2) const = 0;
|
---|
527 |
|
---|
528 | /**
|
---|
529 | \brief With this method one can set contact reporting flags between actors belonging to a pair of groups.
|
---|
530 |
|
---|
531 | It is possible to assign each actor to a group using NxActor::setGroup(). This is a different
|
---|
532 | set of groups from the shape groups despite the similar name. Here up to 0xffff different groups are permitted,
|
---|
533 | With this method one can set contact reporting flags between actors belonging to a pair of groups.
|
---|
534 |
|
---|
535 | The following flags are permitted:
|
---|
536 |
|
---|
537 | NX_NOTIFY_ON_START_TOUCH
|
---|
538 | NX_NOTIFY_ON_END_TOUCH
|
---|
539 | NX_NOTIFY_ON_TOUCH
|
---|
540 | NX_NOTIFY_ON_IMPACT
|
---|
541 | NX_NOTIFY_ON_ROLL
|
---|
542 | NX_NOTIFY_ON_SLIDE
|
---|
543 |
|
---|
544 | See ::NxContactPairFlag.
|
---|
545 |
|
---|
546 | Note that finer grain control of pairwise flags is possible using the functions
|
---|
547 | NxScene::setShapePairFlags() and NxScene::setActorPairFlags().
|
---|
548 |
|
---|
549 | <b>Sleeping:</b> Does <b>NOT</b> wake the actors up automatically.
|
---|
550 |
|
---|
551 | \param[in] group1 First Group.
|
---|
552 | \param[in] group2 Second Grooup
|
---|
553 | \param[in] flags Flags to control contact reporting. See #NxContactPairFlag.
|
---|
554 |
|
---|
555 | <b>Platform:</b>
|
---|
556 | \li PC SW: Yes
|
---|
557 | \li PPU : Yes
|
---|
558 | \li PS3 : Yes
|
---|
559 | \li XB360: Yes
|
---|
560 |
|
---|
561 | @see getActorGroupPairFlags() NxActorGroup NxActor.getGroup() NxActor.setGroup()
|
---|
562 | */
|
---|
563 | virtual void setActorGroupPairFlags(NxActorGroup group1, NxActorGroup group2, NxU32 flags) = 0;
|
---|
564 |
|
---|
565 | /**
|
---|
566 | \brief This reads the value set with #setActorGroupPairFlags.
|
---|
567 |
|
---|
568 | \param[in] group1 First Group
|
---|
569 | \param[in] group2 Second Group
|
---|
570 | \return The contact reporting flags associated with this actor pair. See #setActorGroupPairFlags.
|
---|
571 |
|
---|
572 | <b>Platform:</b>
|
---|
573 | \li PC SW: Yes
|
---|
574 | \li PPU : Yes
|
---|
575 | \li PS3 : Yes
|
---|
576 | \li XB360: Yes
|
---|
577 |
|
---|
578 | @see setActorPairFlags() NxActorGroup NxActor.getGroup() NxActor.setGroup()
|
---|
579 | */
|
---|
580 | virtual NxU32 getActorGroupPairFlags(NxActorGroup group1, NxActorGroup group2) const = 0;
|
---|
581 |
|
---|
582 | #ifdef NX_SUPPORT_NEW_FILTERING
|
---|
583 | /**
|
---|
584 | \brief Setups filtering operations. See comments for ::NxGroupsMask
|
---|
585 |
|
---|
586 | <b>Sleeping:</b> Does <b>NOT</b> wake the actors up automatically.
|
---|
587 |
|
---|
588 | \param[in] op0 Filter op 0.
|
---|
589 | \param[in] op1 Filter op 1.
|
---|
590 | \param[in] op2 Filter op 2.
|
---|
591 |
|
---|
592 | <b>Platform:</b>
|
---|
593 | \li PC SW: Yes
|
---|
594 | \li PPU : No
|
---|
595 | \li PS3 : Yes
|
---|
596 | \li XB360: Yes
|
---|
597 |
|
---|
598 | @see setFilterBool() setFilterConstant0() setFilterConstant1()
|
---|
599 | */
|
---|
600 | virtual void setFilterOps(NxFilterOp op0, NxFilterOp op1, NxFilterOp op2) = 0;
|
---|
601 |
|
---|
602 | /**
|
---|
603 | \brief Setups filtering's boolean value. See comments for ::NxGroupsMask
|
---|
604 |
|
---|
605 | <b>Sleeping:</b> Does <b>NOT</b> wake the actors up automatically.
|
---|
606 |
|
---|
607 | \param[in] flag Boolean value for filter.
|
---|
608 |
|
---|
609 | <b>Platform:</b>
|
---|
610 | \li PC SW: Yes
|
---|
611 | \li PPU : No
|
---|
612 | \li PS3 : Yes
|
---|
613 | \li XB360: Yes
|
---|
614 |
|
---|
615 | @see setFilterOps() setFilterConstant0() setFilterConstant1()
|
---|
616 | */
|
---|
617 | virtual void setFilterBool(bool flag) = 0;
|
---|
618 |
|
---|
619 | /**
|
---|
620 | \brief Setups filtering's K0 value. See comments for ::NxGroupsMask
|
---|
621 |
|
---|
622 | <b>Sleeping:</b> Does <b>NOT</b> wake the actors up automatically.
|
---|
623 |
|
---|
624 | \param[in] mask The new group mask. See #NxGroupsMask.
|
---|
625 |
|
---|
626 | <b>Platform:</b>
|
---|
627 | \li PC SW: Yes
|
---|
628 | \li PPU : No
|
---|
629 | \li PS3 : Yes
|
---|
630 | \li XB360: Yes
|
---|
631 |
|
---|
632 | @see setFilterOps() setFilterBool() setFilterConstant1()
|
---|
633 | */
|
---|
634 | virtual void setFilterConstant0(const NxGroupsMask& mask) = 0;
|
---|
635 |
|
---|
636 | /**
|
---|
637 | \brief Setups filtering's K1 value. See comments for ::NxGroupsMask
|
---|
638 |
|
---|
639 | <b>Sleeping:</b> Does <b>NOT</b> wake the actors up automatically.
|
---|
640 |
|
---|
641 | \param[in] mask The new group mask. See #NxGroupsMask.
|
---|
642 |
|
---|
643 | <b>Platform:</b>
|
---|
644 | \li PC SW: Yes
|
---|
645 | \li PPU : No
|
---|
646 | \li PS3 : Yes
|
---|
647 | \li XB360: Yes
|
---|
648 |
|
---|
649 | @see setFilterOps() setFilterBool() setFilterConstant0()
|
---|
650 | */
|
---|
651 | virtual void setFilterConstant1(const NxGroupsMask& mask) = 0;
|
---|
652 | #endif
|
---|
653 |
|
---|
654 | //@}
|
---|
655 | /************************************************************************************************/
|
---|
656 |
|
---|
657 | /** @name Enumeration
|
---|
658 | */
|
---|
659 | //@{
|
---|
660 |
|
---|
661 | /**
|
---|
662 | \brief Retrieve the number of actors in the scene.
|
---|
663 | \return the number of actors.
|
---|
664 |
|
---|
665 | <b>Platform:</b>
|
---|
666 | \li PC SW: Yes
|
---|
667 | \li PPU : Yes
|
---|
668 | \li PS3 : Yes
|
---|
669 | \li XB360: Yes
|
---|
670 |
|
---|
671 | @see getActors()
|
---|
672 | */
|
---|
673 | virtual NxU32 getNbActors() const = 0;
|
---|
674 |
|
---|
675 | /**
|
---|
676 | \brief Retrieve an array of all the actors in the scene.
|
---|
677 |
|
---|
678 | \return an array of actor pointers with size getNbActors().
|
---|
679 |
|
---|
680 | <b>Platform:</b>
|
---|
681 | \li PC SW: Yes
|
---|
682 | \li PPU : Yes
|
---|
683 | \li PS3 : Yes
|
---|
684 | \li XB360: Yes
|
---|
685 |
|
---|
686 | @see getNbActors()
|
---|
687 | */
|
---|
688 | virtual NxActor** getActors() = 0;
|
---|
689 |
|
---|
690 | /**
|
---|
691 | \brief Returns the number of static shapes in the scene.
|
---|
692 |
|
---|
693 | \return the number of static shapes.
|
---|
694 |
|
---|
695 | <b>Platform:</b>
|
---|
696 | \li PC SW: Yes
|
---|
697 | \li PPU : Yes
|
---|
698 | \li PS3 : Yes
|
---|
699 | \li XB360: Yes
|
---|
700 |
|
---|
701 | @see getNbDynamicShapes();
|
---|
702 | @see getTotalNbShapes()
|
---|
703 | */
|
---|
704 | virtual NxU32 getNbStaticShapes() const = 0;
|
---|
705 |
|
---|
706 | /**
|
---|
707 | \brief Returns the number of dynamic shapes in the scene.
|
---|
708 |
|
---|
709 | \return the number of dynamic shapes.
|
---|
710 |
|
---|
711 | <b>Platform:</b>
|
---|
712 | \li PC SW: Yes
|
---|
713 | \li PPU : Yes
|
---|
714 | \li PS3 : Yes
|
---|
715 | \li XB360: Yes
|
---|
716 |
|
---|
717 | @see getNbStaticShapes()
|
---|
718 | @see getTotalNbShapes()
|
---|
719 | */
|
---|
720 | virtual NxU32 getNbDynamicShapes() const = 0;
|
---|
721 |
|
---|
722 | /**
|
---|
723 | \brief Returns the total number of shapes in the scene, including compounds' sub-shapes.
|
---|
724 |
|
---|
725 | \return the total number of shapes.
|
---|
726 |
|
---|
727 | <b>Platform:</b>
|
---|
728 | \li PC SW: Yes
|
---|
729 | \li PPU : Yes
|
---|
730 | \li PS3 : Yes
|
---|
731 | \li XB360: Yes
|
---|
732 |
|
---|
733 | @see getNbStaticShapes()
|
---|
734 | @see getNbDynamicShapes()
|
---|
735 | */
|
---|
736 | virtual NxU32 getTotalNbShapes() const = 0;
|
---|
737 |
|
---|
738 | /**
|
---|
739 | \brief Returns the number of joints in the scene.
|
---|
740 |
|
---|
741 | \return the number of joints in this scene. This includes all joints, even broken ones.
|
---|
742 |
|
---|
743 | <b>Platform:</b>
|
---|
744 | \li PC SW: Yes
|
---|
745 | \li PPU : No
|
---|
746 | \li PS3 : Yes
|
---|
747 | \li XB360: Yes
|
---|
748 |
|
---|
749 | @see getNextJoint()
|
---|
750 | */
|
---|
751 | virtual NxU32 getNbJoints() const = 0;
|
---|
752 |
|
---|
753 | /**
|
---|
754 |
|
---|
755 | \brief Restarts the joint iterator so that the next call to ::getNextJoint() returns the first joint in the scene.
|
---|
756 |
|
---|
757 | Creating or deleting joints resets the joint iterator.
|
---|
758 |
|
---|
759 | <b>Platform:</b>
|
---|
760 | \li PC SW: Yes
|
---|
761 | \li PPU : No
|
---|
762 | \li PS3 : Yes
|
---|
763 | \li XB360: Yes
|
---|
764 |
|
---|
765 | @see resetJointIterator() getNbJoints()
|
---|
766 | */
|
---|
767 | virtual void resetJointIterator() = 0;
|
---|
768 |
|
---|
769 | /**
|
---|
770 | \brief Retrieves the next joint when iterating.
|
---|
771 |
|
---|
772 | First call resetJointIterator(), then call this method repeatedly until it returns
|
---|
773 | zero. After a call to resetJointIterator(), repeated calls to getNextJoint() should return a sequence of getNbJoints()
|
---|
774 | joint pointers. The getNbJoints()+1th call will return 0.
|
---|
775 | Creating or deleting joints resets the joint iterator.
|
---|
776 |
|
---|
777 | @see resetJointIterator.
|
---|
778 |
|
---|
779 | \return The next joint in the iteration sequence. Or NULL when the end of the list of joints is reached.
|
---|
780 |
|
---|
781 | <b>Platform:</b>
|
---|
782 | \li PC SW: Yes
|
---|
783 | \li PPU : No
|
---|
784 | \li PS3 : Yes
|
---|
785 | \li XB360: Yes
|
---|
786 |
|
---|
787 | @see resetJointIterator() getNbJoints()
|
---|
788 | */
|
---|
789 | virtual NxJoint * getNextJoint() = 0;
|
---|
790 |
|
---|
791 | /**
|
---|
792 | \brief Returns the number of effectors in the scene.
|
---|
793 |
|
---|
794 | \return the number of effectors in this scene.
|
---|
795 |
|
---|
796 | <b>Platform:</b>
|
---|
797 | \li PC SW: Yes
|
---|
798 | \li PPU : No
|
---|
799 | \li PS3 : Yes
|
---|
800 | \li XB360: Yes
|
---|
801 |
|
---|
802 | @see getNextEffector()
|
---|
803 | */
|
---|
804 | virtual NxU32 getNbEffectors() const = 0;
|
---|
805 |
|
---|
806 | /**
|
---|
807 | \brief Restarts the effector iterator so that the next call to ::getNextEffector() returns the first effector in the scene.
|
---|
808 |
|
---|
809 | Creating or deleting effectors resets the joint iterator.
|
---|
810 |
|
---|
811 | <b>Platform:</b>
|
---|
812 | \li PC SW: Yes
|
---|
813 | \li PPU : No
|
---|
814 | \li PS3 : Yes
|
---|
815 | \li XB360: Yes
|
---|
816 |
|
---|
817 | @see getNextEffector() getNbEffectors()
|
---|
818 | */
|
---|
819 | virtual void resetEffectorIterator() = 0;
|
---|
820 |
|
---|
821 | /**
|
---|
822 | \brief Retrieves the next effector when iterating through the effectors in the scene.
|
---|
823 |
|
---|
824 | First call resetEffectorIterator(), then call this method repeatedly until it returns
|
---|
825 | zero. After a call to resetEffectorIterator(), repeated calls to getNextEffector() should return a sequence of getNbEffectors()
|
---|
826 | effector pointers. The getNbEffectors()+1th call will return 0.
|
---|
827 | Creating or deleting effectors resets the joint iterator.
|
---|
828 |
|
---|
829 | @see resetEffectorIterator.
|
---|
830 |
|
---|
831 | \return The next effector in the iteration sequence. Or NULL when the end of the list of joints is reached.
|
---|
832 |
|
---|
833 | <b>Platform:</b>
|
---|
834 | \li PC SW: Yes
|
---|
835 | \li PPU : No
|
---|
836 | \li PS3 : Yes
|
---|
837 | \li XB360: Yes
|
---|
838 |
|
---|
839 | @see resetEffectorIterator() getNbEffectors()
|
---|
840 | */
|
---|
841 | virtual NxEffector * getNextEffector() = 0;
|
---|
842 | //@}
|
---|
843 | /************************************************************************************************/
|
---|
844 |
|
---|
845 | /** @name Materials
|
---|
846 | */
|
---|
847 | //@{
|
---|
848 |
|
---|
849 | /**
|
---|
850 | \brief Return the number of materials in the scene.
|
---|
851 |
|
---|
852 | Note that the returned value is not related to material indices (NxMaterialIndex).
|
---|
853 | Those may not be allocated continuously, and its values may be higher than getNbMaterials().
|
---|
854 | This will also include the default material which exists without having to be created.
|
---|
855 |
|
---|
856 | \return The size of the internal material array.
|
---|
857 |
|
---|
858 | <b>Platform:</b>
|
---|
859 | \li PC SW: Yes
|
---|
860 | \li PPU : Yes
|
---|
861 | \li PS3 : Yes
|
---|
862 | \li XB360: Yes
|
---|
863 |
|
---|
864 | @see getMaterialArray()
|
---|
865 | */
|
---|
866 | virtual NxU32 getNbMaterials() const = 0;
|
---|
867 |
|
---|
868 | /**
|
---|
869 | \brief Writes the scene's array of material pointers to a user buffer.
|
---|
870 |
|
---|
871 | bufferSize is the number of pointers (not bytes) that the buffer can hold.
|
---|
872 | usersIterator is an iterator that the user should initialize to 0 to start copying the array from the beginning.
|
---|
873 | Once the first call succeeds, the SDK will have changed the value of the iterator (in some data structure specific way) such that the
|
---|
874 | next get*Array() call will return the next batch of values. This way a large internal array can be read out with several calls into
|
---|
875 | a smaller user side buffer.
|
---|
876 |
|
---|
877 | Returns the number of pointers written, this should be less or equal to bufferSize. This will also return the default material which exists without having to be created.
|
---|
878 |
|
---|
879 | The ordering of the materials in the array is not specified.
|
---|
880 |
|
---|
881 | Usage example:
|
---|
882 | \code
|
---|
883 | NxMaterial * ptrs[3];
|
---|
884 | NxU32 iterator = 0;
|
---|
885 | while (3 == s->getMaterialArray(ptrs, 3, iterator))
|
---|
886 | process3Materials(ptrs);
|
---|
887 |
|
---|
888 | \endcode
|
---|
889 |
|
---|
890 | \param[out] userBuffer The buffer to recieve material pointers.
|
---|
891 | \param[in] bufferSize The number of material pointers which can be stored in the buffer.
|
---|
892 | \param[in,out] usersIterator Cookie used to continue iteration from the last position.
|
---|
893 | \return The number of material pointers written to userBuffer.
|
---|
894 |
|
---|
895 | <b>Platform:</b>
|
---|
896 | \li PC SW: Yes
|
---|
897 | \li PPU : Yes
|
---|
898 | \li PS3 : Yes
|
---|
899 | \li XB360: Yes
|
---|
900 |
|
---|
901 | @see getNbMaterials() NxMaterial
|
---|
902 | */
|
---|
903 | virtual NxU32 getMaterialArray(NxMaterial ** userBuffer, NxU32 bufferSize, NxU32 & usersIterator) = 0;
|
---|
904 |
|
---|
905 | /**
|
---|
906 | \brief Returns current highest valid material index.
|
---|
907 |
|
---|
908 | Note that not all indices below this are valid if some of them belong to meshes that
|
---|
909 | have been freed.
|
---|
910 |
|
---|
911 | \return The highest material index.
|
---|
912 |
|
---|
913 | <b>Platform:</b>
|
---|
914 | \li PC SW: Yes
|
---|
915 | \li PPU : Yes
|
---|
916 | \li PS3 : Yes
|
---|
917 | \li XB360: Yes
|
---|
918 |
|
---|
919 | @see NxMaterial NxMaterialIndex NxScene.createMaterial()
|
---|
920 | */
|
---|
921 |
|
---|
922 | virtual NxMaterialIndex getHighestMaterialIndex() const = 0;
|
---|
923 |
|
---|
924 | /**
|
---|
925 | \brief Retrieves the material with the given material index.
|
---|
926 |
|
---|
927 | If the material index is out of range or belongs to a material that was released, 0 is returned,
|
---|
928 | but no error is reported.
|
---|
929 | You can get a pointer to the default material (the material that all invalid material indices are mapped to) by using index 0.
|
---|
930 | You can then change this default material. Releasing the default material has no effect.
|
---|
931 |
|
---|
932 | \param[in] matIndex Material index to retrieve.
|
---|
933 | \return The associated material.
|
---|
934 |
|
---|
935 | <b>Platform:</b>
|
---|
936 | \li PC SW: Yes
|
---|
937 | \li PPU : Yes
|
---|
938 | \li PS3 : Yes
|
---|
939 | \li XB360: Yes
|
---|
940 |
|
---|
941 | @see NxMaterial NxMaterialIndex NxScene.createMaterial() getHighestMaterialIndex()
|
---|
942 | */
|
---|
943 | virtual NxMaterial * getMaterialFromIndex(NxMaterialIndex matIndex) = 0;
|
---|
944 |
|
---|
945 | //@}
|
---|
946 | /************************************************************************************************/
|
---|
947 |
|
---|
948 | /**
|
---|
949 | \brief Flush the scene's command queue for processing.
|
---|
950 |
|
---|
951 | Flushes any buffered commands so that they get executed.
|
---|
952 | Ensures that commands buffered in the system will continue to make forward progress until completion.
|
---|
953 |
|
---|
954 | <b>Platform:</b>
|
---|
955 | \li PC SW: Yes
|
---|
956 | \li PPU : Yes
|
---|
957 | \li PS3 : Yes
|
---|
958 | \li XB360: Yes
|
---|
959 |
|
---|
960 | @see setTiming() simulate() fetchResults() checkResults()
|
---|
961 | */
|
---|
962 | virtual void flushStream() = 0;
|
---|
963 |
|
---|
964 | /**
|
---|
965 | \brief Sets simulation timing parameters used in simulate(elapsedTime).
|
---|
966 |
|
---|
967 | If method is NX_TIMESTEP_FIXED, elapsedTime is internally subdivided into up to
|
---|
968 | maxIter substeps no larger than maxTimestep.
|
---|
969 |
|
---|
970 | If elapsedTime is not a multiple of maxTimestep then any remaining time is accumulated
|
---|
971 | to be added onto the elapsedTime for the next time step.
|
---|
972 |
|
---|
973 | If more sub steps than maxIter are needed to advance the simulation by elapsed time, then
|
---|
974 | the remaining time is also accumulated for the next call to simulate().
|
---|
975 |
|
---|
976 | The timestep method of TIMESTEP_FIXED is strongly preferred for stable, reproducible simulation.
|
---|
977 |
|
---|
978 | Alternatively NX_TIMESTEP_VARIABLE can be used, in this case the first two parameters
|
---|
979 | are not used. See also ::NxTimeStepMethod.
|
---|
980 |
|
---|
981 | \param[in] maxTimestep Maximum size to take for a timestep. <b>Range:</b> (0,inf)
|
---|
982 | \param[in] maxIter Maximum number of iterations to divide a timestep into.
|
---|
983 | \param[in] method Method to use for for timestepp(either variable time step or fixed). See #NxTimeStepMethod.
|
---|
984 |
|
---|
985 | <b>Platform:</b>
|
---|
986 | \li PC SW: Yes
|
---|
987 | \li PPU : No
|
---|
988 | \li PS3 : Yes
|
---|
989 | \li XB360: Yes
|
---|
990 |
|
---|
991 | @see flushStream() simulate() fetchResults() checkResults()
|
---|
992 | */
|
---|
993 | virtual void setTiming(NxReal maxTimestep=1.0f/60.0f, NxU32 maxIter=8, NxTimeStepMethod method=NX_TIMESTEP_FIXED) = 0;
|
---|
994 |
|
---|
995 | /**
|
---|
996 | \brief Retrieves simulation timing parameters.
|
---|
997 |
|
---|
998 | \param[in] maxTimestep Maximum size to take for a timestep. <b>Range:</b> (0,inf)
|
---|
999 | \param[in] maxIter Maximum number of iterations to divide a timestep into.
|
---|
1000 | \param[in] method Method to use for for timestepp(either variable time step or fixed). See #NxTimeStepMethod.
|
---|
1001 | \param[in] numSubSteps The number of sub steps the time step will be divided into.
|
---|
1002 |
|
---|
1003 | <b>Platform:</b>
|
---|
1004 | \li PC SW: Yes
|
---|
1005 | \li PPU : No
|
---|
1006 | \li PS3 : Yes
|
---|
1007 | \li XB360: Yes
|
---|
1008 |
|
---|
1009 | @see setTiming()
|
---|
1010 | */
|
---|
1011 | virtual void getTiming(NxReal& maxTimestep, NxU32& maxIter, NxTimeStepMethod& method, NxU32* numSubSteps=NULL) const = 0;
|
---|
1012 |
|
---|
1013 | /**
|
---|
1014 | \brief Retrieves the debug renderable.
|
---|
1015 |
|
---|
1016 | This will contain the results of any active visualization for this scene.
|
---|
1017 | \return The debug renderable.
|
---|
1018 |
|
---|
1019 | <b>Platform:</b>
|
---|
1020 | \li PC SW: Yes
|
---|
1021 | \li PPU : No
|
---|
1022 | \li PS3 : Yes
|
---|
1023 | \li XB360: Yes
|
---|
1024 |
|
---|
1025 | @see NxDebugRenderable
|
---|
1026 | */
|
---|
1027 | virtual const NxDebugRenderable * getDebugRenderable() = 0;
|
---|
1028 |
|
---|
1029 | /**
|
---|
1030 | \brief Call this method to retrieve the Physics SDK.
|
---|
1031 |
|
---|
1032 | \return The physics SDK this scene is associated with.
|
---|
1033 |
|
---|
1034 | <b>Platform:</b>
|
---|
1035 | \li PC SW: Yes
|
---|
1036 | \li PPU : Yes
|
---|
1037 | \li PS3 : Yes
|
---|
1038 | \li XB360: Yes
|
---|
1039 |
|
---|
1040 | @see NxPhysicsSDK
|
---|
1041 | */
|
---|
1042 | virtual NxPhysicsSDK& getPhysicsSDK() = 0;
|
---|
1043 |
|
---|
1044 | /**
|
---|
1045 | \brief Call this method to retrieve statistics about the current scene.
|
---|
1046 |
|
---|
1047 | \param[out] stats Used to retrieve statistics for the scene. See #NxSceneStats.
|
---|
1048 |
|
---|
1049 | <b>Platform:</b>
|
---|
1050 | \li PC SW: Yes
|
---|
1051 | \li PPU : No
|
---|
1052 | \li PS3 : Yes
|
---|
1053 | \li XB360: Yes
|
---|
1054 |
|
---|
1055 | @see NxSceneStats getLimits()
|
---|
1056 | */
|
---|
1057 | virtual void getStats(NxSceneStats& stats) const = 0;
|
---|
1058 |
|
---|
1059 | /**
|
---|
1060 | \brief Call to retrieve the expected object count limits set in the scene descriptor.
|
---|
1061 |
|
---|
1062 | \param[out] limits Used to retrieve the limits for the scene(eg maximum number of actors). See #NxSceneLimits.
|
---|
1063 |
|
---|
1064 | <b>Platform:</b>
|
---|
1065 | \li PC SW: Yes
|
---|
1066 | \li PPU : No
|
---|
1067 | \li PS3 : Yes
|
---|
1068 | \li XB360: Yes
|
---|
1069 |
|
---|
1070 | @see NxSceneLimits getStats() NxSceneStats
|
---|
1071 | */
|
---|
1072 | virtual void getLimits(NxSceneLimits& limits) const = 0;
|
---|
1073 |
|
---|
1074 | /************************************************************************************************/
|
---|
1075 |
|
---|
1076 | /** @name Callbacks
|
---|
1077 | */
|
---|
1078 | //@{
|
---|
1079 |
|
---|
1080 | /**
|
---|
1081 | \brief Sets a user notify object which receives special simulation events when they occur.
|
---|
1082 |
|
---|
1083 | \param[in] callback User notification callback. See #NxUserNotify.
|
---|
1084 |
|
---|
1085 | <b>Platform:</b>
|
---|
1086 | \li PC SW: Yes
|
---|
1087 | \li PPU : No
|
---|
1088 | \li PS3 : Yes
|
---|
1089 | \li XB360: Yes
|
---|
1090 |
|
---|
1091 | @see NxUserNotify getUserNotify
|
---|
1092 | */
|
---|
1093 | virtual void setUserNotify(NxUserNotify* callback) = 0;
|
---|
1094 |
|
---|
1095 | /**
|
---|
1096 | \brief Retrieves the userNotify pointer set with setUserNotify().
|
---|
1097 |
|
---|
1098 | \return The current user notify pointer. See #NxUserNotify.
|
---|
1099 |
|
---|
1100 | <b>Platform:</b>
|
---|
1101 | \li PC SW: Yes
|
---|
1102 | \li PPU : No
|
---|
1103 | \li PS3 : Yes
|
---|
1104 | \li XB360: Yes
|
---|
1105 |
|
---|
1106 | @see NxUserNotify setUserNotify()
|
---|
1107 | */
|
---|
1108 | virtual NxUserNotify* getUserNotify() const = 0;
|
---|
1109 |
|
---|
1110 | /**
|
---|
1111 | \brief Sets a trigger report object which receives collision trigger events.
|
---|
1112 |
|
---|
1113 | \param[in] callback User trigger callback. See #NxUserTriggerReport.
|
---|
1114 |
|
---|
1115 | <b>Platform:</b>
|
---|
1116 | \li PC SW: Yes
|
---|
1117 | \li PPU : No
|
---|
1118 | \li PS3 : Yes
|
---|
1119 | \li XB360: Yes
|
---|
1120 |
|
---|
1121 | @see NxUserTriggerReport getUserTriggerReport()
|
---|
1122 | */
|
---|
1123 | virtual void setUserTriggerReport(NxUserTriggerReport* callback) = 0;
|
---|
1124 |
|
---|
1125 | /**
|
---|
1126 | \brief Retrieves the callback pointer set with setUserTriggerReport().
|
---|
1127 |
|
---|
1128 | \return The current user trigger pointer. See #NxUserTriggerReport.
|
---|
1129 |
|
---|
1130 | <b>Platform:</b>
|
---|
1131 | \li PC SW: Yes
|
---|
1132 | \li PPU : No
|
---|
1133 | \li PS3 : Yes
|
---|
1134 | \li XB360: Yes
|
---|
1135 |
|
---|
1136 | @see NxUserTriggerReport setUserTriggerReport()
|
---|
1137 | */
|
---|
1138 | virtual NxUserTriggerReport* getUserTriggerReport() const = 0;
|
---|
1139 |
|
---|
1140 | /**
|
---|
1141 | \brief Sets a contact report object which receives collision contact events.
|
---|
1142 |
|
---|
1143 | \param[in] callback User contact callback. See #NxUserContactReport.
|
---|
1144 |
|
---|
1145 | <b>Platform:</b>
|
---|
1146 | \li PC SW: Yes
|
---|
1147 | \li PPU : No
|
---|
1148 | \li PS3 : Yes
|
---|
1149 | \li XB360: Yes
|
---|
1150 |
|
---|
1151 | @see NxUserContactReport getUserContactReport()
|
---|
1152 | */
|
---|
1153 | virtual void setUserContactReport(NxUserContactReport* callback) = 0;
|
---|
1154 |
|
---|
1155 | /**
|
---|
1156 | \brief Retrieves the callback pointer set with setUserContactReport().
|
---|
1157 |
|
---|
1158 | \return The current user contact reporter. See #NxUserContactReport.
|
---|
1159 |
|
---|
1160 | <b>Platform:</b>
|
---|
1161 | \li PC SW: Yes
|
---|
1162 | \li PPU : No
|
---|
1163 | \li PS3 : Yes
|
---|
1164 | \li XB360: Yes
|
---|
1165 |
|
---|
1166 | @see NxUserContactReport setUserContactReport()
|
---|
1167 | */
|
---|
1168 | virtual NxUserContactReport* getUserContactReport() const = 0;
|
---|
1169 |
|
---|
1170 | #if NX_USE_FLUID_API
|
---|
1171 |
|
---|
1172 | /**
|
---|
1173 | Not available in the current release.
|
---|
1174 | The fluid equivalent for registering a specialized version of the user contact report.
|
---|
1175 |
|
---|
1176 | \param[in] callback User fluid contact callback. See #NxUserFluidContactReport.
|
---|
1177 |
|
---|
1178 | <b>Platform:</b>
|
---|
1179 | \li PC SW: No
|
---|
1180 | \li PPU : No
|
---|
1181 | \li PS3 : No
|
---|
1182 | \li XB360: No
|
---|
1183 | */
|
---|
1184 | virtual void setUserFluidContactReport(NxUserFluidContactReport* callback) = 0;
|
---|
1185 |
|
---|
1186 | /**
|
---|
1187 | Not available in the current release.
|
---|
1188 | Retrieves the callback pointer set with setUserFluidContactReport().
|
---|
1189 |
|
---|
1190 | \return The current user fluid contact reporter. See #NxUserFluidContactReport.
|
---|
1191 |
|
---|
1192 | <b>Platform:</b>
|
---|
1193 | \li PC SW: No
|
---|
1194 | \li PPU : No
|
---|
1195 | \li PS3 : No
|
---|
1196 | \li XB360: No
|
---|
1197 | */
|
---|
1198 | virtual NxUserFluidContactReport* getUserFluidContactReport() const = 0;
|
---|
1199 |
|
---|
1200 | #endif
|
---|
1201 | //@}
|
---|
1202 | /************************************************************************************************/
|
---|
1203 |
|
---|
1204 | /** @name Raycasting
|
---|
1205 | */
|
---|
1206 | //@{
|
---|
1207 |
|
---|
1208 | /**
|
---|
1209 | \brief Returns true if any axis aligned bounding box enclosing a shape of type shapeType is intersected by the ray.
|
---|
1210 |
|
---|
1211 | Note: Make certain that the direction vector of NxRay is normalized.
|
---|
1212 |
|
---|
1213 | \param[in] worldRay The ray to cast in the global frame. <b>Range:</b> See #NxRay
|
---|
1214 | \param[in] shapesType Choose if to raycast against static, dynamic or both types of shape. See #NxShapesType.
|
---|
1215 | \param[in] groups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1216 | \param[in] maxDist Max distance to check along the ray for intersecting bounds. <b>Range:</b> (0,inf)
|
---|
1217 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1218 |
|
---|
1219 | \return true if any axis aligned bounding box enclosing a shape of type shapeType is intersected by the ray
|
---|
1220 |
|
---|
1221 | <b>Platform:</b>
|
---|
1222 | \li PC SW: Yes
|
---|
1223 | \li PPU : No
|
---|
1224 | \li PS3 : Yes
|
---|
1225 | \li XB360: Yes
|
---|
1226 |
|
---|
1227 | @see NxShapesType NxRay NxShape.setGroup() raycastAnyShape()
|
---|
1228 | */
|
---|
1229 | virtual bool raycastAnyBounds (const NxRay& worldRay, NxShapesType shapesType, NxU32 groups=0xffffffff, NxReal maxDist=NX_MAX_F32, const NxGroupsMask* groupsMask=NULL) const = 0;
|
---|
1230 |
|
---|
1231 | /**
|
---|
1232 | \brief Returns true if any shape of type ShapeType is intersected by the ray.
|
---|
1233 |
|
---|
1234 | Note: Make certain that the direction vector of NxRay is normalized.
|
---|
1235 |
|
---|
1236 | \param[in] worldRay The ray to cast in the global frame. <b>Range:</b> See #NxRay
|
---|
1237 | \param[in] shapesType Choose if to raycast against static, dynamic or both types of shape. See #NxShapesType.
|
---|
1238 | \param[in] groups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1239 | \param[in] maxDist Max distance to check along the ray for intersecting objects. <b>Range:</b> (0,inf)
|
---|
1240 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1241 |
|
---|
1242 | \return Returns true if any shape of type ShapeType is intersected by the ray.
|
---|
1243 |
|
---|
1244 | <b>Platform:</b>
|
---|
1245 | \li PC SW: Yes
|
---|
1246 | \li PPU : No
|
---|
1247 | \li PS3 : Yes
|
---|
1248 | \li XB360: Yes
|
---|
1249 |
|
---|
1250 | @see NxShapesType NxRay NxShape.setGroup() raycastAnyBounds()
|
---|
1251 | */
|
---|
1252 | virtual bool raycastAnyShape (const NxRay& worldRay, NxShapesType shapesType, NxU32 groups=0xffffffff, NxReal maxDist=NX_MAX_F32, const NxGroupsMask* groupsMask=NULL) const = 0;
|
---|
1253 |
|
---|
1254 | /**
|
---|
1255 | \brief Calls the report's hitCallback() method for all the axis aligned bounding boxes enclosing shapes of type ShapeType intersected by the ray.
|
---|
1256 |
|
---|
1257 | The point of impact is provided as a parameter to hitCallback().
|
---|
1258 | hintFlags is a combination of ::NxRaycastBit flags.
|
---|
1259 | Returns the number of shapes hit.
|
---|
1260 |
|
---|
1261 | Note: Make certain that the direction vector of NxRay is normalized.
|
---|
1262 |
|
---|
1263 | \param[in] worldRay The ray to cast in the global frame. <b>Range:</b> See #NxRay
|
---|
1264 | \param[in] report User callback, to be called when an intersection is encountered.
|
---|
1265 | \param[in] shapesType Choose if to raycast against static, dynamic or both types of shape. See #NxShapesType.
|
---|
1266 | \param[in] groups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1267 | \param[in] maxDist Max distance to check along the ray for intersecting objects. <b>Range:</b> (0,inf)
|
---|
1268 | \param[in] hintFlags Allows the user to specify which field of #NxRaycastHit they are interested in.
|
---|
1269 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1270 |
|
---|
1271 | \return the number of shapes hit.
|
---|
1272 |
|
---|
1273 | <b>Platform:</b>
|
---|
1274 | \li PC SW: Yes
|
---|
1275 | \li PPU : No
|
---|
1276 | \li PS3 : Yes
|
---|
1277 | \li XB360: Yes
|
---|
1278 |
|
---|
1279 | @see raycastAnyBounds() raycastAllShapes() NxRay NxUserRaycastReport NxShapesType NxShape.setGroup() NxRaycastHit
|
---|
1280 | */
|
---|
1281 | virtual NxU32 raycastAllBounds (const NxRay& worldRay, NxUserRaycastReport& report, NxShapesType shapesType, NxU32 groups=0xffffffff, NxReal maxDist=NX_MAX_F32, NxU32 hintFlags=0xffffffff, const NxGroupsMask* groupsMask=NULL) const = 0;
|
---|
1282 |
|
---|
1283 | /**
|
---|
1284 | \brief Calls the report's hitCallback() method for all the shapes of type ShapeType intersected by the ray.
|
---|
1285 |
|
---|
1286 | hintFlags is a combination of ::NxRaycastBit flags.
|
---|
1287 | Returns the number of shapes hit. The point of impact is provided as a parameter to hitCallback().
|
---|
1288 |
|
---|
1289 | Note: Make certain that the direction vector of NxRay is normalized.
|
---|
1290 |
|
---|
1291 | <h3>Example</h3>
|
---|
1292 |
|
---|
1293 | \include NxUserRaycastReport_Usage.cpp
|
---|
1294 |
|
---|
1295 |
|
---|
1296 | \param[in] worldRay The ray to cast in the global frame. <b>Range:</b> See #NxRay
|
---|
1297 | \param[in] report User callback, to be called when an intersection is encountered.
|
---|
1298 | \param[in] shapesType Choose if to raycast against static, dynamic or both types of shape. See #NxShapesType.
|
---|
1299 | \param[in] groups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1300 | \param[in] maxDist Max distance to check along the ray for intersecting objects. <b>Range:</b> (0,inf)
|
---|
1301 | \param[in] hintFlags Allows the user to specify which field of #NxRaycastHit they are interested in. See #NxRaycastBit
|
---|
1302 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1303 |
|
---|
1304 | \return the number of shapes hit
|
---|
1305 |
|
---|
1306 | <b>Platform:</b>
|
---|
1307 | \li PC SW: Yes
|
---|
1308 | \li PPU : No
|
---|
1309 | \li PS3 : Yes
|
---|
1310 | \li XB360: Yes
|
---|
1311 |
|
---|
1312 | @see raycastAnyShape() raycastAllBounds() NxRay NxUserRaycastReport NxShapesType NxShape.setGroup() NxRaycastHit
|
---|
1313 | */
|
---|
1314 | virtual NxU32 raycastAllShapes (const NxRay& worldRay, NxUserRaycastReport& report, NxShapesType shapesType, NxU32 groups=0xffffffff, NxReal maxDist=NX_MAX_F32, NxU32 hintFlags=0xffffffff, const NxGroupsMask* groupsMask=NULL) const = 0;
|
---|
1315 |
|
---|
1316 | /**
|
---|
1317 | \brief Returns the first axis aligned bounding box enclosing a shape of type shapeType that is hit along the ray.
|
---|
1318 |
|
---|
1319 | The world space intersectin point, and the distance along the ray are also provided.
|
---|
1320 | hintFlags is a combination of ::NxRaycastBit flags.
|
---|
1321 |
|
---|
1322 | Note: Make certain that the direction vector of NxRay is normalized.
|
---|
1323 |
|
---|
1324 | \param[in] worldRay The ray to cast in the global frame. <b>Range:</b> See #NxRay
|
---|
1325 | \param[in] shapeType Choose if to raycast against static, dynamic or both types of shape. See #NxShapesType.
|
---|
1326 | \param[out] hit Description of the intersection. See #NxRaycastHit.
|
---|
1327 | \param[in] groups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1328 | \param[in] maxDist Max distance to check along the ray for intersecting objects. <b>Range:</b> (0,inf)
|
---|
1329 | \param[in] hintFlags Allows the user to specify which field of #NxRaycastHit they are interested in. See #NxRaycastBit
|
---|
1330 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1331 |
|
---|
1332 | \return The shape which is hit.
|
---|
1333 |
|
---|
1334 | <b>Platform:</b>
|
---|
1335 | \li PC SW: Yes
|
---|
1336 | \li PPU : No
|
---|
1337 | \li PS3 : Yes
|
---|
1338 | \li XB360: Yes
|
---|
1339 |
|
---|
1340 | @see raycastAllBounds() NxRay NxShapesType NxRaycastHit NxShape.setGroup() NxRaycastBit
|
---|
1341 | */
|
---|
1342 | virtual NxShape* raycastClosestBounds (const NxRay& worldRay, NxShapesType shapeType, NxRaycastHit& hit, NxU32 groups=0xffffffff, NxReal maxDist=NX_MAX_F32, NxU32 hintFlags=0xffffffff, const NxGroupsMask* groupsMask=NULL) const = 0;
|
---|
1343 |
|
---|
1344 | /**
|
---|
1345 | \brief Returns the first shape of type shapeType that is hit along the ray.
|
---|
1346 |
|
---|
1347 | The world space intersectin point, and the distance along the ray are also provided.
|
---|
1348 | hintFlags is a combination of ::NxRaycastBit flags.
|
---|
1349 |
|
---|
1350 | Note: Make certain that the direction vector of NxRay is normalized.
|
---|
1351 |
|
---|
1352 | \param[in] worldRay The ray to cast in the global frame. <b>Range:</b> See #NxRay
|
---|
1353 | \param[in] shapeType Choose if to raycast against static, dynamic or both types of shape. See #NxShapesType.
|
---|
1354 | \param[out] hit Description of the intersection. See #NxRaycastHit.
|
---|
1355 | \param[in] groups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1356 | \param[in] maxDist Max distance to check along the ray for intersecting objects. <b>Range:</b> (0,inf)
|
---|
1357 | \param[in] hintFlags Allows the user to specify which field of #NxRaycastHit they are interested in. See #NxRaycastBit
|
---|
1358 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1359 |
|
---|
1360 | \return The shape which is hit.
|
---|
1361 |
|
---|
1362 | <b>Platform:</b>
|
---|
1363 | \li PC SW: Yes
|
---|
1364 | \li PPU : No
|
---|
1365 | \li PS3 : Yes
|
---|
1366 | \li XB360: Yes
|
---|
1367 |
|
---|
1368 | @see raycastAllShapes() NxRay NxShapesType NxRaycastHit NxShape.setGroup() NxRaycastBit
|
---|
1369 | */
|
---|
1370 | virtual NxShape* raycastClosestShape (const NxRay& worldRay, NxShapesType shapeType, NxRaycastHit& hit, NxU32 groups=0xffffffff, NxReal maxDist=NX_MAX_F32, NxU32 hintFlags=0xffffffff, const NxGroupsMask* groupsMask=NULL) const = 0;
|
---|
1371 |
|
---|
1372 | //@}
|
---|
1373 | /************************************************************************************************/
|
---|
1374 |
|
---|
1375 | /** @name Overlap Testing
|
---|
1376 | */
|
---|
1377 | //@{
|
---|
1378 |
|
---|
1379 | /**
|
---|
1380 | \brief Returns the set of shapes overlapped by the world-space sphere.
|
---|
1381 |
|
---|
1382 | You can test against static and/or dynamic objects by adjusting 'shapeType'.
|
---|
1383 | Shapes are written to the static array 'shapes', which should be big enough to hold 'nbShapes'.
|
---|
1384 | An alternative is to use the ::NxUserEntityReport callback mechanism.
|
---|
1385 |
|
---|
1386 | The function returns the total number of collided shapes.
|
---|
1387 |
|
---|
1388 | NOTE: this functions only tests against the objects' AABBs!
|
---|
1389 |
|
---|
1390 | \param[in] worldSphere Sphere description in world space. <b>Range:</b> See #NxSphere
|
---|
1391 | \param[in] shapeType Choose if to intersect with static, dynamic or both types of shape. See #NxShapesType.
|
---|
1392 | \param[in] nbShapes Number of shapes that the buffer shapes can hold.
|
---|
1393 | \param[out] shapes Buffer to store intersecting shapes. Should be at least sizeof(NxShape *) * nbShapes.
|
---|
1394 | \param[in] callback Alternative method to retrieve overlapping shapes. Is called with sets of overlapping shapes.
|
---|
1395 | \param[in] activeGroups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1396 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1397 |
|
---|
1398 | \return the total number of collided shapes.
|
---|
1399 |
|
---|
1400 | <b>Platform:</b>
|
---|
1401 | \li PC SW: Yes
|
---|
1402 | \li PPU : No
|
---|
1403 | \li PS3 : Yes
|
---|
1404 | \li XB360: Yes
|
---|
1405 |
|
---|
1406 | @see NxSphere NxShapesType overlapAABBShapes NxUserEntityReport NxShape.checkOverlapSphere()
|
---|
1407 | */
|
---|
1408 | virtual NxU32 overlapSphereShapes (const NxSphere& worldSphere, NxShapesType shapeType, NxU32 nbShapes, NxShape** shapes, NxUserEntityReport<NxShape*>* callback, NxU32 activeGroups=0xffffffff, const NxGroupsMask* groupsMask=NULL) = 0;
|
---|
1409 |
|
---|
1410 | /**
|
---|
1411 | \brief Returns the set of shapes overlapped by the world-space AABB.
|
---|
1412 |
|
---|
1413 | You can test against static and/or dynamic objects by adjusting 'shapeType'.
|
---|
1414 | Shapes are written to the static array 'shapes', which should be big enough to hold 'nbShapes'.
|
---|
1415 | An alternative is to use the ::NxUserEntityReport callback mechanism.
|
---|
1416 |
|
---|
1417 | The function returns the total number of collided shapes.
|
---|
1418 |
|
---|
1419 | NOTE: this functions only tests against the objects' AABBs!
|
---|
1420 |
|
---|
1421 | \param[in] worldBounds Axis Aligned Bounding Box in world space. <b>Range:</b> See #NxBounds3
|
---|
1422 | \param[in] shapeType Choose if to intersect with static, dynamic or both types of shape. See #NxShapesType.
|
---|
1423 | \param[in] nbShapes Number of shapes that the buffer shapes can hold.
|
---|
1424 | \param[out] shapes Buffer to store intersecting shapes. Should be at least sizeof(NxShape *) * nbShapes.
|
---|
1425 | \param[in] callback Alternative method to retrieve overlapping shapes. Is called with sets of overlapping shapes.
|
---|
1426 | \param[in] activeGroups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1427 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1428 |
|
---|
1429 | \return the total number of collided shapes.
|
---|
1430 |
|
---|
1431 | <b>Platform:</b>
|
---|
1432 | \li PC SW: Yes
|
---|
1433 | \li PPU : No
|
---|
1434 | \li PS3 : Yes
|
---|
1435 | \li XB360: Yes
|
---|
1436 |
|
---|
1437 | @see NxBounds3 NxShapesType overlapSphereShapes NxUserEntityReport NxShape.checkOverlapAABB()
|
---|
1438 | */
|
---|
1439 | virtual NxU32 overlapAABBShapes (const NxBounds3& worldBounds, NxShapesType shapeType, NxU32 nbShapes, NxShape** shapes, NxUserEntityReport<NxShape*>* callback, NxU32 activeGroups=0xffffffff, const NxGroupsMask* groupsMask=NULL) = 0;
|
---|
1440 |
|
---|
1441 | /**
|
---|
1442 | \brief Returns the set of shapes which are in the negative half space of a number of planes.
|
---|
1443 |
|
---|
1444 | This function returns the set of shapes whose axis aligned bounding volumes are in the negative
|
---|
1445 | half space(side the normal points away from) of all the planes passed in.
|
---|
1446 |
|
---|
1447 | However the set of shapes returned is not conservative, ie additional shapes may be returned which
|
---|
1448 | do not actually intersect the union of the planes negative half space.
|
---|
1449 |
|
---|
1450 | You can test against static and/or dynamic objects by adjusting 'shapeType'.
|
---|
1451 | Shapes are written to the static array 'shapes', which should be big enough to hold 'nbShapes'.
|
---|
1452 | An alternative is to use the ::NxUserEntityReport callback mechanism.
|
---|
1453 |
|
---|
1454 | The function returns the total number of collided shapes.
|
---|
1455 |
|
---|
1456 | This function can be used for view-frustum culling by passing the 6 camera planes to the function.
|
---|
1457 |
|
---|
1458 | \warning Passing more than 32 planes to this function is unsupported and may result in undefined behavior.
|
---|
1459 |
|
---|
1460 | \param[in] nbPlanes Number of planes to test. (worldPlanes should contain this many planes)
|
---|
1461 | \param[in] worldPlanes Set of planes to test. <b>Range:</b> See #NxPlane
|
---|
1462 | \param[in] shapeType Choose if to intersect with static, dynamic or both types of shape. See #NxShapesType.
|
---|
1463 | \param[in] nbShapes Number of shapes that the buffer shapes can hold.
|
---|
1464 | \param[out] shapes Buffer to store intersecting shapes. Should be at least sizeof(NxShape *) * nbShapes.
|
---|
1465 | \param[in] callback Alternative method to retrieve overlapping shapes. Is called with sets of overlapping shapes.
|
---|
1466 | \param[in] activeGroups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1467 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1468 |
|
---|
1469 | \return the total number of collided shapes.
|
---|
1470 |
|
---|
1471 | <b>Platform:</b>
|
---|
1472 | \li PC SW: Yes
|
---|
1473 | \li PPU : No
|
---|
1474 | \li PS3 : Yes
|
---|
1475 | \li XB360: Yes
|
---|
1476 |
|
---|
1477 | @see NxPlane overlapAABBShapes() overlapSphereShapes() NxShapesType NxUserEntityReport NxShape.setGroup()
|
---|
1478 | */
|
---|
1479 |
|
---|
1480 | virtual NxU32 cullShapes (NxU32 nbPlanes, const NxPlane* worldPlanes, NxShapesType shapeType, NxU32 nbShapes, NxShape** shapes, NxUserEntityReport<NxShape*>* callback, NxU32 activeGroups=0xffffffff, const NxGroupsMask* groupsMask=NULL) = 0;
|
---|
1481 |
|
---|
1482 | /**
|
---|
1483 | \brief Checks whether a world-space sphere overlaps a shape or not.
|
---|
1484 |
|
---|
1485 | \param[in] worldSphere Sphere description in world space. <b>Range:</b> See #NxSphere
|
---|
1486 | \param[in] shapeType Choose if to intersect with static, dynamic or both types of shape. See #NxShapesType.
|
---|
1487 | \param[in] activeGroups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1488 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1489 |
|
---|
1490 | \return True if the sphere overlaps a shape.
|
---|
1491 |
|
---|
1492 | <b>Platform:</b>
|
---|
1493 | \li PC SW: Yes
|
---|
1494 | \li PPU : No
|
---|
1495 | \li PS3 : Yes
|
---|
1496 | \li XB360: Yes
|
---|
1497 |
|
---|
1498 | @see NxSphere NxShapesType overlapSphereShapes NxShape.checkOverlapSphere()
|
---|
1499 | */
|
---|
1500 | virtual bool checkOverlapSphere (const NxSphere& worldSphere, NxShapesType shapeType=NX_ALL_SHAPES, NxU32 activeGroups=0xffffffff, const NxGroupsMask* groupsMask=NULL) = 0;
|
---|
1501 |
|
---|
1502 | /**
|
---|
1503 | \brief Checks whether a world-space AABB overlaps a shape or not.
|
---|
1504 |
|
---|
1505 | \param[in] worldBounds Axis Aligned Bounding Box in world space. <b>Range:</b> See #NxBounds3
|
---|
1506 | \param[in] shapeType Choose if to intersect with static, dynamic or both types of shape. See #NxShapesType.
|
---|
1507 | \param[in] activeGroups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1508 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1509 |
|
---|
1510 | \return True if the AABB overlaps a shape.
|
---|
1511 |
|
---|
1512 | <b>Platform:</b>
|
---|
1513 | \li PC SW: Yes
|
---|
1514 | \li PPU : No
|
---|
1515 | \li PS3 : Yes
|
---|
1516 | \li XB360: Yes
|
---|
1517 |
|
---|
1518 | @see NxBounds3 NxShapesType overlapAABBShapes NxShape.checkOverlapAABB()
|
---|
1519 | */
|
---|
1520 | virtual bool checkOverlapAABB (const NxBounds3& worldBounds, NxShapesType shapeType=NX_ALL_SHAPES, NxU32 activeGroups=0xffffffff, const NxGroupsMask* groupsMask=NULL) = 0;
|
---|
1521 |
|
---|
1522 | /**
|
---|
1523 | \brief Checks whether a world-space capsule overlaps something or not.
|
---|
1524 |
|
---|
1525 | \param[in] worldCapsule Capsule description in world space. <b>Range:</b> See #NxCapsule
|
---|
1526 | \param[in] shapeType Choose if to intersect with static, dynamic or both types of shape. See #NxShapesType.
|
---|
1527 | \param[in] activeGroups Mask used to filter shape objects. See #NxShape::setGroup
|
---|
1528 | \param[in] groupsMask Alternative mask used to filter shapes. See #NxShape::setGroupsMask
|
---|
1529 |
|
---|
1530 | \return True if the capsule overlaps a shape.
|
---|
1531 |
|
---|
1532 | <b>Platform:</b>
|
---|
1533 | \li PC SW: Yes
|
---|
1534 | \li PPU : No
|
---|
1535 | \li PS3 : Yes
|
---|
1536 | \li XB360: Yes
|
---|
1537 |
|
---|
1538 | @see NxCapsule NxShapesType NxShape.setGroup NxShape.setGroupsMask
|
---|
1539 | */
|
---|
1540 | virtual bool checkOverlapCapsule (const NxCapsule& worldCapsule, NxShapesType shapeType=NX_ALL_SHAPES, NxU32 activeGroups=0xffffffff, const NxGroupsMask* groupsMask=NULL) = 0;
|
---|
1541 |
|
---|
1542 | //virtual NxU32 overlapAABBTriangles (const NxBounds3& worldBounds, NxArraySDK<NxTriangle>& worldTriangles) = 0;
|
---|
1543 | //@}
|
---|
1544 | /************************************************************************************************/
|
---|
1545 |
|
---|
1546 | /** @name Fluids
|
---|
1547 | */
|
---|
1548 | //@{
|
---|
1549 |
|
---|
1550 | #if NX_USE_FLUID_API
|
---|
1551 |
|
---|
1552 | /**
|
---|
1553 | Not available in the current release.
|
---|
1554 | Creates a fluid in this scene. NxFluidDesc::isValid() must return true.
|
---|
1555 |
|
---|
1556 | \param[in] fluidDesc Description of the fluid object to create. See #NxFluidDesc.
|
---|
1557 | \return The new fluid.
|
---|
1558 |
|
---|
1559 | <b>Platform:</b>
|
---|
1560 | \li PC SW: No
|
---|
1561 | \li PPU : Yes
|
---|
1562 | \li PS3 : No
|
---|
1563 | \li XB360: No
|
---|
1564 | */
|
---|
1565 | virtual NxFluid* createFluid(const NxFluidDesc& fluidDesc) = 0;
|
---|
1566 |
|
---|
1567 | /**
|
---|
1568 | Not available in the current release.
|
---|
1569 | Deletes the specified fluid. The fluid must be in this scene.
|
---|
1570 | Do not keep a reference to the deleted instance.
|
---|
1571 |
|
---|
1572 | \param[in] fluid Fluid to release.
|
---|
1573 |
|
---|
1574 | <b>Platform:</b>
|
---|
1575 | \li PC SW: No
|
---|
1576 | \li PPU : Yes
|
---|
1577 | \li PS3 : No
|
---|
1578 | \li XB360: No
|
---|
1579 | */
|
---|
1580 | virtual void releaseFluid(NxFluid& fluid) = 0;
|
---|
1581 |
|
---|
1582 | /**
|
---|
1583 | Not available in the current release.
|
---|
1584 | \return the number of fluids.
|
---|
1585 |
|
---|
1586 | <b>Platform:</b>
|
---|
1587 | \li PC SW: No
|
---|
1588 | \li PPU : Yes
|
---|
1589 | \li PS3 : No
|
---|
1590 | \li XB360: No
|
---|
1591 | */
|
---|
1592 | virtual NxU32 getNbFluids() const = 0;
|
---|
1593 |
|
---|
1594 | /**
|
---|
1595 | Not available in the current release.
|
---|
1596 | \return an array of fluid pointers with size getNbFluids().
|
---|
1597 |
|
---|
1598 | <b>Platform:</b>
|
---|
1599 | \li PC SW: No
|
---|
1600 | \li PPU : Yes
|
---|
1601 | \li PS3 : No
|
---|
1602 | \li XB360: No
|
---|
1603 | */
|
---|
1604 | virtual NxFluid** getFluids() = 0;
|
---|
1605 |
|
---|
1606 | /**
|
---|
1607 | Not available in the current release.
|
---|
1608 | Creates an implicit mesh in this scene. NxImplicitMeshDesc::isValid() must return true.
|
---|
1609 |
|
---|
1610 | \param[in] implMesh Descriptor for the Implicit mesh to create.
|
---|
1611 | \return The new implicit mesh.
|
---|
1612 |
|
---|
1613 | <b>Platform:</b>
|
---|
1614 | \li PC SW: No
|
---|
1615 | \li PPU : No
|
---|
1616 | \li PS3 : No
|
---|
1617 | \li XB360: No
|
---|
1618 | */
|
---|
1619 | virtual NxImplicitMesh* createImplicitMesh(const NxImplicitMeshDesc& implMesh) = 0;
|
---|
1620 |
|
---|
1621 | /**
|
---|
1622 | Not available in the current release.
|
---|
1623 | Deletes the specified implicit mesh. The implicit mesh must be in this scene.
|
---|
1624 | Do not keep a reference to the deleted instance.
|
---|
1625 |
|
---|
1626 | \param[in] implMesh Implicit mesh to release.
|
---|
1627 |
|
---|
1628 | <b>Platform:</b>
|
---|
1629 | \li PC SW: No
|
---|
1630 | \li PPU : No
|
---|
1631 | \li PS3 : No
|
---|
1632 | \li XB360: No
|
---|
1633 | */
|
---|
1634 | virtual void releaseImplicitMesh(NxImplicitMesh& implMesh) = 0;
|
---|
1635 |
|
---|
1636 | /**
|
---|
1637 | Not available in the current release.
|
---|
1638 | \return the number of implicit meshes.
|
---|
1639 |
|
---|
1640 | <b>Platform:</b>
|
---|
1641 | \li PC SW: No
|
---|
1642 | \li PPU : No
|
---|
1643 | \li PS3 : No
|
---|
1644 | \li XB360: No
|
---|
1645 | */
|
---|
1646 | virtual NxU32 getNbImplicitMeshes() const = 0;
|
---|
1647 |
|
---|
1648 | /**
|
---|
1649 | Not available in the current release.
|
---|
1650 | \return an array of implicit mesh pointers with size getNbImplicitMeshes().
|
---|
1651 |
|
---|
1652 | <b>Platform:</b>
|
---|
1653 | \li PC SW: No
|
---|
1654 | \li PPU : No
|
---|
1655 | \li PS3 : No
|
---|
1656 | \li XB360: No
|
---|
1657 | */
|
---|
1658 | virtual NxImplicitMesh** getImplicitMeshes() = 0;
|
---|
1659 |
|
---|
1660 | /**
|
---|
1661 | Not available in the current release.
|
---|
1662 | Create a triangle mesh for fluid collision with static triangles.
|
---|
1663 | Stream has to be created with NxCookFluidHardwareMesh().
|
---|
1664 |
|
---|
1665 | <b>Platform:</b>
|
---|
1666 | \li PC SW: No
|
---|
1667 | \li PPU : Yes
|
---|
1668 | \li PS3 : No
|
---|
1669 | \li XB360: No
|
---|
1670 | */
|
---|
1671 | virtual bool createFluidHardwareTriangleMesh(NxStream& stream) = 0;
|
---|
1672 |
|
---|
1673 | /**
|
---|
1674 | Not available in the current release.
|
---|
1675 | @see NxSceneDesc.simType
|
---|
1676 |
|
---|
1677 | <b>Platform:</b>
|
---|
1678 | \li PC SW: No
|
---|
1679 | \li PPU : Yes
|
---|
1680 | \li PS3 : No
|
---|
1681 | \li XB360: No
|
---|
1682 | */
|
---|
1683 | virtual NxU32 getSimType() const = 0;
|
---|
1684 |
|
---|
1685 | /**
|
---|
1686 | Not available in the current release.
|
---|
1687 | @see NxSceneDesc.hwSceneType
|
---|
1688 |
|
---|
1689 | <b>Platform:</b>
|
---|
1690 | \li PC SW: No
|
---|
1691 | \li PPU : Yes
|
---|
1692 | \li PS3 : No
|
---|
1693 | \li XB360: No
|
---|
1694 | */
|
---|
1695 | virtual NxU32 getHwSceneType() const = 0;
|
---|
1696 | #endif
|
---|
1697 |
|
---|
1698 | //@}
|
---|
1699 | /************************************************************************************************/
|
---|
1700 |
|
---|
1701 | /**
|
---|
1702 | \brief This is a query to see if the scene is in a state that allows the application to update scene state.
|
---|
1703 |
|
---|
1704 | \return True if the scene can be written by the application.
|
---|
1705 |
|
---|
1706 | <b>Platform:</b>
|
---|
1707 | \li PC SW: Yes
|
---|
1708 | \li PPU : Yes
|
---|
1709 | \li PS3 : Yes
|
---|
1710 | \li XB360: Yes
|
---|
1711 | */
|
---|
1712 | virtual bool isWritable() = 0;
|
---|
1713 |
|
---|
1714 | /**
|
---|
1715 | \brief Advances the simulation by an elapsedTime time.
|
---|
1716 |
|
---|
1717 | If elapsedTime is large, it is internally subdivided according to parameters provided with the
|
---|
1718 | #setTiming() method. See #setTiming() for a more detailed discussion of the elapsedTime parameter
|
---|
1719 | and time stepping behavior.
|
---|
1720 |
|
---|
1721 | Calls to simulate() should pair with calls to fetchResults():
|
---|
1722 | Each fetchResults() invocation corresponds to exactly one simulate()
|
---|
1723 | invocation; calling simulate() twice without an intervening fetchResults()
|
---|
1724 | or fetchResults() twice without an intervening simulate() causes an error
|
---|
1725 | condition.
|
---|
1726 |
|
---|
1727 | scene->simulate();
|
---|
1728 | ...do some processing until physics is computed...
|
---|
1729 | scene->fetchResults();
|
---|
1730 | ...now results of run may be retrieved.
|
---|
1731 |
|
---|
1732 | Applications should not modify physics objects between calls to
|
---|
1733 | simulate() and fetchResults();
|
---|
1734 |
|
---|
1735 | This method replaces startRun().
|
---|
1736 |
|
---|
1737 |
|
---|
1738 | \param[in] elapsedTime Amount of time to advance simulation by. <b>Range:</b> (0,inf)
|
---|
1739 |
|
---|
1740 | <b>Platform:</b>
|
---|
1741 | \li PC SW: Yes
|
---|
1742 | \li PPU : Yes
|
---|
1743 | \li PS3 : Yes
|
---|
1744 | \li XB360: Yes
|
---|
1745 |
|
---|
1746 | @see fetchResults() checkResults()
|
---|
1747 | */
|
---|
1748 | virtual void simulate(NxReal elapsedTime) = 0;
|
---|
1749 |
|
---|
1750 | /**
|
---|
1751 | \brief This checks to see if the part of the simulation run whose results you are interested in has completed.
|
---|
1752 |
|
---|
1753 | This does not cause the data available for reading to be updated with the results of the simulation, it is simply a status check.
|
---|
1754 | The bool will allow it to either return immediately or block waiting for the condition to be met so that it can return true
|
---|
1755 |
|
---|
1756 | This method replaces wait()
|
---|
1757 |
|
---|
1758 | \param[in] status The part of the simulation to check (eg NX_RIGID_BODY_FINISHED). See #NxSimulationStatus.
|
---|
1759 | \param[in] block When set to true will block until the condition is met.
|
---|
1760 | \return True if the results are available.
|
---|
1761 |
|
---|
1762 | <b>Platform:</b>
|
---|
1763 | \li PC SW: Yes
|
---|
1764 | \li PPU : Yes
|
---|
1765 | \li PS3 : Yes
|
---|
1766 | \li XB360: Yes
|
---|
1767 |
|
---|
1768 | @see simulate() fetchResults()
|
---|
1769 | */
|
---|
1770 | virtual bool checkResults(NxSimulationStatus status, bool block = false) = 0;
|
---|
1771 |
|
---|
1772 | /**
|
---|
1773 | This is the big brother to checkResults() it basically does the following:
|
---|
1774 |
|
---|
1775 | \code
|
---|
1776 | if ( checkResults(enum, block) )
|
---|
1777 | {
|
---|
1778 | fire appropriate callbacks
|
---|
1779 | swap buffers
|
---|
1780 | if (CheckResults(all_enums, false))
|
---|
1781 | make IsWritable() true
|
---|
1782 | return true
|
---|
1783 | }
|
---|
1784 | else
|
---|
1785 | return false
|
---|
1786 |
|
---|
1787 | \endcode
|
---|
1788 |
|
---|
1789 | \param[in] status The part of the simulation to fetch results for (eg NX_RIGID_BODY_FINISHED). See #NxSimulationStatus.
|
---|
1790 | \param[in] block When set to true will block until the condition is met.
|
---|
1791 | \param[in] errorState When non-zero will return an error value if an internal fatal error condition is detected.
|
---|
1792 | \return True if the results have been fetched.
|
---|
1793 |
|
---|
1794 | <b>Platform:</b>
|
---|
1795 | \li PC SW: Yes
|
---|
1796 | \li PPU : Yes
|
---|
1797 | \li PS3 : Yes
|
---|
1798 | \li XB360: Yes
|
---|
1799 |
|
---|
1800 | @see simulate() checkResults()
|
---|
1801 | */
|
---|
1802 | virtual bool fetchResults(NxSimulationStatus status, bool block = false, NxU32 *errorState = 0) = 0;
|
---|
1803 |
|
---|
1804 | /**
|
---|
1805 | Flush internal caches.
|
---|
1806 |
|
---|
1807 | <b>Platform:</b>
|
---|
1808 | \li PC SW: Yes
|
---|
1809 | \li PPU : Yes
|
---|
1810 | \li PS3 : Yes
|
---|
1811 | \li XB360: Yes
|
---|
1812 | */
|
---|
1813 | virtual void flushCaches() = 0;
|
---|
1814 |
|
---|
1815 | /**
|
---|
1816 | Accesses internal profiler. If clearData is true, the profile counters are reset. You will most likely want to call readProfileData(true)
|
---|
1817 | right after calling fetchResults(). If that is not the time you want to read out the data, just call readProfileData(false) at some other place
|
---|
1818 | in your code.
|
---|
1819 |
|
---|
1820 | <b>Platform:</b>
|
---|
1821 | \li PC SW: Yes
|
---|
1822 | \li PPU : No
|
---|
1823 | \li PS3 : Yes
|
---|
1824 | \li XB360: Yes
|
---|
1825 | */
|
---|
1826 | virtual const NxProfileData * readProfileData(bool clearData) = 0;
|
---|
1827 |
|
---|
1828 | void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object.
|
---|
1829 | };
|
---|
1830 |
|
---|
1831 | /** @} */
|
---|
1832 | #endif
|
---|
1833 |
|
---|
1834 |
|
---|
1835 | //AGCOPYRIGHTBEGIN
|
---|
1836 | ///////////////////////////////////////////////////////////////////////////
|
---|
1837 | // Copyright © 2005 AGEIA Technologies.
|
---|
1838 | // All rights reserved. www.ageia.com
|
---|
1839 | ///////////////////////////////////////////////////////////////////////////
|
---|
1840 | //AGCOPYRIGHTEND
|
---|
1841 |
|
---|