Main Page Class List Class Members

# sdk/extensions/stress/include/NvBlastExtStressSolver.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 NVBLASTEXTSTRESSSOLVER_H
    00030 #define NVBLASTEXTSTRESSSOLVER_H
    00031
    00032 #include "NvBlastTypes.h"
    00033 #include "NvCTypes.h"
    00034
    00035
    00036 namespace Nv
    00037 {
    00038 namespace Blast
    00039 {
    00040
    00041
    00056 struct ExtStressSolverSettings
    00057 {
    00058     float       hardness;
    00059     float       stressLinearFactor;
    00060     float       stressAngularFactor;
    00061     uint32_t    bondIterationsPerFrame;
    00062     uint32_t    graphReductionLevel;
    00063
    00064     ExtStressSolverSettings() :
    00065         hardness(1000.0f),
    00066         stressLinearFactor(0.25f),
    00067         stressAngularFactor(0.75f),
    00068         bondIterationsPerFrame(18000),
    00069         graphReductionLevel(3)
    00070     {}
    00071 };
    00072
    00073
    00079 struct ExtForceMode
    00080 {
    00081     enum Enum
    00082     {
    00083         IMPULSE,
    00084         VELOCITY,
    00085     };
    00086 };
    00087
    00088
    00104 class NV_DLL_EXPORT ExtStressSolver
    00105 {
    00106 public:
    00108
    00117     static ExtStressSolver*                 create(NvBlastFamily& family, ExtStressSolverSettings settings = ExtStressSolverSettings());
    00118
    00119
    00121
    00125     virtual void                            release() = 0;
    00126
    00138     virtual void                            setNodeInfo(uint32_t graphNodeIndex, float mass, float volume, NvcVec3 localPosition, bool isStatic) = 0;
    00139
    00147     virtual void                            setAllNodesInfoFromLL(float density = 1.0f) = 0;
    00148
    00156     virtual void                            setSettings(const ExtStressSolverSettings& settings) = 0;
    00157
    00163     virtual const ExtStressSolverSettings&  getSettings() const = 0;
    00164
    00174     virtual bool                            notifyActorCreated(const NvBlastActor& actor) = 0;
    00175
    00183     virtual void                            notifyActorDestroyed(const NvBlastActor& actor) = 0;
    00184
    00195     virtual bool                            addForce(const NvBlastActor& actor, NvcVec3 localPosition, NvcVec3 localForce, ExtForceMode::Enum mode = ExtForceMode::IMPULSE) = 0;
    00196
    00204     virtual void                            addForce(uint32_t graphNodeIndex, NvcVec3 localForce, ExtForceMode::Enum mode = ExtForceMode::IMPULSE) = 0;
    00205
    00214     virtual bool                            addGravityForce(const NvBlastActor& actor, NvcVec3 localGravity) = 0;
    00215
    00225     virtual bool                            addAngularVelocity(const NvBlastActor& actor, NvcVec3 localCenterMass, NvcVec3 localAngularVelocity) = 0;
    00226
    00232     virtual void                            update() = 0;
    00233
    00241     virtual uint32_t                        getOverstressedBondCount() const = 0;
    00242
    00255     virtual void                            generateFractureCommands(const NvBlastActor& actor, NvBlastFractureBuffers& commands) = 0;
    00256
    00267     virtual void                            generateFractureCommands(NvBlastFractureBuffers& commands) = 0;
    00268
    00285     virtual uint32_t                        generateFractureCommandsPerActor(const NvBlastActor** actorBuffer, NvBlastFractureBuffers* commandsBuffer, uint32_t bufferSize) = 0;
    00286
    00293     virtual void                            reset() = 0;
    00294
    00300     virtual float                           getStressErrorLinear() const = 0;
    00301
    00307     virtual float                           getStressErrorAngular() const = 0;
    00308
    00314     virtual uint32_t                        getFrameCount() const = 0;
    00315
    00321     virtual uint32_t                        getBondCount() const = 0;
    00322
    00323
    00327     enum DebugRenderMode
    00328     {
    00329         STRESS_GRAPH = 0,
    00330         STRESS_GRAPH_NODES_IMPULSES = 1,
    00331         STRESS_GRAPH_BONDS_IMPULSES = 2
    00332     };
    00333
    00337     struct DebugLine
    00338     {
    00339         DebugLine(const NvcVec3& p0, const NvcVec3& p1, const uint32_t& c)
    00340             : pos0(p0), color0(c), pos1(p1), color1(c) {}
    00341
    00342         NvcVec3 pos0;
    00343         uint32_t        color0;
    00344         NvcVec3 pos1;
    00345         uint32_t        color1;
    00346     };
    00347
    00351     struct DebugBuffer
    00352     {
    00353         const DebugLine* lines;
    00354         uint32_t         lineCount;
    00355     };
    00356
    00369     virtual const DebugBuffer               fillDebugRender(const uint32_t* nodes, uint32_t nodeCount, DebugRenderMode mode, float scale = 1.0f) = 0;
    00370
    00371
    00373
    00385     static uint32_t                         getIterationsPerFrame(const ExtStressSolverSettings& settings, uint32_t bondCount)
    00386     {
    00387         uint32_t perFrame = settings.bondIterationsPerFrame / (bondCount + 1);
    00388         return perFrame > 0 ? perFrame : 1;
    00389     }
    00390
    00398     uint32_t                                getIterationsPerFrame() const
    00399     {
    00400         return getIterationsPerFrame(getSettings(), getBondCount());
    00401     }
    00402
    00403 };
    00404
    00405 } // namespace Blast
    00406 } // namespace Nv
    00407
    00408
    00409 #endif // ifndef NVBLASTEXTSTRESSSOLVER_H