aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerpartsim.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llviewerpartsim.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llviewerpartsim.h')
-rw-r--r--linden/indra/newview/llviewerpartsim.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewerpartsim.h b/linden/indra/newview/llviewerpartsim.h
new file mode 100644
index 0000000..7983838
--- /dev/null
+++ b/linden/indra/newview/llviewerpartsim.h
@@ -0,0 +1,160 @@
1/**
2 * @file llviewerpartsim.h
3 * @brief LLViewerPart class header file
4 *
5 * Copyright (c) 2003-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_LLVIEWERPARTSIM_H
29#define LL_LLVIEWERPARTSIM_H
30
31#include "lldarrayptr.h"
32#include "llskiplist.h"
33#include "llframetimer.h"
34#include "llmemory.h"
35
36#include "llpartdata.h"
37
38class LLViewerImage;
39class LLViewerPart;
40class LLViewerPartSource;
41class LLViewerRegion;
42class LLViewerImage;
43class LLVOPartGroup;
44
45typedef void (*LLVPCallback)(LLViewerPart &part, const F32 dt);
46
47///////////////////
48//
49// An individual particle
50//
51
52
53class LLViewerPart : public LLPartData
54{
55public:
56 LLViewerPart();
57 ~LLViewerPart();
58
59 LLViewerPart &operator=(const LLViewerPart &part);
60 void init(LLViewerPartSource *sourcep, LLViewerImage *imagep, LLVPCallback cb);
61
62
63 U32 mPartID; // Particle ID used primarily for moving between groups
64 F32 mLastUpdateTime; // Last time the particle was updated
65
66
67 LLVPCallback mVPCallback; // Callback function for more complicated behaviors
68 LLPointer<LLViewerPartSource> mPartSourcep; // Particle source used for this object
69
70
71 // Current particle state (possibly used for rendering)
72 LLPointer<LLViewerImage> mImagep;
73 LLVector3 mPosAgent;
74 LLVector3 mVelocity;
75 LLVector3 mAccel;
76 LLColor4 mColor;
77 LLVector2 mScale;
78
79 static U32 sNextPartID;
80};
81
82
83
84class LLViewerPartGroup
85{
86public:
87 LLViewerPartGroup(const LLVector3 &center,
88 const F32 box_radius);
89 virtual ~LLViewerPartGroup();
90
91 void cleanup();
92
93 BOOL addPart(LLViewerPart &part);
94
95 void updateParticles(const F32 dt);
96
97 BOOL posInGroup(const LLVector3 &pos);
98
99 void shift(const LLVector3 &offset);
100
101 LLDynamicArray<LLViewerPart> mParticles;
102
103 const LLVector3 &getCenterAgent() const { return mCenterAgent; }
104 S32 getCount() const { return mParticles.count(); }
105 LLViewerRegion *getRegion() const { return mRegionp; }
106protected:
107 void removePart(const S32 part_num);
108
109protected:
110 LLVector3 mCenterAgent;
111 F32 mBoxRadius;
112 LLVector3 mMinObjPos;
113 LLVector3 mMaxObjPos;
114
115 LLPointer<LLVOPartGroup> mVOPartGroupp;
116 LLViewerRegion *mRegionp;
117};
118
119
120class LLViewerPartSim
121{
122public:
123 LLViewerPartSim();
124 virtual ~LLViewerPartSim();
125
126 void shift(const LLVector3 &offset);
127
128 void updateSimulation();
129
130 void addPartSource(LLViewerPartSource *sourcep);
131
132 void cleanupRegion(LLViewerRegion *regionp);
133
134 BOOL shouldAddPart(); // Just decides whether this particle should be added or not (for particle count capping)
135 void addPart(LLViewerPart &part);
136 void cleanMutedParticles(const LLUUID& task_id);
137
138 friend class LLViewerPartGroup;
139
140 BOOL aboveParticleLimit() const { return sParticleCount > sMaxParticleCount; }
141
142 static void setMaxPartCount(const S32 max_parts) { sMaxParticleCount = max_parts; }
143 static S32 getMaxPartCount() { return sMaxParticleCount; }
144 static void incPartCount(const S32 count) { sParticleCount += count; }
145 static void decPartCount(const S32 count) { sParticleCount -= count; }
146
147protected:
148 LLViewerPartGroup *createViewerPartGroup(const LLVector3 &pos_agent);
149 LLViewerPartGroup *put(LLViewerPart &part);
150
151protected:
152 LLDynamicArray<LLViewerPartGroup *> mViewerPartGroups;
153 LLDynamicArrayPtr<LLPointer<LLViewerPartSource> > mViewerPartSources;
154 LLFrameTimer mSimulationTimer;
155
156 static S32 sMaxParticleCount;
157 static S32 sParticleCount;
158};
159
160#endif // LL_LLVIEWERPARTSIM_H