00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef FRACTURE_TOOLS_API_H
00031 #define FRACTURE_TOOLS_API_H
00032
00033 #include "foundation/Px.h"
00034 #include "ExplicitHierarchicalMesh.h"
00035 #include "FractureToolsStructs.h"
00036
00037 PX_PUSH_PACK_DEFAULT
00038
00039 namespace nvidia
00040 {
00041 namespace apex
00042 {
00043
00044 struct IntersectMesh;
00045 class DestructibleAsset;
00046
00048 class FractureToolsAPI
00049 {
00050 public:
00051
00053 virtual FractureTools::CutoutSet* createCutoutSet() = 0;
00054
00067 virtual void buildCutoutSet(FractureTools::CutoutSet& cutoutSet, const uint8_t* pixelBuffer, uint32_t bufferWidth, uint32_t bufferHeight, float snapThreshold, bool periodic) = 0;
00068
00077 virtual bool calculateCutoutUVMapping(const nvidia::ExplicitRenderTriangle& triangle, PxMat33& theMapping) = 0;
00078
00091 virtual bool calculateCutoutUVMapping(nvidia::ExplicitHierarchicalMesh& hMesh, const PxVec3& targetDirection, PxMat33& theMapping) = 0;
00092
00113 virtual bool createVoronoiSplitMesh
00114 (
00115 nvidia::ExplicitHierarchicalMesh& hMesh,
00116 nvidia::ExplicitHierarchicalMesh& iHMeshCore,
00117 bool exportCoreMesh,
00118 int32_t coreMeshImprintSubmeshIndex,
00119 const FractureTools::MeshProcessingParameters& meshProcessingParams,
00120 const FractureTools::FractureVoronoiDesc& desc,
00121 const CollisionDesc& collisionDesc,
00122 uint32_t randomSeed,
00123 nvidia::IProgressListener& progressListener,
00124 volatile bool* cancel = NULL
00125 ) = 0;
00126
00143 virtual uint32_t createVoronoiSitesInsideMesh
00144 (
00145 nvidia::ExplicitHierarchicalMesh& hMesh,
00146 PxVec3* siteBuffer,
00147 uint32_t* siteChunkIndices,
00148 uint32_t siteCount,
00149 uint32_t* randomSeed,
00150 uint32_t* microgridSize,
00151 BSPOpenMode::Enum meshMode,
00152 nvidia::IProgressListener& progressListener,
00153 uint32_t chunkIndex = 0xFFFFFFFF
00154 ) = 0;
00155
00180 virtual uint32_t createScatterMeshSites
00181 (
00182 uint8_t* meshIndices,
00183 PxMat44* relativeTransforms,
00184 uint32_t* chunkMeshStarts,
00185 uint32_t scatterMeshInstancesBufferSize,
00186 nvidia::ExplicitHierarchicalMesh& hMesh,
00187 uint32_t targetChunkCount,
00188 const uint16_t* targetChunkIndices,
00189 uint32_t* randomSeed,
00190 uint32_t scatterMeshAssetCount,
00191 nvidia::RenderMeshAsset** scatterMeshAssets,
00192 const uint32_t* minCount,
00193 const uint32_t* maxCount,
00194 const float* minScales,
00195 const float* maxScales,
00196 const float* maxAngles
00197 ) = 0;
00198
00212 virtual void visualizeVoronoiCells
00213 (
00214 nvidia::RenderDebugInterface& debugRender,
00215 const PxVec3* sites,
00216 uint32_t siteCount,
00217 const uint32_t* cellColors,
00218 uint32_t cellColorCount,
00219 const PxBounds3& bounds,
00220 uint32_t cellIndex = 0xFFFFFFFF
00221 ) = 0;
00222
00246 virtual bool buildExplicitHierarchicalMesh
00247 (
00248 nvidia::ExplicitHierarchicalMesh& iHMesh,
00249 const nvidia::ExplicitRenderTriangle* meshTriangles,
00250 uint32_t meshTriangleCount,
00251 const nvidia::ExplicitSubmeshData* submeshData,
00252 uint32_t submeshCount,
00253 uint32_t* meshPartition = NULL,
00254 uint32_t meshPartitionCount = 0,
00255 int32_t* parentIndices = NULL,
00256 uint32_t parentIndexCount = 0
00257 ) = 0;
00258
00268 virtual void setBSPTolerances
00269 (
00270 float linearTolerance,
00271 float angularTolerance,
00272 float baseTolerance,
00273 float clipTolerance,
00274 float cleaningTolerance
00275 ) = 0;
00276
00295 virtual void setBSPBuildParameters
00296 (
00297 float logAreaSigmaThreshold,
00298 uint32_t testSetSize,
00299 float splitWeight,
00300 float imbalanceWeight
00301 ) = 0;
00302
00303
00312 virtual bool buildExplicitHierarchicalMeshFromRenderMeshAsset(nvidia::ExplicitHierarchicalMesh& iHMesh, const nvidia::RenderMeshAsset& renderMeshAsset, uint32_t maxRootDepth = UINT32_MAX) = 0;
00313
00323 virtual bool buildExplicitHierarchicalMeshFromDestructibleAsset(nvidia::ExplicitHierarchicalMesh& iHMesh, const nvidia::DestructibleAsset& destructibleAsset, uint32_t maxRootDepth = UINT32_MAX) = 0;
00324
00344 virtual bool createHierarchicallySplitMesh
00345 (
00346 nvidia::ExplicitHierarchicalMesh& hMesh,
00347 nvidia::ExplicitHierarchicalMesh& iHMeshCore,
00348 bool exportCoreMesh,
00349 int32_t coreMeshImprintSubmeshIndex,
00350 const FractureTools::MeshProcessingParameters& meshProcessingParams,
00351 const FractureTools::FractureSliceDesc& desc,
00352 const CollisionDesc& collisionDesc,
00353 uint32_t randomSeed,
00354 nvidia::IProgressListener& progressListener,
00355 volatile bool* cancel = NULL
00356 ) = 0;
00357
00375 virtual bool createChippedMesh
00376 (
00377 nvidia::ExplicitHierarchicalMesh& hMesh,
00378 const FractureTools::MeshProcessingParameters& meshProcessingParams,
00379 const FractureTools::FractureCutoutDesc& desc,
00380 const FractureTools::CutoutSet& iCutoutSet,
00381 const FractureTools::FractureSliceDesc& sliceDesc,
00382 const FractureTools::FractureVoronoiDesc& voronoiDesc,
00383 const CollisionDesc& collisionDesc,
00384 uint32_t randomSeed,
00385 nvidia::IProgressListener& progressListener,
00386 volatile bool* cancel = NULL
00387 ) = 0;
00388
00405 virtual bool hierarchicallySplitChunk
00406 (
00407 nvidia::ExplicitHierarchicalMesh& hMesh,
00408 uint32_t chunkIndex,
00409 const FractureTools::MeshProcessingParameters& meshProcessingParams,
00410 const FractureTools::FractureSliceDesc& desc,
00411 const CollisionDesc& collisionDesc,
00412 uint32_t* randomSeed,
00413 nvidia::IProgressListener& progressListener,
00414 volatile bool* cancel = NULL
00415 ) = 0;
00416
00433 virtual bool voronoiSplitChunk
00434 (
00435 nvidia::ExplicitHierarchicalMesh& hMesh,
00436 uint32_t chunkIndex,
00437 const FractureTools::MeshProcessingParameters& meshProcessingParams,
00438 const FractureTools::FractureVoronoiDesc& desc,
00439 const CollisionDesc& collisionDesc,
00440 uint32_t* randomSeed,
00441 nvidia::IProgressListener& progressListener,
00442 volatile bool* cancel = NULL
00443 ) = 0;
00444
00449 virtual bool buildSliceMesh
00450 (
00451 nvidia::IntersectMesh& intersectMesh,
00452 nvidia::ExplicitHierarchicalMesh& referenceMesh,
00453 const PxPlane& slicePlane,
00454 const FractureTools::NoiseParameters& noiseParameters,
00455 uint32_t randomSeed
00456 ) = 0;
00457
00459 virtual nvidia::ExplicitHierarchicalMesh* createExplicitHierarchicalMesh() = 0;
00460
00462 virtual nvidia::ExplicitHierarchicalMesh::ConvexHull* createExplicitHierarchicalMeshConvexHull() = 0;
00463
00464 };
00465
00466 }}
00467
00468
00469 PX_POP_PACK
00470
00471 #endif // FRACTURE_TOOLS_API_H