MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / save

Method save

deps/physx/physx/samples/samplesubmarine/Crab.cpp:141–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139static const PxSerialObjectId mMotorJoint1_id = (PxSerialObjectId)0x04;
140
141void Crab::save(const char* filename)
142{
143 PxPhysics& physics = mSampleSubmarine->getPhysics();
144 PxCollection* thePxCollection = PxCreateCollection();
145 PxSerializationRegistry* sr = PxSerialization::createSerializationRegistry(physics);
146 for(PxU32 i = 0; i < mActors.size(); ++i)
147 {
148 thePxCollection->add(*mActors[i]);
149 }
150
151 for(PxU32 i = 0; i < mJoints.size(); ++i)
152 {
153 thePxCollection->add(*mJoints[i]);
154 }
155
156 thePxCollection->addId(*mCrabBody, mCrabBody_id);
157 thePxCollection->addId(*mMotorJoint[0], mMotorJoint0_id);
158 thePxCollection->addId(*mMotorJoint[1], mMotorJoint1_id);
159
160 PxCollection* theExtRef = PxCreateCollection();
161 theExtRef->add(*mSampleSubmarine->mMaterial, mMaterial_id);
162
163 PxSerialization::complete(*thePxCollection, *sr, theExtRef);
164
165 PxDefaultFileOutputStream s(filename);
166 PxSerialization::serializeCollectionToBinary(s, *thePxCollection, *sr, theExtRef);
167
168 theExtRef->release();
169 thePxCollection->release();
170 sr->release();
171}
172
173static PxU32 GetFileSize(const char* name)
174{

Callers 1

createDynamicActorsMethod · 0.45

Calls 5

PxCreateCollectionFunction · 0.85
addIdMethod · 0.80
sizeMethod · 0.45
addMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected