PageRenderTime 305ms CodeModel.GetById 160ms app.highlight 14ms RepoModel.GetById 128ms app.codeStats 0ms

/indra/newview/llviewerpartsource.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 209 lines | 113 code | 45 blank | 51 comment | 0 complexity | dace185e46f554f38a7a72b5b130650f MD5 | raw file
  1/** 
  2 * @file llviewerpartsource.h
  3 * @brief LLViewerPartSource class header file
  4 *
  5 * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLVIEWERPARTSOURCE_H
 28#define LL_LLVIEWERPARTSOURCE_H
 29
 30#include "llrefcount.h"
 31#include "llpartdata.h"
 32#include "llpointer.h"
 33#include "llquaternion.h"
 34#include "v3math.h"
 35
 36////////////////////
 37//
 38// A particle source - subclassed to generate particles with different behaviors
 39//
 40//
 41
 42class LLViewerTexture;
 43class LLViewerObject;
 44class LLViewerPart;
 45
 46class LLViewerPartSource : public LLRefCount
 47{
 48public:
 49	enum
 50	{
 51		LL_PART_SOURCE_NULL,
 52		LL_PART_SOURCE_SCRIPT,
 53		LL_PART_SOURCE_SPIRAL,
 54		LL_PART_SOURCE_BEAM,
 55		LL_PART_SOURCE_CHAT
 56	};
 57
 58	LLViewerPartSource(const U32 type);
 59
 60	virtual void update(const F32 dt); // Return FALSE if this source is dead...
 61
 62	virtual void setDead();
 63	BOOL isDead() const				{ return mIsDead; }
 64	void setSuspended( BOOL state )	{ mIsSuspended = state; }
 65	BOOL isSuspended() const		{ return mIsSuspended; }
 66	U32 getType() const				{ return mType; }
 67	static void updatePart(LLViewerPart &part, const F32 dt);
 68	void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; }
 69	LLUUID getOwnerUUID() const { return mOwnerUUID; }
 70	U32	getID() const { return mID; }
 71	LLUUID getImageUUID() const;
 72	void  setStart() ;
 73
 74	LLVector3	mPosAgent; // Location of the particle source
 75	LLVector3	mTargetPosAgent; // Location of the target position
 76	LLVector3	mLastUpdatePosAgent;
 77	LLPointer<LLViewerObject>	mSourceObjectp;
 78	U32 mID;
 79
 80protected:
 81	U32			mType;
 82	BOOL		mIsDead;
 83	BOOL		mIsSuspended;
 84	F32			mLastUpdateTime;
 85	F32			mLastPartTime;
 86	LLUUID		mOwnerUUID;
 87	LLPointer<LLViewerTexture>	mImagep;
 88
 89	// Particle information
 90	U32			mPartFlags; // Flags for the particle
 91	U32         mDelay ; //delay to start particles
 92};
 93
 94
 95
 96///////////////////////////////
 97//
 98// LLViewerPartSourceScript
 99//
100// Particle source that handles the "generic" script-drive particle source
101// attached to objects
102//
103
104
105class LLViewerPartSourceScript : public LLViewerPartSource
106{
107public:
108	LLViewerPartSourceScript(LLViewerObject *source_objp);
109	/*virtual*/ void update(const F32 dt);
110
111	/*virtual*/ void setDead();
112
113	BOOL updateFromMesg();
114
115	// Returns a new particle source to attach to an object...
116	static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num);
117	static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp);
118	static LLPointer<LLViewerPartSourceScript> createPSS(LLViewerObject *source_objp, const LLPartSysData& particle_parameters);
119
120	LLViewerTexture *getImage() const				{ return mImagep; }
121	void setImage(LLViewerTexture *imagep);
122	LLPartSysData				mPartSysData;
123
124	void setTargetObject(LLViewerObject *objp);
125
126protected:
127	LLQuaternion				mRotation;			// Current rotation for particle source
128	LLPointer<LLViewerObject>	mTargetObjectp;		// Target object for the particle source
129};
130
131
132////////////////////////////
133//
134// Particle source for spiral effect (customize avatar, mostly)
135//
136
137class LLViewerPartSourceSpiral : public LLViewerPartSource
138{
139public:
140	LLViewerPartSourceSpiral(const LLVector3 &pos);
141
142	/*virtual*/ void setDead();
143
144	/*virtual*/ void update(const F32 dt);
145
146	void setSourceObject(LLViewerObject *objp);
147	void setColor(const LLColor4 &color);
148
149	static void updatePart(LLViewerPart &part, const F32 dt);
150	LLColor4 mColor;
151protected:
152	LLVector3d mLKGSourcePosGlobal;
153};
154
155
156////////////////////////////
157//
158// Particle source for tractor(editing) beam
159//
160
161class LLViewerPartSourceBeam : public LLViewerPartSource
162{
163public:
164	LLViewerPartSourceBeam();
165
166	/*virtual*/ void setDead();
167
168	/*virtual*/ void update(const F32 dt);
169
170	void setSourceObject(LLViewerObject *objp);
171	void setTargetObject(LLViewerObject *objp);
172	void setSourcePosGlobal(const LLVector3d &pos_global);
173	void setTargetPosGlobal(const LLVector3d &pos_global);
174	void setColor(const LLColor4 &color);
175
176	static void updatePart(LLViewerPart &part, const F32 dt);
177	LLPointer<LLViewerObject>	mTargetObjectp;
178	LLVector3d		mLKGTargetPosGlobal;
179	LLColor4 mColor;
180protected:
181	~LLViewerPartSourceBeam();
182};
183
184
185
186//////////////////////////
187//
188// Particle source for chat effect
189//
190
191class LLViewerPartSourceChat : public LLViewerPartSource
192{
193public:
194	LLViewerPartSourceChat(const LLVector3 &pos);
195
196	/*virtual*/ void setDead();
197
198	/*virtual*/ void update(const F32 dt);
199
200	void setSourceObject(LLViewerObject *objp);
201	void setColor(const LLColor4 &color);
202	static void updatePart(LLViewerPart &part, const F32 dt);
203	LLColor4 mColor;
204protected:
205	LLVector3d mLKGSourcePosGlobal;
206};
207
208
209#endif // LL_LLVIEWERPARTSOURCE_H