aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.h
blob: e8b26e316d477ac1ec5ed280a63fe10ed96af5a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of NVIDIA CORPORATION nor the names of its
//    contributors may be used to endorse or promote products derived
//    from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  

#ifndef PX_PHYSICS_SCB_CLOTH
#define PX_PHYSICS_SCB_CLOTH

#include "PxPhysXConfig.h"

#if PX_USE_CLOTH_API

#include "ScbActor.h"

#include "ScClothCore.h"
#include "NpClothParticleData.h"

namespace physx
{
struct PxClothCollisionSphere;

namespace Scb
{
class Cloth : public Scb::Actor
{
//= ATTENTION! =====================================================================================
// Changing the data layout of this class breaks the binary serialization format.  See comments for 
// PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
// function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
// accordingly.
//==================================================================================================

public:
// PX_SERIALIZATION
											Cloth(const PxEMPTY) : Scb::Actor(PxEmpty), mCloth(PxEmpty) {}
				void						exportExtraData(PxSerializationContext& stream) { mCloth.exportExtraData(stream); }
				void						importExtraData(PxDeserializationContext &context) { mCloth.importExtraData(context); }
				void						resolveReferences(Sc::ClothFabricCore& fabric) { mCloth.resolveReferences(fabric); }
				static void					getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
											Cloth(const PxTransform& globalPose, Sc::ClothFabricCore& fabric, const PxClothParticle* particles, PxClothFlags flags);
											~Cloth();

	//---------------------------------------------------------------------------------
	// Wrapper for Sc::ClothCore interface
	//---------------------------------------------------------------------------------

	PX_INLINE Sc::ClothFabricCore*		getFabric() const	{ return mCloth.getFabric();	}
	PX_INLINE void						resetFabric()		{ return mCloth.resetFabric();	}

	PX_INLINE void						setParticles(const PxClothParticle* currentParticles, const PxClothParticle* previousParticles);
	PX_INLINE PxU32						getNbParticles() const;

	PX_INLINE void						setMotionConstraints(const PxClothParticleMotionConstraint* motionConstraints);
	PX_INLINE bool						getMotionConstraints(PxClothParticleMotionConstraint* motionConstraintsBuffer) const;
	PX_INLINE PxU32						getNbMotionConstraints() const;

	PX_INLINE PxClothMotionConstraintConfig getMotionConstraintConfig() const;
	PX_INLINE void						setMotionConstraintConfig(const PxClothMotionConstraintConfig& config);

	PX_INLINE void						setSeparationConstraints(const PxClothParticleSeparationConstraint* separationConstraints);
	PX_INLINE bool						getSeparationConstraints(PxClothParticleSeparationConstraint* separationConstraintsBuffer) const;
	PX_INLINE PxU32						getNbSeparationConstraints() const;

	PX_INLINE void						clearInterpolation();

	PX_INLINE void						setParticleAccelerations(const PxVec4* particleAccelerations);
	PX_INLINE bool						getParticleAccelerations(PxVec4* particleAccelerationsBuffer) const;
	PX_INLINE PxU32						getNbParticleAccelerations() const;

	PX_INLINE void						addCollisionSphere(const PxClothCollisionSphere& sphere);
	PX_INLINE void						removeCollisionSphere(PxU32 index);
	PX_INLINE void						setCollisionSpheres(const PxClothCollisionSphere* spheresBuffer, PxU32 count);
	PX_INLINE PxU32						getNbCollisionSpheres() const;

	PX_INLINE void						getCollisionData(PxClothCollisionSphere* spheresBuffer, PxU32* capsulesBuffer, 
											PxClothCollisionPlane* planesBuffer, PxU32* convexesBuffer, PxClothCollisionTriangle* trianglesBuffer) const;

	PX_INLINE void						addCollisionCapsule(PxU32 first, PxU32 second);
	PX_INLINE void						removeCollisionCapsule(PxU32 index);
	PX_INLINE PxU32						getNbCollisionCapsules() const;

