diff options
Diffstat (limited to 'linden/indra/newview/llviewerpartsim.h')
-rw-r--r-- | linden/indra/newview/llviewerpartsim.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/linden/indra/newview/llviewerpartsim.h b/linden/indra/newview/llviewerpartsim.h index dbc0fce..42d3fd7 100644 --- a/linden/indra/newview/llviewerpartsim.h +++ b/linden/indra/newview/llviewerpartsim.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #define LL_LLVIEWERPARTSIM_H | 33 | #define LL_LLVIEWERPARTSIM_H |
34 | 34 | ||
35 | #include "lldarrayptr.h" | 35 | #include "lldarrayptr.h" |
36 | #include "llskiplist.h" | ||
37 | #include "llframetimer.h" | 36 | #include "llframetimer.h" |
38 | #include "llmemory.h" | 37 | #include "llmemory.h" |
39 | 38 | ||
@@ -61,13 +60,12 @@ protected: | |||
61 | public: | 60 | public: |
62 | LLViewerPart(); | 61 | LLViewerPart(); |
63 | 62 | ||
64 | LLViewerPart &operator=(const LLViewerPart &part); | ||
65 | void init(LLPointer<LLViewerPartSource> sourcep, LLViewerImage *imagep, LLVPCallback cb); | 63 | void init(LLPointer<LLViewerPartSource> sourcep, LLViewerImage *imagep, LLVPCallback cb); |
66 | 64 | ||
67 | 65 | ||
68 | U32 mPartID; // Particle ID used primarily for moving between groups | 66 | U32 mPartID; // Particle ID used primarily for moving between groups |
69 | F32 mLastUpdateTime; // Last time the particle was updated | 67 | F32 mLastUpdateTime; // Last time the particle was updated |
70 | 68 | F32 mSkipOffset; // Offset against current group mSkippedTime | |
71 | 69 | ||
72 | LLVPCallback mVPCallback; // Callback function for more complicated behaviors | 70 | LLVPCallback mVPCallback; // Callback function for more complicated behaviors |
73 | LLPointer<LLViewerPartSource> mPartSourcep; // Particle source used for this object | 71 | LLPointer<LLViewerPartSource> mPartSourcep; // Particle source used for this object |
@@ -97,7 +95,7 @@ public: | |||
97 | 95 | ||
98 | BOOL addPart(LLViewerPart* part, const F32 desired_size = -1.f); | 96 | BOOL addPart(LLViewerPart* part, const F32 desired_size = -1.f); |
99 | 97 | ||
100 | void updateParticles(const F32 dt); | 98 | void updateParticles(const F32 lastdt); |
101 | 99 | ||
102 | BOOL posInGroup(const LLVector3 &pos, const F32 desired_size = -1.f); | 100 | BOOL posInGroup(const LLVector3 &pos, const F32 desired_size = -1.f); |
103 | 101 | ||
@@ -117,8 +115,7 @@ public: | |||
117 | BOOL mUniformParticles; | 115 | BOOL mUniformParticles; |
118 | U32 mID; | 116 | U32 mID; |
119 | 117 | ||
120 | protected: | 118 | F32 mSkippedTime; |
121 | void removePart(const S32 part_num); | ||
122 | 119 | ||
123 | protected: | 120 | protected: |
124 | LLVector3 mCenterAgent; | 121 | LLVector3 mCenterAgent; |
@@ -131,7 +128,6 @@ protected: | |||
131 | 128 | ||
132 | class LLViewerPartSim | 129 | class LLViewerPartSim |
133 | { | 130 | { |
134 | |||
135 | public: | 131 | public: |
136 | LLViewerPartSim(); | 132 | LLViewerPartSim(); |
137 | virtual ~LLViewerPartSim(); | 133 | virtual ~LLViewerPartSim(); |
@@ -148,7 +144,22 @@ public: | |||
148 | void cleanupRegion(LLViewerRegion *regionp); | 144 | void cleanupRegion(LLViewerRegion *regionp); |
149 | 145 | ||
150 | BOOL shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping) | 146 | BOOL shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping) |
147 | F32 maxRate() // Return maximum particle generation rate | ||
148 | { | ||
149 | if (sParticleCount >= MAX_PART_COUNT) | ||
150 | { | ||
151 | return 1.f; | ||
152 | } | ||
153 | if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount) | ||
154 | { | ||
155 | return (((F32)sParticleCount/(F32)sMaxParticleCount)-PART_THROTTLE_THRESHOLD)*PART_THROTTLE_RESCALE; | ||
156 | } | ||
157 | return 0.f; | ||
158 | } | ||
159 | F32 getRefRate() { return sParticleAdaptiveRate; } | ||
160 | F32 getBurstRate() {return sParticleBurstRate; } | ||
151 | void addPart(LLViewerPart* part); | 161 | void addPart(LLViewerPart* part); |
162 | void updatePartBurstRate() ; | ||
152 | void clearParticlesByID(const U32 system_id); | 163 | void clearParticlesByID(const U32 system_id); |
153 | void clearParticlesByOwnerID(const LLUUID& task_id); | 164 | void clearParticlesByOwnerID(const LLUUID& task_id); |
154 | void removeLastCreatedSource(); | 165 | void removeLastCreatedSource(); |
@@ -170,12 +181,20 @@ protected: | |||
170 | LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size); | 181 | LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size); |
171 | LLViewerPartGroup *put(LLViewerPart* part); | 182 | LLViewerPartGroup *put(LLViewerPart* part); |
172 | 183 | ||
173 | protected: | ||
174 | group_list_t mViewerPartGroups; | 184 | group_list_t mViewerPartGroups; |
175 | source_list_t mViewerPartSources; | 185 | source_list_t mViewerPartSources; |
176 | LLFrameTimer mSimulationTimer; | 186 | LLFrameTimer mSimulationTimer; |
187 | |||
177 | static S32 sMaxParticleCount; | 188 | static S32 sMaxParticleCount; |
178 | static S32 sParticleCount; | 189 | static S32 sParticleCount; |
190 | static F32 sParticleAdaptiveRate; | ||
191 | static F32 sParticleBurstRate; | ||
192 | |||
193 | static const S32 MAX_PART_COUNT; | ||
194 | static const F32 PART_THROTTLE_THRESHOLD; | ||
195 | static const F32 PART_THROTTLE_RESCALE; | ||
196 | static const F32 PART_ADAPT_RATE_MULT; | ||
197 | static const F32 PART_ADAPT_RATE_MULT_RECIP; | ||
179 | }; | 198 | }; |
180 | 199 | ||
181 | #endif // LL_LLVIEWERPARTSIM_H | 200 | #endif // LL_LLVIEWERPARTSIM_H |