diff options
| author | Bryan Galdrikian <[email protected]> | 2017-02-24 09:32:20 -0800 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2017-02-24 09:32:20 -0800 |
| commit | e1bf674c16e3c8472b29574159c789cd3f0c64e0 (patch) | |
| tree | 9f0cfce09c71a2c27ff19589fcad6cd83504477c /tools/AuthoringTool/src/FractureProcessor.h | |
| parent | first commit (diff) | |
| download | blast-e1bf674c16e3c8472b29574159c789cd3f0c64e0.tar.xz blast-e1bf674c16e3c8472b29574159c789cd3f0c64e0.zip | |
Updating to [email protected] and [email protected] with a new directory structure.
NvBlast folder is gone, files have been moved to top level directory. README is changed to reflect this.
Diffstat (limited to 'tools/AuthoringTool/src/FractureProcessor.h')
| -rw-r--r-- | tools/AuthoringTool/src/FractureProcessor.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tools/AuthoringTool/src/FractureProcessor.h b/tools/AuthoringTool/src/FractureProcessor.h new file mode 100644 index 0000000..8b8fefe --- /dev/null +++ b/tools/AuthoringTool/src/FractureProcessor.h @@ -0,0 +1,64 @@ +#pragma once +#include <vector> +#include "NvBlastExtAuthoringTypes.h" +#include "PxFoundation.h" +#include "PxPhysics.h" +#include "PxCooking.h" +#include "PxDefaultAllocator.h" +#include "PxDefaultErrorCallback.h" +#include <memory> +#include "NvBlastExtAuthoringMesh.h" +#include "NvBlastExtAuthoringBondGenerator.h" +#include "NvBlastTypes.h" +#include "NvBlastExtPxAsset.h" + +struct FractureResult +{ + std::vector<std::vector<Nv::Blast::Triangle>> resultGeometry; + std::shared_ptr<Nv::Blast::ExtPxAsset> resultPhysicsAsset; +}; + +struct FractureSettings +{ + unsigned char mode; + uint32_t cellsCount; + uint32_t clusterCount; + float clusterRadius; + int32_t slicingX; + int32_t slicingY; + int32_t slicingZ; + float angleVariation; + float offsetVariation; +}; + +class FractureProcessor +{ +public: + FractureProcessor(); + ~FractureProcessor(); + + + std::shared_ptr<FractureResult> fractureMesh(std::shared_ptr<Nv::Blast::Mesh> sourceMesh, const FractureSettings &settings); + + + physx::PxPhysics* getPhysics() { return physics; } + physx::PxCooking* getCooking() { return cooking; } +private: + physx::PxFoundation* foundation = nullptr; + physx::PxPhysics* physics = nullptr; + physx::PxCooking* cooking = nullptr; + + Nv::Blast::TkFramework* framework = nullptr; + + physx::PxDefaultAllocator g_allocator; + physx::PxDefaultErrorCallback g_errorCallback; + + + void buildPhysicsChunks(const std::vector<std::vector<Nv::Blast::Triangle>>& chunkGeometry, std::vector<Nv::Blast::ExtPxAssetDesc::ChunkDesc>& outPhysicsChunks, + std::vector<Nv::Blast::ExtPxAssetDesc::SubchunkDesc>& outPhysicsSubchunks); + + std::shared_ptr<FractureResult> finalizeMeshProcessing(std::vector<NvBlastChunkDesc> chunkDesc, std::vector<NvBlastBondDesc> bondDescs, std::vector<std::vector<Nv::Blast::Triangle> > chunkMeshes); + + bool initPhysX(); + void releasePhysX(); +}; |