	PX_INLINE void						addCollisionTriangle(const PxClothCollisionTriangle& triangle);
	PX_INLINE void						removeCollisionTriangle(PxU32 index);
	PX_INLINE void						setCollisionTriangles(const PxClothCollisionTriangle* trianglesBuffer, PxU32 count);
	PX_INLINE PxU32						getNbCollisionTriangles() const;

	PX_INLINE void						addCollisionPlane(const PxClothCollisionPlane& plane);
	PX_INLINE void						removeCollisionPlane(PxU32 index);
	PX_INLINE void						setCollisionPlanes(const PxClothCollisionPlane* planesBuffer, PxU32 count);
	PX_INLINE PxU32						getNbCollisionPlanes() const;

	PX_INLINE void						addCollisionConvex(PxU32 mask);
	PX_INLINE void						removeCollisionConvex(PxU32 index);
	PX_INLINE PxU32						getNbCollisionConvexes() const;

	PX_INLINE void						setVirtualParticles(PxU32 numParticles, const PxU32* indices, PxU32 numWeights, const PxVec3* weights);

	PX_INLINE PxU32						getNbVirtualParticles() const;
	PX_INLINE void						getVirtualParticles(PxU32* indicesBuffer) const;

	PX_INLINE PxU32						getNbVirtualParticleWeights() const;
	PX_INLINE void						getVirtualParticleWeights(PxVec3* weightsBuffer) const;

	PX_INLINE PxTransform				getGlobalPose() const;
	PX_INLINE void						setGlobalPose(const PxTransform& pose);

	PX_INLINE void						setTargetPose(const PxTransform& pose);

	PX_INLINE PxVec3					getExternalAcceleration() const;
	PX_INLINE void						setExternalAcceleration(PxVec3 acceleration);

	PX_INLINE PxVec3					getLinearInertiaScale() const;
	PX_INLINE void						setLinearInertiaScale(PxVec3 scale);
	PX_INLINE PxVec3					getAngularInertiaScale() const;
	PX_INLINE void						setAngularInertiaScale(PxVec3 scale);
	PX_INLINE PxVec3					getCentrifugalInertiaScale() const;
	PX_INLINE void						setCentrifugalInertiaScale(PxVec3 scale);

	PX_INLINE PxVec3					getDampingCoefficient() const;
	PX_INLINE void						setDampingCoefficient(PxVec3 dampingCoefficient);

	PX_INLINE PxReal					getFrictionCoefficient() const;
	PX_INLINE void						setFrictionCoefficient(PxReal frictionCoefficient);

	PX_INLINE PxVec3					getLinearDragCoefficient() const;
	PX_INLINE void						setLinearDragCoefficient(PxVec3 dragCoefficient);
	PX_INLINE PxVec3					getAngularDragCoefficient() const;
	PX_INLINE void						setAngularDragCoefficient(PxVec3 dragCoefficient);

	PX_INLINE PxReal					getCollisionMassScale() const;
	PX_INLINE void						setCollisionMassScale(PxReal scalingCoefficient);

	PX_INLINE void						setSelfCollisionDistance(PxReal distance);
	PX_INLINE PxReal					getSelfCollisionDistance() const;
	PX_INLINE void						setSelfCollisionStiffness(PxReal stiffness);
	PX_INLINE PxReal					getSelfCollisionStiffness() const;

	PX_INLINE void						setSelfCollisionIndices(const PxU32* indices, PxU32 nbIndices);
	PX_INLINE bool						getSelfCollisionIndices(PxU32* indices) const;
	PX_INLINE PxU32						getNbSelfCollisionIndices() const;

	PX_INLINE void						setRestPositions(const PxVec4* restPositions);
	PX_INLINE bool						getRestPositions(PxVec4* restPositions) const;
	PX_INLINE PxU32						getNbRestPositions() const; 

