sdk/extensions/authoringCommon/include/NvBlastExtAuthoringPatternGenerator.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 NVBLASTEXTAUTHORINGPATTERNGENERATOR_H
00030 #define NVBLASTEXTAUTHORINGPATTERNGENERATOR_H
00031 
00032 #include "NvBlastGlobals.h"
00033 
00034 namespace Nv
00035 {
00036     namespace Blast
00037     {
00038         typedef float (*RNG_CALLBACK)(void);
00039 
00040         struct PatternDescriptor
00041         {
00042             RNG_CALLBACK RNG = nullptr;
00043 
00044             uint32_t interiorMaterialId = 1000;
00045         };
00046 
00047         struct UniformPatternDesc : public PatternDescriptor
00048         {
00049             uint32_t cellsCount = 2;
00050 
00051             float radiusMin     = 0.0f;
00052             float radiusMax     = 1.0f;
00053             float radiusDistr   = 1.0f;
00054 
00055             float debrisRadiusMult = 1.0f;
00056         };
00057 
00058         struct BeamPatternDesc : public PatternDescriptor
00059         {
00060             uint32_t cellsCount;
00061 
00062             float radiusMin;
00063             float radiusMax;
00064         };
00065 
00066         struct RegularRadialPatternDesc : public PatternDescriptor
00067         {
00068             float radiusMin = 0.0f;
00069             float radiusMax = 1.0f;
00070             
00071             uint32_t radialSteps = 3;
00072             uint32_t angularSteps = 8;
00073 
00074             float aperture = .0f;
00075 
00076             float angularNoiseAmplitude = 0.0f;
00077             
00078             float radialNoiseAmplitude = 0.0f;
00079             float radialNoiseFrequency = 0.0f;
00080 
00081             float debrisRadiusMult = 1.0f;
00082         };
00083 
00084 
00085         struct DamagePattern
00086         {
00090             float activationRadius;
00091             float angle; // For cone shape activation
00092             enum ActivationDistanceType
00093             {
00094                 Point = 0,
00095                 Line,
00096                 Cone
00097             };
00098             ActivationDistanceType activationType = Point;
00099             // ----------------------------------------------
00100 
00101 
00102             uint32_t cellsCount;
00103             class Mesh** cellsMeshes = nullptr;
00104 
00105             virtual void release() = 0;
00106         };
00107 
00108         class PatternGenerator
00109         {
00110         public:
00111             virtual DamagePattern* generateUniformPattern(const UniformPatternDesc* desc) = 0;
00112             virtual DamagePattern* generateBeamPattern(const BeamPatternDesc* desc) = 0;
00113             virtual DamagePattern* generateRegularRadialPattern(const RegularRadialPatternDesc* desc) = 0;
00114 
00115 
00116             virtual DamagePattern* generateVoronoiPattern(uint32_t pointCount, const NvcVec3* points, int32_t interiorMaterialId) = 0;
00117             virtual void release() = 0;
00118         };
00119 
00120         NVBLAST_API void savePatternToObj(DamagePattern* pattern);
00121         
00122     } // namespace Blast
00123 } // namespace Nv
00124 
00125 
00126 #endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H