diff options
| author | bgaldrikian <[email protected]> | 2018-10-03 17:51:20 -0700 |
|---|---|---|
| committer | bgaldrikian <[email protected]> | 2018-10-03 17:51:20 -0700 |
| commit | 6f51c0ad55f3ed33597b8b12391d426fe28a0923 (patch) | |
| tree | b132a8cb2485820ff9556dafc8e874bc9d41f255 /sdk/extensions/authoring/include | |
| parent | Fixes to UnitySample to make it build & run. ( In Unity 2018.2 ) (diff) | |
| download | blast-1.1.4_rc1.tar.xz blast-1.1.4_rc1.zip | |
Blast 1.1.4. See docs/release_notes.txt.v1.1.4_rc1
Diffstat (limited to 'sdk/extensions/authoring/include')
6 files changed, 50 insertions, 444 deletions
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoring.h b/sdk/extensions/authoring/include/NvBlastExtAuthoring.h index d25ded3..5b6c5d6 100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoring.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoring.h @@ -48,6 +48,9 @@ namespace Nv class ConvexMeshBuilder;
class BlastBondGenerator;
class MeshCleaner;
+ class PatternGenerator;
+ class Grid;
+ class GridWalker;
struct CollisionParams;
struct CollisionHull;
}
@@ -72,6 +75,22 @@ NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMesh(const physx::PxVec3* const physx::PxVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
/**
+Constructs mesh object from triangles represented as arrays of vertices, indices and per facet material.
+User should call Mesh::release() after usage.
+
+\param[in] vertices Array for vertex positions, 3 * verticesCount floats will be read
+\param[in] verticesCount Number of vertices in mesh
+\param[in] indices Array of vertex indices. Indices contain vertex index triplets which form a mesh triangle.
+\param[in] indicesCount Indices count (should be equal to numberOfTriangles * 3)
+\param[in] materials Array of material indices per triangle. If not set default material (0) will be assigned.
+\param[in] materialStride Stride for material indices
+
+\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
+*/
+NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMeshOnlyTriangles(const void* vertices, uint32_t verticesCount,
+ uint32_t* indices, uint32_t indexCount, void* materials = nullptr, uint32_t materialStride = 4);
+
+/**
Constructs mesh object from array of vertices, edges and facets.
User should call release() after usage.
@@ -250,4 +269,19 @@ NVBLAST_API uint32_t NvBlastExtAuthoringFindAssetConnectingBonds float maxSeparation = 0.0f
);
+/**
+Returns pattern generator used for generating fracture patterns for Real Time (RT) fracture
+*/
+NVBLAST_API Nv::Blast::PatternGenerator* NvBlastExtAuthoringCreatePatternGenerator();
+
+/**
+TODO
+*/
+NVBLAST_API Nv::Blast::Grid* NvBlastExtAuthoringCreateGridAccelerator(uint32_t resolution, const Nv::Blast::Mesh* m);
+
+/**
+TODO
+*/
+NVBLAST_API Nv::Blast::GridWalker* NvBlastExtAuthoringCreateGridWalker(Nv::Blast::Grid* parent);
+
#endif // ifndef NVBLASTAUTHORING_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h index f4bd754..55e252e 100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h @@ -113,7 +113,7 @@ public: \return 0 if success
*/
virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
- NvBlastBond& resultBond, BondGenerationConfig conf = BondGenerationConfig()) = 0;
+ NvBlastBond& resultBond, BondGenerationConfig conf) = 0;
/**
Creates bond description between number of meshes
@@ -149,7 +149,7 @@ public: */
virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
- BondGenerationConfig conf = BondGenerationConfig()) = 0;
+ BondGenerationConfig conf) = 0;
/**
Creates bond description for prefractured meshes, when there is no info about which chunks should be connected with bond.
@@ -167,6 +167,9 @@ public: */
virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) = 0;
+
+
+
};
} // namespace Blast
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h index cde115a..d174850 100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h @@ -47,6 +47,7 @@ namespace Blast struct CollisionHull;
struct Triangle;
+struct Vertex;
struct CollisionParams
{
@@ -108,6 +109,8 @@ public: */
virtual physx::PxConvexMesh* buildConvexMesh(const CollisionHull& hull) = 0;
+ virtual physx::PxConvexMesh* buildConvexMeshRT(const Nv::Blast::Vertex* vrs, uint32_t count) = 0;
+
/**
Convex geometry trimming.
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h index b75073a..fd3d985 100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h @@ -46,9 +46,16 @@ class CutoutSet; */
struct ChunkInfo
{
+ enum ChunkFlags
+ {
+ NO_FLAGS = 0,
+ CREATED_BY_ISLAND_DETECTOR = 1
+ };
+
Mesh* meshData;
int32_t parent;
int32_t chunkId;
+ uint32_t flags;
bool isLeaf;
bool isChanged;
};
@@ -447,7 +454,7 @@ public: \param[in] chunkId Chunk ID which should be checked for islands
\return Number of found islands is returned
*/
- virtual int32_t islandDetectionAndRemoving(int32_t chunkId) = 0;
+ virtual int32_t islandDetectionAndRemoving(int32_t chunkId, bool createAtNewDepth = false) = 0;
/**
Check if input mesh contains open edges. Open edges can lead to wrong fracturing results.
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h deleted file mode 100755 index b523dcd..0000000 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h +++ /dev/null @@ -1,154 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you
-// under a form of NVIDIA software license agreement provided separately to you.
-//
-// Notice
-// NVIDIA Corporation and its licensors retain all intellectual property and
-// proprietary rights in and to this software and related documentation and
-// any modifications thereto. Any use, reproduction, disclosure, or
-// distribution of this software and related documentation without an express
-// license agreement from NVIDIA Corporation is strictly prohibited.
-//
-// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
-// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
-// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
-// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// Information and code furnished is believed to be accurate and reliable.
-// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
-// information or for any infringement of patents or other rights of third parties that may
-// result from its use. No license is granted by implication or otherwise under any patent
-// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
-// This code supersedes and replaces all information previously supplied.
-// NVIDIA Corporation products are not authorized for use as critical
-// components in life support devices or systems without express written approval of
-// NVIDIA Corporation.
-//
-// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
-
-
-#ifndef NVBLASTAUTHORINGMESH_H
-#define NVBLASTAUTHORINGMESH_H
-
-#include "NvBlastExtAuthoringTypes.h"
-
-namespace Nv
-{
-namespace Blast
-{
-
-/**
- Class for internal mesh representation
-*/
-class Mesh
-{
-public:
- virtual ~Mesh() {}
-
- /**
- Release Mesh memory
- */
- virtual void release() = 0;
-
- /**
- Return true if mesh is valid
- */
- virtual bool isValid() const = 0;
-
- /**
- Return writable pointer on vertices array
- */
- virtual Vertex* getVerticesWritable() = 0;
-
- /**
- Return pointer on vertices array
- */
- virtual const Vertex* getVertices() const = 0;
-
-
- /**
- Return writable pointer on edges array
- */
- virtual Edge* getEdgesWritable() = 0;
-
- /**
- Return pointer on edges array
- */
- virtual const Edge* getEdges() const = 0;
-
- /**
- Return writable pointer on facets array
- */
- virtual Facet* getFacetsBufferWritable() = 0;
-
- /**
- Return pointer on facets array
- */
- virtual const Facet* getFacetsBuffer() const = 0;
-
- /**
- Return writable pointer on specified facet
- */
- virtual Facet* getFacetWritable(int32_t facet) = 0;
- /**
- Return pointer on specified facet
- */
- virtual const Facet* getFacet(int32_t facet) const = 0;
-
- /**
- Return edges count
- */
- virtual uint32_t getEdgesCount() const = 0;
-
- /**
- Return vertices count
- */
- virtual uint32_t getVerticesCount() const = 0;
-
- /**
- Return facet count
- */
- virtual uint32_t getFacetCount() const = 0;
-
- /**
- Return reference on mesh bounding box.
- */
- virtual const physx::PxBounds3& getBoundingBox() const = 0;
-
- /**
- Return writable reference on mesh bounding box.
- */
- virtual physx::PxBounds3& getBoundingBoxWritable() = 0;
-
-
- /**
- Set per-facet material id.
- */
- virtual void setMaterialId(const int32_t* materialIds) = 0;
-
- /**
- Replaces an material id on faces with a new one
- */
- virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
-
- /**
- Set per-facet smoothing group.
- */
- virtual void setSmoothingGroup(const int32_t* smoothingGroups) = 0;
-
- /**
- Recalculate bounding box
- */
- virtual void recalculateBoundingBox() = 0;
-
- /**
- Compute mesh volume. Can be used only for triangulated meshes.
- Return mesh volume. If mesh is not triangulated return 0.
- */
- virtual float getMeshVolume() = 0;
-};
-
-} // namespace Blast
-} // namespace Nv
-
-
-#endif // ifndef NVBLASTAUTHORINGMESH_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h deleted file mode 100755 index fe5cef2..0000000 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h +++ /dev/null @@ -1,287 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you
-// under a form of NVIDIA software license agreement provided separately to you.
-//
-// Notice
-// NVIDIA Corporation and its licensors retain all intellectual property and
-// proprietary rights in and to this software and related documentation and
-// any modifications thereto. Any use, reproduction, disclosure, or
-// distribution of this software and related documentation without an express
-// license agreement from NVIDIA Corporation is strictly prohibited.
-//
-// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
-// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
-// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
-// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// Information and code furnished is believed to be accurate and reliable.
-// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
-// information or for any infringement of patents or other rights of third parties that may
-// result from its use. No license is granted by implication or otherwise under any patent
-// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
-// This code supersedes and replaces all information previously supplied.
-// NVIDIA Corporation products are not authorized for use as critical
-// components in life support devices or systems without express written approval of
-// NVIDIA Corporation.
-//
-// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
-
-
-#ifndef NVBLASTAUTHORINGTYPES_H
-#define NVBLASTAUTHORINGTYPES_H
-
-#include <PxVec3.h>
-#include <PxVec2.h>
-#include <PxBounds3.h>
-#include "NvBlastTypes.h"
-
-#define NOT_VALID_VERTEX INT32_MAX
-
-namespace Nv
-{
-namespace Blast
-{
-
-/**
- Edge representation
-*/
-struct Edge
-{
- uint32_t s, e;
- Edge() : s(NOT_VALID_VERTEX), e(NOT_VALID_VERTEX){}
- Edge(int s, int e) : s(s), e(e) {}
- bool operator<(const Edge& b) const
- {
- if (s == b.s)
- return e < b.e;
- else
- return s < b.s;
- }
-};
-
-/**
- Mesh vertex representation
-*/
-struct Vertex
-{
- physx::PxVec3 p; // Position
- physx::PxVec3 n; // Normal
- physx::PxVec2 uv[1]; // UV-coordinates array, currently supported only one UV coordinate.
-};
-
-
-// Interior material ID
-#define MATERIAL_INTERIOR 1000
-#define SMOOTHING_GROUP_INTERIOR 1000
-
-
-
-/**
- Mesh triangle representation
-*/
-struct Triangle
-{
- Triangle() {};
- Triangle(Vertex a, Vertex b, Vertex c) : a(a), b(b), c(c) {};
- Vertex a, b, c;
- int32_t userData;
- int32_t materialId;
- int32_t smoothingGroup;
- physx::PxVec3 getNormal() const
- {
- return ((b.p - a.p).cross(c.p - a.p));
- }
- inline Vertex& getVertex(uint32_t index)
- {
- return (&a)[index];
- }
- inline const Vertex& getVertex(uint32_t index) const
- {
- return (&a)[index];
- }
-};
-
-
-/**
- Index based triangle
-*/
-struct TriangleIndexed
-{
- TriangleIndexed() {};
- TriangleIndexed(uint32_t a, uint32_t b, uint32_t c) : ea(a), eb(b), ec(c) {};
-
- uint32_t getOpposite(uint32_t a, uint32_t b)
- {
- if (ea != a && ea != b)
- return ea;
- if (eb != a && eb != b)
- return eb;
- if (ec != a && ec != b)
- return ec;
- return NOT_VALID_VERTEX;
- }
-
- bool isContainEdge(uint32_t a, uint32_t b)
- {
- return (a == ea || a == eb || a == ec) && (b == ea || b == eb || b == ec);
- }
-
- Triangle convertToTriangle(Vertex* vertices)
- {
- Triangle tr;
- tr.a = vertices[ea];
- tr.b = vertices[eb];
- tr.c = vertices[ec];
-
- tr.userData = userData;
- tr.materialId = materialId;
- tr.smoothingGroup = smoothingGroup;
- return tr;
- }
-
- uint32_t ea, eb, ec;
- int32_t materialId;
- int32_t smoothingGroup;
- int32_t userData;
-};
-
-
-
-
-/**
- Mesh facet representation
-*/
-struct Facet
-{
- int32_t firstEdgeNumber;
- uint32_t edgesCount;
- int64_t userData;
- int32_t materialId;
- int32_t smoothingGroup;
-
- Facet(int32_t fEdge = 0, uint32_t eCount = 0, int32_t materialId = 0, int64_t userData = 0, int32_t smoothingGroup = 0) : firstEdgeNumber(fEdge), edgesCount(eCount), userData(userData), materialId(materialId), smoothingGroup(smoothingGroup) {}
-};
-
-/**
- Abstract base class for user-defined random value generator.
-*/
-class RandomGeneratorBase
-{
-public:
- // Generates uniformly distributed value in [0, 1] range.
- virtual float getRandomValue() = 0;
- // Seeds random value generator
- virtual void seed(int32_t seed) = 0;
- virtual ~RandomGeneratorBase() {};
-};
-
-/**
- Collision hull geometry format.
-*/
-struct CollisionHull
-{
- /**
- Collision hull polygon format.
- */
- struct HullPolygon
- {
- // Polygon base plane
- float mPlane[4];
- // Number vertices in polygon
- uint16_t mNbVerts;
- // First index in CollisionHull.indices array for this polygon
- uint16_t mIndexBase;
- };
- ///**
-
- uint32_t pointsCount;
- uint32_t indicesCount;
- uint32_t polygonDataCount;
- physx::PxVec3* points;
- uint32_t* indices;
- HullPolygon* polygonData;
-
- virtual ~CollisionHull() {}
-
- virtual void release() = 0;
-};
-
-/**
- Authoring results. Which contains NvBlastAsset, render and collision meshes
-*/
-struct AuthoringResult
-{
- uint32_t chunkCount; //Number of chunks in Blast asset
-
- uint32_t bondCount; //Number of bonds in Blast asset
-
- NvBlastAsset* asset; //Blast asset
-
- /**
- assetToFractureChunkIdMap used for getting internal FractureChunkId with FractureTool::getChunkId.
- FractureChunkId = FractureTool.getChunkId(aResult.assetToFractureChunkIdMap(AssetChunkId);
- */
- uint32_t* assetToFractureChunkIdMap;
-
- /**
- Offsets for render mesh geometry. Contains chunkCount + 1 element.
- First triangle for i-th chunk: aResult.geometry[aResult.geometryOffset[i]]
- aResult.geometryOffset[chunkCount+1] is total number of triangles in geometry
- */
- uint32_t* geometryOffset;
-
- Triangle* geometry; //Raw array of Triangle for all chunks
-
- NvBlastChunkDesc* chunkDescs; //Array of chunk descriptors. Contains chunkCount elements
-
- NvBlastBondDesc* bondDescs; //Array of bond descriptors. Contains bondCount elements
-
- /**
- Collision hull offsets. Contains chunkCount + 1 element.
- First collision hull for i-th chunk: aResult.collisionHull[aResult.collisionHullOffset[i]]
- aResult.collisionHullOffset[chunkCount+1] is total number of collision hulls in collisionHull
- */
- uint32_t* collisionHullOffset;
-
- CollisionHull** collisionHull; //Raw array of pointers to collision hull for all chunks.
-
- /**
- Array of chunk physics parameters. Contains chunkCount elements
- */
- struct ExtPxChunk* physicsChunks;
-
- /**
- Array of phisics subchunks (convex mesh) descriptors.
- Use collisionHullOffset for accessing elements.
- */
- struct ExtPxSubchunk* physicsSubchunks;
-
- /**
- Array of material names.
- */
- const char** materialNames;
- /**
- Size of array of material names.
- */
-
- uint32_t materialCount;
-
- //// Member functions ////
- virtual ~AuthoringResult() {}
-
- /**
- Free collision hulls data
- */
- virtual void releaseCollisionHulls() = 0;
-
- /**
- Free all data and AuthoringResult
- */
- virtual void release() = 0;
-};
-
-
-} // namespace Blast
-} // namespace Nv
-
-
-#endif // ifndef NVBLASTAUTHORINGTYPES_H
|