RavEngine
Loading...
Searching...
No Matches
DyHairSystem.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#ifndef DY_HAIR_SYSTEM_H
28#define DY_HAIR_SYSTEM_H
29
30#include "DyHairSystemCore.h"
31#include "PxvGeometry.h"
32
33namespace physx
34{
35 namespace Sc
36 {
37 class HairSystemSim;
38 }
39
40 namespace Dy
41 {
42 typedef size_t HairSystemHandle;
43
44 // forward-declarations
45 class Context;
46 class HairSystem;
47
49 {
72 };
73
74
76 {
77 HairSystem* hairSystem;
78 };
79
81 {
82 PX_NOCOPY(HairSystem)
83 public:
85 mSim(sim)
86 , mCore(core)
87 , mShapeCore(NULL)
88 , mElementId(0xffFFffFF)
89 , mGpuRemapId(0xffFFffFF)
90
91 {
92 mCore.mDirtyFlags = HairSystemDirtyFlag::eALL;
93 }
94
95 ~HairSystem() {}
96
97 PX_FORCE_INLINE void setShapeCore(PxsShapeCore* shapeCore)
98 {
99 mShapeCore = shapeCore;
100 }
101
102 PX_FORCE_INLINE PxU32 getGpuRemapId() const { return mGpuRemapId; }
103 PX_FORCE_INLINE void setGpuRemapId(PxU32 remapId)
104 {
105 mGpuRemapId = remapId;
106 PxHairSystemGeometryLL& geom = mShapeCore->mGeometry.get<PxHairSystemGeometryLL>();
107 geom.gpuRemapId = remapId;
108 }
109
110 PX_FORCE_INLINE PxU32 getElementId() const { return mElementId; }
111 PX_FORCE_INLINE void setElementId(const PxU32 elementId) { mElementId = elementId; }
112
113
114 PX_FORCE_INLINE Sc::HairSystemSim* getHairSystemSim() const { return mSim; }
115
116 PX_FORCE_INLINE const HairSystemCore& getCore() const { return mCore; }
117 PX_FORCE_INLINE HairSystemCore& getCore() { return mCore; }
118 PX_FORCE_INLINE PxsShapeCore& getShapeCore() { return *mShapeCore; }
119
120 PX_FORCE_INLINE PxU16 getIterationCounts() { return mCore.mSolverIterationCounts; }
121
122 private: // variables
123 Sc::HairSystemSim* mSim;
124 HairSystemCore& mCore;
125 PxsShapeCore* mShapeCore;
126 PxU32 mElementId; //this is used for the bound array
127 PxU32 mGpuRemapId;
128 };
129
130
131 PX_FORCE_INLINE HairSystem* getHairSystem(HairSystemHandle handle)
132 {
133 return reinterpret_cast<HairSystem*>(handle);
134 }
135
136 }
137}
138
139#endif
Definition DyHairSystem.h:81
Definition ScHairSystemSim.h:42
#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 DyHairSystemCore.h:70
Definition DyHairSystem.h:49
Enum
Definition DyHairSystem.h:51
@ eTWISTING_REST_POSITIONS
‍Bending rest angles were changed
Definition DyHairSystem.h:62
@ eREST_POSITION_TRANSFORM
‍Positions, velocities or masses changed
Definition DyHairSystem.h:58
@ ePOSITIONS_VELOCITIES_MASS
‍Attachment was changed
Definition DyHairSystem.h:57
@ eGRID_SIZE
‍Parameters were changed
Definition DyHairSystem.h:55
@ eATTACHMENT
‍Grid size was changed. sets ePARAMETERS because settings are stored there
Definition DyHairSystem.h:56
@ ePARAMETERS
‍default, everything up-to-date
Definition DyHairSystem.h:54
@ eSTRAND_LENGTHS
‍Shape matching group size or overlap changed. sets ePARAMETERS because settings are stored there
Definition DyHairSystem.h:65
@ eNUM_STRANDS_OR_VERTS
‍Topology of vertex arrangement was changed
Definition DyHairSystem.h:66
@ eLOD_DATA
‍Level of detail was changed, update lodX pos/vel from lod0
Definition DyHairSystem.h:60
@ eSHAPE_MATCHING_SIZES
‍Rest (=skinned) positions changed
Definition DyHairSystem.h:64
@ eLOD_SWITCH
‍Transform of the rest positions changed
Definition DyHairSystem.h:59
@ eALL
‍Number of strands or vertices changed
Definition DyHairSystem.h:70
@ eREST_POSITIONS
‍Twisting rest positions were changed
Definition DyHairSystem.h:63
@ eBENDING_REST_ANGLES
‍Definition of detail levels changed . Must come after setting any kind of rest positions....
Definition DyHairSystem.h:61
Definition DyHairSystem.h:76
Definition PxvGeometry.h:135
Definition PxvGeometry.h:221