summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llgl.cpp79
-rw-r--r--indra/llrender/llgl.h12
-rw-r--r--indra/llrender/llglslshader.cpp6
-rw-r--r--indra/llrender/llrender.cpp99
-rw-r--r--indra/llrender/llrender.h6
-rw-r--r--indra/llrender/llrendersphere.cpp97
-rw-r--r--indra/llrender/llrendersphere.h5
-rw-r--r--indra/llrender/llvertexbuffer.cpp414
-rw-r--r--indra/llrender/llvertexbuffer.h13
-rw-r--r--indra/newview/app_settings/logcontrol.xml2
-rw-r--r--indra/newview/app_settings/settings.xml2
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl63
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/giV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/uiV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinyV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/treeV.glsl35
-rw-r--r--indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl121
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/blurV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/environment/terrainV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/shinyV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl1
-rwxr-xr-xindra/newview/llagent.cpp4
-rw-r--r--indra/newview/llcylinder.cpp260
-rw-r--r--indra/newview/llcylinder.h33
-rw-r--r--indra/newview/lldrawpool.cpp4
-rw-r--r--indra/newview/lldrawpoolalpha.cpp26
-rw-r--r--indra/newview/lldrawpoolalpha.h1
-rw-r--r--indra/newview/lldrawpoolavatar.cpp167
-rw-r--r--indra/newview/lldrawpoolavatar.h2
-rw-r--r--indra/newview/lldrawpoolbump.cpp2
-rw-r--r--indra/newview/lldrawpoolsimple.cpp43
-rw-r--r--indra/newview/lldrawpoolsimple.h5
-rw-r--r--indra/newview/lldrawpoolsky.cpp6
-rw-r--r--indra/newview/lldrawpoolterrain.cpp4
-rw-r--r--indra/newview/lldrawpooltree.cpp12
-rw-r--r--indra/newview/lldrawpoolwater.cpp6
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp4
-rw-r--r--indra/newview/lldynamictexture.cpp4
-rw-r--r--indra/newview/llface.cpp48
-rw-r--r--indra/newview/llface.h6
-rw-r--r--indra/newview/llfloaterimagepreview.cpp4
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp34
-rw-r--r--indra/newview/llhudeffectbeam.cpp4
-rw-r--r--indra/newview/llmanip.cpp4
-rw-r--r--indra/newview/llmaniptranslate.cpp7
-rw-r--r--indra/newview/llpreviewtexture.cpp2
-rw-r--r--indra/newview/llselectmgr.cpp55
-rw-r--r--indra/newview/llspatialpartition.cpp76
-rw-r--r--indra/newview/llspatialpartition.h1
-rw-r--r--indra/newview/lltexlayer.cpp3
-rw-r--r--indra/newview/lltextureview.cpp4
-rw-r--r--indra/newview/lltracker.cpp8
-rw-r--r--indra/newview/llviewerjointmesh.cpp32
-rw-r--r--indra/newview/llviewershadermgr.cpp408
-rw-r--r--indra/newview/llviewershadermgr.h44
-rw-r--r--indra/newview/llviewerwindow.cpp28
-rw-r--r--indra/newview/llvosurfacepatch.cpp20
-rwxr-xr-xindra/newview/llvovolume.cpp24
-rw-r--r--indra/newview/llwlparamset.cpp8
-rw-r--r--indra/newview/pipeline.cpp170
-rw-r--r--indra/newview/pipeline.h4
162 files changed, 2603 insertions, 1491 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 4e3cfb9c8a..87a6b9b885 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1329,8 +1329,6 @@ void LLGLState::initClass()
sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
glDisable(GL_MULTISAMPLE_ARB);
-
- glEnableClientState(GL_VERTEX_ARRAY);
}
//static
@@ -1604,7 +1602,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
{
- if (!gDebugGL)
+ if (!gDebugGL || LLGLSLShader::sNoFixedFunction)
{
return;
}
@@ -1661,7 +1659,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
};
- for (S32 j = 0; j < 4; j++)
+ for (S32 j = 1; j < 4; j++)
{
if (glIsEnabled(value[j]))
{
@@ -1875,79 +1873,6 @@ void LLGLManager::initGLStates()
////////////////////////////////////////////////////////////////////////////////
-void enable_vertex_weighting(const S32 index)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glEnableVertexAttribArrayARB(index); // vertex weights
-#endif
-}
-
-void disable_vertex_weighting(const S32 index)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glDisableVertexAttribArrayARB(index); // vertex weights
-#endif
-}
-
-void enable_binormals(const S32 index)
-{
-#if GL_ARB_vertex_program
- if (index > 0)
- {
- glEnableVertexAttribArrayARB(index); // binormals
- }
-#endif
-}
-
-void disable_binormals(const S32 index)
-{
-#if GL_ARB_vertex_program
- if (index > 0)
- {
- glDisableVertexAttribArrayARB(index); // binormals
- }
-#endif
-}
-
-
-void enable_cloth_weights(const S32 index)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glEnableVertexAttribArrayARB(index);
-#endif
-}
-
-void disable_cloth_weights(const S32 index)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glDisableVertexAttribArrayARB(index);
-#endif
-}
-
-void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, stride, weights);
- stop_glerror();
-#endif
-}
-
-void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glVertexAttribPointerARB(index, 4, GL_FLOAT, TRUE, stride, weights);
- stop_glerror();
-#endif
-}
-
-void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals)
-{
-#if GL_ARB_vertex_program
- if (index > 0) glVertexAttribPointerARB(index, 3, GL_FLOAT, FALSE, stride, binormals);
- stop_glerror();
-#endif
-}
-
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific )
{
// GL_VERSION returns a null-terminated string with the format:
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index d736133f3f..495e523c31 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -252,7 +252,7 @@ public:
static void dumpStates();
static void checkStates(const std::string& msg = "");
static void checkTextureChannels(const std::string& msg = "");
- static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001);
+ static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0);
protected:
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
@@ -419,15 +419,7 @@ extern LLMatrix4 gGLObliqueProjectionInverse;
#include "llglstates.h"
void init_glstates();
-void enable_vertex_weighting(const S32 index);
-void disable_vertex_weighting(const S32 index);
-void enable_binormals(const S32 index);
-void disable_binormals(const S32 index);
-void enable_cloth_weights(const S32 index);
-void disable_cloth_weights(const S32 index);
-void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights);
-void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights);
-void set_binormals(const S32 index, const U32 stride, const LLVector3 *binormals);
+
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific );
extern BOOL gClothRipple;
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index f51d83abe4..02bcc9e338 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -31,6 +31,7 @@
#include "llshadermgr.h"
#include "llfile.h"
#include "llrender.h"
+#include "llvertexbuffer.h"
#if LL_DARWIN
#include "OpenGL/OpenGL.h"
@@ -386,6 +387,7 @@ void LLGLSLShader::bind()
gGL.flush();
if (gGLManager.mHasShaderObjects)
{
+ LLVertexBuffer::unbind();
glUseProgramObjectARB(mProgramObject);
sCurBoundShader = mProgramObject;
sCurBoundShaderPtr = this;
@@ -411,6 +413,7 @@ void LLGLSLShader::unbind()
stop_glerror();
}
}
+ LLVertexBuffer::unbind();
glUseProgramObjectARB(0);
sCurBoundShader = 0;
sCurBoundShaderPtr = NULL;
@@ -420,6 +423,7 @@ void LLGLSLShader::unbind()
void LLGLSLShader::bindNoShader(void)
{
+ LLVertexBuffer::unbind();
glUseProgramObjectARB(0);
sCurBoundShader = 0;
sCurBoundShaderPtr = NULL;
@@ -930,7 +934,9 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v
std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
{
+ stop_glerror();
glUniform4fvARB(location, count, v);
+ stop_glerror();
mValue[location] = vec;
}
}
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index d72918b15d..da85bc202c 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1580,6 +1580,105 @@ void LLRender::color3fv(const GLfloat* c)
color4f(c[0],c[1],c[2],1);
}
+void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
+{
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttrib3fARB(loc, r,g,b);
+ }
+ else
+ {
+ glColor3f(r,g,b);
+ }
+}
+
+void LLRender::diffuseColor3fv(const F32* c)
+{
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttrib3fvARB(loc, c);
+ }
+ else
+ {
+ glColor3fv(c);
+ }
+}
+
+void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a)
+{
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttrib4fARB(loc, r,g,b,a);
+ }
+ else
+ {
+ glColor4f(r,g,b,a);
+ }
+
+}
+
+void LLRender::diffuseColor4fv(const F32* c)
+{
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttrib4fvARB(loc, c);
+ }
+ else
+ {
+ glColor4fv(c);
+ }
+}
+
+void LLRender::diffuseColor4ubv(const U8* c)
+{
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttrib4ubvARB(loc, c);
+ }
+ else
+ {
+ glColor4ubv(c);
+ }
+}
+
+
+
+
void LLRender::debugTexUnits(void)
{
LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL;
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 9eedebe2ce..5f97bff1c4 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -350,6 +350,12 @@ public:
void color3fv(const GLfloat* c);
void color4ubv(const GLubyte* c);
+ void diffuseColor3f(F32 r, F32 g, F32 b);
+ void diffuseColor3fv(const F32* c);
+ void diffuseColor4f(F32 r, F32 g, F32 b, F32 a);
+ void diffuseColor4fv(const F32* c);
+ void diffuseColor4ubv(const U8* c);
+
void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count);
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count);
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
diff --git a/indra/llrender/llrendersphere.cpp b/indra/llrender/llrendersphere.cpp
index a5cd70445f..e7e07a1ab2 100644
--- a/indra/llrender/llrendersphere.cpp
+++ b/indra/llrender/llrendersphere.cpp
@@ -35,106 +35,11 @@
#include "llglheaders.h"
-GLUquadricObj *gQuadObj2 = NULL;
LLRenderSphere gSphere;
-void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-
-void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks)
-{
- if (!gQuadObj2)
- {
- gQuadObj2 = gluNewQuadric();
- if (!gQuadObj2)
- {
- llwarns << "drawSolidSphere couldn't allocate quadric" << llendl;
- return;
- }
- }
-
- gluQuadricDrawStyle(gQuadObj2, GLU_FILL);
- gluQuadricNormals(gQuadObj2, GLU_SMOOTH);
- // If we ever changed/used the texture or orientation state
- // of quadObj, we'd need to change it to the defaults here
- // with gluQuadricTexture and/or gluQuadricOrientation.
- gluQuadricTexture(gQuadObj2, GL_TRUE);
- gluSphere(gQuadObj2, radius, slices, stacks);
-}
-
-
-// A couple thoughts on sphere drawing:
-// 1) You need more slices than stacks, but little less than 2:1
-// 2) At low LOD, setting stacks to an odd number avoids a "band" around the equator, making things look smoother
-void LLRenderSphere::prerender()
-{
- // Create a series of display lists for different LODs
- mDList[0] = glGenLists(1);
- glNewList(mDList[0], GL_COMPILE);
- drawSolidSphere(1.0, 30, 20);
- glEndList();
-
- mDList[1] = glGenLists(1);
- glNewList(mDList[1], GL_COMPILE);
- drawSolidSphere(1.0, 20, 15);
- glEndList();
-
- mDList[2] = glGenLists(1);
- glNewList(mDList[2], GL_COMPILE);
- drawSolidSphere(1.0, 12, 8);
- glEndList();
-
- mDList[3] = glGenLists(1);
- glNewList(mDList[3], GL_COMPILE);
- drawSolidSphere(1.0, 8, 5);
- glEndList();
-}
-
-void LLRenderSphere::cleanupGL()
-{
- for (S32 detail = 0; detail < 4; detail++)
- {
- glDeleteLists(mDList[detail], 1);
- mDList[detail] = 0;
- }
-
- if (gQuadObj2)
- {
- gluDeleteQuadric(gQuadObj2);
- gQuadObj2 = NULL;
- }
-}
-
-// Constants here are empirically derived from my eyeballs, JNC
-//
-// The toughest adjustment is the cutoff for the lowest LOD
-// Maybe we should have more LODs at the low end?
-void LLRenderSphere::render(F32 pixel_area)
-{
- S32 level_of_detail;
-
- if (pixel_area > 10000.f)
- {
- level_of_detail = 0;
- }
- else if (pixel_area > 800.f)
- {
- level_of_detail = 1;
- }
- else if (pixel_area > 100.f)
- {
- level_of_detail = 2;
- }
- else
- {
- level_of_detail = 3;
- }
- glCallList(mDList[level_of_detail]);
-}
-
-
void LLRenderSphere::render()
{
- glCallList(mDList[0]);
+ renderGGL();
}
inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
diff --git a/indra/llrender/llrendersphere.h b/indra/llrender/llrendersphere.h
index 96a6bec80c..f8e9e86e7f 100644
--- a/indra/llrender/llrendersphere.h
+++ b/indra/llrender/llrendersphere.h
@@ -40,11 +40,6 @@ void lat2xyz(LLVector3 * result, F32 lat, F32 lon); // utility routine
class LLRenderSphere
{
public:
- LLGLuint mDList[5];
-
- void prerender();
- void cleanupGL();
- void render(F32 pixel_area); // of a box of size 1.0 at that position
void render(); // render at highest LOD
void renderGGL(); // render using LLRender
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index b6a252e8fa..5d19168842 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -62,7 +62,6 @@ U32 LLVertexBuffer::sAllocatedBytes = 0;
BOOL LLVertexBuffer::sMapped = FALSE;
BOOL LLVertexBuffer::sUseStreamDraw = TRUE;
BOOL LLVertexBuffer::sPreferStreamDraw = FALSE;
-S32 LLVertexBuffer::sWeight4Loc = -1;
std::vector<U32> LLVertexBuffer::sDeleteList;
@@ -130,6 +129,7 @@ S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] =
sizeof(LLVector2), // TYPE_TEXCOORD2,
sizeof(LLVector2), // TYPE_TEXCOORD3,
sizeof(LLColor4U), // TYPE_COLOR,
+ sizeof(U8), // TYPE_EMISSIVE
sizeof(LLVector4), // TYPE_BINORMAL,
sizeof(F32), // TYPE_WEIGHT,
sizeof(LLVector4), // TYPE_WEIGHT4,
@@ -156,36 +156,79 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
llerrs << "Cannot use LLGLImmediate and LLVertexBuffer simultaneously!" << llendl;
}*/
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
if (sLastMask != data_mask)
{
+ llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ static LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr;
+ llassert(sLastMask == 0 || last_shader == shader);
+ last_shader = shader;
+
U32 mask[] =
{
MAP_VERTEX,
MAP_NORMAL,
MAP_TEXCOORD0,
MAP_COLOR,
+ MAP_EMISSIVE,
+ MAP_WEIGHT,
+ MAP_WEIGHT4,
+ MAP_BINORMAL,
+ MAP_CLOTHWEIGHT,
};
+ U32 type[] =
+ {
+ TYPE_VERTEX,
+ TYPE_NORMAL,
+ TYPE_TEXCOORD0,
+ TYPE_COLOR,
+ TYPE_EMISSIVE,
+ TYPE_WEIGHT,
+ TYPE_WEIGHT4,
+ TYPE_BINORMAL,
+ TYPE_CLOTHWEIGHT,
+ };
+
GLenum array[] =
{
GL_VERTEX_ARRAY,
GL_NORMAL_ARRAY,
GL_TEXTURE_COORD_ARRAY,
GL_COLOR_ARRAY,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
};
BOOL error = FALSE;
- for (U32 i = 0; i < 4; ++i)
+ for (U32 i = 0; i < 9; ++i)
{
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(type[i]);
+ }
+
if (sLastMask & mask[i])
{ //was enabled
- if (!(data_mask & mask[i]) && i > 0)
+ if (!(data_mask & mask[i]))
{ //needs to be disabled
- glDisableClientState(array[i]);
+ if (loc >= 0)
+ {
+ glDisableVertexAttribArrayARB(loc);
+ }
+ else if (!shader)
+ {
+ glDisableClientState(array[i]);
+ }
}
- else if (gDebugGL)
- { //needs to be enabled, make sure it was (DEBUG TEMPORARY)
- if (i > 0 && !glIsEnabled(array[i]))
+ else if (gDebugGL && !shader && array[i])
+ { //needs to be enabled, make sure it was (DEBUG)
+ if (loc < 0 && !glIsEnabled(array[i]))
{
if (gDebugSession)
{
@@ -201,11 +244,18 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
}
else
{ //was disabled
- if (data_mask & mask[i] && i > 0)
+ if (data_mask & mask[i])
{ //needs to be enabled
- glEnableClientState(array[i]);
+ if (loc >= 0)
+ {
+ glEnableVertexAttribArrayARB(loc);
+ }
+ else if (!shader)
+ {
+ glEnableClientState(array[i]);
+ }
}
- else if (gDebugGL && i > 0 && glIsEnabled(array[i]))
+ else if (!shader && array[i] && gDebugGL && glIsEnabled(array[i]))
{ //needs to be disabled, make sure it was (DEBUG TEMPORARY)
if (gDebugSession)
{
@@ -232,62 +282,71 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
MAP_TEXCOORD3
};
+ U32 type_tc[] =
+ {
+ TYPE_TEXCOORD1,
+ TYPE_TEXCOORD2,
+ TYPE_TEXCOORD3
+ };
+
for (U32 i = 0; i < 3; i++)
{
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(type_tc[i]);
+ }
+
if (sLastMask & map_tc[i])
{
if (!(data_mask & map_tc[i]))
- {
- glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ { //disable
+ if (loc >= 0)
+ {
+ glDisableVertexAttribArrayARB(loc);
+ }
+ else if (!shader)
+ {
+ glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
}
else if (data_mask & map_tc[i])
{
- glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ if (loc >= 0)
+ {
+ glEnableVertexAttribArrayARB(loc);
+ }
+ else if (!shader)
+ {
+ glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
}
- if (sLastMask & MAP_BINORMAL)
+ if (!shader)
{
- if (!(data_mask & MAP_BINORMAL))
+ if (sLastMask & MAP_BINORMAL)
{
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ if (!(data_mask & MAP_BINORMAL))
+ {
+ glClientActiveTextureARB(GL_TEXTURE2_ARB);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
- }
- else if (data_mask & MAP_BINORMAL)
- {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
-
- if (sLastMask & MAP_WEIGHT4)
- {
- if (sWeight4Loc < 0)
+ else if (data_mask & MAP_BINORMAL)
{
- llerrs << "Weighting disabled but vertex buffer still bound!" << llendl;
- }
-
- if (!(data_mask & MAP_WEIGHT4))
- { //disable 4-component skin weight
- glDisableVertexAttribArrayARB(sWeight4Loc);
- }
- }
- else if (data_mask & MAP_WEIGHT4)
- {
- if (sWeight4Loc >= 0)
- { //enable 4-component skin weight
- glEnableVertexAttribArrayARB(sWeight4Loc);
+ glClientActiveTextureARB(GL_TEXTURE2_ARB);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
}
}
-
-
+
sLastMask = data_mask;
}
}
@@ -295,6 +354,8 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
//static
void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm)
{
+ llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+
U32 count = pos.size();
llassert_always(norm.size() >= pos.size());
llassert_always(count > 0) ;
@@ -309,6 +370,49 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, con
glDrawArrays(sGLMode[mode], 0, count);
}
+//static
+void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp)
+{
+ llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+
+ U32 mask = LLVertexBuffer::MAP_VERTEX;
+ if (tc)
+ {
+ mask = mask | LLVertexBuffer::MAP_TEXCOORD0;
+ }
+
+ unbind();
+
+ setupClientArrays(mask);
+
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ if (shader)
+ {
+ S32 loc = shader->getAttribLocation(LLVertexBuffer::TYPE_VERTEX);
+ if (loc > -1)
+ {
+ glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 16, pos);
+
+ if (tc)
+ {
+ loc = shader->getAttribLocation(LLVertexBuffer::TYPE_TEXCOORD0);
+ if (loc > -1)
+ {
+ glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, 0, tc);
+ }
+ }
+ }
+ }
+ else
+ {
+ glTexCoordPointer(2, GL_FLOAT, 0, tc);
+ glVertexPointer(3, GL_FLOAT, 16, pos);
+ }
+
+ glDrawElements(sGLMode[mode], num_indices, GL_UNSIGNED_SHORT, indicesp);
+}
+
void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const
{
if (start >= (U32) mRequestedNumVerts ||
@@ -343,6 +447,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
validateRange(start, end, count, indices_offset);
llassert(mRequestedNumVerts >= 0);
+ llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
if (mGLIndices != sGLRenderIndices)
{
@@ -371,6 +476,8 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
{
+ llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+
llassert(mRequestedNumIndices >= 0);
if (indices_offset >= (U32) mRequestedNumIndices ||
indices_offset + count > (U32) mRequestedNumIndices)
@@ -403,6 +510,8 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
{
+ llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+
llassert(mRequestedNumVerts >= 0);
if (first >= (U32) mRequestedNumVerts ||
first + count > (U32) mRequestedNumVerts)
@@ -1593,6 +1702,10 @@ bool LLVertexBuffer::getColorStrider(LLStrider<LLColor4U>& strider, S32 index, S
{
return VertexBufferStrider<LLColor4U,TYPE_COLOR>::get(*this, strider, index, count, map_range);
}
+bool LLVertexBuffer::getEmissiveStrider(LLStrider<U8>& strider, S32 index, S32 count, bool map_range)
+{
+ return VertexBufferStrider<U8,TYPE_EMISSIVE>::get(*this, strider, index, count, map_range);
+}
bool LLVertexBuffer::getWeightStrider(LLStrider<F32>& strider, S32 index, S32 count, bool map_range)
{
return VertexBufferStrider<F32,TYPE_WEIGHT>::get(*this, strider, index, count, map_range);
@@ -1811,66 +1924,223 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const
llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl;
}
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ //assert that fixed function is allowed OR a shader is currently bound
+ llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+
if (data_mask & MAP_NORMAL)
{
- glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_NORMAL);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
+ }
+ else if (!shader)
+ {
+ glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
+ }
}
if (data_mask & MAP_TEXCOORD3)
{
- glClientActiveTextureARB(GL_TEXTURE3_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_TEXCOORD3);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3]));
+ }
+ else if (!shader)
+ {
+ glClientActiveTextureARB(GL_TEXTURE3_ARB);
+ glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3]));
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
if (data_mask & MAP_TEXCOORD2)
{
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_TEXCOORD2);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2]));
+ }
+ else if (!shader)
+ {
+ glClientActiveTextureARB(GL_TEXTURE2_ARB);
+ glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2]));
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
if (data_mask & MAP_TEXCOORD1)
{
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_TEXCOORD1);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
+ }
+ else if (!shader)
+ {
+ glClientActiveTextureARB(GL_TEXTURE1_ARB);
+ glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
if (data_mask & MAP_BINORMAL)
{
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_BINORMAL);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL]));
+ }
+ else if (!shader)
+ {
+ glClientActiveTextureARB(GL_TEXTURE2_ARB);
+ glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL]));
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ }
}
if (data_mask & MAP_TEXCOORD0)
{
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_TEXCOORD0);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
+ }
+ else if (!shader)
+ {
+ glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
+ }
}
if (data_mask & MAP_COLOR)
{
- glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_COLOR);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
+ }
+ else if (!shader)
+ {
+ glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
+ }
+ }
+ if (data_mask & MAP_EMISSIVE)
+ {
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_EMISSIVE);
+ }
+
+ if (loc >= 0)
+ {
+ glVertexAttribPointerARB(loc, 1, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], (void*)(base + mOffsets[TYPE_EMISSIVE]));
+ }
}
-
if (data_mask & MAP_WEIGHT)
{
- glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT]));
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_WEIGHT);
+ }
+
+ if (loc < 0)
+ { //legacy behavior, some shaders have weight hardcoded to location 1
+ loc = 1;
+ }
+
+ glVertexAttribPointerARB(loc, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT]));
+
}
- if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1)
+ if (data_mask & MAP_WEIGHT4)
{
- glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4]));
+ if (shader)
+ {
+ S32 loc = shader->getAttribLocation(TYPE_WEIGHT4);
+ if (loc > -1)
+ {
+ glVertexAttribPointerARB(loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4]));
+ }
+ }
}
if (data_mask & MAP_CLOTHWEIGHT)
{
- glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
+ S32 loc = -1;
+ if (shader)
+ {
+ loc = shader->getAttribLocation(TYPE_CLOTHWEIGHT);
+ }
+
+ if (loc < 0)
+ { //legacy behavior, some shaders have weight hardcoded to location 4
+ loc = 4;
+ }
+ glVertexAttribPointerARB(loc, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
}
if (data_mask & MAP_VERTEX)
{
- if (data_mask & MAP_TEXTURE_INDEX)
+ S32 loc = -1;
+ if (shader)
{
- glVertexPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+ loc = shader->getAttribLocation(TYPE_VERTEX);
}
- else
+
+ if (loc >= 0)
{
- glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+ if (data_mask & MAP_TEXTURE_INDEX)
+ {
+ glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+ }
+ else
+ {
+ glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+ }
+ }
+ else if (!shader)
+ {
+ if (data_mask & MAP_TEXTURE_INDEX)
+ {
+ glVertexPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+ }
+ else
+ {
+ glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
+ }
}
}
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index cc5d11e1c2..9497bc9357 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -111,8 +111,6 @@ public:
static LLVBOPool sStreamIBOPool;
static LLVBOPool sDynamicIBOPool;
- static S32 sWeight4Loc;
-
static BOOL sUseStreamDraw;
static BOOL sPreferStreamDraw;
@@ -120,6 +118,7 @@ public:
static void cleanupClass();
static void setupClientArrays(U32 data_mask);
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
+ static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp);
static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
static void unbind(); //unbind any bound vertex buffer
@@ -133,6 +132,12 @@ public:
static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);
+ //WARNING -- when updating these enums you MUST
+ // 1 - update LLVertexBuffer::sTypeSize
+ // 2 - add a strider accessor
+ // 3 - modify LLVertexBuffer::setupVertexBuffer
+ // 4 - modify LLVertexBuffer::setupClientArray
+ // 5 - modify LLViewerShaderMgr::mReservedAttribs
enum {
TYPE_VERTEX,
TYPE_NORMAL,
@@ -141,6 +146,7 @@ public:
TYPE_TEXCOORD2,
TYPE_TEXCOORD3,
TYPE_COLOR,
+ TYPE_EMISSIVE,
// These use VertexAttribPointer and should possibly be made generic
TYPE_BINORMAL,
TYPE_WEIGHT,
@@ -160,6 +166,7 @@ public:
MAP_TEXCOORD2 = (1<<TYPE_TEXCOORD2),
MAP_TEXCOORD3 = (1<<TYPE_TEXCOORD3),
MAP_COLOR = (1<<TYPE_COLOR),
+ MAP_EMISSIVE = (1<<TYPE_EMISSIVE),
// These use VertexAttribPointer and should possibly be made generic
MAP_BINORMAL = (1<<TYPE_BINORMAL),
MAP_WEIGHT = (1<<TYPE_WEIGHT),
@@ -218,10 +225,12 @@ public:
bool getNormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getBinormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
+ bool getEmissiveStrider(LLStrider<U8>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
+
BOOL isEmpty() const { return mEmpty; }
BOOL isLocked() const { return mVertexLocked || mIndexLocked; }
S32 getNumVerts() const { return mNumVerts; }
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index ae72dee900..a76eb3cd37 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -43,7 +43,7 @@
<key>tags</key>
<array>
<!-- sample entry for debugging a specific item -->
-<!-- <string>Voice</string> -->
+<!-- <string>Voice</string> -->
</array>
</map>
</array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 01842d1037..481dddd4ae 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7582,7 +7582,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
- <integer>0</integer>
+ <integer>1</integer>
</map>
<key>RenderDebugNormalScale</key>
<map>
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index d9f29ced4f..81b632e7fa 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -6,8 +6,7 @@
*/
-
-attribute vec4 weight; //1
+attribute vec4 weight;
uniform vec4 matrixPalette[45];
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index 2796222c68..ec7359d565 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -5,7 +5,9 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -13,31 +15,33 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
+ vec4 pos_in = vec4(position.xyz, 1.0);
+
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
gl_Position = gl_ProjectionMatrix * pos;
- //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ //gl_Position = gl_ModelViewProjectionMatrix * position;
gl_FogFragCoord = length(pos.xyz);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0));
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0));
gl_FrontColor = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index 2eb814bd91..0b075feef5 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -13,16 +17,17 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec3 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
calcAtmospherics(pos.xyz);
vec4 specular = vec4(1.0);
- vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
+ vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
gl_FrontColor = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 7613e50dca..35c5a38081 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -7,7 +7,7 @@
-attribute vec4 object_weight;
+attribute vec4 weight4;
uniform mat4 matrixPalette[32];
@@ -15,8 +15,8 @@ mat4 getObjectSkinnedTransform()
{
int i;
- vec4 w = fract(object_weight);
- vec4 index = floor(object_weight);
+ vec4 w = fract(weight4);
+ vec4 index = floor(weight4);
float scale = 1.0/(w.x+w.y+w.z+w.w);
w *= scale;
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
index 86b189b282..dcc891b16f 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
@@ -5,21 +5,23 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
mat4 getSkinnedTransform();
void main()
{
vec4 pos;
-
+ vec4 pos_in = vec4(position, 1.0);
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- gl_FrontColor = gl_Color;
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_FrontColor = diffuse_color;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
gl_Position = gl_ProjectionMatrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000..5d1306bfc9
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,63 @@
+/**
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform mat4 shadow_matrix[6];
+uniform vec4 shadow_clip;
+uniform vec2 screen_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+varying vec3 vary_ambient;
+varying vec3 vary_directional;
+varying vec3 vary_fragcoord;
+varying vec3 vary_position;
+varying vec3 vary_pointlight_col;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+ float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ vec2 sc = pos_screen.xy*2.0;
+ sc /= screen_res;
+ sc -= vec2(1.0,1.0);
+ vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+ vec4 pos = inv_proj * ndc;
+ pos /= pos.w;
+ pos.w = 1.0;
+ return pos;
+}
+
+void main()
+{
+ vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+ frag *= screen_res;
+
+ vec4 pos = vec4(vary_position, 1.0);
+
+ vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy);
+
+ vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0);
+ vec4 color = diff * col;
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index ac3f7189c2..eeebae4464 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getObjectSkinnedTransform();
@@ -59,7 +63,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
@@ -67,9 +71,9 @@ void main()
mat4 trans = getObjectSkinnedTransform();
trans = gl_ModelViewMatrix * trans;
- pos = trans * gl_Vertex;
+ pos = trans * vec4(position.xyz, 1.0);
- norm = gl_Vertex.xyz + gl_Normal.xyz;
+ norm = position.xyz + normal.xyz;
norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz);
vec4 frag_pos = gl_ProjectionMatrix * pos;
@@ -80,7 +84,7 @@ void main()
calcAtmospherics(pos.xyz);
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -90,17 +94,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 44cb78e914..3a17f6a709 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -5,7 +5,10 @@
* $/LicenseInfo$
*/
-
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -62,22 +65,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix * vert;
+ vec4 vert = vec4(position.xyz, 1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (gl_ModelViewMatrix * vert);
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(gl_NormalMatrix * normal);
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -87,7 +90,7 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
@@ -96,10 +99,10 @@ void main()
vary_light = gl_LightSource[0].position.xyz;
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = col.rgb*gl_Color.rgb;
+ col.rgb = col.rgb*diffuse_color.rgb;
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
index c7a4f86727..df61785aa1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
@@ -5,21 +5,23 @@
* $License$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0);
p.z = max(p.z, -p.w+0.01);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
index 68e4055cf2..468d7332a6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
@@ -5,7 +5,9 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -59,20 +61,21 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
vec4 frag_pos = gl_ProjectionMatrix * pos;
@@ -82,9 +85,7 @@ void main()
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -94,17 +95,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb;
+ vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index 7bc78fe407..bdea3d2b57 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -6,16 +6,20 @@
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_normal = normalize(gl_NormalMatrix * normal);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index 3268618093..d8e8f6088d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -13,7 +13,7 @@ varying vec3 vary_normal;
void main()
{
- vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+ vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy);
if (diff.a < 0.2)
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
index 78986ab12e..c693725074 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
@@ -13,7 +13,6 @@ varying vec4 post_pos;
void main()
{
- //gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
gl_FragColor = vec4(1,1,1,1);
gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index f177fcd8f1..35d0bb5603 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -9,34 +9,35 @@
mat4 getSkinnedTransform();
-attribute vec4 weight;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec4 post_pos;
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
+ vec4 pos_in = vec4(position.xyz, 1.0);
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
pos = gl_ProjectionMatrix * pos;
post_pos = pos;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
-
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index 7eac11287a..9ef11109ed 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -5,7 +5,9 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
mat4 getSkinnedTransform();
@@ -15,28 +17,26 @@ varying vec3 vary_normal;
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
+ vec4 pos_in = vec4(position.xyz, 1.0);
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
vary_normal = norm;
gl_Position = gl_ProjectionMatrix * pos;
- //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
index 862f809de5..016b5e1008 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -13,7 +13,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
index dc69519a85..93e00fe523 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
@@ -5,7 +5,11 @@
* $License$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+attribute vec2 texcoord2;
varying vec3 vary_mat0;
varying vec3 vary_mat1;
@@ -15,17 +19,17 @@ mat4 getObjectSkinnedTransform();
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
- vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
+ vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+ vec3 b = normalize((mat * vec4(vec4(texcoord2,0,1).xyz+position.xyz, 1.0)).xyz-pos.xyz);
vec3 t = cross(b, n);
vary_mat0 = vec3(t.x, b.x, n.x);
@@ -33,5 +37,5 @@ void main()
vary_mat2 = vec3(t.z, b.z, n.z);
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
index 5b6726488b..3c28776045 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -5,7 +5,11 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+attribute vec2 texcoord2;
varying vec3 vary_mat0;
varying vec3 vary_mat1;
@@ -14,16 +18,16 @@ varying vec3 vary_mat2;
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vec3 n = normalize(gl_NormalMatrix * gl_Normal);
- vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz);
+ vec3 n = normalize(gl_NormalMatrix * normal);
+ vec3 b = normalize(gl_NormalMatrix * vec4(texcoord2,0,1).xyz);
vec3 t = cross(b, n);
vary_mat0 = vec3(t.x, b.x, n.x);
vary_mat1 = vec3(t.y, b.y, n.y);
vary_mat2 = vec3(t.z, b.z, n.z);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index 3eac63076c..9ba5e97a95 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -5,7 +5,8 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec2 texcoord0;
//////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -41,12 +42,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -142,7 +143,7 @@ void main()
// Texture coords
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
gl_TexCoord[0].xy -= 0.5;
gl_TexCoord[0].xy /= cloud_scale.x;
gl_TexCoord[0].xy += 0.5;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index 338d0ebb2b..26355731ae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -1,5 +1,5 @@
/**
- * @file diffuseF.glsl
+ * @file diffuseAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
@@ -15,7 +15,7 @@ varying vec3 vary_normal;
void main()
{
- vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+ vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
if (col.a < minimum_alpha || col.a > maximum_alpha)
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
new file mode 100644
index 0000000000..dfc1b52c2e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -0,0 +1,30 @@
+/**
+ * @file diffuseAlphaMaskNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+varying vec3 vary_normal;
+
+void main()
+{
+ vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragData[0] = vec4(col.rgb, 0.0);
+ gl_FragData[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
new file mode 100644
index 0000000000..ff9578e253
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
@@ -0,0 +1,23 @@
+/**
+ * @file diffuseNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+
+varying vec3 vary_normal;
+varying float vary_texture_index;
+
+void main()
+{
+ //transform vertex
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ vary_normal = normalize(gl_NormalMatrix * normal);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
index 2c4caea109..fadbe5b9ef 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
@@ -7,27 +7,32 @@
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+
varying vec3 vary_normal;
mat4 getObjectSkinnedTransform();
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
vary_normal = norm.xyz;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
index b56d1493c3..e424737702 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec4 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
varying float vary_texture_index;
@@ -13,11 +17,11 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vary_texture_index = gl_Vertex.w;
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_texture_index = position.w;
+ vary_normal = normalize(gl_NormalMatrix * normal);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
new file mode 100644
index 0000000000..5a9a6196f3
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -0,0 +1,28 @@
+/**
+ * @file emissiveF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+
+void main()
+{
+ float shadow = 1.0;
+
+ vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color;
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
new file mode 100644
index 0000000000..9841943fe6
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
@@ -0,0 +1,38 @@
+/**
+ * @file emissiveV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+attribute vec4 position;
+attribute float emissive;
+attribute vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+vec3 atmosAmbient(vec3 light);
+vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 scaleDownLight(vec3 light);
+vec3 scaleUpLight(vec3 light);
+
+varying float vary_texture_index;
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz, 1.0);
+ vec4 pos = (gl_ModelViewMatrix * vert);
+ vary_texture_index = position.w;
+
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(0,0,0,emissive);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
index 2eed044b7c..3e5fc7a36b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
@@ -6,6 +6,9 @@
*/
+attribute vec4 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
@@ -19,18 +22,17 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
+ vec4 vert = vec4(position.xyz, 1.0);
+ vec4 pos = (gl_ModelViewMatrix * vert);
+ vary_texture_index = position.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vert);
-
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
index e86f2896da..d97d7ea82d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
@@ -5,6 +5,9 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec2 vary_fragcoord;
@@ -14,11 +17,12 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
+ vec4 tex = vec4(texcoord0,0,1);
tex.w = 1.0;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
index 723777bd3a..cb47f62bbf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
@@ -5,13 +5,15 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
index 4baf1fc65a..6a53644723 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
@@ -5,8 +5,9 @@
* $/LicenseInfo$
*/
-
-
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
varying vec2 vary_fragcoord;
@@ -15,9 +16,10 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
index 434fb6f534..bb0497b309 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
@@ -6,15 +6,15 @@
*/
+attribute vec3 position;
varying vec4 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
vary_fragcoord = pos;
gl_Position = pos;
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 0d25d7792d..6c08f7b51f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -37,7 +37,10 @@ uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -92,7 +95,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
vec4 getPosition(vec2 pos_screen)
{
- float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ float depth = texture2DRect(depthMap, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
@@ -111,9 +114,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -127,16 +130,16 @@ void main()
vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
if (proj_tc.z < 0.0)
{
- discard;
+ //discard;
}
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
if (dist_atten <= 0.0)
{
- discard;
+ //discard;
}
lv = proj_origin-pos.xyz;
@@ -164,7 +167,7 @@ void main()
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -181,7 +184,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -214,7 +217,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 5efa3200d4..601bb17bc7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -20,7 +20,10 @@ uniform sampler2DRect depthMap;
uniform vec3 env_mat[3];
uniform float sun_wash;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -49,9 +52,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos;
+ vec3 lv = center.xyz-pos;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -72,11 +75,11 @@ void main()
float noise = texture2D(noiseMap, frag.xy/128.0).b;
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
float lit = da * dist_atten * noise;
- col = gl_Color.rgb*lit*col;
+ col = color.rgb*lit*col;
vec4 spec = texture2DRect(specularRect, frag.xy);
if (spec.a > 0.0)
@@ -86,7 +89,7 @@ void main()
{
sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
sa *= noise;
- col += da*sa*gl_Color.rgb*spec.rgb;
+ col += da*sa*color.rgb*spec.rgb;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index c510d8ad77..a09cfa2661 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -5,23 +5,15 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
-
-varying vec4 vary_light;
varying vec4 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
vary_fragcoord = pos;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
-
- vary_light = gl_MultiTexCoord0;
-
gl_Position = pos;
-
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
index 876f65ee3a..30dbe3f75e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -13,7 +13,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
index eebe930666..38525044ba 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
@@ -5,6 +5,7 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -13,7 +14,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
index 58e9bcec58..6bbbfdd8ee 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -5,19 +5,21 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
post_pos = pos;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
index d40c2d9f78..7a8ac14f5e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -5,14 +5,14 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
post_pos = pos;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 1ea00f723a..8dfb466e88 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -5,7 +5,8 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec2 texcoord0;
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -39,12 +40,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
- //vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+ //vec3 P = position.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index d327216a0c..35ab77d3cc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -45,7 +45,7 @@ uniform vec3 env_mat[3];
//uniform vec4 shadow_clip;
uniform mat3 ssao_effect_mat;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
varying vec2 vary_fragcoord;
vec3 vary_PositionEye;
@@ -265,7 +265,7 @@ void main()
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
- float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+ float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
@@ -286,7 +286,7 @@ void main()
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
+ float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
// add the two types of shiny together
@@ -306,5 +306,6 @@ void main()
}
gl_FragColor.rgb = col;
+
gl_FragColor.a = bloom;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
index 745cc01992..5b3f655edf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
@@ -6,21 +6,16 @@
*/
+attribute vec3 position;
uniform vec2 screen_res;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- gl_Position = ftransform();
-
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
-
- vary_light = gl_MultiTexCoord0;
+ vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 9aaffc15bf..ed67dc32d5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -13,7 +13,6 @@ uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
-uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
@@ -32,7 +31,10 @@ uniform float far_clip;
uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
uniform float sun_wash;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -60,9 +62,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -82,7 +84,7 @@ void main()
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
lv = proj_origin-pos.xyz;
@@ -108,7 +110,7 @@ void main()
vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -127,7 +129,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -156,7 +158,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
index c43125dad9..7cdfe445df 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
@@ -6,12 +6,14 @@
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 665d8126a0..6bbf86177a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -25,7 +25,6 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
uniform mat4 inv_proj;
uniform vec2 screen_res;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
index 814deb3677..d39bfef4ae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
@@ -5,9 +5,8 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
-
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -15,13 +14,8 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vary_light = gl_MultiTexCoord0;
-
- gl_FrontColor = gl_Color;
+ vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index 3038fd2966..33b379d70c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -5,7 +5,11 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
varying vec3 vary_normal;
@@ -26,14 +30,14 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_normal = normalize(gl_NormalMatrix * normal);
// Transform and pass tex coords
- gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
- vec4 t = gl_MultiTexCoord1;
+ vec4 t = vec4(texcoord1,0,1);
gl_TexCoord[0].zw = t.xy;
gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index de7e038402..08a3bc251a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -11,10 +11,18 @@ uniform sampler2D diffuseMap;
varying vec3 vary_normal;
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
void main()
{
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
- gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
new file mode 100644
index 0000000000..9f0b902c96
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
@@ -0,0 +1,27 @@
+/**
+ * @file treeShadowF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+varying vec4 post_pos;
+
+void main()
+{
+ float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a;
+
+ if (alpha < minimum_alpha || alpha > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragColor = vec4(1,1,1,1);
+
+ gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
new file mode 100644
index 0000000000..42ce2f5226
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
@@ -0,0 +1,23 @@
+/**
+ * @file treeShadowV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+
+varying vec4 post_pos;
+
+void main()
+{
+ //transform vertex
+ vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+
+ post_pos = pos;
+
+ gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
+
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
index a9bef4292d..f56f389348 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -6,16 +6,19 @@
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_normal = normalize(gl_NormalMatrix * normal);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
index 5397290b11..b5869e6cb2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
@@ -6,6 +6,8 @@
*/
+attribute vec3 position;
+
void calcAtmospherics(vec3 inPositionEye);
@@ -29,25 +31,25 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
void main()
{
//transform vertex
- vec4 position = gl_Vertex;
+ vec4 pos = vec4(position.xyz, 1.0);
mat4 modelViewProj = gl_ModelViewProjectionMatrix;
vec4 oPosition;
//get view vector
vec3 oEyeVec;
- oEyeVec.xyz = position.xyz-eyeVec;
+ oEyeVec.xyz = pos.xyz-eyeVec;
float d = length(oEyeVec.xy);
float ld = min(d, 2560.0);
- position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+ pos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
view.xyz = oEyeVec;
d = clamp(ld/1536.0-0.5, 0.0, 1.0);
d *= d;
- oPosition = position;
+ oPosition = vec4(position, 1.0);
oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
vary_position = gl_ModelViewMatrix * oPosition;
oPosition = modelViewProj * oPosition;
@@ -55,17 +57,16 @@ void main()
refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
//get wave position parameter (create sweeping horizontal waves)
- vec3 v = position.xyz;
+ vec3 v = pos.xyz;
v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
//push position for further horizon effect.
- position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
- position.w = 1.0;
- position = position*gl_ModelViewMatrix;
-
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
-
+ pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ pos.w = 1.0;
+ pos = gl_ModelViewMatrix*pos;
+ calcAtmospherics(pos.xyz);
+
//pass wave parameters to pixel shader
vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055;
//get two normal map (detail map) texture coordinates
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index 32f5f5f236..1ec0836dcc 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -19,7 +19,6 @@ uniform float warmthAmount;
void main()
{
vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy);
-
/// CALCULATING LUMINANCE (Using NTSC lum weights)
/// http://en.wikipedia.org/wiki/Luma_%28video%29
float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
@@ -27,4 +26,5 @@ void main()
gl_FragColor.rgb = col.rgb;
gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
index 76736fed53..b8881e0b19 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -5,11 +5,13 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
- gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
+ gl_TexCoord[0].xy = texcoord0;
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
index 9bb41626ae..a05449a77c 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -5,20 +5,21 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 glowDelta;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
- gl_TexCoord[0].xy = gl_MultiTexCoord0.xy + glowDelta*(-3.5);
- gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + glowDelta*(-2.5);
- gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + glowDelta*(-1.5);
- gl_TexCoord[3].xy = gl_MultiTexCoord0.xy + glowDelta*(-0.5);
- gl_TexCoord[0].zw = gl_MultiTexCoord0.xy + glowDelta*(0.5);
- gl_TexCoord[1].zw = gl_MultiTexCoord0.xy + glowDelta*(1.5);
- gl_TexCoord[2].zw = gl_MultiTexCoord0.xy + glowDelta*(2.5);
- gl_TexCoord[3].zw = gl_MultiTexCoord0.xy + glowDelta*(3.5);
+ gl_TexCoord[0].xy = texcoord0 + glowDelta*(-3.5);
+ gl_TexCoord[1].xy = texcoord0 + glowDelta*(-2.5);
+ gl_TexCoord[2].xy = texcoord0 + glowDelta*(-1.5);
+ gl_TexCoord[3].xy = texcoord0 + glowDelta*(-0.5);
+ gl_TexCoord[0].zw = texcoord0 + glowDelta*(0.5);
+ gl_TexCoord[1].zw = texcoord0 + glowDelta*(1.5);
+ gl_TexCoord[2].zw = texcoord0 + glowDelta*(2.5);
+ gl_TexCoord[3].zw = texcoord0 + glowDelta*(3.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index 8af981915b..d0d8aed67e 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -5,6 +5,13 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
+attribute vec2 texcoord2;
+attribute vec2 texcoord3;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
@@ -26,17 +33,17 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- vec4 pos = gl_ModelViewMatrix * gl_Vertex;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = gl_ModelViewMatrix * position;
+ vec3 norm = normalize(gl_NormalMatrix * normal);
- vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), gl_Color);
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color);
gl_FrontColor = color;
- gl_TexCoord[0] = texgen_object(gl_Vertex,gl_MultiTexCoord0,gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
- gl_TexCoord[1] = gl_TextureMatrix[1]*gl_MultiTexCoord1;
- gl_TexCoord[2] = texgen_object(gl_Vertex,gl_MultiTexCoord2,gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
- gl_TexCoord[3] = gl_TextureMatrix[3]*gl_MultiTexCoord3;
+ gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
+ gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(texcoord1,0,1);
+ gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
+ gl_TexCoord[3] = gl_TextureMatrix[3]*vec4(texcoord3,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 831d6a761c..92d4759fe8 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -6,6 +6,7 @@
*/
+attribute vec3 position;
void calcAtmospherics(vec3 inPositionEye);
@@ -27,7 +28,6 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
void main()
{
//transform vertex
- vec4 position = gl_Vertex;
mat4 modelViewProj = gl_ModelViewProjectionMatrix;
vec4 oPosition;
@@ -45,7 +45,7 @@ void main()
d = clamp(ld/1536.0-0.5, 0.0, 1.0);
d *= d;
- oPosition = position;
+ oPosition = vec4(position, 1.0);
oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
oPosition = modelViewProj * oPosition;
refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
@@ -55,11 +55,12 @@ void main()
v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
//push position for further horizon effect.
- position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
- position.w = 1.0;
- position = position*gl_ModelViewMatrix;
+ vec4 pos;
+ pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ pos.w = 1.0;
+ pos = gl_ModelViewMatrix*pos;
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
+ calcAtmospherics(pos.xyz);
//pass wave parameters to pixel shader
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
index 04bfff22c1..22095bc611 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
@@ -5,12 +5,15 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
index ce183ec154..46be1c45d3 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
@@ -5,11 +5,14 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
index f6c6d945de..a0cbdaafb8 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
@@ -6,10 +6,10 @@
*/
-
+uniform vec4 highlight_color;
uniform sampler2D diffuseMap;
void main()
{
- gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+ gl_FragColor = highlight_color*texture2D(diffuseMap, gl_TexCoord[0].xy);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index f114f766bf..0547c44093 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -5,23 +5,13 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- pos = normalize(pos);
- float d = dot(pos, normalize(gl_NormalMatrix * gl_Normal));
- d *= d;
- d = 1.0 - d;
- d *= d;
-
- d = min(d, gl_Color.a*2.0);
-
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor.rgb = gl_Color.rgb;
- gl_FrontColor.a = max(d, gl_Color.a);
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
index 5a5d0ec506..9c528750eb 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
@@ -5,8 +5,10 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
new file mode 100644
index 0000000000..a5442c9bf4
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file onetexturenocolorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform sampler2D tex0;
+
+void main()
+{
+ gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy);
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
new file mode 100644
index 0000000000..7df45e90e6
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
@@ -0,0 +1,18 @@
+/**
+ * @file onetexturenocolorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+
+
+void main()
+{
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
index 8401208e28..18c8e394c6 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -5,12 +5,14 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_FrontColor = gl_Color;
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_FrontColor = diffuse_color;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
index f685b112b4..dde4e87c63 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
@@ -6,11 +6,14 @@
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
index 9ca6cae5c5..9d129caf21 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
@@ -6,11 +6,15 @@
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
index 056d1a9582..438a9bec85 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -6,11 +6,16 @@
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
+
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
- gl_FrontColor = gl_Color;
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = gl_TextureMatrix[1] * vec4(texcoord1,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
new file mode 100644
index 0000000000..78668711ac
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
@@ -0,0 +1,33 @@
+/**
+ * @file emissiveSkinnedV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+attribute vec3 position;
+attribute float emissive;
+attribute vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+mat4 getObjectSkinnedTransform();
+
+void main()
+{
+ //transform vertex
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ mat4 mat = getObjectSkinnedTransform();
+
+ mat = gl_ModelViewMatrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(0,0,0,emissive);
+
+ gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
new file mode 100644
index 0000000000..05d7cc397f
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
@@ -0,0 +1,29 @@
+/**
+ * @file emissiveV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+attribute vec4 position;
+attribute float emissive;
+attribute vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+varying float vary_texture_index;
+
+void main()
+{
+ //transform vertex
+ vary_texture_index = position.w;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(0,0,0,emissive);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
new file mode 100644
index 0000000000..57d98038e0
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
@@ -0,0 +1,27 @@
+/**
+ * @file fullbrightNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+ vec4 pos = (gl_ModelViewMatrix * vert);
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(1,1,1,1);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
index 5283e80407..5ed2b38f42 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
mat4 getObjectSkinnedTransform();
@@ -15,21 +19,21 @@ void main()
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
vec3 ref = reflect(pos.xyz, -norm.xyz);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
index 31e0f0a429..4063294c51 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
@@ -14,18 +18,18 @@ uniform vec4 origin;
void main()
{
//transform vertex
- gl_Position = ftransform();
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(gl_NormalMatrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
index 1db79791de..316c93c36a 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
@@ -6,6 +6,9 @@
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
mat4 getObjectSkinnedTransform();
@@ -13,21 +16,16 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
- norm.xyz = (mat*norm).xyz;
- norm.xyz = normalize(norm.xyz-pos.xyz);
-
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
index 3382384c99..d88612765c 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
@@ -5,21 +5,24 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
+
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
index eea41bb4f0..41a9cd2fe6 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
@@ -5,7 +5,10 @@
* $License$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -16,21 +19,21 @@ void main()
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
vec3 ref = reflect(pos.xyz, -norm.xyz);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
index 68a086dbc1..4757295470 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
@@ -5,7 +5,10 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
@@ -14,14 +17,14 @@ uniform vec4 origin;
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(gl_NormalMatrix * normal);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
vec3 ref = reflect(pos.xyz, -norm);
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
new file mode 100644
index 0000000000..54c262885e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
@@ -0,0 +1,30 @@
+/**
+ * @file simpleNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
index af92e5e002..fbda2e70d2 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
@@ -5,7 +5,10 @@
* $License$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -14,21 +17,21 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
index b493f76fcc..39fad42acb 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
@@ -5,7 +5,10 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -13,16 +16,15 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
-
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
new file mode 100644
index 0000000000..1e9e7f4b0b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
@@ -0,0 +1,35 @@
+/**
+ * @file treeV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+
+ gl_Position = gl_ModelViewProjectionMatrix*vert;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1);
+
+ vec4 pos = (gl_ModelViewMatrix * vert);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
index 3e8b719f93..e6d5c00c4d 100644
--- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -13,17 +17,17 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
calcAtmospherics(pos.xyz);
// vec4 specular = specularColor;
vec4 specular = vec4(1.0);
- vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
+ vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000..294a000ab5
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,121 @@
+/**
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRectShadow shadowMap0;
+uniform sampler2DRectShadow shadowMap1;
+uniform sampler2DRectShadow shadowMap2;
+uniform sampler2DRectShadow shadowMap3;
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform mat4 shadow_matrix[6];
+uniform vec4 shadow_clip;
+uniform vec2 screen_res;
+uniform vec2 shadow_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+varying vec3 vary_ambient;
+varying vec3 vary_directional;
+varying vec3 vary_fragcoord;
+varying vec3 vary_position;
+varying vec3 vary_pointlight_col;
+
+uniform float shadow_bias;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+ float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ vec2 sc = pos_screen.xy*2.0;
+ sc /= screen_res;
+ sc -= vec2(1.0,1.0);
+ vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+ vec4 pos = inv_proj * ndc;
+ pos.xyz /= pos.w;
+ pos.w = 1.0;
+ return pos;
+}
+
+float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
+{
+ stc.xyz /= stc.w;
+ stc.z += shadow_bias;
+
+ float cs = shadow2DRect(shadowMap, stc.xyz).x;
+ float shadow = cs;
+
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
+
+ return shadow/5.0;
+}
+
+
+void main()
+{
+ vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+ frag *= screen_res;
+
+ float shadow = 1.0;
+ vec4 pos = vec4(vary_position, 1.0);
+
+ vec4 spos = pos;
+
+ if (spos.z > -shadow_clip.w)
+ {
+ vec4 lpos;
+
+ if (spos.z < -shadow_clip.z)
+ {
+ lpos = shadow_matrix[3]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap3, lpos, 1.5);
+ shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
+ }
+ else if (spos.z < -shadow_clip.y)
+ {
+ lpos = shadow_matrix[2]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap2, lpos, 1.5);
+ }
+ else if (spos.z < -shadow_clip.x)
+ {
+ lpos = shadow_matrix[1]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap1, lpos, 1.5);
+ }
+ else
+ {
+ lpos = shadow_matrix[0]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap0, lpos, 1.5);
+ }
+ }
+
+ vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
+
+ vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0);
+ vec4 color = diff * col;
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index 948a52da5b..a446239a22 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -5,7 +5,10 @@
* $License$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -59,18 +62,18 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position, 1.0)).xyz;
gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0);
- vec4 n = gl_Vertex;
- n.xyz += gl_Normal.xyz;
+ vec4 n = vec4(position, 1.0);
+ n.xyz += normal.xyz;
n.xyz = (mat*n).xyz;
n.xyz = normalize(n.xyz-pos.xyz);
@@ -81,8 +84,8 @@ void main()
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -92,23 +95,23 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
- pos.xyz = (gl_ModelViewProjectionMatrix * gl_Vertex).xyz;
+ pos.xyz = (gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0)).xyz;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index f616ecc872..91dcca4607 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -5,7 +5,10 @@
* $/LicenseInfo$
*/
-
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -61,22 +64,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix * vert;
-
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
+ vec4 vert = vec4(position.xyz, 1.0);
+ vary_texture_index = position.w;
vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -86,17 +89,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = col.rgb*gl_Color.rgb;
+ col.rgb = col.rgb*diffuse_color.rgb;
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index 01e40afc4f..8102578bb2 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -6,6 +6,9 @@
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -61,20 +64,21 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
gl_Position = gl_ProjectionMatrix * pos;
@@ -84,9 +88,7 @@ void main()
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -96,17 +98,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb;
+ vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
index 393084a3db..5e19a3b043 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
@@ -6,6 +6,7 @@
*/
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -13,7 +14,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index f54186ffca..a16be0c8b4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -36,7 +36,10 @@ uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform float size;
+uniform vec3 color;
+uniform float falloff;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -110,9 +113,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -143,7 +146,7 @@ void main()
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
if (dist_atten <= 0.0)
{
@@ -175,7 +178,7 @@ void main()
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -192,7 +195,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -225,7 +228,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index f0c9b01671..cbac299e44 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -47,7 +47,8 @@ uniform mat3 ssao_effect_mat;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
+
varying vec2 vary_fragcoord;
vec3 vary_PositionEye;
@@ -264,7 +265,7 @@ void main()
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
- float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+ float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -291,7 +292,7 @@ void main()
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
+ float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index 745cc01992..9534f1d79c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -6,21 +6,18 @@
*/
+attribute vec3 position;
uniform vec2 screen_res;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
+
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
-
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
- vary_light = gl_MultiTexCoord0;
+ vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index d53850b489..699fcdb0f3 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -30,7 +30,7 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
uniform mat4 inv_proj;
uniform vec2 screen_res;
@@ -167,10 +167,10 @@ void main()
}*/
float shadow = 1.0;
- float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+ float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
vec3 shadow_pos = pos.xyz + displace*norm;
- vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+ vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index 814deb3677..39cca9589e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -5,6 +5,7 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
varying vec4 vary_light;
@@ -15,13 +16,8 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vary_light = gl_MultiTexCoord0;
-
- gl_FrontColor = gl_Color;
+ vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
index de469542f9..68f79fba82 100644
--- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
@@ -6,6 +6,8 @@
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 texelSize;
uniform vec2 blurDirection;
@@ -14,10 +16,10 @@ uniform float blurWidth;
void main(void)
{
// Transform vertex
- gl_Position = ftransform();
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
- vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0);
+ vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0);
// for (int i = 0; i < 7; i++) {
// gl_TexCoord[i].st = s + (i * blurDelta);
diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
index 9c52b8dd5d..7dd2ead200 100644
--- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
@@ -6,11 +6,15 @@
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
+
void main(void)
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
index 2658bee88d..b5367b5dae 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
@@ -6,6 +6,12 @@
*/
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
+
void calcAtmospherics(vec3 inPositionEye);
@@ -28,24 +34,24 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = ftransform();
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+
+ vec4 pos = gl_ModelViewMatrix * vec4(position.xyz, 1.0);
+ vec3 norm = normalize(gl_NormalMatrix * normal);
- vec4 pos = gl_ModelViewMatrix * gl_Vertex;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ calcAtmospherics(pos.xyz);
/// Potentially better without it for water.
pos /= pos.w;
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
-
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0));
gl_FrontColor = color;
// Transform and pass tex coords
- gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
- vec4 t = gl_MultiTexCoord1;
+ vec4 t = vec4(texcoord1,0,1);
gl_TexCoord[0].zw = t.xy;
gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
index 3d43a1813a..bc927cfdb6 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
@@ -5,8 +5,6 @@
* $/LicenseInfo$
*/
-
-
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
index f49e74406f..72a18c6858 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
@@ -13,23 +13,28 @@ uniform vec4 origin;
varying float vary_texture_index;
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
-
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
index 3076fa3260..cf8ea23c36 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
@@ -5,6 +5,11 @@
* $/LicenseInfo$
*/
+
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
void calcAtmospherics(vec3 inPositionEye);
@@ -14,16 +19,15 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
vec4 pos = (gl_ModelViewMatrix * vert);
-
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
index 49992d3535..5d633f53d5 100644
--- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
@@ -6,6 +6,10 @@
*/
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
@@ -18,20 +22,20 @@ uniform vec4 origin;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
-
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));
+ gl_FrontColor = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0));
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
new file mode 100644
index 0000000000..d2a83c9724
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
@@ -0,0 +1,36 @@
+/**
+ * @file simpleNonIndexedV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+
+ gl_Position = gl_ModelViewProjectionMatrix*vert;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1);
+
+ vec4 pos = (gl_ModelViewMatrix * vert);
+
+ vec3 norm = normalize(gl_NormalMatrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
index 5e02391767..4f53cde40c 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
@@ -7,6 +7,11 @@
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -15,18 +20,19 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
vec4 pos = (gl_ModelViewMatrix * vert);
+ gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1);
+
+
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(gl_NormalMatrix * normal);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 3eac63076c..9ba5e97a95 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -5,7 +5,8 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec2 texcoord0;
//////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -41,12 +42,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -142,7 +143,7 @@ void main()
// Texture coords
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
gl_TexCoord[0].xy -= 0.5;
gl_TexCoord[0].xy /= cloud_scale.x;
gl_TexCoord[0].xy += 0.5;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 1ea00f723a..31c995a542 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -6,6 +6,8 @@
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -39,12 +41,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
- //vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+ //vec3 P = position.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
index 3d970d252c..f65dfff42f 100644
--- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
@@ -5,38 +5,39 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+attribute vec4 clothing;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
void calcAtmospherics(vec3 inPositionEye);
-attribute vec4 clothing; //4
-
-attribute vec4 gWindDir; //7
-attribute vec4 gSinWaveParams; //3
-attribute vec4 gGravity; //5
+uniform vec4 gWindDir;
+uniform vec4 gSinWaveParams;
+uniform vec4 gGravity;
const vec4 gMinMaxConstants = vec4(1.0, 0.166666, 0.0083143, .00018542); // #minimax-generated coefficients
const vec4 gPiConstants = vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); // # {1/2PI, 2PI, PI, PI/2}
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
mat4 trans = getSkinnedTransform();
vec3 norm;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
//wind
vec4 windEffect;
windEffect = vec4(dot(norm, gWindDir.xyz));
- pos.x = dot(trans[2].xyz, gl_Vertex.xyz);
+ pos.x = dot(trans[2].xyz, position.xyz);
windEffect.xyz = pos.x * vec3(0.015, 0.015, 0.015)
+ windEffect.xyz;
windEffect.w = windEffect.w * 2.0 + 1.0; // move wind offset value to [-1, 3]
@@ -83,7 +84,7 @@ void main()
sinWave.xyz = max(sinWave.xyz, vec3(-1.0, -1.0, -1.0)); // clamp to underlying body shape
offsetPos = clothing * sinWave.x; // multiply wind effect times clothing displacement
temp2 = gWindDir*sinWave.z + vec4(norm,0); // calculate normal offset due to wind oscillation
- offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+gl_Vertex; // add to offset vertex position, and zero out effect from w
+ offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+vec4(position.xyz, 1.0); // add to offset vertex position, and zero out effect from w
norm += temp2.xyz*2.0; // add sin wave effect on normals (exaggerated)
//add "backlighting" effect
@@ -101,7 +102,7 @@ void main()
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0));
gl_FrontColor = color;
gl_Position = gl_ProjectionMatrix * pos;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
index eebe930666..b769e1ee1d 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -13,7 +13,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
index 7e20d71529..057d36ed22 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
@@ -5,6 +5,7 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -13,7 +14,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
index e86f2896da..d97d7ea82d 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
@@ -5,6 +5,9 @@
* $/LicenseInfo$
*/
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec2 vary_fragcoord;
@@ -14,11 +17,12 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
+ vec4 tex = vec4(texcoord0,0,1);
tex.w = 1.0;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
index 9afeac6ddf..5bdb69fb6f 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
@@ -5,18 +5,20 @@
* $/LicenseInfo$
*/
-
-
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
index 876f65ee3a..2581098609 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -13,7 +13,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
index eebe930666..ed6fd1ee80 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
-
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -13,7 +13,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
index 745cc01992..9872c9f366 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
@@ -6,6 +6,8 @@
*/
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 screen_res;
@@ -14,13 +16,10 @@ varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
-
- vary_light = gl_MultiTexCoord0;
+ vary_light = vec4(texcoord0,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
index 24bbc0a1a1..9144b8361f 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
@@ -6,7 +6,6 @@
*/
-
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 642a1907f0..64a5884e14 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3925,7 +3925,7 @@ void LLAgent::renderAutoPilotTarget()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
// lovely green
- glColor4f(0.f, 1.f, 1.f, 1.f);
+ gGL.color4f(0.f, 1.f, 1.f, 1.f);
target_global = mAutoPilotTargetGlobal;
@@ -3935,7 +3935,7 @@ void LLAgent::renderAutoPilotTarget()
glScalef(height_meters, height_meters, height_meters);
- gSphere.render(1500.f);
+ gSphere.render();
gGL.popMatrix();
}
diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp
index 4901e29691..2adc071d7a 100644
--- a/indra/newview/llcylinder.cpp
+++ b/indra/newview/llcylinder.cpp
@@ -37,261 +37,39 @@
#include "llgl.h"
#include "llglheaders.h"
-LLCylinder gCylinder;
LLCone gCone;
-GLUquadricObj* gQuadObj = NULL;
-
-static const GLint SLICES[] = { 30, 20, 12, 6 }; // same as sphere slices
-static const GLint STACKS = 2;
-static const GLfloat RADIUS = 0.5f;
-
-// draws a cylinder or cone
-// returns approximate number of triangles required
-U32 draw_cylinder_side(GLint slices, GLint stacks, GLfloat base_radius, GLfloat top_radius)
-{
- U32 triangles = 0;
- GLfloat height = 1.0f;
-
- if (!gQuadObj)
- {
- gQuadObj = gluNewQuadric();
- if (!gQuadObj) llerror("draw_cylindrical_body couldn't allocated quadric", 0);
- }
-
- gluQuadricDrawStyle(gQuadObj, GLU_FILL);
- gluQuadricNormals(gQuadObj, GLU_SMOOTH);
- gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
- gluQuadricTexture(gQuadObj, GL_TRUE);
- gluCylinder(gQuadObj, base_radius, top_radius, height, slices, stacks);
- triangles += stacks * (slices * 2);
-
-
- return triangles;
-}
-
-
-// Returns number of triangles required to draw
-// Need to know if top or not to set lighting normals
-const BOOL TOP = TRUE;
-const BOOL BOTTOM = FALSE;
-U32 draw_cylinder_cap(GLint slices, GLfloat base_radius, BOOL is_top)
-{
- U32 triangles = 0;
-
- if (!gQuadObj)
- {
- gQuadObj = gluNewQuadric();
- if (!gQuadObj) llerror("draw_cylinder_base couldn't allocated quadric", 0);
- }
-
- gluQuadricDrawStyle(gQuadObj, GLU_FILL);
- gluQuadricNormals(gQuadObj, GLU_SMOOTH);
- gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
- gluQuadricTexture(gQuadObj, GL_TRUE);
-
- // no hole in the middle of the disk, and just one ring
- GLdouble inner_radius = 0.0;
- GLint rings = 1;
-
- // normals point in +z for top, -z for base
- if (is_top)
- {
- gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
- }
- else
- {
- gluQuadricOrientation(gQuadObj, GLU_INSIDE);
- }
- gluDisk(gQuadObj, inner_radius, base_radius, slices, rings);
- triangles += slices;
-
- return triangles;
-}
-
-void LLCylinder::drawSide(S32 detail)
-{
- draw_cylinder_side(SLICES[detail], STACKS, RADIUS, RADIUS);
-}
-
-void LLCylinder::drawTop(S32 detail)
-{
- draw_cylinder_cap(SLICES[detail], RADIUS, TOP);
-}
-
-void LLCylinder::drawBottom(S32 detail)
-{
- draw_cylinder_cap(SLICES[detail], RADIUS, BOTTOM);
-}
-
-void LLCylinder::prerender()
-{
-}
-
-void LLCylinder::cleanupGL()
-{
- if (gQuadObj)
- {
- gluDeleteQuadric(gQuadObj);
- gQuadObj = NULL;
- }
-}
-
-void LLCylinder::render(F32 pixel_area)
-{
- renderface(pixel_area, 0);
- renderface(pixel_area, 1);
- renderface(pixel_area, 2);
-}
-
-
-void LLCylinder::renderface(F32 pixel_area, S32 face)
-{
- if (face < 0 || face > 2)
- {
- llerror("LLCylinder::renderface() invalid face number", face);
- return;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- S32 level_of_detail;
-
- if (pixel_area > 20000.f)
- {
- level_of_detail = 0;
- }
- else if (pixel_area > 1600.f)
- {
- level_of_detail = 1;
- }
- else if (pixel_area > 200.f)
- {
- level_of_detail = 2;
- }
- else
- {
- level_of_detail = 3;
- }
-
- if (level_of_detail < 0 || CYLINDER_LEVELS_OF_DETAIL <= level_of_detail)
- {
- llerror("LLCylinder::renderface() invalid level of detail", level_of_detail);
- return;
- }
-
- LLVertexBuffer::unbind();
-
- switch(face)
- {
- case 0:
- glTranslatef(0.f, 0.f, -0.5f);
- drawSide(level_of_detail);
- break;
- case 1:
- glTranslatef(0.0f, 0.f, 0.5f);
- drawTop(level_of_detail);
- break;
- case 2:
- glTranslatef(0.0f, 0.f, -0.5f);
- drawBottom(level_of_detail);
- break;
- default:
- llerror("LLCylinder::renderface() fell out of switch", 0);
- break;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-}
-
-
//
// Cones
//
-void LLCone::prerender()
+void LLCone::render(S32 sides)
{
-}
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.vertex3f(0,0,0);
-void LLCone::cleanupGL()
-{
- if (gQuadObj)
+ for (U32 i = 0; i < sides; i++)
{
- gluDeleteQuadric(gQuadObj);
- gQuadObj = NULL;
+ F32 a = (F32) i/sides * F_PI*2.f;
+ F32 x = cosf(a)*0.5f;
+ F32 y = sinf(a)*0.5f;
+ gGL.vertex3f(x,y,0.f);
}
-}
+ gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, 0.f);
-void LLCone::drawSide(S32 detail)
-{
- draw_cylinder_side( SLICES[detail], STACKS, RADIUS, 0.f );
-}
-
-void LLCone::drawBottom(S32 detail)
-{
- draw_cylinder_cap( SLICES[detail], RADIUS, BOTTOM );
-}
-
-void LLCone::render(S32 level_of_detail)
-{
- GLfloat height = 1.0f;
+ gGL.end();
- if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.vertex3f(0.f, 0.f, 1.f);
+ for (U32 i = 0; i < sides; i++)
{
- llerror("LLCone::render() invalid level of detail", level_of_detail);
- return;
+ F32 a = (F32) i/sides * F_PI*2.f;
+ F32 x = cosf(a)*0.5f;
+ F32 y = sinf(a)*0.5f;
+ gGL.vertex3f(x,y,0.f);
}
+ gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, 0.f);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- // center object at 0
- glTranslatef(0.f, 0.f, - height / 2.0f);
-
- drawSide(level_of_detail);
- drawBottom(level_of_detail);
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.end();
}
-
-void LLCone::renderface(S32 level_of_detail, S32 face)
-{
- if (face < 0 || face > 1)
- {
- llerror("LLCone::renderface() invalid face number", face);
- return;
- }
-
- if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
- {
- llerror("LLCone::renderface() invalid level of detail", level_of_detail);
- return;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- LLVertexBuffer::unbind();
-
- switch(face)
- {
- case 0:
- glTranslatef(0.f, 0.f, -0.5f);
- drawSide(level_of_detail);
- break;
- case 1:
- glTranslatef(0.f, 0.f, -0.5f);
- drawBottom(level_of_detail);
- break;
- default:
- llerror("LLCylinder::renderface() fell out of switch", 0);
- break;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-}
diff --git a/indra/newview/llcylinder.h b/indra/newview/llcylinder.h
index 40a669ceb6..4369f06659 100644
--- a/indra/newview/llcylinder.h
+++ b/indra/newview/llcylinder.h
@@ -30,45 +30,18 @@
//#include "stdtypes.h"
//#include "llgl.h"
-//
-// Cylinders
-//
-const S32 CYLINDER_LEVELS_OF_DETAIL = 4;
-const S32 CYLINDER_FACES = 3;
-
-class LLCylinder
-{
-public:
- void prerender();
- void drawTop(S32 detail);
- void drawSide(S32 detail);
- void drawBottom(S32 detail);
- void cleanupGL();
-
- void render(F32 pixel_area);
- void renderface(F32 pixel_area, S32 face);
-};
-
+#include "llvertexbuffer.h"
//
// Cones
//
-const S32 CONE_LOD_HIGHEST = 0;
-const S32 CONE_LEVELS_OF_DETAIL = 4;
-const S32 CONE_FACES = 2;
-
class LLCone
{
public:
- void prerender();
- void cleanupGL();
- void drawSide(S32 detail);
- void drawBottom(S32 detail);
- void render(S32 level_of_detail);
- void renderface(S32 level_of_detail, S32 face);
+ void render(S32 sides = 12);
};
-extern LLCylinder gCylinder;
+
extern LLCone gCone;
#endif
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 286284f828..0c572def72 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -384,7 +384,7 @@ BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE;
void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4& color)
{
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
}
void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
@@ -394,7 +394,7 @@ void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
void LLFacePool::LLOverrideFaceColor::setColor(F32 r, F32 g, F32 b, F32 a)
{
- glColor4f(r,g,b,a);
+ gGL.diffuseColor4f(r,g,b,a);
}
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 9719140a37..a3f8eb377a 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -54,7 +54,7 @@ static BOOL deferred_render = FALSE;
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
LLRenderPass(type), current_shader(NULL), target_shader(NULL),
- simple_shader(NULL), fullbright_shader(NULL),
+ simple_shader(NULL), fullbright_shader(NULL), emissive_shader(NULL),
mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
{
@@ -175,11 +175,13 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
{
simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram;
+ emissive_shader = &gObjectEmissiveWaterProgram;
}
else
{
simple_shader = &gObjectSimpleAlphaMaskProgram;
fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
+ emissive_shader = &gObjectEmissiveProgram;
}
if (mVertexShaderLevel > 0)
@@ -319,20 +321,22 @@ void LLDrawPoolAlpha::render(S32 pass)
BOOL shaders = gPipeline.canUseVertexShaders();
if(shaders)
{
- gObjectFullbrightNonIndexedProgram.bind();
+ gHighlightProgram.bind();
+ gHighlightProgram.uniform4f("highlight_color", 1,0,0,1);
}
else
{
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gGL.diffuseColor4f(1,0,0,1);
}
- glColor4f(1,0,0,1);
+
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0);
if(shaders)
{
- gObjectFullbrightNonIndexedProgram.unbind();
+ gHighlightProgram.unbind();
}
}
}
@@ -488,23 +492,27 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
- if (draw_glow_for_this_partition &&
- params.mGlowColor.mV[3] > 0)
+ if (current_shader &&
+ draw_glow_for_this_partition &&
+ params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
{
// install glow-accumulating blend mode
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
+ emissive_shader->bind();
+
// glow doesn't use vertex colors from the mesh data
- params.mVertexBuffer->setBuffer(mask & ~LLVertexBuffer::MAP_COLOR);
- glColor4ubv(params.mGlowColor.mV);
-
+ params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
+
// do the actual drawing, again
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// restore our alpha blend mode
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
+ current_shader->bind();
}
if (tex_setup)
diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h
index 12a7ae92b1..a4245e561d 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -78,6 +78,7 @@ private:
LLGLSLShader* target_shader;
LLGLSLShader* simple_shader;
LLGLSLShader* fullbright_shader;
+ LLGLSLShader* emissive_shader;
// our 'normal' alpha blend function for this pass
LLRender::eBlendFactor mColorSFactor;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 28e464b60d..082448d95c 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -263,7 +263,6 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
gPipeline.bindDeferredShader(*sVertexProgram);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
@@ -271,7 +270,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
sVertexProgram = &gDeferredSkinnedAlphaProgram;
gPipeline.bindDeferredShader(*sVertexProgram);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
gPipeline.enableLightsDynamic();
}
@@ -280,7 +278,6 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha()
LLVertexBuffer::unbind();
gPipeline.unbindDeferredShader(*sVertexProgram);
sDiffuseChannel = 0;
- LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
@@ -314,8 +311,7 @@ void LLDrawPoolAvatar::endPostDeferredAlpha()
// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
sRenderingSkinned = FALSE;
sSkipOpaque = FALSE;
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
+
gPipeline.unbindDeferredShader(*sVertexProgram);
sDiffuseChannel = 0;
sShaderLevel = mVertexShaderLevel;
@@ -356,19 +352,15 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
if (pass == 0)
{
sVertexProgram = &gDeferredAvatarShadowProgram;
- if (sShaderLevel > 0)
- {
- gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
- }
+
//gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
if ((sShaderLevel > 0)) // for hardware blending
{
sRenderingSkinned = TRUE;
sVertexProgram->bind();
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
}
else
@@ -376,7 +368,6 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
sVertexProgram = &gDeferredAttachmentShadowProgram;
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -389,14 +380,12 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass)
{
sRenderingSkinned = FALSE;
sVertexProgram->unbind();
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
}
else
{
LLVertexBuffer::unbind();
sVertexProgram->unbind();
- LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
}
@@ -430,11 +419,6 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
if (pass == 0)
{
- if (sShaderLevel > 0)
- {
- gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
- }
-
avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
}
else
@@ -492,11 +476,6 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
//reset vertex buffer mappings
LLVertexBuffer::unbind();
- if (pass == 0)
- { //make sure no stale colors are left over from a previous render
- glColor4f(1,1,1,1);
- }
-
if (LLPipeline::sImpostorRender)
{ //impostor render does not have impostors or rigid rendering
pass += 2;
@@ -535,6 +514,11 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
beginRiggedGlow();
break;
}
+
+ if (pass == 0)
+ { //make sure no stale colors are left over from a previous render
+ gGL.diffuseColor4f(1,1,1,1);
+ }
}
void LLDrawPoolAvatar::endRenderPass(S32 pass)
@@ -597,6 +581,11 @@ void LLDrawPoolAvatar::beginImpostor()
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
sDiffuseChannel = 0;
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
}
void LLDrawPoolAvatar::endImpostor()
@@ -606,6 +595,10 @@ void LLDrawPoolAvatar::endImpostor()
gImpostorProgram.unbind();
}
gPipeline.enableLightsDynamic();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
}
void LLDrawPoolAvatar::beginRigid()
@@ -614,11 +607,11 @@ void LLDrawPoolAvatar::beginRigid()
{
if (LLPipeline::sUnderWaterRender)
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
}
else
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorProgram;
}
if (sVertexProgram != NULL)
@@ -672,9 +665,10 @@ void LLDrawPoolAvatar::endDeferredImpostor()
void LLDrawPoolAvatar::beginDeferredRigid()
{
- sVertexProgram = &gDeferredNonIndexedDiffuseProgram;
+ sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
sVertexProgram->bind();
+ sVertexProgram->setAlphaRange(0.2f, 1.f);
}
void LLDrawPoolAvatar::endDeferredRigid()
@@ -703,11 +697,11 @@ void LLDrawPoolAvatar::beginSkinned()
{
if (LLPipeline::sUnderWaterRender)
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
}
else
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorProgram;
}
}
@@ -716,17 +710,6 @@ void LLDrawPoolAvatar::beginSkinned()
sRenderingSkinned = TRUE;
sVertexProgram->bind();
- if (sShaderLevel >= SHADER_LEVEL_CLOTH)
- {
- enable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
- }
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
- if (sShaderLevel >= SHADER_LEVEL_BUMP)
- {
- enable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
- }
-
sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
gGL.getTexUnit(0)->activate();
}
@@ -754,16 +737,6 @@ void LLDrawPoolAvatar::endSkinned()
sRenderingSkinned = FALSE;
sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
gGL.getTexUnit(0)->activate();
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
- if (sShaderLevel >= SHADER_LEVEL_BUMP)
- {
- disable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
- }
- if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
- {
- disable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
- }
-
sVertexProgram->unbind();
sShaderLevel = mVertexShaderLevel;
}
@@ -809,7 +782,6 @@ void LLDrawPoolAvatar::beginRiggedSimple()
{
sDiffuseChannel = 0;
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -820,7 +792,6 @@ void LLDrawPoolAvatar::endRiggedSimple()
{
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -847,7 +818,34 @@ void LLDrawPoolAvatar::endRiggedFullbrightAlpha()
void LLDrawPoolAvatar::beginRiggedGlow()
{
- beginRiggedFullbright();
+ if (sShaderLevel > 0)
+ {
+ if (LLPipeline::sUnderWaterRender)
+ {
+ sVertexProgram = &gSkinnedObjectEmissiveWaterProgram;
+ }
+ else
+ {
+ sVertexProgram = &gSkinnedObjectEmissiveProgram;
+ }
+ }
+ else
+ {
+ if (LLPipeline::sUnderWaterRender)
+ {
+ sVertexProgram = &gObjectEmissiveNonIndexedWaterProgram;
+ }
+ else
+ {
+ sVertexProgram = &gObjectEmissiveNonIndexedProgram;
+ }
+ }
+
+ if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
+ {
+ sDiffuseChannel = 0;
+ sVertexProgram->bind();
+ }
}
void LLDrawPoolAvatar::endRiggedGlow()
@@ -884,7 +882,6 @@ void LLDrawPoolAvatar::beginRiggedFullbright()
{
sDiffuseChannel = 0;
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -895,7 +892,6 @@ void LLDrawPoolAvatar::endRiggedFullbright()
{
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -928,7 +924,6 @@ void LLDrawPoolAvatar::beginRiggedShinySimple()
{
sVertexProgram->bind();
LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -940,7 +935,6 @@ void LLDrawPoolAvatar::endRiggedShinySimple()
LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -974,7 +968,6 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny()
{
sVertexProgram->bind();
LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -986,7 +979,6 @@ void LLDrawPoolAvatar::endRiggedFullbrightShiny()
LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -996,14 +988,12 @@ void LLDrawPoolAvatar::beginDeferredRiggedSimple()
sVertexProgram = &gDeferredSkinnedDiffuseProgram;
sDiffuseChannel = 0;
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
void LLDrawPoolAvatar::endDeferredRiggedSimple()
{
LLVertexBuffer::unbind();
sVertexProgram->unbind();
- LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
@@ -1013,7 +1003,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedBump()
sVertexProgram->bind();
normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
void LLDrawPoolAvatar::endDeferredRiggedBump()
@@ -1022,7 +1011,6 @@ void LLDrawPoolAvatar::endDeferredRiggedBump()
sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->unbind();
- LLVertexBuffer::sWeight4Loc = -1;
normal_channel = -1;
sDiffuseChannel = 0;
sVertexProgram = NULL;
@@ -1032,14 +1020,12 @@ void LLDrawPoolAvatar::beginDeferredSkinned()
{
sShaderLevel = mVertexShaderLevel;
sVertexProgram = &gDeferredAvatarProgram;
-
sRenderingSkinned = TRUE;
sVertexProgram->bind();
+ sVertexProgram->setAlphaRange(0.2f, 1.f);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
gGL.getTexUnit(0)->activate();
}
@@ -1047,7 +1033,6 @@ void LLDrawPoolAvatar::endDeferredSkinned()
{
// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
sRenderingSkinned = FALSE;
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
sVertexProgram->unbind();
sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -1161,10 +1146,10 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
- if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view
+ /*if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view
{
gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f));
- }
+ }*/
if (pass == 1)
{
@@ -1255,11 +1240,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
- if (sShaderLevel > 0)
- {
- gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
- }
-
if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
{
LLMatrix4 rot_mat;
@@ -1273,16 +1253,16 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
wind = wind * rot_mat;
wind.mV[VW] = avatarp->mWindVec.mV[VW];
- sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_WIND, wind.mV);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_WIND, 1, wind.mV);
F32 phase = -1.f * (avatarp->mRipplePhase);
F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f);
LLVector4 sin_params(freq, freq, freq, phase);
- sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_SINWAVE, sin_params.mV);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_SINWAVE, 1, sin_params.mV);
LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f);
gravity = gravity * rot_mat;
- sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_GRAVITY, gravity.mV);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_GRAVITY, 1, gravity.mV);
}
if( !single_avatar || (avatarp == single_avatar) )
@@ -1520,7 +1500,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
if (glow)
{
- glColor4f(0,0,0,face->getTextureEntry()->getGlow());
+ gGL.diffuseColor4f(0,0,0,face->getTextureEntry()->getGlow());
}
gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture());
@@ -1671,34 +1651,3 @@ LLVertexBufferAvatar::LLVertexBufferAvatar()
}
-void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const
-{
- if (sRenderingSkinned)
- {
- U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
-
- glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_VERTEX], (void*)(base + 0));
- glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
-
- set_vertex_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT],
- LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_WEIGHT], (F32*)(base + mOffsets[TYPE_WEIGHT]));
-
- if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP)
- {
- set_binormals(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL],
- LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_BINORMAL], (LLVector3*)(base + mOffsets[TYPE_BINORMAL]));
- }
-
- if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)
- {
- set_vertex_clothing_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING],
- LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_CLOTHWEIGHT], (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
- }
- }
- else
- {
- LLVertexBuffer::setupVertexBuffer(data_mask);
- }
-}
-
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index fcd8294af5..e0326bcfaf 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -176,6 +176,7 @@ public:
RIGGED_FULLBRIGHT_SHINY_MASK = RIGGED_SIMPLE_MASK,
RIGGED_GLOW_MASK = LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_EMISSIVE |
LLVertexBuffer::MAP_WEIGHT4,
RIGGED_ALPHA_MASK = RIGGED_SIMPLE_MASK,
RIGGED_FULLBRIGHT_ALPHA_MASK = RIGGED_FULLBRIGHT_MASK,
@@ -214,7 +215,6 @@ class LLVertexBufferAvatar : public LLVertexBuffer
{
public:
LLVertexBufferAvatar();
- virtual void setupVertexBuffer(U32 data_mask) const;
};
extern S32 AVATAR_OFFSET_POS;
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 6f71c54f79..6931ada7cd 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -762,7 +762,7 @@ void LLDrawPoolBump::renderBump(U32 pass)
LLGLDisable fog(GL_FOG);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
LLGLEnable blend(GL_BLEND);
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
/// Get rid of z-fighting with non-bump pass.
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -1.0f);
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index eec4ee6bac..80c202d4e2 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -46,7 +46,7 @@ static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass");
void LLDrawPoolGlow::beginPostDeferredPass(S32 pass)
{
- gDeferredFullbrightProgram.bind();
+ gDeferredEmissiveProgram.bind();
}
static LLFastTimer::DeclareTimer FTM_RENDER_GLOW_PUSH("Glow Push");
@@ -76,10 +76,22 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass)
void LLDrawPoolGlow::endPostDeferredPass(S32 pass)
{
- gDeferredFullbrightProgram.unbind();
+ gDeferredEmissiveProgram.unbind();
LLRenderPass::endRenderPass(pass);
}
+S32 LLDrawPoolGlow::getNumPasses()
+{
+ if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
void LLDrawPoolGlow::render(S32 pass)
{
LLFastTimer t(FTM_RENDER_GLOW);
@@ -93,39 +105,29 @@ void LLDrawPoolGlow::render(S32 pass)
U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
- if (shader_level > 0 && fullbright_shader)
- {
- fullbright_shader->bind();
- }
- else
- {
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
- }
+ //should never get here without basic shaders enabled
+ llassert(shader_level > 0);
+
+ LLGLSLShader* shader = LLPipeline::sUnderWaterRender ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram;
+ shader->bind();
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
gGL.setColorMask(false, true);
- if (shader_level > 1)
- {
- pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
- }
- else
- {
- renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
- }
+ pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
gGL.setColorMask(true, false);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (shader_level > 0 && fullbright_shader)
{
- fullbright_shader->unbind();
+ shader->unbind();
}
}
void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
{
- glColor4ubv(params.mGlowColor.mV);
+ //gGL.diffuseColor4ubv(params.mGlowColor.mV);
LLRenderPass::pushBatch(params, mask, texture, batch_textures);
}
@@ -253,6 +255,7 @@ void LLDrawPoolGrass::prerender()
void LLDrawPoolGrass::beginRenderPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_GRASS);
+ stop_glerror();
if (LLPipeline::sUnderWaterRender)
{
diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h
index 3811b3d398..bd62bc7502 100644
--- a/indra/newview/lldrawpoolsimple.h
+++ b/indra/newview/lldrawpoolsimple.h
@@ -118,7 +118,8 @@ public:
enum
{
VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_EMISSIVE
};
virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
@@ -130,6 +131,8 @@ public:
/*virtual*/ void endPostDeferredPass(S32 pass);
/*virtual*/ void renderPostDeferred(S32 pass);
+ /*virtual*/ S32 getNumPasses();
+
void render(S32 pass = 0);
void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index efffb2df9e..d1c8fa5fc9 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -84,7 +84,7 @@ void LLDrawPoolSky::render(S32 pass)
}
else if (LLGLSLShader::sNoFixedFunction)
{ //just use the UI shader (generic single texture no lighting)
- gUIProgram.bind();
+ gOneTextureNoColorProgram.bind();
}
else
{
@@ -118,7 +118,7 @@ void LLDrawPoolSky::render(S32 pass)
S32 face_count = (S32)mDrawFace.size();
LLVertexBuffer::unbind();
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
for (S32 i = 0; i < llmin(6, face_count); ++i)
{
@@ -146,7 +146,7 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side)
LLGLEnable blend(GL_BLEND);
mSkyTex[side].bindTexture(FALSE);
- glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
+ gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
face.renderIndexed();
}
}
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 3daa0f8261..8d6b31912a 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -106,6 +106,10 @@ U32 LLDrawPoolTerrain::getVertexDataMask()
{
return LLVertexBuffer::MAP_VERTEX;
}
+ else if (LLGLSLShader::sCurBoundShaderPtr)
+ {
+ return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3);
+ }
else
{
return VERTEX_DATA_MASK;
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index a6e0151114..da8e3e8b3a 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -65,17 +65,18 @@ void LLDrawPoolTree::beginRenderPass(S32 pass)
if (LLPipeline::sUnderWaterRender)
{
- shader = &gObjectAlphaMaskNonIndexedWaterProgram;
+ shader = &gTreeWaterProgram;
}
else
{
- shader = &gObjectAlphaMaskNonIndexedProgram;
+ shader = &gTreeProgram;
}
if (gPipeline.canUseVertexShaders())
{
shader->bind();
shader->setAlphaRange(0.5f, 1.f);
+ gGL.diffuseColor4f(1,1,1,1);
}
else
{
@@ -141,7 +142,7 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_TREES);
- shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram;
+ shader = &gDeferredTreeProgram;
shader->bind();
shader->setAlphaRange(0.5f, 1.f);
}
@@ -168,8 +169,8 @@ void LLDrawPoolTree::beginShadowPass(S32 pass)
glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
- gDeferredShadowAlphaMaskProgram.bind();
- gDeferredShadowAlphaMaskProgram.setAlphaRange(0.5f, 1.f);
+ gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.setAlphaRange(0.5f, 1.f);
}
void LLDrawPoolTree::renderShadow(S32 pass)
@@ -183,6 +184,7 @@ void LLDrawPoolTree::endShadowPass(S32 pass)
glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"),
gSavedSettings.getF32("RenderDeferredSpotShadowBias"));
+ gDeferredTreeShadowProgram.unbind();
}
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 31c14361b5..ae1598907b 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -219,7 +219,7 @@ void LLDrawPoolWater::render(S32 pass)
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
}
- glColor4fv(water_color.mV);
+ gGL.diffuseColor4fv(water_color.mV);
// Automatically generate texture coords for detail map
glEnable(GL_TEXTURE_GEN_S); //texture unit 1
@@ -383,7 +383,7 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
- glColor3f(1.f, 1.f, 1.f);
+ gGL.diffuseColor3f(1.f, 1.f, 1.f);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
@@ -623,8 +623,6 @@ void LLDrawPoolWater::shade()
water_color.mV[3] = 0.9f;
}
- glColor4fv(water_color.mV);
-
{
LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
LLGLDisable cullface(GL_CULL_FACE);
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 79a835fd14..e4de92490e 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -100,12 +100,12 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass )
{
sky_shader =
LLPipeline::sUnderWaterRender ?
- &gObjectSimpleWaterProgram :
+ &gObjectFullbrightNoColorWaterProgram :
&gWLSkyProgram;
cloud_shader =
LLPipeline::sUnderWaterRender ?
- &gObjectSimpleWaterProgram :
+ &gObjectFullbrightNoColorWaterProgram :
&gWLCloudProgram;
}
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index f781d5f3ff..4955b6224e 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -40,6 +40,7 @@
#include "llvertexbuffer.h"
#include "llviewerdisplay.h"
#include "llrender.h"
+#include "llglslshader.h"
// static
LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
@@ -206,6 +207,9 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
return TRUE;
}
+ LLGLSLShader::bindNoShader();
+ LLVertexBuffer::unbind();
+
BOOL result = FALSE;
BOOL ret = FALSE ;
for( S32 order = 0; order < ORDER_COUNT; order++ )
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 432e61f6d8..f5a8013f4d 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -362,8 +362,8 @@ void LLFace::setSize(S32 num_vertices, S32 num_indices, bool align)
{
if (align)
{
- //allocate vertices in blocks of 4 for alignment
- num_vertices = (num_vertices + 0x3) & ~0x3;
+ //allocate vertices in blocks of 16 for alignment
+ num_vertices = (num_vertices + 0xF) & ~0xF;
}
if (mGeomCount != num_vertices ||
@@ -503,7 +503,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
}
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
if (mDrawablep->isState(LLDrawable::RIGGED))
{
@@ -1055,6 +1055,7 @@ static LLFastTimer::DeclareTimer FTM_FACE_GEOM_POSITION("Position");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_NORMAL("Normal");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TEXTURE("Texture");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color");
+static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_BINORMAL("Binormal");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index");
@@ -1124,6 +1125,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
+ bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE);
bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL);
@@ -1758,6 +1760,44 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}
}
+ if (rebuild_emissive)
+ {
+ LLFastTimer t(FTM_FACE_GEOM_EMISSIVE);
+ LLStrider<U8> emissive;
+ mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range);
+
+ U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
+
+ LLVector4a src;
+
+
+ U32 glow32 = glow |
+ (glow << 8) |
+ (glow << 16) |
+ (glow << 24);
+
+ U32 vec[4];
+ vec[0] = vec[1] = vec[2] = vec[3] = glow32;
+
+ src.loadua((F32*) vec);
+
+ LLVector4a* dst = (LLVector4a*) emissive.get();
+ S32 num_vecs = num_vertices/16;
+ if (num_vertices%16 > 0)
+ {
+ ++num_vecs;
+ }
+
+ for (S32 i = 0; i < num_vecs; i++)
+ {
+ dst[i] = src;
+ }
+
+ if (map_range)
+ {
+ mVertexBuffer->setBuffer(0);
+ }
+ }
if (rebuild_tcoord)
{
mTexExtents[0].setVec(0,0);
@@ -2095,7 +2135,7 @@ void LLFace::renderSetColor() const
{
const LLColor4* color = &(getRenderColor());
- glColor4fv(color->mV);
+ gGL.diffuseColor4fv(color->mV);
}
}
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index b5eaeecd60..82e4ab61b7 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -329,13 +329,9 @@ public:
{
return lhs->getTexture() < rhs->getTexture();
}
- else if (lte->getBumpShinyFullbright() != rte->getBumpShinyFullbright())
- {
- return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
- }
else
{
- return lte->getGlow() < rte->getGlow();
+ return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
}
}
};
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index e4d8e3513d..dc4c15316a 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -691,7 +691,7 @@ BOOL LLImagePreviewAvatar::render()
LLVertexBuffer::unbind();
avatarp->updateLOD();
-
+
if (avatarp->mDrawable.notNull())
{
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
@@ -699,7 +699,7 @@ BOOL LLImagePreviewAvatar::render()
LLGLDisable no_blend(GL_BLEND);
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
-
+ gPipeline.enableLightsPreview();
avatarPoolp->renderAvatars(avatarp); // renders only one avatar
}
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ef846ec42e..b9838f7da2 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -3623,6 +3623,15 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
LLVertexBuffer::unbind();
+ bool no_ff = LLGLSLShader::sNoFixedFunction;
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ LLGLSLShader::sNoFixedFunction = false;
+
+ if (shader)
+ {
+ shader->unbind();
+ }
+
stop_gloderror();
static U32 cur_name = 1;
@@ -4003,6 +4012,13 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
mResourceCost = calcResourceCost();
+ LLVertexBuffer::unbind();
+ LLGLSLShader::sNoFixedFunction = no_ff;
+ if (shader)
+ {
+ shader->bind();
+ }
+
/*if (which_lod == -1 && mScene[LLModel::LOD_PHYSICS].empty())
{ //build physics scene
mScene[LLModel::LOD_PHYSICS] = mScene[LLModel::LOD_LOW];
@@ -4950,7 +4966,8 @@ BOOL LLModelPreview::render()
llassert(binding == model->mMaterialList[i]);
- glColor4fv(material.mDiffuseColor.mV);
+ gGL.diffuseColor4fv(material.mDiffuseColor.mV);
+
if (material.mDiffuseMap.notNull())
{
if (material.mDiffuseMap->getDiscardLevel() > -1)
@@ -4962,12 +4979,12 @@ BOOL LLModelPreview::render()
}
else
{
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
}
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor3f(0.4f, 0.4f, 0.4f);
+ gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
if (edges)
{
@@ -5069,11 +5086,11 @@ BOOL LLModelPreview::render()
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor4f(0.4f, 0.4f, 0.0f, 0.4f);
+ gGL.diffuseColor4f(0.4f, 0.4f, 0.0f, 0.4f);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
- glColor3f(1.f, 1.f, 0.f);
+ gGL.diffuseColor3f(1.f, 1.f, 0.f);
glLineWidth(2.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -5093,7 +5110,7 @@ BOOL LLModelPreview::render()
//show degenerate triangles
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
LLGLDisable cull(GL_CULL_FACE);
- glColor4f(1.f,0.f,0.f,1.f);
+ gGL.diffuseColor4f(1.f,0.f,0.f,1.f);
const LLVector4a scale(0.5f);
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
@@ -5258,11 +5275,12 @@ BOOL LLModelPreview::render()
const std::string& binding = instance.mModel->mMaterialList[i];
const LLImportMaterial& material = instance.mMaterial[binding];
+
buffer->setBuffer(type_mask & buffer->getTypeMask());
- glColor4fv(material.mDiffuseColor.mV);
+ gGL.diffuseColor4fv(material.mDiffuseColor.mV);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
- glColor3f(0.4f, 0.4f, 0.4f);
+ gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
if (edges)
{
diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp
index 37b7b2e75d..ec5a0926c4 100644
--- a/indra/newview/llhudeffectbeam.cpp
+++ b/indra/newview/llhudeffectbeam.cpp
@@ -295,12 +295,12 @@ void LLHUDEffectBeam::render()
F32 alpha = mFadeInterp.getCurVal()*mColor.mV[3];
alpha *= mInterpFade[i].getCurVal();
coloru.mV[3] = (U8)alpha;
- glColor4ubv(coloru.mV);
+ gGL.color4ubv(coloru.mV);
glPushMatrix();
glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
glScalef(scale, scale, scale);
- gSphere.render(0);
+ gSphere.render();
glPopMatrix();
}
}
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 85e0043651..d10f6562f7 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -466,11 +466,11 @@ void LLManip::renderXYZ(const LLVector3 &vec)
feedback_string = llformat("X: %.3f", vec.mV[VX]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);
- glColor3f(0.5f, 1.f, 0.5f);
+ gGL.diffuseColor3f(0.5f, 1.f, 0.5f);
feedback_string = llformat("Y: %.3f", vec.mV[VY]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);
- glColor3f(0.5f, 0.5f, 1.f);
+ gGL.diffuseColor3f(0.5f, 0.5f, 1.f);
feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);
}
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index f871df0c36..a9b14829b2 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1519,6 +1519,7 @@ void LLManipTranslate::renderSnapGuides()
F32 sz = mGridSizeMeters;
F32 tiles = sz;
+
glMatrixMode(GL_TEXTURE);
gGL.pushMatrix();
usc = 1.0f/usc;
@@ -1665,7 +1666,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
glStencilFunc(GL_ALWAYS, 0, stencil_mask);
gGL.setColorMask(false, false);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
//setup clip plane
normal = normal * grid_rotation;
@@ -2239,11 +2240,11 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_
break;
}
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glRotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
glScalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
- gCone.render(CONE_LOD_HIGHEST);
+ gCone.render();
gGL.popMatrix();
}
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 18d6731fcb..3ff5a05d81 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -169,7 +169,7 @@ void LLPreviewTexture::draw()
saveAs();
}
// Draw the texture
- glColor3f( 1.f, 1.f, 1.f );
+ gGL.diffuseColor3f( 1.f, 1.f, 1.f );
gl_draw_scaled_image(interior.mLeft,
interior.mBottom,
interior.getWidth(),
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 26b2b0f5c3..568c967a9a 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -89,6 +89,7 @@
#include "llvoavatarself.h"
#include "llvovolume.h"
#include "pipeline.h"
+#include "llviewershadermgr.h"
#include "llglheaders.h"
@@ -5570,8 +5571,7 @@ void pushWireframe(LLDrawable* drawable)
for (S32 i = 0; i < rigged_volume->getNumVolumeFaces(); ++i)
{
const LLVolumeFace& face = rigged_volume->getVolumeFace(i);
- glVertexPointer(3, GL_FLOAT, 16, face.mPositions);
- glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, face.mTexCoords, face.mNumIndices, face.mIndices);
}
gGL.popMatrix();
}
@@ -5584,7 +5584,7 @@ void pushWireframe(LLDrawable* drawable)
LLFace* face = drawable->getFace(i);
if (face->verify())
{
- pushVerts(face, LLVertexBuffer::MAP_VERTEX);
+ pushVerts(face, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0);
}
}
}
@@ -5604,6 +5604,13 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
return;
}
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ if (shader)
+ {
+ gHighlightProgram.bind();
+ }
+
glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix();
@@ -5627,26 +5634,41 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
{
gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
- LLGLEnable fog(GL_FOG);
- glFogi(GL_FOG_MODE, GL_LINEAR);
- float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
- LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
- glFogf(GL_FOG_START, d);
- glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV())));
- glFogfv(GL_FOG_COLOR, fogCol.mV);
-
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ if (shader)
{
- glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+ gHighlightProgram.uniform4f("highlight_color", color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
pushWireframe(drawable);
}
+ else
+ {
+ LLGLEnable fog(GL_FOG);
+ glFogi(GL_FOG_MODE, GL_LINEAR);
+ float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
+ LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
+ glFogf(GL_FOG_START, d);
+ glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV())));
+ glFogfv(GL_FOG_COLOR, fogCol.mV);
+
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ {
+ gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+ pushWireframe(drawable);
+ }
+ }
}
gGL.flush();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
- glColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+ if (shader)
+ {
+ gHighlightProgram.uniform4f("highlight_color", color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+ }
+ else
+ {
+ gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+ }
LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(3.f, 3.f);
glLineWidth(3.f);
@@ -5654,6 +5676,11 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
glLineWidth(1.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
gGL.popMatrix();
+
+ if (shader)
+ {
+ shader->bind();
+ }
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index e23b431457..3d371f7a44 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2503,7 +2503,7 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
{
params = *j;
LLRenderPass::applyModelMatrix(*params);
- glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
+ gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
params->mVertexBuffer->setBuffer(mask);
params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES,
params->mStart, params->mEnd, params->mCount, params->mOffset);
@@ -2560,11 +2560,11 @@ void renderOctree(LLSpatialGroup* group)
{
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
{
- glColor4f(0, 1, 0, group->mBuilt);
+ gGL.diffuseColor4f(0, 1, 0, group->mBuilt);
}
else if (gFrameTimeSeconds - face->mLastMoveTime < 0.5f)
{
- glColor4f(1, 0, 0, group->mBuilt);
+ gGL.diffuseColor4f(1, 0, 0, group->mBuilt);
}
else
{
@@ -2661,7 +2661,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
if (render_objects)
{
LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
- glColor4f(0, 0.5f, 0, 0.5f);
+ gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
gGL.color4f(0, 0.5f, 0, 0.5f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
}
@@ -2671,7 +2671,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
if (render_objects)
{
- glColor4f(0.f, 0.5f, 0.f,1.f);
+ gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f);
gGL.color4f(0.f, 0.5f, 0.f, 1.f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
}
@@ -2680,7 +2680,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
if (render_objects)
{
- glColor4f(0.f, 0.75f, 0.f,0.5f);
+ gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
gGL.color4f(0.f, 0.75f, 0.f, 0.5f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
}
@@ -2689,11 +2689,11 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
LLVertexBuffer::unbind();
group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
- glColor4f(1.0f, 0.f, 0.f, 0.5f);
+ gGL.diffuseColor4f(1.0f, 0.f, 0.f, 0.5f);
group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4f(1.0f, 1.f, 1.f, 1.0f);
+ gGL.diffuseColor4f(1.0f, 1.f, 1.f, 1.0f);
group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}*/
@@ -2726,23 +2726,23 @@ void renderUpdateType(LLDrawable* drawablep)
switch (vobj->getLastUpdateType())
{
case OUT_FULL:
- glColor4f(0,1,0,0.5f);
+ gGL.diffuseColor4f(0,1,0,0.5f);
break;
case OUT_TERSE_IMPROVED:
- glColor4f(0,1,1,0.5f);
+ gGL.diffuseColor4f(0,1,1,0.5f);
break;
case OUT_FULL_COMPRESSED:
if (vobj->getLastUpdateCached())
{
- glColor4f(1,0,0,0.5f);
+ gGL.diffuseColor4f(1,0,0,0.5f);
}
else
{
- glColor4f(1,1,0,0.5f);
+ gGL.diffuseColor4f(1,1,0,0.5f);
}
break;
case OUT_FULL_CACHED:
- glColor4f(0,0,1,0.5f);
+ gGL.diffuseColor4f(0,0,1,0.5f);
break;
default:
llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl;
@@ -2936,7 +2936,7 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
{
if (!decomp->mBaseHullMesh.empty())
{
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions, decomp->mBaseHullMesh.mNormals);
}
else
@@ -2956,13 +2956,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color)
{
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glPolygonOffset(3.f, 3.f);
glLineWidth(3.f);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
glLineWidth(1.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3044,11 +3044,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
else if (!decomp->mPhysicsShapeMesh.empty())
{
//decomp has physics mesh, render that mesh
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
@@ -3174,7 +3174,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::unbind();
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
@@ -3182,7 +3182,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
}
@@ -3216,7 +3216,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
volume_params.setShear ( 0, 0 );
LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
pushVerts(sphere);
LLPrimitive::sVolumeManager->unrefVolume(sphere);
}
@@ -3230,7 +3230,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
volume_params.setShear ( 0, 0 );
LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
pushVerts(cylinder);
LLPrimitive::sVolumeManager->unrefVolume(cylinder);
}
@@ -3242,10 +3242,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
pushVerts(phys_volume);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pushVerts(phys_volume);
LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
@@ -3263,10 +3263,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
LLVertexBuffer::unbind();
glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
}
@@ -3290,10 +3290,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
gGL.popMatrix();
/*{ //analytical shape, just push visual rep.
- glColor3fv(color.mV);
+ gGL.diffuseColor3fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
pushVerts(drawable, data_mask);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pushVerts(drawable, data_mask);
}*/
@@ -3335,10 +3335,10 @@ void renderPhysicsShapes(LLSpatialGroup* group)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
- glColor3f(0.2f, 0.5f, 0.3f);
+ gGL.diffuseColor3f(0.2f, 0.5f, 0.3f);
buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0);
- glColor3f(0.2f, 1.f, 0.3f);
+ gGL.diffuseColor3f(0.2f, 1.f, 0.3f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0);
}
@@ -3430,7 +3430,7 @@ void renderTextureAnim(LLDrawInfo* params)
}
LLGLEnable blend(GL_BLEND);
- glColor4f(1,1,0,0.5f);
+ gGL.diffuseColor4f(1,1,0,0.5f);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
@@ -3456,22 +3456,22 @@ void renderShadowFrusta(LLDrawInfo* params)
if (gPipeline.mShadowCamera[4].AABBInFrustum(center, size))
{
- glColor3f(1,0,0);
+ gGL.diffuseColor3f(1,0,0);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
if (gPipeline.mShadowCamera[5].AABBInFrustum(center, size))
{
- glColor3f(0,1,0);
+ gGL.diffuseColor3f(0,1,0);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
if (gPipeline.mShadowCamera[6].AABBInFrustum(center, size))
{
- glColor3f(0,0,1);
+ gGL.diffuseColor3f(0,0,1);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
if (gPipeline.mShadowCamera[7].AABBInFrustum(center, size))
{
- glColor3f(1,0,1);
+ gGL.diffuseColor3f(1,0,1);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
@@ -3489,7 +3489,7 @@ void renderLights(LLDrawable* drawablep)
if (drawablep->getNumFaces())
{
LLGLEnable blend(GL_BLEND);
- glColor4f(0,1,1,0.5f);
+ gGL.diffuseColor4f(0,1,1,0.5f);
for (S32 i = 0; i < drawablep->getNumFaces(); i++)
{
@@ -3657,7 +3657,7 @@ void renderRaycast(LLDrawable* drawablep)
{
//render face positions
LLVertexBuffer::unbind();
- glColor4f(0,1,1,0.5f);
+ gGL.diffuseColor4f(0,1,1,0.5f);
glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
}
@@ -4248,7 +4248,7 @@ public:
LLVector3 local_start = mStart;
LLVector3 local_end = mEnd;
- if (!gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
+ if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
{
return false;
}
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 54d5d36f6e..077d0fed65 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -93,7 +93,6 @@ public:
LLPointer<LLViewerTexture> mTexture;
std::vector<LLPointer<LLViewerTexture> > mTextureList;
- LLColor4U mGlowColor;
S32 mDebugColor;
const LLMatrix4* mTextureMatrix;
const LLMatrix4* mModelMatrix;
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index e8abee2fb7..87e7a57ae8 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -295,6 +295,8 @@ BOOL LLTexLayerSetBuffer::render()
BOOL success = TRUE;
+ LLVertexBuffer::unbind();
+
//hack to use fixed function when updating tex layer sets
bool no_ff = LLGLSLShader::sNoFixedFunction;
LLGLSLShader::sNoFixedFunction = false;
@@ -304,6 +306,7 @@ BOOL LLTexLayerSetBuffer::render()
success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight );
gGL.flush();
+ LLVertexBuffer::unbind();
LLGLSLShader::sNoFixedFunction = no_ff;
if(upload_now)
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 0115115a23..f4b01a6bab 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -571,7 +571,7 @@ void LLGLTexMemBar::draw()
color = (total_mem < llfloor(max_total_mem * texmem_lower_bound_scale)) ? LLColor4::green :
(total_mem < max_total_mem) ? LLColor4::yellow : LLColor4::red;
color[VALPHA] = .75f;
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
gl_rect_2d(left, top, right, bottom); // red/yellow/green
@@ -594,7 +594,7 @@ void LLGLTexMemBar::draw()
color = (bound_mem < llfloor(max_bound_mem * texmem_lower_bound_scale)) ? LLColor4::green :
(bound_mem < max_bound_mem) ? LLColor4::yellow : LLColor4::red;
color[VALPHA] = .75f;
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
gl_rect_2d(left, top, right, bottom);
#else
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index 983108391f..2ec7534025 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -506,7 +506,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.pushMatrix();
+ {
glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
@@ -559,9 +560,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
gGL.end();
}
-
- //gCylinder.render(1000);
- glPopMatrix();
+ }
+ gGL.popMatrix();
std::string text;
text = llformat( "%.0f m", to_vec.magVec());
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 77c8bb0329..2d08a27923 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -459,7 +459,10 @@ void LLViewerJointMesh::uploadJointMatrices()
}
}
stop_glerror();
- glUniform4fvARB(gAvatarMatrixParam, 45, mat);
+ if (LLGLSLShader::sCurBoundShaderPtr)
+ {
+ LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat);
+ }
stop_glerror();
}
else
@@ -512,7 +515,8 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
if (!mValid || !mMesh || !mFace || !mVisible ||
!mFace->getVertexBuffer() ||
- mMesh->getNumFaces() == 0)
+ mMesh->getNumFaces() == 0 ||
+ (LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShaderPtr == NULL))
{
return 0;
}
@@ -527,9 +531,9 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
// setup current color
//----------------------------------------------------------------
if (is_dummy)
- glColor4fv(LLVOAvatar::getDummyColor().mV);
+ gGL.diffuseColor4fv(LLVOAvatar::getDummyColor().mV);
else
- glColor4fv(mColor.mV);
+ gGL.diffuseColor4fv(mColor.mV);
stop_glerror();
@@ -547,11 +551,11 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
if (mIsTransparent)
{
- glColor4f(1.f, 1.f, 1.f, 1.f);
+ gGL.diffuseColor4f(1.f, 1.f, 1.f, 1.f);
}
else
{
- glColor4f(0.7f, 0.6f, 0.3f, 1.f);
+ gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f);
gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
}
}
@@ -582,13 +586,16 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
}
- mFace->getVertexBuffer()->setBuffer(sRenderMask);
+
+ U32 mask = sRenderMask;
U32 start = mMesh->mFaceVertexOffset;
U32 end = start + mMesh->mFaceVertexCount - 1;
U32 count = mMesh->mFaceIndexCount;
U32 offset = mMesh->mFaceIndexOffset;
+ LLVertexBuffer* buff = mFace->getVertexBuffer();
+
if (mMesh->hasWeights())
{
if ((mFace->getPool()->getVertexShaderLevel() > 0))
@@ -597,16 +604,23 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
uploadJointMatrices();
}
+ mask = mask | LLVertexBuffer::MAP_WEIGHT;
+ if (mFace->getPool()->getVertexShaderLevel() > 1)
+ {
+ mask = mask | LLVertexBuffer::MAP_CLOTHWEIGHT;
+ }
}
- mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ buff->setBuffer(mask);
+ buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
}
else
{
glPushMatrix();
LLMatrix4 jointToWorld = getWorldMatrix();
glMultMatrixf((GLfloat*)jointToWorld.mMatrix);
- mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ buff->setBuffer(mask);
+ buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
glPopMatrix();
}
gPipeline.addTrianglesDrawn(count);
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 36106752a2..ab193c7d85 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -66,6 +66,7 @@ LLGLSLShader gOcclusionProgram;
LLGLSLShader gCustomAlphaProgram;
LLGLSLShader gGlowCombineProgram;
LLGLSLShader gTwoTextureAddProgram;
+LLGLSLShader gOneTextureNoColorProgram;
//object shaders
LLGLSLShader gObjectSimpleProgram;
@@ -74,6 +75,8 @@ LLGLSLShader gObjectSimpleAlphaMaskProgram;
LLGLSLShader gObjectSimpleWaterAlphaMaskProgram;
LLGLSLShader gObjectFullbrightProgram;
LLGLSLShader gObjectFullbrightWaterProgram;
+LLGLSLShader gObjectEmissiveProgram;
+LLGLSLShader gObjectEmissiveWaterProgram;
LLGLSLShader gObjectFullbrightAlphaMaskProgram;
LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram;
LLGLSLShader gObjectFullbrightShinyProgram;
@@ -81,13 +84,21 @@ LLGLSLShader gObjectFullbrightShinyWaterProgram;
LLGLSLShader gObjectShinyProgram;
LLGLSLShader gObjectShinyWaterProgram;
LLGLSLShader gObjectBumpProgram;
+LLGLSLShader gTreeProgram;
+LLGLSLShader gTreeWaterProgram;
+LLGLSLShader gObjectFullbrightNoColorProgram;
+LLGLSLShader gObjectFullbrightNoColorWaterProgram;
LLGLSLShader gObjectSimpleNonIndexedProgram;
LLGLSLShader gObjectSimpleNonIndexedWaterProgram;
LLGLSLShader gObjectAlphaMaskNonIndexedProgram;
LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram;
+LLGLSLShader gObjectAlphaMaskNoColorProgram;
+LLGLSLShader gObjectAlphaMaskNoColorWaterProgram;
LLGLSLShader gObjectFullbrightNonIndexedProgram;
LLGLSLShader gObjectFullbrightNonIndexedWaterProgram;
+LLGLSLShader gObjectEmissiveNonIndexedProgram;
+LLGLSLShader gObjectEmissiveNonIndexedWaterProgram;
LLGLSLShader gObjectFullbrightShinyNonIndexedProgram;
LLGLSLShader gObjectFullbrightShinyNonIndexedWaterProgram;
LLGLSLShader gObjectShinyNonIndexedProgram;
@@ -96,11 +107,13 @@ LLGLSLShader gObjectShinyNonIndexedWaterProgram;
//object hardware skinning shaders
LLGLSLShader gSkinnedObjectSimpleProgram;
LLGLSLShader gSkinnedObjectFullbrightProgram;
+LLGLSLShader gSkinnedObjectEmissiveProgram;
LLGLSLShader gSkinnedObjectFullbrightShinyProgram;
LLGLSLShader gSkinnedObjectShinySimpleProgram;
LLGLSLShader gSkinnedObjectSimpleWaterProgram;
LLGLSLShader gSkinnedObjectFullbrightWaterProgram;
+LLGLSLShader gSkinnedObjectEmissiveWaterProgram;
LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram;
LLGLSLShader gSkinnedObjectShinySimpleWaterProgram;
@@ -124,6 +137,7 @@ LLGLSLShader gImpostorProgram;
LLGLSLShader gWLSkyProgram;
LLGLSLShader gWLCloudProgram;
+
// Effects Shaders
LLGLSLShader gGlowProgram;
LLGLSLShader gGlowExtractProgram;
@@ -138,12 +152,14 @@ LLGLSLShader gDeferredDiffuseProgram;
LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
LLGLSLShader gDeferredNonIndexedDiffuseProgram;
LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
+LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
LLGLSLShader gDeferredSkinnedDiffuseProgram;
LLGLSLShader gDeferredSkinnedBumpProgram;
LLGLSLShader gDeferredSkinnedAlphaProgram;
LLGLSLShader gDeferredBumpProgram;
LLGLSLShader gDeferredTerrainProgram;
LLGLSLShader gDeferredTreeProgram;
+LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredAvatarProgram;
LLGLSLShader gDeferredAvatarAlphaProgram;
LLGLSLShader gDeferredLightProgram;
@@ -160,6 +176,7 @@ LLGLSLShader gDeferredAttachmentShadowProgram;
LLGLSLShader gDeferredAlphaProgram;
LLGLSLShader gDeferredAvatarEyesProgram;
LLGLSLShader gDeferredFullbrightProgram;
+LLGLSLShader gDeferredEmissiveProgram;
LLGLSLShader gDeferredGIProgram;
LLGLSLShader gDeferredGIFinalProgram;
LLGLSLShader gDeferredPostGIProgram;
@@ -170,10 +187,6 @@ LLGLSLShader gDeferredWLCloudProgram;
LLGLSLShader gDeferredStarProgram;
LLGLSLShader gLuminanceGatherProgram;
-
-//current avatar shader parameter pointer
-GLint gAvatarMatrixParam;
-
LLViewerShaderMgr::LLViewerShaderMgr() :
mVertexShaderLevel(SHADER_COUNT, 0),
mMaxAvatarShaderLevel(0)
@@ -188,14 +201,19 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gAvatarEyeballProgram);
mShaderList.push_back(&gObjectSimpleProgram);
mShaderList.push_back(&gImpostorProgram);
+ mShaderList.push_back(&gObjectFullbrightNoColorProgram);
+ mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram);
mShaderList.push_back(&gObjectSimpleAlphaMaskProgram);
mShaderList.push_back(&gObjectBumpProgram);
mShaderList.push_back(&gUIProgram);
mShaderList.push_back(&gCustomAlphaProgram);
mShaderList.push_back(&gGlowCombineProgram);
mShaderList.push_back(&gTwoTextureAddProgram);
+ mShaderList.push_back(&gOneTextureNoColorProgram);
mShaderList.push_back(&gSolidColorProgram);
mShaderList.push_back(&gOcclusionProgram);
+ mShaderList.push_back(&gObjectEmissiveProgram);
+ mShaderList.push_back(&gObjectEmissiveWaterProgram);
mShaderList.push_back(&gObjectFullbrightProgram);
mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
mShaderList.push_back(&gObjectFullbrightShinyProgram);
@@ -204,16 +222,24 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gObjectSimpleNonIndexedWaterProgram);
mShaderList.push_back(&gObjectAlphaMaskNonIndexedProgram);
mShaderList.push_back(&gObjectAlphaMaskNonIndexedWaterProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNoColorProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram);
+ mShaderList.push_back(&gTreeProgram);
+ mShaderList.push_back(&gTreeWaterProgram);
mShaderList.push_back(&gObjectFullbrightNonIndexedProgram);
mShaderList.push_back(&gObjectFullbrightNonIndexedWaterProgram);
+ mShaderList.push_back(&gObjectEmissiveNonIndexedProgram);
+ mShaderList.push_back(&gObjectEmissiveNonIndexedWaterProgram);
mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram);
mShaderList.push_back(&gObjectFullbrightShinyNonIndexedWaterProgram);
mShaderList.push_back(&gSkinnedObjectSimpleProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightProgram);
+ mShaderList.push_back(&gSkinnedObjectEmissiveProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightShinyProgram);
mShaderList.push_back(&gSkinnedObjectShinySimpleProgram);
mShaderList.push_back(&gSkinnedObjectSimpleWaterProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightWaterProgram);
+ mShaderList.push_back(&gSkinnedObjectEmissiveWaterProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightShinyWaterProgram);
mShaderList.push_back(&gSkinnedObjectShinySimpleWaterProgram);
mShaderList.push_back(&gTerrainProgram);
@@ -234,6 +260,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
mShaderList.push_back(&gDeferredFullbrightProgram);
+ mShaderList.push_back(&gDeferredEmissiveProgram);
mShaderList.push_back(&gDeferredAvatarEyesProgram);
mShaderList.push_back(&gDeferredPostGIProgram);
mShaderList.push_back(&gDeferredEdgeProgram);
@@ -268,19 +295,24 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
{
if (mReservedAttribs.empty())
{
- mReservedAttribs.push_back("materialColor");
- mReservedAttribs.push_back("specularColor");
+ //MUST match order of enum in LLVertexBuffer.h
+ mReservedAttribs.push_back("position");
+ mReservedAttribs.push_back("normal");
+ mReservedAttribs.push_back("texcoord0");
+ mReservedAttribs.push_back("texcoord1");
+ mReservedAttribs.push_back("texcoord2");
+ mReservedAttribs.push_back("texcoord3");
+ mReservedAttribs.push_back("diffuse_color");
+ mReservedAttribs.push_back("emissive");
mReservedAttribs.push_back("binormal");
- mReservedAttribs.push_back("object_weight");
-
- mAvatarAttribs.reserve(5);
- mAvatarAttribs.push_back("weight");
- mAvatarAttribs.push_back("clothing");
- mAvatarAttribs.push_back("gWindDir");
- mAvatarAttribs.push_back("gSinWaveParams");
- mAvatarAttribs.push_back("gGravity");
+ mReservedAttribs.push_back("weight");
+ mReservedAttribs.push_back("weight4");
+ mReservedAttribs.push_back("clothing");
mAvatarUniforms.push_back("matrixPalette");
+ mAvatarUniforms.push_back("gWindDir");
+ mAvatarUniforms.push_back("gSinWaveParams");
+ mAvatarUniforms.push_back("gGravity");
mReservedUniforms.reserve(24);
mReservedUniforms.push_back("diffuseMap");
@@ -446,6 +478,7 @@ void LLViewerShaderMgr::setShaders()
mMaxAvatarShaderLevel = 0;
LLGLSLShader::sNoFixedFunction = false;
+ LLVertexBuffer::unbind();
if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")
&& gSavedSettings.getBOOL("VertexShaderEnable"))
{
@@ -637,8 +670,11 @@ void LLViewerShaderMgr::unloadShaders()
gCustomAlphaProgram.unload();
gGlowCombineProgram.unload();
gTwoTextureAddProgram.unload();
+ gOneTextureNoColorProgram.unload();
gSolidColorProgram.unload();
+ gObjectFullbrightNoColorProgram.unload();
+ gObjectFullbrightNoColorWaterProgram.unload();
gObjectSimpleProgram.unload();
gImpostorProgram.unload();
gObjectSimpleAlphaMaskProgram.unload();
@@ -647,6 +683,8 @@ void LLViewerShaderMgr::unloadShaders()
gObjectSimpleWaterAlphaMaskProgram.unload();
gObjectFullbrightProgram.unload();
gObjectFullbrightWaterProgram.unload();
+ gObjectEmissiveProgram.unload();
+ gObjectEmissiveWaterProgram.unload();
gObjectFullbrightAlphaMaskProgram.unload();
gObjectFullbrightWaterAlphaMaskProgram.unload();
@@ -659,8 +697,14 @@ void LLViewerShaderMgr::unloadShaders()
gObjectSimpleNonIndexedWaterProgram.unload();
gObjectAlphaMaskNonIndexedProgram.unload();
gObjectAlphaMaskNonIndexedWaterProgram.unload();
+ gObjectAlphaMaskNoColorProgram.unload();
+ gObjectAlphaMaskNoColorWaterProgram.unload();
gObjectFullbrightNonIndexedProgram.unload();
gObjectFullbrightNonIndexedWaterProgram.unload();
+ gObjectEmissiveNonIndexedProgram.unload();
+ gObjectEmissiveNonIndexedWaterProgram.unload();
+ gTreeProgram.unload();
+ gTreeWaterProgram.unload();
gObjectShinyNonIndexedProgram.unload();
gObjectFullbrightShinyNonIndexedProgram.unload();
@@ -669,11 +713,13 @@ void LLViewerShaderMgr::unloadShaders()
gSkinnedObjectSimpleProgram.unload();
gSkinnedObjectFullbrightProgram.unload();
+ gSkinnedObjectEmissiveProgram.unload();
gSkinnedObjectFullbrightShinyProgram.unload();
gSkinnedObjectShinySimpleProgram.unload();
gSkinnedObjectSimpleWaterProgram.unload();
gSkinnedObjectFullbrightWaterProgram.unload();
+ gSkinnedObjectEmissiveWaterProgram.unload();
gSkinnedObjectFullbrightShinyWaterProgram.unload();
gSkinnedObjectShinySimpleWaterProgram.unload();
@@ -699,6 +745,7 @@ void LLViewerShaderMgr::unloadShaders()
gDeferredDiffuseProgram.unload();
gDeferredDiffuseAlphaMaskProgram.unload();
gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
gDeferredNonIndexedDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
@@ -1055,9 +1102,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (mVertexShaderLevel[SHADER_DEFERRED] == 0)
{
gDeferredTreeProgram.unload();
+ gDeferredTreeShadowProgram.unload();
gDeferredDiffuseProgram.unload();
gDeferredDiffuseAlphaMaskProgram.unload();
gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
gDeferredNonIndexedDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
@@ -1080,6 +1129,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.unload();
gDeferredAlphaProgram.unload();
gDeferredFullbrightProgram.unload();
+ gDeferredEmissiveProgram.unload();
gDeferredAvatarEyesProgram.unload();
gDeferredPostGIProgram.unload();
gDeferredEdgeProgram.unload();
@@ -1132,6 +1182,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
}
+
+ if (success)
+ {
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader";
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.clear();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -1205,6 +1265,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredTreeShadowProgram.mName = "Deferred Tree Shadow Shader";
+ gDeferredTreeShadowProgram.mShaderFiles.clear();
+ gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredTreeShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredTreeShadowProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gDeferredImpostorProgram.mName = "Deferred Impostor Shader";
gDeferredImpostorProgram.mShaderFiles.clear();
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1407,6 +1477,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredEmissiveProgram.mName = "Deferred Emissive Shader";
+ gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredEmissiveProgram.mFeatures.hasGamma = true;
+ gDeferredEmissiveProgram.mFeatures.hasTransport = true;
+ gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+ gDeferredEmissiveProgram.mShaderFiles.clear();
+ gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredEmissiveProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
// load water shader
gDeferredWaterProgram.mName = "Deferred Water Shader";
gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true;
@@ -1475,7 +1559,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarShadowProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gDeferredAvatarShadowProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -1507,7 +1591,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gDeferredAvatarProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -1522,9 +1606,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
gDeferredAvatarAlphaProgram.mShaderFiles.clear();
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -1680,12 +1764,16 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectFullbrightShinyProgram.unload();
gObjectFullbrightShinyWaterProgram.unload();
gObjectShinyWaterProgram.unload();
+ gObjectFullbrightNoColorProgram.unload();
+ gObjectFullbrightNoColorWaterProgram.unload();
gObjectSimpleProgram.unload();
gImpostorProgram.unload();
gObjectSimpleAlphaMaskProgram.unload();
gObjectBumpProgram.unload();
gObjectSimpleWaterProgram.unload();
gObjectSimpleWaterAlphaMaskProgram.unload();
+ gObjectEmissiveProgram.unload();
+ gObjectEmissiveWaterProgram.unload();
gObjectFullbrightProgram.unload();
gObjectFullbrightAlphaMaskProgram.unload();
gObjectFullbrightWaterProgram.unload();
@@ -1698,16 +1786,24 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectSimpleNonIndexedWaterProgram.unload();
gObjectAlphaMaskNonIndexedProgram.unload();
gObjectAlphaMaskNonIndexedWaterProgram.unload();
+ gObjectAlphaMaskNoColorProgram.unload();
+ gObjectAlphaMaskNoColorWaterProgram.unload();
gObjectFullbrightNonIndexedProgram.unload();
gObjectFullbrightNonIndexedWaterProgram.unload();
+ gObjectEmissiveNonIndexedProgram.unload();
+ gObjectEmissiveNonIndexedWaterProgram.unload();
gSkinnedObjectSimpleProgram.unload();
gSkinnedObjectFullbrightProgram.unload();
+ gSkinnedObjectEmissiveProgram.unload();
gSkinnedObjectFullbrightShinyProgram.unload();
gSkinnedObjectShinySimpleProgram.unload();
gSkinnedObjectSimpleWaterProgram.unload();
gSkinnedObjectFullbrightWaterProgram.unload();
+ gSkinnedObjectEmissiveWaterProgram.unload();
gSkinnedObjectFullbrightShinyWaterProgram.unload();
gSkinnedObjectShinySimpleWaterProgram.unload();
+ gTreeProgram.unload();
+ gTreeWaterProgram.unload();
return TRUE;
}
@@ -1756,7 +1852,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectAlphaMaskNonIndexedProgram.mFeatures.disableTextureIndex = true;
gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAlphaMask = true;
gObjectAlphaMaskNonIndexedProgram.mShaderFiles.clear();
- gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB));
gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
gObjectAlphaMaskNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
success = gObjectAlphaMaskNonIndexedProgram.createShader(NULL, NULL);
@@ -1773,7 +1869,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAlphaMask = true;
gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.clear();
- gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB));
gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
gObjectAlphaMaskNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
gObjectAlphaMaskNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
@@ -1782,6 +1878,76 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader";
+ gObjectAlphaMaskNoColorProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectAlphaMaskNoColorWaterProgram.mName = "No color alpha mask Water Shader";
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectAlphaMaskNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectAlphaMaskNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectAlphaMaskNoColorWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gTreeProgram.mName = "Tree Shader";
+ gTreeProgram.mFeatures.calculatesLighting = true;
+ gTreeProgram.mFeatures.calculatesAtmospherics = true;
+ gTreeProgram.mFeatures.hasGamma = true;
+ gTreeProgram.mFeatures.hasAtmospherics = true;
+ gTreeProgram.mFeatures.hasLighting = true;
+ gTreeProgram.mFeatures.disableTextureIndex = true;
+ gTreeProgram.mFeatures.hasAlphaMask = true;
+ gTreeProgram.mShaderFiles.clear();
+ gTreeProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB));
+ gTreeProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gTreeProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gTreeProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gTreeWaterProgram.mName = "Tree Water Shader";
+ gTreeWaterProgram.mFeatures.calculatesLighting = true;
+ gTreeWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gTreeWaterProgram.mFeatures.hasWaterFog = true;
+ gTreeWaterProgram.mFeatures.hasAtmospherics = true;
+ gTreeWaterProgram.mFeatures.hasLighting = true;
+ gTreeWaterProgram.mFeatures.disableTextureIndex = true;
+ gTreeWaterProgram.mFeatures.hasAlphaMask = true;
+ gTreeWaterProgram.mShaderFiles.clear();
+ gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB));
+ gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gTreeWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gTreeWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gTreeWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectFullbrightNonIndexedProgram.mName = "Non Indexed Fullbright Shader";
gObjectFullbrightNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
gObjectFullbrightNonIndexedProgram.mFeatures.hasGamma = true;
@@ -1813,6 +1979,68 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectEmissiveNonIndexedProgram.mName = "Non Indexed Emissive Shader";
+ gObjectEmissiveNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.hasGamma = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.disableTextureIndex = true;
+ gObjectEmissiveNonIndexedProgram.mShaderFiles.clear();
+ gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectEmissiveNonIndexedProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectEmissiveNonIndexedWaterProgram.mName = "Non Indexed Emissive Water Shader";
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.clear();
+ gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectEmissiveNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectEmissiveNonIndexedWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightNoColorProgram.mName = "Non Indexed no color Fullbright Shader";
+ gObjectFullbrightNoColorProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightNoColorProgram.mFeatures.hasGamma = true;
+ gObjectFullbrightNoColorProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightNoColorProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightNoColorProgram.mFeatures.disableTextureIndex = true;
+ gObjectFullbrightNoColorProgram.mShaderFiles.clear();
+ gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectFullbrightNoColorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightNoColorWaterProgram.mName = "Non Indexed no color Fullbright Water Shader";
+ gObjectFullbrightNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectFullbrightNoColorWaterProgram.mShaderFiles.clear();
+ gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectFullbrightNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectFullbrightNoColorWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectShinyNonIndexedProgram.mName = "Non Indexed Shiny Shader";
gObjectShinyNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
gObjectShinyNonIndexedProgram.mFeatures.calculatesLighting = true;
@@ -1907,19 +2135,19 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
- gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
- gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
- gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
- gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
- gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
- gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
- success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
+ gObjectSimpleWaterProgram.mName = "Simple Water Shader";
+ gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
+ gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectSimpleWaterProgram.mShaderFiles.clear();
+ gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
}
if (success)
@@ -1938,23 +2166,24 @@ BOOL LLViewerShaderMgr::loadShadersObject()
success = gObjectBumpProgram.createShader(NULL, NULL);
}
+
if (success)
{
- gObjectSimpleWaterProgram.mName = "Simple Water Shader";
- gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
- gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
- gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
- gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
- gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
- gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0;
- gObjectSimpleWaterProgram.mShaderFiles.clear();
- gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
- gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
- gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
- gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
+ gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
+ gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
}
-
+
if (success)
{
gObjectSimpleWaterAlphaMaskProgram.mName = "Simple Water Alpha Mask Shader";
@@ -2006,6 +2235,37 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectEmissiveProgram.mName = "Emissive Shader";
+ gObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveProgram.mFeatures.hasGamma = true;
+ gObjectEmissiveProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectEmissiveProgram.mShaderFiles.clear();
+ gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectEmissiveProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectEmissiveWaterProgram.mName = "Emissive Water Shader";
+ gObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveWaterProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectEmissiveWaterProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectEmissiveWaterProgram.mShaderFiles.clear();
+ gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectEmissiveWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectEmissiveWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectFullbrightAlphaMaskProgram.mName = "Fullbright Alpha Mask Shader";
gObjectFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
gObjectFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
@@ -2141,6 +2401,39 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gSkinnedObjectEmissiveProgram.mName = "Skinned Emissive Shader";
+ gSkinnedObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.hasGamma = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.hasTransport = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.isFullbright = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.hasObjectSkinning = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.disableTextureIndex = true;
+ gSkinnedObjectEmissiveProgram.mShaderFiles.clear();
+ gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
+ gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gSkinnedObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gSkinnedObjectEmissiveProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gSkinnedObjectEmissiveWaterProgram.mName = "Skinned Emissive Water Shader";
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasGamma = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasTransport = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.isFullbright = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasObjectSkinning = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.disableTextureIndex = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true;
+ gSkinnedObjectEmissiveWaterProgram.mShaderFiles.clear();
+ gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
+ gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gSkinnedObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gSkinnedObjectEmissiveWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gSkinnedObjectFullbrightShinyProgram.mName = "Skinned Fullbright Shiny Shader";
gSkinnedObjectFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true;
gSkinnedObjectFullbrightShinyProgram.mFeatures.hasGamma = true;
@@ -2287,7 +2580,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
- success = gAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gAvatarProgram.createShader(NULL, &mAvatarUniforms);
if (success)
{
@@ -2306,7 +2599,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
// Note: no cloth under water:
gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1);
gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- success = gAvatarWaterProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gAvatarWaterProgram.createShader(NULL, &mAvatarUniforms);
}
/// Keep track of avatar levels
@@ -2325,7 +2618,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB));
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
- success = gAvatarPickProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gAvatarPickProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -2431,6 +2724,21 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
+ gOneTextureNoColorProgram.mName = "One Texture No Color Shader";
+ gOneTextureNoColorProgram.mShaderFiles.clear();
+ gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB));
+ gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gOneTextureNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gOneTextureNoColorProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gOneTextureNoColorProgram.bind();
+ gOneTextureNoColorProgram.uniform1i("tex0", 0);
+ }
+ }
+
+ if (success)
+ {
gSolidColorProgram.mName = "Solid Color Shader";
gSolidColorProgram.mShaderFiles.clear();
gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER_ARB));
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index d4040f11e1..270c05b669 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -71,15 +71,6 @@ public:
SHADER_COUNT
};
- typedef enum
- {
- MATERIAL_COLOR = 0,
- SPECULAR_COLOR,
- BINORMAL,
- OBJECT_WEIGHT,
- END_RESERVED_ATTRIBS
- } eGLSLReservedAttribs;
-
typedef enum
{
DIFFUSE_MAP = 0,
@@ -186,16 +177,10 @@ public:
typedef enum
{
- AVATAR_WEIGHT = END_RESERVED_ATTRIBS,
- AVATAR_CLOTHING,
+ AVATAR_MATRIX = END_RESERVED_UNIFORMS,
AVATAR_WIND,
AVATAR_SINWAVE,
- AVATAR_GRAVITY
- } eAvatarAttribs;
-
- typedef enum
- {
- AVATAR_MATRIX = END_RESERVED_UNIFORMS
+ AVATAR_GRAVITY,
} eAvatarUniforms;
// simple model of forward iterator
@@ -265,9 +250,6 @@ private:
std::vector<std::string> mGlowExtractUniforms;
- //avatar shader parameter tables
- std::vector<std::string> mAvatarAttribs;
-
std::vector<std::string> mAvatarUniforms;
// the list of shaders we need to propagate parameters to.
@@ -294,7 +276,9 @@ extern LLGLSLShader gGlowCombineProgram;
//output tex0[tc0] + tex1[tc1]
extern LLGLSLShader gTwoTextureAddProgram;
-
+
+extern LLGLSLShader gOneTextureNoColorProgram;
+
//object shaders
extern LLGLSLShader gObjectSimpleProgram;
extern LLGLSLShader gObjectSimpleAlphaMaskProgram;
@@ -304,13 +288,23 @@ extern LLGLSLShader gObjectSimpleNonIndexedProgram;
extern LLGLSLShader gObjectSimpleNonIndexedWaterProgram;
extern LLGLSLShader gObjectAlphaMaskNonIndexedProgram;
extern LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram;
+extern LLGLSLShader gObjectAlphaMaskNoColorProgram;
+extern LLGLSLShader gObjectAlphaMaskNoColorWaterProgram;
extern LLGLSLShader gObjectFullbrightProgram;
extern LLGLSLShader gObjectFullbrightWaterProgram;
+extern LLGLSLShader gObjectFullbrightNoColorProgram;
+extern LLGLSLShader gObjectFullbrightNoColorWaterProgram;
+extern LLGLSLShader gObjectEmissiveProgram;
+extern LLGLSLShader gObjectEmissiveWaterProgram;
extern LLGLSLShader gObjectFullbrightAlphaMaskProgram;
extern LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram;
extern LLGLSLShader gObjectFullbrightNonIndexedProgram;
extern LLGLSLShader gObjectFullbrightNonIndexedWaterProgram;
+extern LLGLSLShader gObjectEmissiveNonIndexedProgram;
+extern LLGLSLShader gObjectEmissiveNonIndexedWaterProgram;
extern LLGLSLShader gObjectBumpProgram;
+extern LLGLSLShader gTreeProgram;
+extern LLGLSLShader gTreeWaterProgram;
extern LLGLSLShader gObjectSimpleLODProgram;
extern LLGLSLShader gObjectFullbrightLODProgram;
@@ -327,11 +321,13 @@ extern LLGLSLShader gObjectShinyNonIndexedWaterProgram;
extern LLGLSLShader gSkinnedObjectSimpleProgram;
extern LLGLSLShader gSkinnedObjectFullbrightProgram;
+extern LLGLSLShader gSkinnedObjectEmissiveProgram;
extern LLGLSLShader gSkinnedObjectFullbrightShinyProgram;
extern LLGLSLShader gSkinnedObjectShinySimpleProgram;
extern LLGLSLShader gSkinnedObjectSimpleWaterProgram;
extern LLGLSLShader gSkinnedObjectFullbrightWaterProgram;
+extern LLGLSLShader gSkinnedObjectEmissiveWaterProgram;
extern LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram;
extern LLGLSLShader gSkinnedObjectShinySimpleWaterProgram;
@@ -368,6 +364,7 @@ extern LLGLSLShader gDeferredWaterProgram;
extern LLGLSLShader gDeferredDiffuseProgram;
extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
+extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedBumpProgram;
@@ -375,6 +372,7 @@ extern LLGLSLShader gDeferredSkinnedAlphaProgram;
extern LLGLSLShader gDeferredBumpProgram;
extern LLGLSLShader gDeferredTerrainProgram;
extern LLGLSLShader gDeferredTreeProgram;
+extern LLGLSLShader gDeferredTreeShadowProgram;
extern LLGLSLShader gDeferredLightProgram;
extern LLGLSLShader gDeferredMultiLightProgram;
extern LLGLSLShader gDeferredSpotLightProgram;
@@ -394,6 +392,7 @@ extern LLGLSLShader gDeferredAvatarShadowProgram;
extern LLGLSLShader gDeferredAttachmentShadowProgram;
extern LLGLSLShader gDeferredAlphaProgram;
extern LLGLSLShader gDeferredFullbrightProgram;
+extern LLGLSLShader gDeferredEmissiveProgram;
extern LLGLSLShader gDeferredAvatarEyesProgram;
extern LLGLSLShader gDeferredAvatarAlphaProgram;
extern LLGLSLShader gDeferredWLSkyProgram;
@@ -401,8 +400,5 @@ extern LLGLSLShader gDeferredWLCloudProgram;
extern LLGLSLShader gDeferredStarProgram;
extern LLGLSLShader gLuminanceGatherProgram;
-//current avatar shader parameter pointer
-extern GLint gAvatarMatrixParam;
-
#endif
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 8d4f9b346f..9f66c074fd 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1720,10 +1720,7 @@ void LLViewerWindow::initGLDefaults()
glCullFace(GL_BACK);
// RN: Need this for translation and stretch manip.
- gCone.prerender();
gBox.prerender();
- gSphere.prerender();
- gCylinder.prerender();
}
struct MainPanel : public LLPanel
@@ -2233,6 +2230,10 @@ void LLViewerWindow::drawDebugText()
gGL.color4f(1,1,1,1);
gGL.pushMatrix();
gGL.pushUIMatrix();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
{
// scale view by UI global scale factor and aspect ratio correction factor
gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
@@ -2242,6 +2243,10 @@ void LLViewerWindow::drawDebugText()
gGL.popMatrix();
gGL.flush();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
}
void LLViewerWindow::draw()
@@ -3441,26 +3446,26 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
if (drawable && drawable->isLight())
{
LLVOVolume* vovolume = drawable->getVOVolume();
- glPushMatrix();
+ gGL.pushMatrix();
LLVector3 center = drawable->getPositionAgent();
- glTranslatef(center[0], center[1], center[2]);
+ gGL.translatef(center[0], center[1], center[2]);
F32 scale = vovolume->getLightRadius();
- glScalef(scale, scale, scale);
+ gGL.scalef(scale, scale, scale);
LLColor4 color(vovolume->getLightColor(), .5f);
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
F32 pixel_area = 100000.f;
// Render Outside
- gSphere.render(pixel_area);
+ gSphere.render();
// Render Inside
glCullFace(GL_FRONT);
- gSphere.render(pixel_area);
+ gSphere.render();
glCullFace(GL_BACK);
- glPopMatrix();
+ gGL.popMatrix();
}
return true;
}
@@ -4635,10 +4640,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
gPipeline.destroyGL();
}
- gCone.cleanupGL();
gBox.cleanupGL();
- gSphere.cleanupGL();
- gCylinder.cleanupGL();
if(gPostProcess)
{
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index 510525259f..7e00350926 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -59,6 +59,12 @@ public:
// virtual
void setupVertexBuffer(U32 data_mask) const
{
+ if (LLGLSLShader::sNoFixedFunction)
+ { //just use default if shaders are in play
+ LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3));
+ return;
+ }
+
U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
//assume tex coords 2 and 3 are present
@@ -106,20 +112,6 @@ public:
glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
}
- if (data_mask & MAP_WEIGHT)
- {
- glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT]));
- }
-
- if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1)
- {
- glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4]));
- }
-
- if (data_mask & MAP_CLOTHWEIGHT)
- {
- glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
- }
if (data_mask & MAP_VERTEX)
{
glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index eb3ed3c379..a1fbdfbbe1 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3836,8 +3836,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
}
- U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
-
if (idx >= 0 &&
draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
@@ -3846,7 +3844,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
#endif
- draw_vec[idx]->mGlowColor.mV[3] == glow &&
draw_vec[idx]->mFullbright == fullbright &&
draw_vec[idx]->mBump == bump &&
draw_vec[idx]->mTextureMatrix == tex_mat &&
@@ -3878,7 +3875,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec.push_back(draw_info);
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
- draw_info->mGlowColor.setVec(0,0,0,glow);
if (type == LLRenderPass::PASS_ALPHA)
{ //for alpha sorting
facep->setDrawInfo(draw_info);
@@ -3978,6 +3974,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 cur_total = 0;
+ bool emissive = false;
+
//get all the faces into a list
for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
{
@@ -4189,6 +4187,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
+
if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
{
facep->clearVertexBuffer();
@@ -4202,6 +4201,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLTextureEntry* te = facep->getTextureEntry();
LLViewerTexture* tex = facep->getTexture();
+ if (te->getGlow() >= 1.f/255.f)
+ {
+ emissive = true;
+ }
+
if (facep->isState(LLFace::TEXTURE_ANIM))
{
if (!vobj->mTexAnimMode)
@@ -4318,6 +4322,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
+ if (emissive)
+ { //emissive faces are present, include emissive byte to preserve batching
+ simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
+ alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
+ bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
+ fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
+ }
+
bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
if (batch_textures)
@@ -4461,10 +4473,6 @@ struct CompareBatchBreakerModified
{
return lte->getFullbright() < rte->getFullbright();
}
- else if (lte->getGlow() != rte->getGlow())
- {
- return lte->getGlow() < rte->getGlow();
- }
else
{
return lhs->getTexture() < rhs->getTexture();
diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp
index 02d914a812..22fba90f65 100644
--- a/indra/newview/llwlparamset.cpp
+++ b/indra/newview/llwlparamset.cpp
@@ -91,8 +91,9 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset;
val.mV[2] = (F32) i->second[2].asReal();
val.mV[3] = (F32) i->second[3].asReal();
-
- shader->uniform4fv(param, 1, val.mV);
+ stop_glerror();
+ shader->uniform4fv(param, 1, val.mV);
+ stop_glerror();
}
else // param is the uniform name
{
@@ -118,8 +119,9 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
{
val.mV[0] = i->second.asBoolean();
}
-
+ stop_glerror();
shader->uniform4fv(param, 1, val.mV);
+ stop_glerror();
}
}
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 01ff1bb16f..f6d021fda8 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -138,7 +138,7 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10;
const U32 REFLECTION_MAP_RES = 128;
-
+const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
// Max number of occluders to search for. JC
const S32 MAX_OCCLUDER_COUNT = 2;
@@ -457,6 +457,8 @@ void LLPipeline::init()
mSpotLightFade[i] = 1.f;
}
+ mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
+ mDeferredVB->allocateBuffer(8, 0, true);
setLightingDetail(-1);
}
@@ -535,6 +537,8 @@ void LLPipeline::cleanup()
mMovedBridge.clear();
mInitialized = FALSE;
+
+ mDeferredVB = NULL;
}
//============================================================================
@@ -3490,7 +3494,7 @@ void LLPipeline::renderHighlights()
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightProgram.bind();
- gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,1,1,0.5f);
+ gHighlightProgram.uniform4f("highlight_color",1,1,1,0.5f);
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
@@ -3522,7 +3526,7 @@ void LLPipeline::renderHighlights()
color.setVec(1.f, 0.f, 0.f, 0.5f);
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
- gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,0,0,0.5f);
+ gHighlightProgram.uniform4f("highlight_color",1,0,0,0.5f);
}
int count = mHighlightFaces.size();
for (S32 i = 0; i < count; i++)
@@ -6926,6 +6930,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
shader.uniform1f("lum_scale", gSavedSettings.getF32("RenderLuminanceScale"));
shader.uniform1f("sun_lum_scale", gSavedSettings.getF32("RenderSunLuminanceScale"));
shader.uniform1f("sun_lum_offset", gSavedSettings.getF32("RenderSunLuminanceOffset"));
+ shader.uniform3fv("sun_dir", 1, mTransformedSunDir.mV);
shader.uniform1f("lum_lod", gSavedSettings.getF32("RenderLuminanceDetail"));
shader.uniform1f("gi_range", gSavedSettings.getF32("RenderGIRange"));
shader.uniform1f("gi_brightness", gSavedSettings.getF32("RenderGIBrightness"));
@@ -7000,21 +7005,23 @@ void LLPipeline::renderDeferredLighting()
glh::matrix4f mat = glh_copy_matrix(gGLModelView);
- F32 vert[] =
- {
- -1,1,
- -1,-3,
- 3,1,
- };
- glVertexPointer(2, GL_FLOAT, 0, vert);
- glColor3f(1,1,1);
+ LLStrider<LLVector3> vert;
+ mDeferredVB->getVertexStrider(vert);
+ LLStrider<LLVector2> tc0;
+ LLStrider<LLVector2> tc1;
+ mDeferredVB->getTexCoord0Strider(tc0);
+ mDeferredVB->getTexCoord1Strider(tc1);
+ vert[0].set(-1,1,0);
+ vert[1].set(-1,-3,0);
+ vert[2].set(3,1,0);
+
{
setupHWLights(NULL); //to set mSunDir;
LLVector4 dir(mSunDir, 0.f);
glh::vec4f tc(dir.mV);
mat.mult_matrix_vec(tc);
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0);
+ mTransformedSunDir.set(tc.v);
}
glPushMatrix();
@@ -7029,7 +7036,7 @@ void LLPipeline::renderDeferredLighting()
{ //paint shadow/SSAO light map (direct lighting lightmap)
LLFastTimer ftm(FTM_SUN_SHADOW);
bindDeferredShader(gDeferredSunProgram, 0);
-
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
glClearColor(1,1,1,1);
mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
@@ -7060,7 +7067,7 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
@@ -7084,7 +7091,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredEdgeProgram.bind();
mEdgeMap.bindTarget();
bindDeferredShader(gDeferredEdgeProgram);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
unbindDeferredShader(gDeferredEdgeProgram);
mEdgeMap.flush();
}
@@ -7106,7 +7114,8 @@ void LLPipeline::renderDeferredLighting()
gLuminanceGatherProgram.uniform2f("screen_res", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight());
mLuminanceMap.bindTarget();
bindDeferredShader(gLuminanceGatherProgram);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
unbindDeferredShader(gLuminanceGatherProgram);
mLuminanceMap.flush();
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true);
@@ -7124,7 +7133,8 @@ void LLPipeline::renderDeferredLighting()
mGIMapPost[0].bindTarget();
bindDeferredShader(gDeferredGIProgram, 0, &mGIMap, 0, mTrueNoiseMap);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
unbindDeferredShader(gDeferredGIProgram);
mGIMapPost[0].flush();
}
@@ -7149,7 +7159,8 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_FALSE);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
@@ -7164,7 +7175,8 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_FALSE);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mGIMapPost[0].flush();
@@ -7178,13 +7190,12 @@ void LLPipeline::renderDeferredLighting()
LLFastTimer ftm(FTM_SOFTEN_SHADOW);
//blur lightmap
mDeferredLight[1].bindTarget();
-
glClearColor(1,1,1,1);
mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
bindDeferredShader(gDeferredBlurLightProgram);
-
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian");
const U32 kern_length = 4;
F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize");
@@ -7212,7 +7223,7 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
@@ -7220,6 +7231,7 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(gDeferredBlurLightProgram);
bindDeferredShader(gDeferredBlurLightProgram, 1);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
mDeferredLight[0].bindTarget();
gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f);
@@ -7228,7 +7240,7 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mDeferredLight[0].flush();
@@ -7278,10 +7290,10 @@ void LLPipeline::renderDeferredLighting()
glPushMatrix();
glLoadIdentity();
- glVertexPointer(2, GL_FLOAT, 0, vert);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
@@ -7290,7 +7302,7 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(gDeferredSoftenProgram);
}
- { //render sky
+ { //render non-deferred geometry (fullbright, alpha, etc)
LLGLDisable blend(GL_BLEND);
LLGLDisable stencil(GL_STENCIL_TEST);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -7331,12 +7343,12 @@ void LLPipeline::renderDeferredLighting()
std::list<LLVector4> light_colors;
LLVertexBuffer::unbind();
+ LLVector4a* v = (LLVector4a*) vert.get();
- F32 v[24];
- glVertexPointer(3, GL_FLOAT, 0, v);
-
{
bindDeferredShader(gDeferredLightProgram);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter)
{
@@ -7391,15 +7403,15 @@ void LLPipeline::renderDeferredLighting()
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
//meaning negative facing
- v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000
- v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001
- v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010
- v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011
+ v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000
+ v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001
+ v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010
+ v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011
- v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100
- v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101
- v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110
- v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111
+ v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100
+ v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101
+ v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110
+ v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111
if (camera->getOrigin().mV[0] > c[0] + s + 0.2f ||
camera->getOrigin().mV[0] < c[0] - s - 0.2f ||
@@ -7418,8 +7430,12 @@ void LLPipeline::renderDeferredLighting()
}
LLFastTimer ftm(FTM_LOCAL_LIGHTS);
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
- glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+ //glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
+ gDeferredLightProgram.uniform3fv("center", 1, tc.v);
+ gDeferredLightProgram.uniform1f("size", s*s);
+ gDeferredLightProgram.uniform3fv("color", 1, col.mV);
+ gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
+ //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
stop_glerror();
@@ -7446,6 +7462,8 @@ void LLPipeline::renderDeferredLighting()
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
bindDeferredShader(gDeferredSpotLightProgram);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter)
@@ -7474,18 +7492,20 @@ void LLPipeline::renderDeferredLighting()
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
//meaning negative facing
- v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000
- v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001
- v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010
- v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011
+ v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000
+ v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001
+ v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010
+ v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011
- v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100
- v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101
- v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110
- v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111
-
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
- glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+ v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100
+ v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101
+ v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110
+ v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111
+
+ gDeferredSpotLightProgram.uniform3fv("center", 1, tc.v);
+ gDeferredSpotLightProgram.uniform1f("size", s*s);
+ gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV);
+ gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
}
@@ -7493,9 +7513,16 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(gDeferredSpotLightProgram);
}
+ //reset mDeferredVB to fullscreen triangle
+ vert[0].set(-1,1,0);
+ vert[1].set(-1,-3,0);
+ vert[2].set(3,1,0);
+
{
bindDeferredShader(gDeferredMultiLightProgram);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
LLGLDepthTest depth(GL_FALSE);
//full screen blit
@@ -7511,7 +7538,7 @@ void LLPipeline::renderDeferredLighting()
LLVector4 light[max_count];
LLVector4 col[max_count];
- glVertexPointer(2, GL_FLOAT, 0, vert);
+// glVertexPointer(2, GL_FLOAT, 0, vert);
F32 far_z = 0.f;
@@ -7534,7 +7561,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiLightProgram.uniform1f("far_z", far_z);
far_z = 0.f;
count = 0;
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
}
@@ -7544,6 +7572,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter)
{
LLFastTimer ftm(FTM_PROJECTORS);
@@ -7565,9 +7595,11 @@ void LLPipeline::renderDeferredLighting()
LLColor3 col = volume->getLightColor();
col *= volume->getLightIntensity();
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
- glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ gDeferredMultiSpotLightProgram.uniform3fv("center", 1, tc.v);
+ gDeferredMultiSpotLightProgram.uniform1f("size", s*s);
+ gDeferredMultiSpotLightProgram.uniform3fv("color", 1, col.mV);
+ gDeferredMultiSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
@@ -7600,11 +7632,11 @@ void LLPipeline::renderDeferredLighting()
bindDeferredShader(gDeferredPostProgram, 0, &mGIMapPost[0]);
gDeferredPostProgram.bind();
-
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
LLVertexBuffer::unbind();
- glVertexPointer(2, GL_FLOAT, 0, vert);
- glColor3f(1,1,1);
+// glVertexPointer(2, GL_FLOAT, 0, vert);
+ gGL.diffuseColor3f(1,1,1);
glPushMatrix();
glLoadIdentity();
@@ -7612,8 +7644,8 @@ void LLPipeline::renderDeferredLighting()
glPushMatrix();
glLoadIdentity();
- glDrawArrays(GL_TRIANGLES, 0, 3);
-
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
@@ -8240,7 +8272,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
stop_glerror();
@@ -8284,12 +8316,14 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gDeferredShadowAlphaMaskProgram.bind();
gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f);
renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE);
- glColor4f(1,1,1,1);
+ gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.setAlphaRange(0.6f, 1.f);
renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
}
//glCullFace(GL_BACK);
+ gDeferredShadowProgram.bind();
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
doOcclusion(shadow_cam);
@@ -9666,6 +9700,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
static const F32 clip_plane = 0.99999f;
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
gGL.color4ub(64,64,64,255);
gGL.begin(LLRender::QUADS);
gGL.vertex3f(-1, -1, clip_plane);
@@ -9675,6 +9714,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.end();
gGL.flush();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
+
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 28e6526acd..61ab84588d 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -536,6 +536,9 @@ public:
LLRenderTarget mHighlight;
LLRenderTarget mPhysicsDisplay;
+ //utility buffer for rendering post effects, gets abused by renderDeferredLighting
+ LLPointer<LLVertexBuffer> mDeferredVB;
+
//sun shadow map
LLRenderTarget mShadow[6];
std::vector<LLVector3> mShadowFrustPoints[4];
@@ -581,6 +584,7 @@ public:
LLColor4 mSunDiffuse;
LLVector3 mSunDir;
+ LLVector3 mTransformedSunDir;
BOOL mInitialized;
BOOL mVertexShadersEnabled;