	PX_INLINE PxReal					getSolverFrequency() const;
	PX_INLINE void						setSolverFrequency(PxReal);

	PX_INLINE PxReal					getStiffnessFrequency() const;
	PX_INLINE void						setStiffnessFrequency(PxReal);

	PX_INLINE void						setStretchConfig(PxClothFabricPhaseType::Enum type, const PxClothStretchConfig& config);
	PX_INLINE void						setTetherConfig(const PxClothTetherConfig& config);

	PX_INLINE PxClothStretchConfig		getStretchConfig(PxClothFabricPhaseType::Enum type) const;
	PX_INLINE PxClothTetherConfig		getTetherConfig() const;

	PX_INLINE PxClothFlags				getClothFlags() const;
	PX_INLINE void						setClothFlags(PxClothFlags flags);

	PX_INLINE PxVec3					getWindVelocity() const;
	PX_INLINE void						setWindVelocity(PxVec3);
	PX_INLINE PxReal					getDragCoefficient() const;
	PX_INLINE void						setDragCoefficient(PxReal);
	PX_INLINE PxReal					getLiftCoefficient() const;
	PX_INLINE void						setLiftCoefficient(PxReal);

	PX_INLINE bool						isSleeping() const;
	PX_INLINE PxReal					getSleepLinearVelocity() const;
	PX_INLINE void						setSleepLinearVelocity(PxReal threshold);
	PX_INLINE void						setWakeCounter(PxReal wakeCounterValue);
	PX_INLINE PxReal					getWakeCounter() const;
	PX_INLINE void						wakeUp();
	PX_INLINE void						putToSleep();

	PX_INLINE void						getParticleData(NpClothParticleData&);

	PX_INLINE PxReal					getPreviousTimeStep() const;

	PX_INLINE PxBounds3					getWorldBounds() const;

	PX_INLINE void						setSimulationFilterData(const PxFilterData& data);
	PX_INLINE PxFilterData				getSimulationFilterData() const;

	PX_INLINE void						setContactOffset(PxReal);
	PX_INLINE PxReal					getContactOffset() const;
	PX_INLINE void						setRestOffset(PxReal);
	PX_INLINE PxReal					getRestOffset() const;

	//---------------------------------------------------------------------------------
	// Data synchronization
	//---------------------------------------------------------------------------------
				
	// Synchronously called with fetchResults.
	void syncState();

	//---------------------------------------------------------------------------------
	// Miscellaneous
	//---------------------------------------------------------------------------------
	PX_FORCE_INLINE	const Sc::ClothCore&		getScCloth()		const	{ return mCloth; }  // Only use if you know what you're doing!
	PX_FORCE_INLINE	Sc::ClothCore&				getScCloth()				{ return mCloth; }  // Only use if you know what you're doing!

