Main Page Class List Class Members

- Main Page
- User's Guide
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# sdk/extensions/RT/source/NvBlastExtRTGeometry.h

Go to the documentation of this file.

    00001 #pragma once
    00002 #include "NvBlastExtAuthoringTypes.h"
    00003 #include "NvBlastExtAuthoringInternalCommon.h"
    00004 #include "NvBlastExtAuthoringAccelerator.h"
    00005 #include "NvBlastExtRT.h"
    00006 #include <map>
    00007
    00008 using physx::PxVec3;
    00009 using physx::PxVec2;
    00010
    00011
    00012 namespace Nv
    00013 {
    00014     namespace Blast
    00015     {
    00016         class Mesh;
    00017
    00018         class VertexWelding
    00019         {
    00020         public:
    00021
    00022             typedef int32_t (VertexWelding::*LOCATE_CALLBACK)(const Vertex& v, uint32_t bucket, bool& isAllDataTheSame);
    00023
    00024             VertexWelding(uint32_t maxVertexCount, uint32_t maxBucketCount, float gridCellSize, float weldEpsilon, float auxEpsilon, LOCATE_CALLBACK clb);
    00025
    00026             const Vertex* getVertices() const
    00027             {
    00028                 return vertex.data();
    00029             }
    00030             uint32_t getVerticesCount() const
    00031             {
    00032                 return vertex.size();
    00033             }
    00034             void reset();
    00035             int32_t WeldVertex(const Vertex *v);
    00036
    00037             int32_t LocateVertexInBucket(const Vertex& v, uint32_t bucket, bool& isAllDataTheSame);
    00038
    00039             int32_t LocateVertexInBucketOnlyPosition(const Vertex& v, uint32_t bucket, bool& isAllDataTheSame);
    00040
    00041
    00042         private:
    00043             // Computes hash bucket index in range [0, NUM_BUCKETS-1]
    00044             //int32_t ComputeHashBucketIndex(const Vertex& v)
    00045             int32_t ComputeHashBucketIndex(int32_t x, int32_t y, int32_t z);
    00046
    00047             void AddVertexToBucket(const Vertex& v, uint32_t bucket);
    00048
    00049             std::vector<int32_t> first; // start of linked list for each bucket
    00050             std::vector<int32_t> next; // links each vertex to next in linked list
    00051             std::vector<Vertex> vertex; // unique vertices within tolerance
    00052
    00053             const uint32_t maxVertexCount; // max number of vertices that can be welded at once
    00054             const uint32_t maxBucketCount; // number of hash buckets to map grid cells into
    00055             const float gridCellSizeInv; // grid cell size; must be at least 2*WELD_EPSILON
    00056             const float weldEpsilon; // radius around vertex defining welding neighborhood
    00057             const float auxEpsilon; // epsilon for normal and uv of vertex
    00058
    00059             LOCATE_CALLBACK locateCallback;
    00060         };
    00061
    00062         class BooleanToolV2 : public Fracturer
    00063         {
    00064         public:
    00065
    00066             struct Mode
    00067             {
    00068                 int32_t ca, cb, ci;
    00069                 Mode() { ca = 0; cb = 0; ci = -1; };
    00070                 Mode(int32_t a, int32_t b, int32_t c) : ca(a), cb(b), ci(c)
    00071                 {
    00072                 }
    00073
    00074                 static Mode Intersection()
    00075                 {
    00076                     return Mode(0, 0, 1);
    00077                 }
    00078
    00082                 static Mode Union()
    00083                 {
    00084                     return Mode(1, 1, -1);
    00085                 }
    00089                 static Mode Difference()
    00090                 {
    00091                     return Mode(1, 0, -1);
    00092                 }
    00093             };
    00094
    00095             BooleanToolV2();
    00096
    00097             void release();
    00098
    00103             const Mesh* mMeshA;
    00104             const Mesh* mMeshB;
    00105             SpatialAccelerator* mAccelA;
    00106             SpatialAccelerator* mAccelB;
    00107             //const PreparedMesh* mPreparedA;
    00108             //const PreparedMesh* mPreparedB;
    00109
    00110
    00114             void makeFacetFacetTests(BooleanToolOutputData* outputData, int32_t threadId, int32_t threadCount);
    00115             void retain(bool isA, BooleanToolOutputData* outputData, int32_t threadId, int32_t threadCount,
    00116                 const DamagePattern* pattern = nullptr, int32_t chunk = -1);
    00117
    00121             //Nv::Blast::Mesh* getMesh();
    00122
    00123
    00124         private:
    00125
    00126             int32_t computeV03(const PxVec3& point);
    00127             int32_t computeV30(const PxVec3& point);
    00128
    00129
    00133             void computeRetained(const Mesh* mesh, const physx::PxBounds3& bMeshBoudning,
    00134                 int32_t(BooleanToolV2::*computeV3)(const physx::PxVec3&), int32_t btC, int32_t btCI, int32_t parentFacetOffset,
    00135                 BooleanToolOutputData* outputData, int32_t threadId, int32_t threadCount,
    00136                 struct FaceOrientation* fo = nullptr, const std::vector<bool>* validAdjacentFacet = nullptr);
    00137
    00138
    00140
    00143             float* sx1;
    00144             float* sy1;
    00145             float* ex1;
    00146             float* ey1;
    00147             float* px1;
    00148             float* py1;
    00149             float* pt1;
    00150             float* resy1;
    00151             int32_t* winding1;
    00152             int32_t* projectedWinding1;
    00153
    00154
    00155             float* sx2;
    00156             float* sy2;
    00157             float* ex2;
    00158             float* ey2;
    00159             float* px2;
    00160             float* py2;
    00161             float* pt2;
    00162             float* resy2;
    00163             int32_t* winding2;
    00164             int32_t* projectedWinding2;
    00165
    00166             uint32_t* edgeFacetTestA;
    00167             uint32_t* edgeFacetTestB;
    00168
    00169
    00173             int32_t* edgeCrossCheckTest;
    00174             Vertex* edgeCrossA;
    00175             Vertex* edgeCrossB;
    00176
    00177             Mode mToolMode;
    00178         };
    00179
    00180         class TriangulatorV2 : public MeshGenerator
    00181         {
    00182         public:
    00183             TriangulatorV2();
    00184
    00185             void release();
    00186
    00187             uint32_t build(const BooleanResultEdge* edges, uint32_t inEdgeCount, const Vertex* inVertices, Vertex* outWeldedVrts, uint32_t& vcount, uint32_t* outTriangles, PerTriangleAdditionalData* adata, uint32_t maxTcount, const Mesh* ma, const Mesh* mb);
    00188
    00189             struct LinkedListElement
    00190             {
    00191                 uint32_t point;
    00192                 uint32_t nextPoint;
    00193                 uint32_t prevPoint;
    00194             };
    00195
    00196             Vertex* weldedVertices;
    00197             uint32_t    weldedCount;
    00198             uint32_t*   triangleIndices;
    00199             uint32_t    triangleCount;
    00200
    00201         private:
    00202
    00203             void triangulatePolygonWithEarClipping(ProjectionDirections dir);
    00204
    00205             LinkedListElement facetList[1024];
    00206             uint32_t facetListSize;
    00207             uint32_t pointIndicesList[1024];
    00208             uint32_t pointCount;
    00209
    00210             physx::PxVec2 projectedPointList[1024];
    00211             uint32_t projectedPointCount;
    00212
    00213             uint32_t visitedFlagValue[1024];
    00214             uint32_t currentFlagValue;
    00215
    00216
    00217
    00218             Edge* weldedEdges;
    00219
    00220
    00221             const BooleanResultEdge*    mInpEdges;
    00222             uint32_t                    mInpEdgeCount;
    00223             uint32_t                    maxTriangleCount;
    00224
    00225             const Mesh*                 meshA;
    00226             const Mesh*                 meshB;
    00227
    00228             VertexWelding wldg;
    00229         };
    00230
    00231     }
    00232 }
    00233

Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com