MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / save

Method save

physx/source/physxcooking/src/BVHStructureBuilder.cpp:167–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165#define PX_BVH_STRUCTURE_VERSION 1
166
167bool BVHStructureBuilder::save(PxOutputStream& stream, bool endian) const
168{
169 // write header
170 if(!writeHeader('B', 'V', 'H', 'S', PX_BVH_STRUCTURE_VERSION, endian, stream))
171 return false;
172
173 // write mData members
174 writeDword(mNumVolumes, endian, stream);
175 writeDword(mNumNodes, endian, stream);
176
177 // write indices and bounds
178 for(PxU32 i = 0; i < mNumVolumes; i++)
179 {
180 writeDword(mIndices[i], endian, stream);
181 }
182
183 for(PxU32 i = 0; i < mNumVolumes; i++)
184 {
185 writeFloatBuffer(&mBounds[i].minimum.x, 3, endian, stream);
186 writeFloatBuffer(&mBounds[i].maximum.x, 3, endian, stream);
187 }
188
189 // write nodes
190 for(PxU32 i = 0; i < mNumNodes; i++)
191 {
192 writeDword(mNodes[i].mData, endian, stream);
193
194 writeFloatBuffer(&mNodes[i].mBV.minimum.x, 3, endian, stream);
195 writeFloatBuffer(&mNodes[i].mBV.maximum.x, 3, endian, stream);
196 }
197
198 return true;
199}
200
201void BVHStructureBuilder::moveData(Gu::BVHStructureData& bvhData)
202{

Callers 3

cookTriangleMeshMethod · 0.45
cookConvexMeshMethod · 0.45
cookBVHStructureMethod · 0.45

Calls 1

writeHeaderFunction · 0.85

Tested by

no test coverage detected