	static size_t getScOffset()	{ return reinterpret_cast<size_t>(&reinterpret_cast<Cloth*>(0)->mCloth);	}

private:
	Sc::ClothCore		mCloth;
};

PX_INLINE void Cloth::setParticles(const PxClothParticle* currentParticles, const PxClothParticle* previousParticles)
{
	if(!isBuffering())
		mCloth.setParticles(currentParticles, previousParticles);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setParticles() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbParticles() const 
{
	return mCloth.getNbParticles();
}

PX_INLINE void Cloth::setMotionConstraints(const PxClothParticleMotionConstraint* motionConstraints)
{
	if(!isBuffering())
		mCloth.setMotionConstraints(motionConstraints);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setMotionConstraints() not allowed while simulation is running.");
}

PX_INLINE bool Cloth::getMotionConstraints(PxClothParticleMotionConstraint* motionConstraintsBuffer) const
{
	if(!isBuffering())
		return mCloth.getMotionConstraints(motionConstraintsBuffer);
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getMotionConstraints() not allowed while simulation is running.");
		return false;
	}
}

PX_INLINE PxU32 Cloth::getNbMotionConstraints() const
{
	return mCloth.getNbMotionConstraints();
}

PX_INLINE PxClothMotionConstraintConfig Cloth::getMotionConstraintConfig() const
{
	if(!isBuffering())
		return mCloth.getMotionConstraintConfig();
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getMotionConstraintScaleBias() not allowed while simulation is running.");

	return PxClothMotionConstraintConfig();
}

PX_INLINE void Cloth::setMotionConstraintConfig(const PxClothMotionConstraintConfig& config)
{
	if(!isBuffering())
		mCloth.setMotionConstraintConfig(config);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setMotionConstraintConfig() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setSeparationConstraints(const PxClothParticleSeparationConstraint* separationConstraints)
{
	if(!isBuffering())
		mCloth.setSeparationConstraints(separationConstraints);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSeparationConstraints() not allowed while simulation is running.");
}

PX_INLINE bool Cloth::getSeparationConstraints(PxClothParticleSeparationConstraint* separationConstraintsBuffer) const
{
	if(!isBuffering())
		return mCloth.getSeparationConstraints(separationConstraintsBuffer);
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSeparationConstraints() not allowed while simulation is running.");
		return false;
	}
}

PX_INLINE PxU32 Cloth::getNbSeparationConstraints() const
{
	return mCloth.getNbSeparationConstraints();
}

PX_INLINE void Cloth::clearInterpolation()
{
	return mCloth.clearInterpolation();
}

PX_INLINE void Cloth::setParticleAccelerations(const PxVec4* particleAccelerations)
{
	if(!isBuffering())
		mCloth.setParticleAccelerations(particleAccelerations);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setParticleAccelerations() not allowed while simulation is running.");
}

PX_INLINE bool Cloth::getParticleAccelerations(PxVec4* particleAccelerationsBuffer) const
{
	if(!isBuffering())
		return mCloth.getParticleAccelerations(particleAccelerationsBuffer);
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getParticleAccelerations() not allowed while simulation is running.");
		return false;
	}
}

PX_INLINE PxU32 Cloth::getNbParticleAccelerations() const
{
	return mCloth.getNbParticleAccelerations();
}

PX_INLINE void Cloth::addCollisionSphere(const PxClothCollisionSphere& sphere)
{
	if(!isBuffering())
		mCloth.addCollisionSphere(sphere);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionSphere() not allowed while simulation is running.");
}

PX_INLINE void Cloth::removeCollisionSphere(PxU32 index)
{
	if(!isBuffering())
		mCloth.removeCollisionSphere(index);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionSphere() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setCollisionSpheres(const PxClothCollisionSphere* spheresBuffer, PxU32 count)
{
	if(!isBuffering())
		mCloth.setCollisionSpheres(spheresBuffer, count);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionSpheres() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbCollisionSpheres() const
{
	if(!isBuffering())
		return mCloth.getNbCollisionSpheres();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbCollisionSpheres() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::getCollisionData( PxClothCollisionSphere* spheresBuffer, PxU32* capsulesBuffer, 
									   PxClothCollisionPlane* planesBuffer, PxU32* convexesBuffer, PxClothCollisionTriangle* trianglesBuffer ) const
{
	if(!isBuffering())
		mCloth.getCollisionData(spheresBuffer, capsulesBuffer, planesBuffer, convexesBuffer, trianglesBuffer);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getCollisionData() not allowed while simulation is running.");
}

PX_INLINE void Cloth::addCollisionCapsule(PxU32 first, PxU32 second)
{
	if(!isBuffering())
		mCloth.addCollisionCapsule(first, second);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionCapsule() not allowed while simulation is running.");
}

PX_INLINE void Cloth::removeCollisionCapsule(PxU32 index)
{
	if(!isBuffering())
		mCloth.removeCollisionCapsule(index);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionCapsule() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbCollisionCapsules() const
{
	if(!isBuffering())
		return mCloth.getNbCollisionCapsules();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbCollisionCapsules() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::addCollisionTriangle(const PxClothCollisionTriangle& triangle)
{
	if(!isBuffering())
		mCloth.addCollisionTriangle(triangle);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionTriangle() not allowed while simulation is running.");
}

PX_INLINE void Cloth::removeCollisionTriangle(PxU32 index)
{
	if(!isBuffering())
		mCloth.removeCollisionTriangle(index);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionTriangle() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setCollisionTriangles(const PxClothCollisionTriangle* trianglesBuffer, PxU32 count)
{
	if(!isBuffering())
		mCloth.setCollisionTriangles(trianglesBuffer, count);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionTriangles() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbCollisionTriangles() const
{
	if(!isBuffering())
		return mCloth.getNbCollisionTriangles();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbCollisionTriangles() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::addCollisionPlane(const PxClothCollisionPlane& plane)
{
	if(!isBuffering())
		mCloth.addCollisionPlane(plane);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionPlane() not allowed while simulation is running.");
}

PX_INLINE void Cloth::removeCollisionPlane(PxU32 index)
{
	if(!isBuffering())
		mCloth.removeCollisionPlane(index);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionPlane() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setCollisionPlanes(const PxClothCollisionPlane* planesBuffer, PxU32 count)
{
	if(!isBuffering())
		mCloth.setCollisionPlanes(planesBuffer, count);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionPlanes() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbCollisionPlanes() const
{
	if(!isBuffering())
		return mCloth.getNbCollisionPlanes();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbCollisionPlanes() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::addCollisionConvex(PxU32 mask)
{
	if(!isBuffering())
		mCloth.addCollisionConvex(mask);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionConvex() not allowed while simulation is running.");
}

PX_INLINE void Cloth::removeCollisionConvex(PxU32 index)
{
	if(!isBuffering())
		mCloth.removeCollisionConvex(index);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionConvex() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbCollisionConvexes() const
{
	if(!isBuffering())
		return mCloth.getNbCollisionConvexes();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbCollisionConvexes() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::setVirtualParticles(PxU32 numParticles, const PxU32* indices, PxU32 numWeights, const PxVec3* weights)
{
	if(!isBuffering())
		mCloth.setVirtualParticles(numParticles, indices, numWeights, weights);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setVirtualParticles() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbVirtualParticles() const
{
	if(!isBuffering())
		return mCloth.getNbVirtualParticles();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbVirtualParticles() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::getVirtualParticles(PxU32* indicesBuffer) const
{
	if(!isBuffering())
		mCloth.getVirtualParticles(indicesBuffer);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getVirtualParticles() not allowed while simulation is running.");
}

PX_INLINE PxU32 Cloth::getNbVirtualParticleWeights() const
{
	if(!isBuffering())
		return mCloth.getNbVirtualParticleWeights();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getNbVirtualParticleWeights() not allowed while simulation is running.");
		return 0;
	}
}

PX_INLINE void Cloth::getVirtualParticleWeights(PxVec3* weightsBuffer) const
{
	if(!isBuffering())
		mCloth.getVirtualParticleWeights(weightsBuffer);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getVirtualParticleWeights() not allowed while simulation is running.");
}

PX_INLINE PxTransform Cloth::getGlobalPose() const
{
	if(!isBuffering())
		return mCloth.getGlobalPose();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getGlobalPose() not allowed while simulation is running.");
		return PxTransform(PxIdentity);
	}
}

PX_INLINE void Cloth::setGlobalPose(const PxTransform& pose)
{
	if(!isBuffering())
		mCloth.setGlobalPose(pose);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setGlobalPose() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setTargetPose(const PxTransform& pose)
{
	if(!isBuffering())
		mCloth.setTargetPose(pose);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setTargetPose() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getExternalAcceleration() const
{
	if(!isBuffering())
		return mCloth.getExternalAcceleration();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getExternalAcceleration() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setExternalAcceleration(PxVec3 acceleration)
{
	if(!isBuffering())
		mCloth.setExternalAcceleration(acceleration);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setExternalAcceleration() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getLinearInertiaScale() const
{
	if(!isBuffering())
		return mCloth.getLinearInertiaScale();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getLinearInertiaScale() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setLinearInertiaScale(PxVec3 scale)
{
	if(!isBuffering())
		mCloth.setLinearInertiaScale(scale);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setLinearInertiaScale() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getAngularInertiaScale() const
{
	if(!isBuffering())
		return mCloth.getAngularInertiaScale();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getAngularInertiaScale() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setAngularInertiaScale(PxVec3 scale)
{
	if(!isBuffering())
		mCloth.setAngularInertiaScale(scale);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setAngularInertiaScale() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getCentrifugalInertiaScale() const
{
	if(!isBuffering())
		return mCloth.getCentrifugalInertiaScale();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getCentrifugalInertiaScale() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setCentrifugalInertiaScale(PxVec3 scale)
{
	if(!isBuffering())
		mCloth.setCentrifugalInertiaScale(scale);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCentrifugalInertiaScale() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getDampingCoefficient() const
{
	if(!isBuffering())
		return mCloth.getDampingCoefficient();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getDampingCoefficient() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setDampingCoefficient(PxVec3 dampingCoefficient)
{
	if(!isBuffering())
		mCloth.setDampingCoefficient(dampingCoefficient);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setDampingCoefficient() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getFrictionCoefficient() const
{
	if(!isBuffering())
		return mCloth.getFrictionCoefficient();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getFrictionCoefficient() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setFrictionCoefficient(PxReal frictionCoefficient)
{
	if(!isBuffering())
		mCloth.setFrictionCoefficient(frictionCoefficient);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setFrictionCoefficient() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getLinearDragCoefficient() const
{
	if(!isBuffering())
		return mCloth.getLinearDragCoefficient();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getLinearDragCoefficient() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setLinearDragCoefficient(PxVec3 dampingCoefficient)
{
	if(!isBuffering())
		mCloth.setLinearDragCoefficient(dampingCoefficient);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setLinearDragCoefficient() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getAngularDragCoefficient() const
{
	if(!isBuffering())
		return mCloth.getAngularDragCoefficient();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getAngularDragCoefficient() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setAngularDragCoefficient(PxVec3 dampingCoefficient)
{
	if(!isBuffering())
		mCloth.setAngularDragCoefficient(dampingCoefficient);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setAngularDragCoefficient() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getCollisionMassScale() const
{
	if(!isBuffering())
		return mCloth.getCollisionMassScale();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getCollisionMassScale() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setCollisionMassScale(PxReal scalingCoefficient)
{
	if(!isBuffering())
		mCloth.setCollisionMassScale(scalingCoefficient);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionMassScale() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getSelfCollisionDistance() const
{
	if(!isBuffering())
		return mCloth.getSelfCollisionDistance();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSelfCollisionDistance() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setSelfCollisionDistance(PxReal distance)
{
	if(!isBuffering())
		mCloth.setSelfCollisionDistance(distance);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSelfCollisionDistance() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getSelfCollisionStiffness() const
{
	if(!isBuffering())
		return mCloth.getSelfCollisionStiffness();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSelfCollisionStiffness() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setSelfCollisionStiffness(PxReal stiffness)
{
	if(!isBuffering())
		mCloth.setSelfCollisionStiffness(stiffness);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSelfCollisionStiffness() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setSelfCollisionIndices(const PxU32* indices, PxU32 nbIndices)
{
	if(!isBuffering())
		mCloth.setSelfCollisionIndices(indices, nbIndices);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSelfCollisionIndices() not allowed while simulation is running.");
}

PX_INLINE bool Cloth::getSelfCollisionIndices(PxU32* indices) const
{
	if(!isBuffering())
		return mCloth.getSelfCollisionIndices(indices);
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSelfCollisionIndices() not allowed while simulation is running.");
		return false;
	}
}

PX_INLINE PxU32 Cloth::getNbSelfCollisionIndices() const
{
	return mCloth.getNbSelfCollisionIndices();
}

PX_INLINE void Cloth::setRestPositions(const PxVec4* restPositions)
{
	if(!isBuffering())
		mCloth.setRestPositions(restPositions);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setRestPositions() not allowed while simulation is running.");
}

PX_INLINE bool Cloth::getRestPositions(PxVec4* restPositions) const
{
	if(!isBuffering())
		return mCloth.getRestPositions(restPositions);
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getRestPositions() not allowed while simulation is running.");
		return false;
	}
}

PX_INLINE PxU32 Cloth::getNbRestPositions() const
{
	return mCloth.getNbRestPositions();
}

PX_INLINE PxReal Cloth::getSolverFrequency() const
{
	if(!isBuffering())
		return mCloth.getSolverFrequency();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSolverFrequency() not allowed while simulation is running.");
		return 60.0f;
	}
}

PX_INLINE void Cloth::setSolverFrequency(PxReal solverFreq)
{
	if(!isBuffering())
		mCloth.setSolverFrequency(solverFreq);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSolverFrequency() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getStiffnessFrequency() const
{
	if(!isBuffering())
		return mCloth.getStiffnessFrequency();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getStiffnessFrequency() not allowed while simulation is running.");
		return 60.0f;
	}
}

PX_INLINE void Cloth::setStiffnessFrequency(PxReal solverFreq)
{
	if(!isBuffering())
		mCloth.setStiffnessFrequency(solverFreq);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setStiffnessFrequency() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setStretchConfig(PxClothFabricPhaseType::Enum type, const PxClothStretchConfig& config)
{
	if(!isBuffering())
		mCloth.setStretchConfig(type, config);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setStretchConfig() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setTetherConfig(const PxClothTetherConfig& config)
{
	if(!isBuffering())
		mCloth.setTetherConfig(config);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setTetherConfig() not allowed while simulation is running.");
}

PX_INLINE PxClothStretchConfig Cloth::getStretchConfig(PxClothFabricPhaseType::Enum type) const
{
	if(!isBuffering())
		return mCloth.getStretchConfig(type);
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getStretchConfig() not allowed while simulation is running.");		
		return PxClothStretchConfig();
	}
}

PX_INLINE PxClothTetherConfig Cloth::getTetherConfig() const
{
	if(!isBuffering())
		return mCloth.getTetherConfig();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getTetherConfig() not allowed while simulation is running.");		
		return PxClothTetherConfig();
	}
}

PX_INLINE PxClothFlags Cloth::getClothFlags() const
{
	if(!isBuffering())
		return mCloth.getClothFlags();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getClothFlags() not allowed while simulation is running.");
		return PxClothFlags(0);
	}
}

PX_INLINE void Cloth::setClothFlags(PxClothFlags flags)
{
	if(!isBuffering())
		mCloth.setClothFlags(flags);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setClothFlag() not allowed while simulation is running.");
}

PX_INLINE PxVec3 Cloth::getWindVelocity() const
{
	if(!isBuffering())
		return mCloth.getWindVelocity();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getWindVelocity() not allowed while simulation is running.");
		return PxVec3(0.0f);
	}
}

PX_INLINE void Cloth::setWindVelocity(PxVec3 wind)
{
	if(!isBuffering())
		mCloth.setWindVelocity(wind);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setWindVelocity() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getDragCoefficient() const
{
	if(!isBuffering())
		return mCloth.getDragCoefficient();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getDragCoefficient() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setDragCoefficient(PxReal value)
{
	if(!isBuffering())
		mCloth.setDragCoefficient(value);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setDragCoefficient() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getLiftCoefficient() const
{
	if(!isBuffering())
		return mCloth.getLiftCoefficient();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getLiftCoefficient() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setLiftCoefficient(PxReal value)
{
	if(!isBuffering())
		mCloth.setLiftCoefficient(value);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setLiftCoefficient() not allowed while simulation is running.");
}

PX_INLINE bool Cloth::isSleeping() const
{
	if(!isBuffering())
		return mCloth.isSleeping();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::isSleeping() not allowed while simulation is running.");
		return false;
	}
}

PX_INLINE PxReal Cloth::getSleepLinearVelocity() const
{
	if(!isBuffering())
		return mCloth.getSleepLinearVelocity();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSleepLinearVelocity() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setSleepLinearVelocity(PxReal threshold)
{
	if(!isBuffering())
		mCloth.setSleepLinearVelocity(threshold);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSleepLinearVelocity() not allowed while simulation is running.");
}

PX_INLINE void Cloth::setWakeCounter(PxReal wakeCounterValue)
{
	if(!isBuffering())
		mCloth.setWakeCounter(wakeCounterValue);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setWakeCounter() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getWakeCounter() const
{
	if(!isBuffering())
		return mCloth.getWakeCounter();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getWakeCounter() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::wakeUp()
{
	Scene* scene = getScbScene();
	PX_ASSERT(scene);  // only allowed for an object in a scene

	if(!isBuffering())
		mCloth.wakeUp(scene->getWakeCounterResetValue());
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::wakeUp() not allowed while simulation is running.");
}

PX_INLINE void Cloth::putToSleep()
{
	if(!isBuffering())
		mCloth.putToSleep();
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::putToSleep() not allowed while simulation is running.");
}

PX_INLINE void Cloth::getParticleData(NpClothParticleData& particleData)
{
	if(!isBuffering())
		return getScCloth().getParticleData(particleData);

	Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, 
		"Call to PxCloth::lockParticleData() not allowed while simulation is running.");

	particleData.particles = 0;
	particleData.previousParticles = 0;
}

PxReal Cloth::getPreviousTimeStep() const
{
	if(!isBuffering())
		return mCloth.getPreviousTimeStep();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getPreviousTimeStep() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE PxBounds3 Cloth::getWorldBounds() const
{
	if(!isBuffering())
		return mCloth.getWorldBounds();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getWorldBounds() not allowed while simulation is running.");
		return PxBounds3::empty();
	}
}

PX_INLINE void Cloth::setSimulationFilterData(const PxFilterData& data)
{
	if(!isBuffering())
		mCloth.setSimulationFilterData(data);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSimulationFilterData() not allowed while simulation is running.");
}

PX_INLINE PxFilterData Cloth::getSimulationFilterData() const
{
	if(!isBuffering())
		return mCloth.getSimulationFilterData();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getSimulationFilterData() not allowed while simulation is running.");
		return PxFilterData();
	}
}

PX_INLINE void Cloth::setContactOffset(PxReal offset)
{
	if(!isBuffering())
		mCloth.setContactOffset(offset);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setContactOffset() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getContactOffset() const
{
	if(!isBuffering())
		return mCloth.getContactOffset();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getContactOffset() not allowed while simulation is running.");
		return 0.0f;
	}
}

PX_INLINE void Cloth::setRestOffset(PxReal offset)
{
	if(!isBuffering())
		mCloth.setRestOffset(offset);
	else
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setRestOffset() not allowed while simulation is running.");
}

PX_INLINE PxReal Cloth::getRestOffset() const
{
	if(!isBuffering())
		return mCloth.getRestOffset();
	else
	{
		Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getRestOffset() not allowed while simulation is running.");
		return 0.0f;
	}
}

}  // namespace Scb

}

#endif // PX_USE_CLOTH_API

#endif