15 #include "physxKitchen.h" 16 #include "physxConvexMesh.h" 17 #include "physxConvexMeshDesc.h" 18 #include "physxTriangleMesh.h" 19 #include "physxTriangleMeshDesc.h" 20 #include "physxFileStream.h" 21 #include "physxMemoryReadBuffer.h" 22 #include "physxMemoryWriteBuffer.h" 23 #include "physxClothMesh.h" 24 #include "physxClothMeshDesc.h" 25 #include "physxSoftBodyMesh.h" 26 #include "physxSoftBodyMeshDesc.h" 49 NxCookingParams params;
51 params.targetPlatform = PLATFORM_PC;
52 params.skinWidth = skinWidth;
53 params.hintCollisionSpeed = hintCollisionSpeed;
55 _cooking->NxSetCookingParams(params);
66 nassertr_always(!filename.empty(),
false);
67 nassertr_always(filename.
touch(),
false);
68 nassertr_always(meshDesc.
is_valid(),
false);
71 return _cooking->NxCookConvexMesh(meshDesc.get_desc(), fs);
82 nassertr_always(!filename.empty(),
false);
83 nassertr_always(filename.
touch(),
false);
84 nassertr_always(meshDesc.
is_valid(),
false);
87 return _cooking->NxCookTriangleMesh(meshDesc.get_desc(), fs);
98 nassertr_always(!filename.empty(),
false);
99 nassertr_always(filename.
touch(),
false);
100 nassertr_always(meshDesc.
is_valid(),
false);
103 return _cooking->NxCookClothMesh(meshDesc.get_desc(), fs);
114 nassertr_always(!filename.empty(),
false);
115 nassertr_always(filename.
touch(),
false);
116 nassertr_always(meshDesc.
is_valid(),
false);
119 return _cooking->NxCookSoftBodyMesh(meshDesc.get_desc(), fs);
130 nassertr_always(!filename.empty(),
false);
131 nassertr_always(filename.
touch(),
false);
132 nassertr_always(meshDesc.
is_valid(),
false);
151 fs.storeDword(texcoords.size());
154 plist<LPoint2f>::const_iterator it;
155 for(it=texcoords.begin(); it!=texcoords.end(); it++) {
158 fs.storeFloat(v.get_x());
159 fs.storeFloat(v.get_y());
173 nassertr_always(meshDesc.
is_valid(), NULL);
176 bool status = _cooking->NxCookConvexMesh(meshDesc.get_desc(), buffer);
177 nassertr(status, NULL);
179 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
183 nassertr(mesh, NULL);
186 nassertr(meshPtr, NULL);
201 nassertr_always(meshDesc.
is_valid(), NULL);
204 bool status = _cooking->NxCookTriangleMesh(meshDesc.get_desc(), buffer);
205 nassertr(status, NULL);
207 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
211 nassertr(mesh, NULL);
214 nassertr(meshPtr, NULL);
229 nassertr_always(meshDesc.
is_valid(), NULL);
232 bool status = _cooking->NxCookClothMesh(meshDesc.get_desc(), wbuffer);
233 nassertr(status, NULL);
235 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
239 nassertr(mesh, NULL);
242 NxClothMesh *meshPtr = sdk->createClothMesh(rbuffer);
243 nassertr(meshPtr, NULL);
258 nassertr_always(meshDesc.
is_valid(), NULL);
261 bool status = _cooking->NxCookSoftBodyMesh(meshDesc.get_desc(), wbuffer);
262 nassertr(status, NULL);
264 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
268 nassertr(mesh, NULL);
271 NxSoftBodyMesh *meshPtr = sdk->createSoftBodyMesh(rbuffer);
272 nassertr(meshPtr, NULL);
bool is_valid() const
Returns true if the descriptor is valid.
This is our own Panda specialization on the default STL list.
bool touch() const
Updates the modification time of the file to the current time.
The name of a file, such as a texture file or an Egg file.
bool is_valid() const
Returns true if the descriptor is valid.
void set_cooking_params(float skinWidth, bool hintCollisionSpeed)
Sets two parameters which affect mesh cooking:
bool is_valid() const
Returns true if the descriptor is valid.
bool is_valid() const
Returns true if the descriptor is valid.
This is a two-component point in space.