diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/lldrawpoolsimple.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/lldrawpoolsimple.cpp')
-rw-r--r-- | linden/indra/newview/lldrawpoolsimple.cpp | 207 |
1 files changed, 185 insertions, 22 deletions
diff --git a/linden/indra/newview/lldrawpoolsimple.cpp b/linden/indra/newview/lldrawpoolsimple.cpp index a2f8675..1fdf87f 100644 --- a/linden/indra/newview/lldrawpoolsimple.cpp +++ b/linden/indra/newview/lldrawpoolsimple.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -102,18 +103,15 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) | |||
102 | if (LLPipeline::sUnderWaterRender) | 103 | if (LLPipeline::sUnderWaterRender) |
103 | { | 104 | { |
104 | simple_shader = &gObjectSimpleWaterProgram; | 105 | simple_shader = &gObjectSimpleWaterProgram; |
105 | fullbright_shader = &gObjectFullbrightWaterProgram; | ||
106 | } | 106 | } |
107 | else | 107 | else |
108 | { | 108 | { |
109 | simple_shader = &gObjectSimpleProgram; | 109 | simple_shader = &gObjectSimpleProgram; |
110 | fullbright_shader = &gObjectFullbrightProgram; | ||
111 | } | 110 | } |
112 | 111 | ||
113 | if (mVertexShaderLevel > 0) | 112 | if (mVertexShaderLevel > 0) |
114 | { | 113 | { |
115 | simple_shader->bind(); | 114 | simple_shader->bind(); |
116 | simple_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 0.f); | ||
117 | } | 115 | } |
118 | else | 116 | else |
119 | { | 117 | { |
@@ -139,39 +137,204 @@ void LLDrawPoolSimple::endRenderPass(S32 pass) | |||
139 | void LLDrawPoolSimple::render(S32 pass) | 137 | void LLDrawPoolSimple::render(S32 pass) |
140 | { | 138 | { |
141 | LLGLDisable blend(GL_BLEND); | 139 | LLGLDisable blend(GL_BLEND); |
142 | LLGLState alpha_test(GL_ALPHA_TEST, gPipeline.canUseWindLightShadersOnObjects()); | 140 | LLGLDisable alpha_test(GL_ALPHA_TEST); |
143 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | 141 | |
144 | |||
145 | { //render simple | 142 | { //render simple |
146 | LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); | 143 | LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); |
147 | gPipeline.enableLightsDynamic(); | 144 | gPipeline.enableLightsDynamic(); |
148 | renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); | 145 | renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); |
146 | |||
147 | if (LLPipeline::sRenderDeferred) | ||
148 | { | ||
149 | renderTexture(LLRenderPass::PASS_BUMP, getVertexDataMask()); | ||
150 | } | ||
149 | } | 151 | } |
152 | } | ||
153 | |||
154 | //=============================== | ||
155 | //DEFERRED IMPLEMENTATION | ||
156 | //=============================== | ||
157 | |||
158 | void LLDrawPoolSimple::beginDeferredPass(S32 pass) | ||
159 | { | ||
160 | LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); | ||
161 | gDeferredDiffuseProgram.bind(); | ||
162 | } | ||
163 | |||
164 | void LLDrawPoolSimple::endDeferredPass(S32 pass) | ||
165 | { | ||
166 | LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); | ||
167 | LLRenderPass::endRenderPass(pass); | ||
168 | |||
169 | gDeferredDiffuseProgram.unbind(); | ||
170 | } | ||
171 | |||
172 | void LLDrawPoolSimple::renderDeferred(S32 pass) | ||
173 | { | ||
174 | LLGLDisable blend(GL_BLEND); | ||
175 | LLGLDisable alpha_test(GL_ALPHA_TEST); | ||
176 | |||
177 | { //render simple | ||
178 | LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); | ||
179 | renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | // grass drawpool | ||
184 | LLDrawPoolGrass::LLDrawPoolGrass() : | ||
185 | LLRenderPass(POOL_GRASS) | ||
186 | { | ||
187 | |||
188 | } | ||
189 | |||
190 | void LLDrawPoolGrass::prerender() | ||
191 | { | ||
192 | mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); | ||
193 | } | ||
194 | |||
195 | |||
196 | void LLDrawPoolGrass::beginRenderPass(S32 pass) | ||
197 | { | ||
198 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); | ||
199 | |||
200 | if (LLPipeline::sUnderWaterRender) | ||
201 | { | ||
202 | simple_shader = &gObjectSimpleWaterProgram; | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | simple_shader = &gObjectSimpleProgram; | ||
207 | } | ||
208 | |||
209 | if (mVertexShaderLevel > 0) | ||
210 | { | ||
211 | simple_shader->bind(); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | // don't use shaders! | ||
216 | if (gGLManager.mHasShaderObjects) | ||
217 | { | ||
218 | LLGLSLShader::bindNoShader(); | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | |||
223 | void LLDrawPoolGrass::endRenderPass(S32 pass) | ||
224 | { | ||
225 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); | ||
226 | LLRenderPass::endRenderPass(pass); | ||
227 | |||
228 | if (mVertexShaderLevel > 0) | ||
229 | { | ||
230 | simple_shader->unbind(); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | void LLDrawPoolGrass::render(S32 pass) | ||
235 | { | ||
236 | LLGLDisable blend(GL_BLEND); | ||
237 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | ||
150 | 238 | ||
151 | { | 239 | { |
152 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); | 240 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); |
153 | LLGLEnable test(GL_ALPHA_TEST); | 241 | LLGLEnable test(GL_ALPHA_TEST); |
154 | LLGLEnable blend(GL_BLEND); | ||
155 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | 242 | gGL.setSceneBlendType(LLRender::BT_ALPHA); |
156 | //render grass | 243 | //render grass |
157 | LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); | 244 | LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); |
158 | } | 245 | } |
159 | 246 | ||
160 | { //render fullbright | 247 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
161 | if (mVertexShaderLevel > 0) | 248 | } |
162 | { | 249 | |
163 | fullbright_shader->bind(); | 250 | void LLDrawPoolGrass::beginDeferredPass(S32 pass) |
164 | fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); | 251 | { |
165 | } | 252 | |
166 | else | 253 | } |
167 | { | 254 | |
168 | gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); | 255 | void LLDrawPoolGrass::endDeferredPass(S32 pass) |
169 | } | 256 | { |
170 | LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT); | 257 | |
171 | U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR; | 258 | } |
172 | renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); | 259 | |
173 | } | 260 | void LLDrawPoolGrass::renderDeferred(S32 pass) |
261 | { | ||
262 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | ||
263 | |||
264 | { | ||
265 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); | ||
266 | gDeferredTreeProgram.bind(); | ||
267 | LLGLEnable test(GL_ALPHA_TEST); | ||
268 | //render grass | ||
269 | LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); | ||
270 | } | ||
174 | 271 | ||
175 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | 272 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
176 | } | 273 | } |
177 | 274 | ||
275 | |||
276 | // Fullbright drawpool | ||
277 | LLDrawPoolFullbright::LLDrawPoolFullbright() : | ||
278 | LLRenderPass(POOL_FULLBRIGHT) | ||
279 | { | ||
280 | } | ||
281 | |||
282 | void LLDrawPoolFullbright::prerender() | ||
283 | { | ||
284 | mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); | ||
285 | } | ||
286 | |||
287 | void LLDrawPoolFullbright::beginRenderPass(S32 pass) | ||
288 | { | ||
289 | LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT); | ||
290 | |||
291 | if (LLPipeline::sUnderWaterRender) | ||
292 | { | ||
293 | fullbright_shader = &gObjectFullbrightWaterProgram; | ||
294 | } | ||
295 | else | ||
296 | { | ||
297 | fullbright_shader = &gObjectFullbrightProgram; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | void LLDrawPoolFullbright::endRenderPass(S32 pass) | ||
302 | { | ||
303 | LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT); | ||
304 | LLRenderPass::endRenderPass(pass); | ||
305 | |||
306 | if (mVertexShaderLevel > 0) | ||
307 | { | ||
308 | fullbright_shader->unbind(); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | void LLDrawPoolFullbright::render(S32 pass) | ||
313 | { //render fullbright | ||
314 | LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT); | ||
315 | if (mVertexShaderLevel > 0) | ||
316 | { | ||
317 | fullbright_shader->bind(); | ||
318 | fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); | ||
319 | } | ||
320 | else | ||
321 | { | ||
322 | gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); | ||
323 | } | ||
324 | |||
325 | //gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); | ||
326 | |||
327 | //LLGLEnable test(GL_ALPHA_TEST); | ||
328 | //LLGLEnable blend(GL_BLEND); | ||
329 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
330 | U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR; | ||
331 | renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); | ||
332 | |||
333 | //gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | ||
334 | } | ||
335 | |||
336 | S32 LLDrawPoolFullbright::getNumPasses() | ||
337 | { | ||
338 | return 1; | ||
339 | } | ||
340 | |||