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

Function flattenChunk

physx/samples/samplelargeworld/ChunkLoader.cpp:261–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261static void flattenChunk(SampleArray<PxVec3>& terrainVertices, const PxBounds3& bound, PxReal dataY)
262{
263 PxBounds3 bound1 = bound;
264 PxReal deltaX = bound1.maximum.x - bound1.minimum.x;
265 PxReal deltaZ = bound1.maximum.z- bound1.minimum.z;
266 PxReal delta = deltaX < deltaZ ? deltaX : deltaZ;
267 bound1.fattenFast(delta/32);
268
269 const PxU32 size = terrainVertices.size();
270
271 for(PxU32 i = 0; i < size; ++i)
272 {
273 if((terrainVertices[i].x <= bound1.maximum.x && terrainVertices[i].x >= bound1.minimum.x)
274 && (terrainVertices[i].z <= bound1.maximum.z && terrainVertices[i].z >= bound1.minimum.z))
275 {
276 terrainVertices[i].y = dataY;
277 }
278 }
279}
280
281void SampleLargeWorld::addCity(SampleArray<PxVec3>& terrainVertices, const PxBounds3& bound, PxCollection& outCollection)
282{

Callers 1

createChunkMethod · 0.85

Calls 2

fattenFastMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected