aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lldrawpoolsimple.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/lldrawpoolsimple.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/lldrawpoolsimple.cpp')
-rw-r--r--linden/indra/newview/lldrawpoolsimple.cpp165
1 files changed, 84 insertions, 81 deletions
diff --git a/linden/indra/newview/lldrawpoolsimple.cpp b/linden/indra/newview/lldrawpoolsimple.cpp
index 7e6c3dd..cdb22bf 100644
--- a/linden/indra/newview/lldrawpoolsimple.cpp
+++ b/linden/indra/newview/lldrawpoolsimple.cpp
@@ -32,7 +32,6 @@
32#include "llviewerprecompiledheaders.h" 32#include "llviewerprecompiledheaders.h"
33 33
34#include "lldrawpoolsimple.h" 34#include "lldrawpoolsimple.h"
35#include "lldrawpoolbump.h"
36 35
37#include "llviewercamera.h" 36#include "llviewercamera.h"
38#include "llagent.h" 37#include "llagent.h"
@@ -40,76 +39,46 @@
40#include "llface.h" 39#include "llface.h"
41#include "llsky.h" 40#include "llsky.h"
42#include "pipeline.h" 41#include "pipeline.h"
42#include "llspatialpartition.h"
43#include "llglslshader.h" 43#include "llglslshader.h"
44#include "llglimmediate.h"
44 45
45class LLRenderShinyGlow : public LLDrawPoolBump 46
46{ 47static LLGLSLShader* simple_shader = NULL;
47public: 48static LLGLSLShader* fullbright_shader = NULL;
48 LLRenderShinyGlow() { }
49
50 void render(S32 pass = 0)
51 {
52 LLCubeMap* cube_map = gSky.mVOSkyp->getCubeMap();
53 if( cube_map )
54 {
55 cube_map->enable(0);
56 cube_map->setMatrix(0);
57 cube_map->bind();
58 glEnableClientState(GL_NORMAL_ARRAY);
59
60 glColor4f(1,1,1,1);
61
62 U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL;
63 renderStatic(LLRenderPass::PASS_SHINY, mask);
64 renderActive(LLRenderPass::PASS_SHINY, mask);
65
66 glDisableClientState(GL_NORMAL_ARRAY);
67 cube_map->disable();
68 cube_map->restoreMatrix();
69 }
70 }
71};
72 49
73void LLDrawPoolGlow::render(S32 pass) 50void LLDrawPoolGlow::render(S32 pass)
74{ 51{
52 LLFastTimer t(LLFastTimer::FTM_RENDER_GLOW);
75 LLGLEnable blend(GL_BLEND); 53 LLGLEnable blend(GL_BLEND);
76 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 54 LLGLDisable test(GL_ALPHA_TEST);
77 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); 55 gGL.blendFunc(GL_ONE, GL_ONE);
78 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 56
79 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 57 U32 shader_level = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
80 renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
81 renderActive(LLRenderPass::PASS_GLOW, getVertexDataMask());
82 58
83 if (gSky.mVOSkyp) 59 if (shader_level > 0 && fullbright_shader)
84 { 60 {
85 glPushMatrix(); 61 fullbright_shader->bind();
86 LLVector3 origin = gCamera->getOrigin();
87 glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
88
89 LLFace* facep = gSky.mVOSkyp->mFace[LLVOSky::FACE_BLOOM];
90
91 if (facep)
92 {
93 LLGLDisable cull(GL_CULL_FACE);
94 facep->getTexture()->bind();
95 glColor4f(1,1,1,1);
96 facep->renderIndexed(getVertexDataMask());
97 }
98
99 glPopMatrix();
100 } 62 }
101 63 else
102 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
103
104 if (LLPipeline::sDynamicReflections)
105 { 64 {
106 LLRenderShinyGlow glow; 65 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
107 glow.render();
108 } 66 }
109 67
68 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
69 LLGLDepthTest depth(GL_TRUE, GL_FALSE);
70 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
71 renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
72
73 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
74
110 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); 75 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
111 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 76 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
112 77
78 if (shader_level > 0 && fullbright_shader)
79 {
80 fullbright_shader->unbind();
81 }
113} 82}
114 83
115void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) 84void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
@@ -131,53 +100,87 @@ void LLDrawPoolSimple::prerender()
131 100
132void LLDrawPoolSimple::beginRenderPass(S32 pass) 101void LLDrawPoolSimple::beginRenderPass(S32 pass)
133{ 102{
103 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
134 glEnableClientState(GL_VERTEX_ARRAY); 104 glEnableClientState(GL_VERTEX_ARRAY);
135 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 105 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
136 glEnableClientState(GL_NORMAL_ARRAY); 106 glEnableClientState(GL_NORMAL_ARRAY);
137 glEnableClientState(GL_COLOR_ARRAY); 107 glEnableClientState(GL_COLOR_ARRAY);
108
109 if (LLPipeline::sUnderWaterRender)
110 {
111 simple_shader = &gObjectSimpleWaterProgram;
112 fullbright_shader = &gObjectFullbrightWaterProgram;
113 }
114 else
115 {
116 simple_shader = &gObjectSimpleProgram;
117 fullbright_shader = &gObjectFullbrightProgram;
118 }
119
120 if (mVertexShaderLevel > 0)
121 {
122 simple_shader->bind();
123 simple_shader->uniform1f(LLShaderMgr::FULLBRIGHT, 0.f);
124 }
125 else
126 {
127 // don't use shaders!
128 if (gGLManager.mHasShaderObjects)
129 {
130 glUseProgramObjectARB(0);
131 }
132 }
133}
134
135void LLDrawPoolSimple::endRenderPass(S32 pass)
136{
137 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
138 LLRenderPass::endRenderPass(pass);
139 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
140
141 if (mVertexShaderLevel > 0){
142
143 simple_shader->unbind();
144 }
138} 145}
139 146
140void LLDrawPoolSimple::render(S32 pass) 147void LLDrawPoolSimple::render(S32 pass)
141{ 148{
142 LLGLDisable blend(GL_BLEND); 149 LLGLDisable blend(GL_BLEND);
143 LLGLDisable alpha_test(GL_ALPHA_TEST); 150 LLGLState alpha_test(GL_ALPHA_TEST, gPipeline.canUseWindLightShadersOnObjects());
144 151 glAlphaFunc(GL_GREATER, 0.5f);
145 { 152
153 { //render simple
146 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); 154 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
147 gPipeline.enableLightsDynamic(1.f); 155 gPipeline.enableLightsDynamic();
148 renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask()); 156 renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask());
149 renderActive(LLRenderPass::PASS_SIMPLE, getVertexDataMask());
150 } 157 }
151 158
152 { 159 {
153 LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); 160 LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS);
161 LLGLEnable test(GL_ALPHA_TEST);
154 LLGLEnable blend(GL_BLEND); 162 LLGLEnable blend(GL_BLEND);
155 LLGLEnable alpha_test(GL_ALPHA_TEST); 163 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
156 glAlphaFunc(GL_GREATER, 0.5f);
157 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
158 //render grass 164 //render grass
159 LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); 165 LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
160 glAlphaFunc(GL_GREATER, 0.01f); 166 }
161 } 167
162 168 { //render fullbright
163 { 169 if (mVertexShaderLevel > 0)
170 {
171 fullbright_shader->bind();
172 fullbright_shader->uniform1f(LLShaderMgr::FULLBRIGHT, 1.f);
173 }
174 else
175 {
176 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
177 }
164 LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT); 178 LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT);
165 U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR; 179 U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR;
166 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
167 glDisableClientState(GL_NORMAL_ARRAY); 180 glDisableClientState(GL_NORMAL_ARRAY);
168 renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); 181 renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
169 renderActive(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
170 } 182 }
171 183
172 { 184 glAlphaFunc(GL_GREATER, 0.01f);
173 LLFastTimer t(LLFastTimer::FTM_RENDER_INVISIBLE);
174 U32 invisi_mask = LLVertexBuffer::MAP_VERTEX;
175 glDisableClientState(GL_COLOR_ARRAY);
176 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
177 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
178 renderInvisible(invisi_mask);
179 renderActive(LLRenderPass::PASS_INVISIBLE, invisi_mask);
180 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
181 }
182} 185}
183 186