RavEngine
Loading...
Searching...
No Matches
DyParticleSystem.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26
27
28#ifndef PXD_PARTICLESYSTEM_H
29#define PXD_PARTICLESYSTEM_H
30
31#include "foundation/PxSimpleTypes.h"
32#include "DyParticleSystemCore.h"
33#include "PxvGeometry.h"
34
35#define MAX_SPARSEGRID_DIM 1024
36#define MIN_SPARSEGRID_ID -512
37#define MAX_SPARSEGRID_ID 511
38
39namespace physx
40{
41 namespace Sc
42 {
43 class ParticleSystemSim;
44 }
45
46
47 namespace Dy
48 {
49 typedef size_t ParticleSystemHandle;
50
51 class ParticleSystemCore;
52
54 {
55 enum Enum
56 {
57 eUPDATE_PARAMS = 1 << 1,
58 eUPDATE_MATERIAL = 1 << 2,
59 eUPDATE_PHASE = 1 << 3,
60 eUPDATE_ACTIVE_PARTICLECOUNT = 1 << 4
61 };
62 };
63
64
66 {
67 PX_NOCOPY(ParticleSystem)
68 public:
69
70 ParticleSystem(Dy::ParticleSystemCore& core) : mCore(core), mShapeCore(NULL),
71 mElementId(0xffffffff), mGpuRemapId(0xffffffff)
72 {
73 mFlag = 0;
74 }
75
77
78 PX_FORCE_INLINE void setShapeCore(PxsShapeCore* shapeCore)
79 {
80 mShapeCore = shapeCore;
81 }
82
83 PX_FORCE_INLINE void setGpuRemapId(const PxU32 remapId)
84 {
85 mGpuRemapId = remapId;
86 PxParticleSystemGeometryLL& geom = mShapeCore->mGeometry.get<PxParticleSystemGeometryLL>();
87 geom.materialsLL.gpuRemapId = remapId;
88 }
89
90 PX_FORCE_INLINE PxU32 getGpuRemapId() const { return mGpuRemapId; }
91
92 PX_FORCE_INLINE void setElementId(const PxU32 elementId) { mElementId = elementId; }
93 PX_FORCE_INLINE PxU32 getElementId() { return mElementId; }
94
95 PX_FORCE_INLINE ParticleSystemCore& getCore() const { return mCore; }
96 PX_FORCE_INLINE PxsShapeCore& getShapeCore() { return *mShapeCore; }
97
98 PX_FORCE_INLINE PxU16 getIterationCounts() { return mCore.solverIterationCounts; }
99
100 PxU32 mFlag;
101
102 private:
103 ParticleSystemCore& mCore;
104 PxsShapeCore* mShapeCore;
105 PxU32 mElementId; //this is used for the bound array
106 PxU32 mGpuRemapId;
107
108 };
109
111 {
112 ParticleSystem* particleSystem;
113 };
114
115 PX_FORCE_INLINE ParticleSystem* getParticleSystem(ParticleSystemHandle handle)
116 {
117 return reinterpret_cast<ParticleSystem*>(handle);
118 }
119
120 }
121}
122
123#endif
Definition DyParticleSystemCore.h:51
Definition DyParticleSystem.h:66
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition DyParticleSystem.h:54
Definition DyParticleSystem.h:111
Definition PxvGeometry.h:120
Definition PxvGeometry.h:221