diff options
Diffstat (limited to 'linden/indra/newview/llvopart.h')
-rw-r--r-- | linden/indra/newview/llvopart.h | 281 |
1 files changed, 0 insertions, 281 deletions
diff --git a/linden/indra/newview/llvopart.h b/linden/indra/newview/llvopart.h deleted file mode 100644 index 3f31de6..0000000 --- a/linden/indra/newview/llvopart.h +++ /dev/null | |||
@@ -1,281 +0,0 @@ | |||
1 | /** | ||
2 | * @file llvopart.h | ||
3 | * @brief Description of LLVOPart class | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLVOPART_H | ||
29 | #define LL_LLVOPART_H | ||
30 | |||
31 | #include "llviewerobject.h" | ||
32 | #include "v3math.h" | ||
33 | #include "llframetimer.h" | ||
34 | #include "partsyspacket.h" // for compressing / decompressing particle system data | ||
35 | |||
36 | //28 September 2001 - try and make the internal structs more meaningful than a huge array of floats! | ||
37 | typedef struct OneParticleData | ||
38 | { | ||
39 | F32 position[3]; | ||
40 | F32 velocity[3]; | ||
41 | F32 acceleration[3]; | ||
42 | F32 scale[3]; | ||
43 | F32 alpha[3]; | ||
44 | F32 remainingLifetime; | ||
45 | F32 deathOffset; | ||
46 | F32 localWind[3]; | ||
47 | }OneParticleData; | ||
48 | |||
49 | |||
50 | |||
51 | |||
52 | |||
53 | /* viewer object for a particle system */ | ||
54 | const U32 PART_SYS_BYTES_OF_FLAGS = 8; | ||
55 | |||
56 | class LLVOPart : public LLViewerObject | ||
57 | { | ||
58 | public: | ||
59 | LLVOPart(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); | ||
60 | |||
61 | ~LLVOPart(); | ||
62 | |||
63 | // Initialize data that's only inited once per class. | ||
64 | static void initClass(); | ||
65 | |||
66 | /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. | ||
67 | BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | ||
68 | |||
69 | |||
70 | /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys, | ||
71 | void **user_data, | ||
72 | U32 block_num, | ||
73 | const EObjectUpdateType update_type, | ||
74 | LLDataPacker *dp); | ||
75 | |||
76 | /*virtual*/ void updateTextures(LLAgent &agent); | ||
77 | |||
78 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | ||
79 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | ||
80 | |||
81 | protected: | ||
82 | void setParticleCountdownStateWaitingDead(U32 particleNumber); | ||
83 | |||
84 | //Override these methods for new particle classes | ||
85 | void spawnParticle(const U32 particleNumber); | ||
86 | void onParticleBounce(const U32 particleNumber); | ||
87 | |||
88 | void setDefaultValues(); | ||
89 | |||
90 | U8 setParticleParams(F32 bounce_b, | ||
91 | const F32 o_pos[3], const F32 o_or[3], U32 n, LLUUID image_uuid, U8 flags[PART_SYS_BYTES_OF_FLAGS]); | ||
92 | |||
93 | U8 initializeParticlesAndConstraints(U32 initialNumberOfParticles, | ||
94 | F32 diffEqAlpha[3], | ||
95 | F32 diffEqScale[3], | ||
96 | F32 scale_ranges[4], | ||
97 | F32 alpha_ranges[4], | ||
98 | F32 velocityOffset[3], | ||
99 | F32 killPlaneZ, | ||
100 | F32 killPlaneNormal[3], | ||
101 | F32 bouncePlaneZ, | ||
102 | F32 bouncePlaneNormal[3], | ||
103 | F32 spawnRange, | ||
104 | F32 spawnFrequency, | ||
105 | F32 spawnFreqencyRange, | ||
106 | F32 spawnDirection[3], | ||
107 | F32 spawnDirectionRange, | ||
108 | F32 spawnVelocity, | ||
109 | F32 spawnVelocityRange, | ||
110 | F32 speedLimit, | ||
111 | F32 windWeight, | ||
112 | F32 currentGravity[3], | ||
113 | F32 gravityWeight, | ||
114 | F32 globalLifetime, | ||
115 | F32 individualLifetime, | ||
116 | F32 individualLifetimeRange, | ||
117 | F32 alphaDecay, | ||
118 | F32 scaleDecay, | ||
119 | F32 distanceDeath, | ||
120 | F32 dampMotionFactor, | ||
121 | F32 windDiffusionFactor[3]); | ||
122 | // initializes particles randomly within these ranges | ||
123 | // scale ranges and alpha ranges contain initial conditions plus rates of change | ||
124 | // of initial conditions My naming is inconsistent (passing alpha derivatives with alpha | ||
125 | // values), but this class is wrapped by another one, and this function is called only once | ||
126 | |||
127 | U8 iterateParticles(F32 deltaT); // step by one deltaT, check for bounces and particle deaths | ||
128 | |||
129 | void reverseTranslateParticlesAndPotentiallyKill(const LLVector3 &moveBy); | ||
130 | |||
131 | void translateParticlesBy(const LLVector3 &moveBy); | ||
132 | void translateParticlesTo(const LLVector3 &moveTo); | ||
133 | void rotateParticlesBy(const LLQuaternion &q); | ||
134 | void rotateParticlesTo(const LLQuaternion &q); | ||
135 | |||
136 | /////////////////////// | ||
137 | // | ||
138 | // Legacy, "dead" methods | ||
139 | U8 setParticlesDistFadeout(F32 beginFadeout, F32 endFadeout); | ||
140 | |||
141 | protected: | ||
142 | LLFrameTimer mDeathTimer; | ||
143 | U32 mNumPart; // number of particles | ||
144 | U32 mNumLiveParticles; | ||
145 | BOOL mParticlesDead; // am I dead yet? (i.e. should I keep rendering?) | ||
146 | LLPartInitData mInitSysData; // data for initializing the particle system. | ||
147 | |||
148 | U64 mTimeLastFrame; | ||
149 | |||
150 | //27 September 2001 - LLParticleSystem no longer a seperate class, as does not allow access to all object facilities | ||
151 | //the following private data and methods used to be in LLParticleSystem | ||
152 | |||
153 | F32 mCurrTime; // time value in simulator for particle system -- note: may be independent of simulator time | ||
154 | F32 mLastTime; // time last frame | ||
155 | |||
156 | //26 September - these are replaced by alpha and scale parameters below | ||
157 | //F32 mDiffEq[18]; // constants for second-order differential equation describing particle motion | ||
158 | // MDS -- july, doubled the number of constants to handle scale, alpha and rotation | ||
159 | //26 September - just use mKillPlaneZ, as the rest really confusing to set sometimes | ||
160 | //F32 mKillParameters[6]; // take a dot-product of a particle's <x,y,z,t, 1, mag^2> values | ||
161 | // with this and compare to zero to determine if its killed | ||
162 | // computational trick, only call it a "kill" when the dot product of | ||
163 | // the velocity with the first three values of this is below zero | ||
164 | |||
165 | //26 September - use mBouncePlaneZ as the parameters are interesting but hard to manipulate predictably | ||
166 | //F32 mBounceParams[5]; // same as "mKillParameters" only they determine when an object bounces | ||
167 | // this is actually for generalized bouncing, might indicate decayed bouncing, or sliding behavior | ||
168 | |||
169 | F32 mBounceBehavior; // first three are multiplied pointwise with x,y and z velocities, | ||
170 | // next three are added pointwise to x, y and z positions | ||
171 | |||
172 | F32 mAlpha; // so I can fade out the whole system | ||
173 | |||
174 | LLQuaternion mOriginOrientation; // quaternion for origin orientation | ||
175 | |||
176 | // geometry / image data for particles visual representation | ||
177 | |||
178 | //F32 *state_arr; // big array of velocity and position and acceleration | ||
179 | OneParticleData *mParticleState; // big array of velocity and position and acceleration | ||
180 | U8 *mDeadArr; // mDeadArr[i] == true if particle i is dead | ||
181 | |||
182 | U8 mFlags[PART_SYS_BYTES_OF_FLAGS]; // just copy the flags from the initialization data | ||
183 | |||
184 | |||
185 | //New structures added as of 26 September 2001 | ||
186 | |||
187 | //Have to remember the states if are to spawn new particles. | ||
188 | //These are from the original implementation, but now remembered! | ||
189 | F32 mDiffEqAlpha[3]; | ||
190 | F32 mDiffEqScale[3]; | ||
191 | F32 mScale_range[4]; | ||
192 | F32 mAlpha_range[4]; | ||
193 | LLVector3 mVelocityOffset; | ||
194 | |||
195 | |||
196 | //Incorporated in mFlags[PART_SYS_ACTION_BYTE] | ||
197 | //What actions will this system perform - bit mask of flags so can perform multiple operations. | ||
198 | //PART_SYS_SPAWN, | ||
199 | //PART_SYS_BOUNCE, | ||
200 | //PART_SYS_AFFECTED_BY_WIND, | ||
201 | //PART_SYS_AFFECTED_BY_GRAVITY, | ||
202 | //PART_SYS_EVALUATE_WIND_PER_PARTICLE, | ||
203 | //PART_SYS_APPLY_FORCE | ||
204 | //PART_SYS_DAMP_MOTION | ||
205 | //are valid flags. | ||
206 | |||
207 | //Incorporated in mFlags[PART_SYS_KILL_BYTE] | ||
208 | //What actions will this system perform - bit mask of flags so can perform multiple operations. | ||
209 | //PART_SYS_KILL_PLANE, | ||
210 | //PART_SYS_GLOBAL_DIE, | ||
211 | //PART_SYS_DISTANCE_DEATH | ||
212 | //are valid flags. | ||
213 | |||
214 | F32 mKillPlaneZ; | ||
215 | //For simplicity assume the XY plane, so this sets an altitude at which to die | ||
216 | LLVector3 mKillPlaneNormal; | ||
217 | //Normal direction to the kill plane - UNIT vector | ||
218 | F32 mBouncePlaneZ; | ||
219 | //For simplicity assume the XY plane, so this sets an altitude at which to bounce | ||
220 | LLVector3 mBouncePlaneNormal; | ||
221 | //Normal direction to the bounce plane - UNIT vector | ||
222 | LLVector3 mSpawnPoint; | ||
223 | //If new particles are created, this is where they come from | ||
224 | F32 mSpawnRange; | ||
225 | //Range of emission points about the mSpawnPoint | ||
226 | F32 mSpawnFrequency; | ||
227 | //Required if the system is to spawn new particles. | ||
228 | //This variable determines the time after a particle dies when it is respawned. | ||
229 | F32 mSpawnFrequencyRange; | ||
230 | //Determines the random range of time until a new particle is spawned. | ||
231 | LLVector3 mSpawnDirection; | ||
232 | //Direction vector giving the mean direction in which particles are spawned | ||
233 | F32 mSpawnDirectionRange; | ||
234 | //Direction limiting the angular range of emissions about the mean direction. 1.0f means everywhere, 0.0f means uni-directional | ||
235 | F32 mSpawnVelocity; | ||
236 | //The mean speed at which particles are emitted | ||
237 | F32 mSpawnVelocityRange; | ||
238 | //The range of speeds about the mean at which particles are emitted. | ||
239 | F32 mSpeedLimitSquared; | ||
240 | //Used to constrain particle maximum velocity (squared to minimize calcs) | ||
241 | LLVector3 mCurrentWind; | ||
242 | //Wind direction used in update calculations | ||
243 | F32 mCurrentWindMagnitude, mCurrentWindMagnitudeSquareRoot; | ||
244 | //Velocity of current wind and square root of it to save calculations | ||
245 | F32 mWindWeight; | ||
246 | //How much of an effect does wind have | ||
247 | LLVector3 mCurrentGravity; | ||
248 | //Gravity direction used in update calculations | ||
249 | F32 mGravityWeight; | ||
250 | //How much of an effect does gravity have | ||
251 | F32 mGlobalLifetime, mOriginalGlobalLifetime; | ||
252 | //If particles re-spawn, a system can exist forever. | ||
253 | //If (ActionFlags & PART_SYS_GLOBAL_DIE) is TRUE this variable is used to determine how long the system lasts. | ||
254 | F32 mIndividualLifetime; | ||
255 | //How long does each particle last if nothing else happens to it | ||
256 | F32 mOneOverIndividualLifetime; | ||
257 | //For fast reciprocals | ||
258 | F32 mIndividualLifetimeRange; | ||
259 | //Range of variation in individual lifetimes | ||
260 | F32 mAlphaDecay; | ||
261 | //By what factor does alpha decrease as the lifetime of a particle is approached. | ||
262 | F32 mScaleDecay; | ||
263 | //By what factor does scale decrease as the lifetime of a particle is approached. | ||
264 | F32 mDistanceDeathSquared; | ||
265 | //With the increased functionality, particle systems can expand to indefinite size | ||
266 | //(e.g. wind can chaotically move particles into a wide spread). | ||
267 | //To avoid particles exceeding normal object size constraints, | ||
268 | //set the PART_SYS_DISTANCE_DEATH flag, and set a distance value here, representing a radius around the spawn point. | ||
269 | //Square to reduce computation. | ||
270 | F32 mOneOverDistanceDeathSquared; | ||
271 | //For fast reciprocals | ||
272 | F32 mDampMotionFactor; | ||
273 | //How much to damp motion | ||
274 | LLVector3 mWindDiffusionFactor; | ||
275 | //How does wind affect the apearance of sprites | ||
276 | |||
277 | F32 mUpdatePhysicsInputsTime; | ||
278 | //Internal value to determine whether the time is right to update physical environmental effects | ||
279 | }; | ||
280 | |||
281 | #endif // LL_VO_PART_H | ||