PageRenderTime 64ms CodeModel.GetById 20ms app.highlight 17ms RepoModel.GetById 23ms app.codeStats 1ms

/indra/newview/lldrawpoolavatar.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 229 lines | 166 code | 38 blank | 25 comment | 0 complexity | e84ce82922f4d265eadb8f0deed18507 MD5 | raw file
  1 /** 
  2 * @file lldrawpoolavatar.h
  3 * @brief LLDrawPoolAvatar class definition
  4 *
  5 * $LicenseInfo:firstyear=2002&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_LLDRAWPOOLAVATAR_H
 28#define LL_LLDRAWPOOLAVATAR_H
 29
 30#include "lldrawpool.h"
 31
 32class LLVOAvatar;
 33class LLGLSLShader;
 34class LLFace;
 35class LLMeshSkinInfo;
 36class LLVolume;
 37class LLVolumeFace;
 38
 39
 40class LLDrawPoolAvatar : public LLFacePool
 41{
 42public:
 43	enum
 44	{
 45		SHADER_LEVEL_BUMP = 2,
 46		SHADER_LEVEL_CLOTH = 3
 47	};
 48	
 49	enum
 50	{
 51		VERTEX_DATA_MASK =	LLVertexBuffer::MAP_VERTEX |
 52							LLVertexBuffer::MAP_NORMAL |
 53							LLVertexBuffer::MAP_TEXCOORD0 |
 54							LLVertexBuffer::MAP_WEIGHT |
 55							LLVertexBuffer::MAP_CLOTHWEIGHT
 56	};
 57
 58	virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
 59
 60	virtual S32 getVertexShaderLevel() const;
 61
 62	LLDrawPoolAvatar();
 63
 64	static LLMatrix4& getModelView();
 65
 66	/*virtual*/ LLDrawPool *instancePool();
 67
 68	/*virtual*/ S32  getNumPasses();
 69	/*virtual*/ void beginRenderPass(S32 pass);
 70	/*virtual*/ void endRenderPass(S32 pass);
 71	/*virtual*/ void prerender();
 72	/*virtual*/ void render(S32 pass = 0);
 73
 74	/*virtual*/ S32 getNumDeferredPasses();
 75	/*virtual*/ void beginDeferredPass(S32 pass);
 76	/*virtual*/ void endDeferredPass(S32 pass);
 77	/*virtual*/ void renderDeferred(S32 pass);
 78
 79	/*virtual*/ S32 getNumPostDeferredPasses();
 80	/*virtual*/ void beginPostDeferredPass(S32 pass);
 81	/*virtual*/ void endPostDeferredPass(S32 pass);
 82	/*virtual*/ void renderPostDeferred(S32 pass);
 83
 84	/*virtual*/ S32 getNumShadowPasses();
 85	/*virtual*/ void beginShadowPass(S32 pass);
 86	/*virtual*/ void endShadowPass(S32 pass);
 87	/*virtual*/ void renderShadow(S32 pass);
 88
 89	void beginRigid();
 90	void beginImpostor();
 91	void beginSkinned();
 92	
 93	void endRigid();
 94	void endImpostor();
 95	void endSkinned();
 96
 97	void beginDeferredImpostor();
 98	void beginDeferredRigid();
 99	void beginDeferredSkinned();
