Main Page   Class List   Class Members  

  • Main Page
  • User's Guide
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

sdk/extensions/RT/source/NvBlastExtRTImpl.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 #ifndef NVBLASTAUTHORINGRTIMPL_H
00030 #define NVBLASTAUTHORINGRTIMPL_H
00031 
00032 #include <NvBlastExtRT.h>
00033 #include <thread>
00034 #include <mutex>
00035 #include <condition_variable>
00036 #include <atomic>
00037 
00038 namespace physx
00039 {
00040     class PxCooking;
00041 };
00042 
00043 namespace Nv
00044 {
00045     namespace Blast
00046     {
00047 
00048         class BooleanToolV2;
00049         class TriangulatorV2;
00050 
00051         struct BooleanToolOutputDataImpl : public BooleanToolOutputData
00052         {
00053             BooleanToolOutputDataImpl(bool createOnlyEdgeBuffer = false);
00054 
00055             void release() override;
00056 
00057             void reset() override;
00058             void resetEdges() override;
00059 
00060             void copyVerticesAndResults(const BooleanToolOutputData* other) override;
00061 
00062             uint32_t edgesCount() const override
00063             {
00064                 return *mEdgesCount;
00065             }
00066             uint32_t verticesCount() const override
00067             {
00068                 return *mVerticesCount;
00069             }
00070             uint32_t ffResultCount() const override
00071             {
00072                 return *mFfResultCount;
00073             }
00074 
00075             uint32_t addEdge(const BooleanResultEdge&) override;
00076             uint32_t addVertex(const Vertex&) override;
00077             uint32_t addFfResult(const FacetFacetResult&) override;
00078 
00079             BooleanResultEdge& getNewEdge() override;
00080             Vertex& getNewVertex() override;
00081             FacetFacetResult& getNewFfResult() override;
00082 
00083             std::atomic<uint32_t>* mEdgesCount;
00084             std::atomic<uint32_t>* mVerticesCount;
00085             std::atomic<uint32_t>* mFfResultCount;
00086 
00087             bool isVerticesAndResultsAllocated;
00088         };
00089 
00090         class FractureRTImpl : public FractureRT
00091         {
00092         public:
00093             
00094             FractureRTImpl();
00095 
00096             virtual void release() override;
00097             virtual void processMesh(DamagePattern* pattern, const Mesh* msh) override;
00098 
00099             virtual uint32_t getResultChunkCount() override 
00100             {
00101                 return resultChunkCount;
00102             };
00103             virtual Vertex* getVertexBuffer() override
00104             {
00105                 return verticesBuffer;
00106             };
00107             virtual uint32_t* getVertexOffset() override
00108             {
00109                 return vertexOffset;
00110             };
00111             virtual uint32_t* getIndexBuffer() override
00112             {
00113                 return indexBuffer;
00114             };
00115             virtual uint32_t* getIndexOffset() override 
00116             {
00117                 return indexOffset;
00118             };
00119             PerTriangleAdditionalData* getPerTriangleData() override
00120             {
00121                 return adata;
00122             };
00123 
00124             void dumpChunksToObj(const char* path) override;
00125 
00126         private:
00127 
00128             BooleanToolV2* btool;
00129             TriangulatorV2* triangulator;
00130             Vertex* verticesBuffer;
00131             uint32_t* indexBuffer;
00132             PerTriangleAdditionalData* adata;
00133 
00134             uint32_t triangleCount;
00135             uint32_t vertexCount;
00136 
00137             uint32_t* indexOffset;
00138             uint32_t* vertexOffset;
00139             uint32_t resultChunkCount;
00140 
00141             BooleanToolOutputDataImpl* outputData;
00142         };
00143     }
00144 }
00145 
00146 Nv::Blast::BooleanToolOutputData* CreateBooleanToolOutputData(bool isMergedMesh = false);
00147 
00148 #ifdef USE_MERGED_MESH
00149 void sortResultBuffer(Nv::Blast::FacetFacetResult*& ffResultBuffer, uint32_t ffCount);
00150 void procesOutputEdges(Nv::Blast::BooleanToolOutputData* outputData, Nv::Blast::DamagePattern* pattern, uint32_t facetCount);
00151 #endif
00152 
00153 #endif // ifndef NVBLASTAUTHORINGRTIMPL_H
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com