| 228 | } |
| 229 | |
| 230 | void SampleLargeWorld::addTrees(const PxTriangleMeshGeometry& meshGeom, const PxBounds3& bound, PxCollection& outCollection) |
| 231 | { |
| 232 | const char* filename = getSampleMediaFilename("tree.obj"); |
| 233 | const char* filenameCooked = getSampleOutputFilePath("tree.obj", ""); |
| 234 | |
| 235 | PxReal maxDist = 2*(bound.maximum.y - bound.minimum.y); |
| 236 | for(PxU32 i = (PxU32)bound.minimum.z; i < (PxU32)bound.maximum.z; i += 80) |
| 237 | { |
| 238 | PxVec3 rayStart(bound.minimum.x, bound.maximum.y, (PxReal)i); |
| 239 | |
| 240 | PxRaycastBuffer hit; |
| 241 | PxQueryFilterData filter(PxQueryFlag::eSTATIC); |
| 242 | PxScene& scene = getActiveScene(); |
| 243 | bool ret = false; |
| 244 | { |
| 245 | PxSceneReadLock scopedLock(scene); |
| 246 | ret = scene.raycast(rayStart, PxVec3(0.0f,-1.0f,0.0f), maxDist, hit, PxHitFlag::ePOSITION, filter); |
| 247 | } |
| 248 | if( ret ) |
| 249 | { |
| 250 | MeshBuilder::addObjMeshToPxCollection( |
| 251 | getPhysics(), getCooking(), getDefaultMaterial(), |
| 252 | filename, filenameCooked, |
| 253 | PxTransform(hit.block.position, PxQuat(-PxHalfPi, PxVec3(1,0,0))), PxVec3(200, 200, 200), |
| 254 | outCollection, gTreeName); |
| 255 | |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | } |
| 260 | |
| 261 | static void flattenChunk(SampleArray<PxVec3>& terrainVertices, const PxBounds3& bound, PxReal dataY) |
| 262 | { |
nothing calls this directly
no test coverage detected