42 NxCookingParams params;
44 params.targetPlatform = PLATFORM_PC;
45 params.skinWidth = skinWidth;
46 params.hintCollisionSpeed = hintCollisionSpeed;
48 _cooking->NxSetCookingParams(params);
57 nassertr_always(!filename.empty(),
false);
58 nassertr_always(filename.
touch(),
false);
59 nassertr_always(meshDesc.
is_valid(),
false);
62 return _cooking->NxCookConvexMesh(meshDesc.get_desc(), fs);
71 nassertr_always(!filename.empty(),
false);
72 nassertr_always(filename.
touch(),
false);
73 nassertr_always(meshDesc.
is_valid(),
false);
75 PhysxFileStream fs = PhysxFileStream(filename,
false);
76 return _cooking->NxCookTriangleMesh(meshDesc.get_desc(), fs);
85 nassertr_always(!filename.empty(),
false);
86 nassertr_always(filename.
touch(),
false);
87 nassertr_always(meshDesc.
is_valid(),
false);
89 PhysxFileStream fs = PhysxFileStream(filename,
false);
90 return _cooking->NxCookClothMesh(meshDesc.get_desc(), fs);
99 nassertr_always(!filename.empty(),
false);
100 nassertr_always(filename.
touch(),
false);
101 nassertr_always(meshDesc.
is_valid(),
false);
103 PhysxFileStream fs = PhysxFileStream(filename,
false);
104 return _cooking->NxCookSoftBodyMesh(meshDesc.get_desc(), fs);
113 nassertr_always(!filename.empty(),
false);
114 nassertr_always(filename.
touch(),
false);
115 nassertr_always(meshDesc.
is_valid(),
false);
117 const plist<LPoint2f> texcoords = meshDesc.get_texcoords();
120 PhysxFileStream fs = PhysxFileStream(filename.c_str(),
false);
134 fs.storeDword(texcoords.size());
137 plist<LPoint2f>::const_iterator it;
138 for(it=texcoords.begin(); it!=texcoords.end(); it++) {
141 fs.storeFloat(v.get_x());
142 fs.storeFloat(v.get_y());
154 nassertr_always(meshDesc.
is_valid(),
nullptr);
156 PhysxMemoryWriteBuffer buffer;
157 bool status = _cooking->NxCookConvexMesh(meshDesc.get_desc(), buffer);
158 nassertr(status,
nullptr);
160 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
161 nassertr(sdk,
nullptr);
163 PhysxConvexMesh *mesh =
new PhysxConvexMesh();
164 nassertr(mesh,
nullptr);
166 NxConvexMesh *meshPtr = sdk->createConvexMesh(PhysxMemoryReadBuffer(buffer.data));
167 nassertr(meshPtr,
nullptr);
180 nassertr_always(meshDesc.
is_valid(),
nullptr);
182 PhysxMemoryWriteBuffer buffer;
183 bool status = _cooking->NxCookTriangleMesh(meshDesc.get_desc(), buffer);
184 nassertr(status,
nullptr);
186 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
187 nassertr(sdk,
nullptr);
189 PhysxTriangleMesh *mesh =
new PhysxTriangleMesh();
190 nassertr(mesh,
nullptr);
192 NxTriangleMesh *meshPtr = sdk->createTriangleMesh(PhysxMemoryReadBuffer(buffer.data));
193 nassertr(meshPtr,
nullptr);
206 nassertr_always(meshDesc.
is_valid(),
nullptr);
208 PhysxMemoryWriteBuffer wbuffer;
209 bool status = _cooking->NxCookClothMesh(meshDesc.get_desc(), wbuffer);
210 nassertr(status,
nullptr);
212 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
213 nassertr(sdk,
nullptr);
215 PhysxClothMesh *mesh =
new PhysxClothMesh();
216 nassertr(mesh,
nullptr);
218 PhysxMemoryReadBuffer rbuffer(wbuffer.data);
219 NxClothMesh *meshPtr = sdk->createClothMesh(rbuffer);
220 nassertr(meshPtr,
nullptr);
233 nassertr_always(meshDesc.
is_valid(),
nullptr);
235 PhysxMemoryWriteBuffer wbuffer;
236 bool status = _cooking->NxCookSoftBodyMesh(meshDesc.get_desc(), wbuffer);
237 nassertr(status,
nullptr);
239 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
240 nassertr(sdk,
nullptr);
242 PhysxSoftBodyMesh *mesh =
new PhysxSoftBodyMesh();
243 nassertr(mesh,
nullptr);
245 PhysxMemoryReadBuffer rbuffer(wbuffer.data);
246 NxSoftBodyMesh *meshPtr = sdk->createSoftBodyMesh(rbuffer);
247 nassertr(meshPtr,
nullptr);
The name of a file, such as a texture file or an Egg file.
bool touch() const
Updates the modification time of the file to the current time.
bool is_valid() const
Returns true if the descriptor is valid.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.