EmitterGeoms.h
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 
00030 #ifndef EMITTER_GEOMS_H
00031 #define EMITTER_GEOMS_H
00032 
00033 #include "Apex.h"
00034 
00035 namespace nvidia
00036 {
00037 namespace apex
00038 {
00039 
00040 PX_PUSH_PACK_DEFAULT
00041 
00043 struct EmitterType
00044 {
00046     enum Enum
00047     {
00048         ET_RATE = 0,            
00049         ET_DENSITY_ONCE,        
00050         ET_DENSITY_BRUSH,       
00051         ET_FILL,                
00052         ET_UNDEFINED,
00053     };
00054 };
00055 
00056 class EmitterGeomBox;
00057 class EmitterGeomSphere;
00058 class EmitterGeomSphereShell;
00059 class EmitterGeomCylinder;
00060 class EmitterGeomExplicit;
00061 
00063 class EmitterGeom
00064 {
00065 public:
00067     virtual void                            setEmitterType(EmitterType::Enum) = 0;
00068     
00070     virtual EmitterType::Enum               getEmitterType() const = 0;
00071 
00073     virtual const EmitterGeomBox*           isBoxGeom() const
00074     {
00075         return NULL;
00076     }
00077     
00079     virtual const EmitterGeomSphere*        isSphereGeom() const
00080     {
00081         return NULL;
00082     }
00083     
00085     virtual const EmitterGeomSphereShell*   isSphereShellGeom() const
00086     {
00087         return NULL;
00088     }
00089     
00091     virtual const EmitterGeomCylinder*      isCylinderGeom() const
00092     {
00093         return NULL;
00094     }
00095     
00097     virtual const EmitterGeomExplicit*      isExplicitGeom() const
00098     {
00099         return NULL;
00100     }
00101 };
00102 
00104 class EmitterGeomSphereShell : public EmitterGeom
00105 {
00106 public:
00107     
00109     virtual void    setRadius(float radius) = 0;
00110     
00112     virtual float   getRadius() const = 0;
00113 
00115     virtual void    setShellThickness(float thickness) = 0;
00116     
00118     virtual float   getShellThickness() const = 0;
00119 };
00120 
00122 class EmitterGeomSphere : public EmitterGeom
00123 {
00124 public:
00125 
00127     virtual void    setRadius(float radius) = 0;
00128     
00130     virtual float   getRadius() const = 0;
00131 };
00132 
00134 class EmitterGeomCylinder : public EmitterGeom
00135 {
00136 public:
00137 
00139     virtual void    setRadius(float radius) = 0;
00140     
00142     virtual float   getRadius() const = 0;
00143 
00145     virtual void    setHeight(float height) = 0;
00146     
00148     virtual float   getHeight() const = 0;
00149 };
00150 
00152 class EmitterGeomBox : public EmitterGeom
00153 {
00154 public:
00155 
00157     virtual void    setExtents(const PxVec3& extents) = 0;
00158     
00160     virtual PxVec3  getExtents() const = 0;
00161 };
00162 
00164 class EmitterGeomExplicit : public EmitterGeom
00165 {
00166 public:
00167     
00169     struct PointParams
00170     {
00171         PxVec3 position; 
00172         bool doDetectOverlaps; 
00173     };
00174 
00176     struct SphereParams
00177     {
00178         PxVec3 center; 
00179         float radius; 
00180         bool doDetectOverlaps; 
00181     };
00182 
00184     struct EllipsoidParams
00185     {
00186         PxVec3 center; 
00187         float radius; 
00188         PxVec3 normal; 
00189         float polarRadius; 
00190         bool doDetectOverlaps; 
00191     };
00192 
00194     virtual void    resetParticleList() = 0;
00195 
00202     virtual void    addParticleList(uint32_t count,
00203                                     const PointParams* params,
00204                                     const PxVec3* velocities = 0) = 0;
00205 
00212     virtual void    addParticleList(uint32_t count,
00213                                     const PxVec3* positions,
00214                                     const PxVec3* velocities = 0) = 0;
00215 
00217     struct PointListData
00218     {
00219         const void* positionStart;          
00220         uint32_t    positionStrideBytes;    
00221         const void* velocityStart;          
00222         uint32_t    velocityStrideBytes;    
00223         const void* userDataStart;          
00224         uint32_t    userDataStrideBytes;    
00225     };
00226     
00233     virtual void    addParticleList(uint32_t count, const PointListData& data) = 0;
00234 
00242     virtual void    addSphereList(uint32_t count,
00243                                   const SphereParams* params,
00244                                   const PxVec3* velocities = 0) = 0;
00245 
00253     virtual void    addEllipsoidList(uint32_t count,
00254                                      const EllipsoidParams*  params,
00255                                      const PxVec3* velocities = 0) = 0;
00256 
00265     virtual void    getParticleList(const PointParams* &params,
00266                                     uint32_t& numPoints,
00267                                     const PxVec3* &velocities,
00268                                     uint32_t& numVelocities) const = 0;
00269 
00278     virtual void    getSphereList(const SphereParams* &params,
00279                                   uint32_t& numSpheres,
00280                                   const PxVec3* &velocities,
00281                                   uint32_t& numVelocities) const = 0;
00282 
00291     virtual void    getEllipsoidList(const EllipsoidParams* &params,
00292                                      uint32_t& numEllipsoids,
00293                                      const PxVec3* &velocities,
00294                                      uint32_t& numVelocities) const = 0;
00295 
00297     virtual uint32_t    getParticleCount() const = 0;
00298 
00300     virtual PxVec3      getParticlePos(uint32_t index) const = 0;
00301 
00303     virtual uint32_t    getSphereCount() const = 0;
00304 
00306     virtual PxVec3      getSphereCenter(uint32_t index) const = 0;
00307 
00309     virtual float       getSphereRadius(uint32_t index) const = 0;
00310 
00312     virtual uint32_t    getEllipsoidCount() const = 0;
00313 
00315     virtual PxVec3      getEllipsoidCenter(uint32_t index) const = 0;
00316 
00318     virtual float       getEllipsoidRadius(uint32_t index) const = 0;
00319 
00321     virtual PxVec3      getEllipsoidNormal(uint32_t index) const = 0;
00322 
00324     virtual float       getEllipsoidPolarRadius(uint32_t index) const = 0;
00325 
00327     virtual float       getDistance() const = 0;
00328 };
00329 
00330 
00331 PX_POP_PACK
00332 
00333 }
00334 } // end namespace nvidia
00335 
00336 #endif // EMITTER_GEOMS_H

Generated on Sat Dec 1 2018 15:52:05

Copyright © 2012-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.