100	
101	void endDeferredImpostor();
102	void endDeferredRigid();
103	void endDeferredSkinned();
104	
105	void beginPostDeferredAlpha();
106	void endPostDeferredAlpha();
107
108	void beginRiggedSimple();
109	void beginRiggedFullbright();
110	void beginRiggedFullbrightShiny();
111	void beginRiggedShinySimple();
112	void beginRiggedAlpha();
113	void beginRiggedFullbrightAlpha();
114	void beginRiggedGlow();
115	void beginDeferredRiggedAlpha();
116
117	void endRiggedSimple();
118	void endRiggedFullbright();
119	void endRiggedFullbrightShiny();
120	void endRiggedShinySimple();
121	void endRiggedAlpha();
122	void endRiggedFullbrightAlpha();
123	void endRiggedGlow();
124	void endDeferredRiggedAlpha();
125
126	void beginDeferredRiggedSimple();
127	void beginDeferredRiggedBump();
128	
129	void endDeferredRiggedSimple();
130	void endDeferredRiggedBump();
131		
132	void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar,
133									  LLFace* facep, 
134									  const LLMeshSkinInfo* skin, 
135									  LLVolume* volume,
136									  const LLVolumeFace& vol_face);
137	void updateRiggedVertexBuffers(LLVOAvatar* avatar);
138
139	void renderRigged(LLVOAvatar* avatar, U32 type, bool glow = false);
140	void renderRiggedSimple(LLVOAvatar* avatar);
141	void renderRiggedAlpha(LLVOAvatar* avatar);
142	void renderRiggedFullbrightAlpha(LLVOAvatar* avatar);
143	void renderRiggedFullbright(LLVOAvatar* avatar);
144	void renderRiggedShinySimple(LLVOAvatar* avatar);
145	void renderRiggedFullbrightShiny(LLVOAvatar* avatar);
146	void renderRiggedGlow(LLVOAvatar* avatar);
147	void renderDeferredRiggedSimple(LLVOAvatar* avatar);
148	void renderDeferredRiggedBump(LLVOAvatar* avatar);
149
150	typedef enum
151	{
152		RIGGED_SIMPLE = 0,
153		RIGGED_FULLBRIGHT,
154		RIGGED_SHINY,
155		RIGGED_FULLBRIGHT_SHINY,
156		RIGGED_GLOW,
157		RIGGED_ALPHA,
158		RIGGED_FULLBRIGHT_ALPHA,
159		RIGGED_DEFERRED_BUMP,
160		RIGGED_DEFERRED_SIMPLE,
161		NUM_RIGGED_PASSES,
162		RIGGED_UNKNOWN,
163	} eRiggedPass;
164
165	typedef enum
166	{
167		RIGGED_SIMPLE_MASK = LLVertexBuffer::MAP_VERTEX | 
168							 LLVertexBuffer::MAP_NORMAL | 
169							 LLVertexBuffer::MAP_TEXCOORD0 |
170							 LLVertexBuffer::MAP_COLOR |
171							 LLVertexBuffer::MAP_WEIGHT4,
172		RIGGED_FULLBRIGHT_MASK = LLVertexBuffer::MAP_VERTEX | 
173							 LLVertexBuffer::MAP_TEXCOORD0 |
174							 LLVertexBuffer::MAP_COLOR |
175							 LLVertexBuffer::MAP_WEIGHT4,
176		RIGGED_SHINY_MASK = RIGGED_SIMPLE_MASK,
177		RIGGED_FULLBRIGHT_SHINY_MASK = RIGGED_SIMPLE_MASK,							 
178		RIGGED_GLOW_MASK = LLVertexBuffer::MAP_VERTEX | 
179							 LLVertexBuffer::MAP_TEXCOORD0 |
180							 LLVertexBuffer::MAP_EMISSIVE |
181							 LLVertexBuffer::MAP_WEIGHT4,
182		RIGGED_ALPHA_MASK = RIGGED_SIMPLE_MASK,
183		RIGGED_FULLBRIGHT_ALPHA_MASK = RIGGED_FULLBRIGHT_MASK,
184		RIGGED_DEFERRED_BUMP_MASK = LLVertexBuffer::MAP_VERTEX | 
185							 LLVertexBuffer::MAP_NORMAL | 
186							 LLVertexBuffer::MAP_TEXCOORD0 |
187							 LLVertexBuffer::MAP_BINORMAL |
188							 LLVertexBuffer::MAP_COLOR |
189							 LLVertexBuffer::MAP_WEIGHT4,
190		RIGGED_DEFERRED_SIMPLE_MASK = LLVertexBuffer::MAP_VERTEX | 
191							 LLVertexBuffer::MAP_NORMAL | 
192							 LLVertexBuffer::MAP_TEXCOORD0 |
193							 LLVertexBuffer::MAP_COLOR |
194							 LLVertexBuffer::MAP_WEIGHT4,
195	} eRiggedDataMask;
196
197	void addRiggedFace(LLFace* facep, U32 type);
198	void removeRiggedFace(LLFace* facep); 
199
200	std::vector<LLFace*> mRiggedFace[NUM_RIGGED_PASSES];
201
202	/*virtual*/ LLViewerTexture *getDebugTexture();
203	/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
204
205	void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null.
206
207
208	static BOOL sSkipOpaque;
209	static BOOL sSkipTransparent;
210	static S32 sDiffuseChannel;
211
212	static LLGLSLShader* sVertexProgram;
213};
214
215class LLVertexBufferAvatar : public LLVertexBuffer
216{
217public:
218	LLVertexBufferAvatar();
219};
220
221extern S32 AVATAR_OFFSET_POS;
222extern S32 AVATAR_OFFSET_NORMAL;
223extern S32 AVATAR_OFFSET_TEX0;
224extern S32 AVATAR_OFFSET_TEX1;
225extern S32 AVATAR_VERTEX_BYTES;
226const S32 AVATAR_BUFFER_ELEMENTS = 8192; // Needs to be enough to store all avatar vertices.
227
228extern BOOL gAvatarEmbossBumpMap;
229#endif // LL_LLDRAWPOOLAVATAR_H