summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llglslshader.cpp4
-rw-r--r--indra/llrender/llglslshader.h3
-rw-r--r--indra/llrender/llrender.cpp106
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/giV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/debugV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/uiV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewV.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinyV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/treeV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/blurV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/environment/terrainV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/shinyV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl6
-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.glsl5
-rw-r--r--indra/newview/llviewershadermgr.cpp2
96 files changed, 847 insertions, 297 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 61648e527d..95ce227171 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -76,6 +76,10 @@ hasAlphaMask(false)
LLGLSLShader::LLGLSLShader()
: mProgramObject(0), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE)
{
+ for (U32 i = 0; i < LLRender::NUM_MATRIX_MODES; ++i)
+ {
+ mMatHash[i] = 0xFFFFFFFF;
+ }
}
void LLGLSLShader::unload()
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 558ea66b50..c1765e2701 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -117,7 +117,6 @@ public:
GLint getAttribLocation(U32 attrib);
GLint mapUniformTextureChannel(GLint location, GLenum type);
-
//enable/disable texture channel for specified uniform
//if given texture uniform is active in the shader,
//the corresponding channel will be active upon return
@@ -132,6 +131,8 @@ public:
// Unbinds any previously bound shader by explicitly binding no shader.
static void bindNoShader(void);
+ U32 mMatHash[LLRender::NUM_MATRIX_MODES];
+
GLhandleARB mProgramObject;
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 27d25c0d3a..359e6fd560 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1018,6 +1018,8 @@ void LLRender::refreshState(void)
void LLRender::syncMatrices()
{
+ stop_glerror();
+
GLenum mode[] =
{
GL_MODELVIEW,
@@ -1028,27 +1030,105 @@ void LLRender::syncMatrices()
GL_TEXTURE,
};
- for (U32 i = 0; i < 2; ++i)
+ std::string name[] =
+ {
+ "modelview_matrix",
+ "projection_matrix",
+ "texture_matrix0",
+ "texture_matrix1",
+ "texture_matrix2",
+ "texture_matrix3",
+ };
+
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ if (shader)
{
- if (mMatHash[i] != mCurMatHash[i])
+
+ llassert(shader);
+
+ bool do_normal = false;
+ bool do_mvp = false;
+
+ for (U32 i = 0; i < NUM_MATRIX_MODES; ++i)
{
- glMatrixMode(mode[i]);
- glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
- mCurMatHash[i] = mMatHash[i];
+ if (mMatHash[i] != shader->mMatHash[i])
+ {
+ shader->uniformMatrix4fv(name[i], 1, GL_FALSE, mMatrix[i][mMatIdx[i]].m);
+ shader->mMatHash[i] = mMatHash[i];
+
+ if (i == MM_MODELVIEW)
+ {
+ do_normal = true;
+ do_mvp = true;
+ }
+ else if (i == MM_PROJECTION)
+ {
+ do_mvp = true;
+ }
+ }
}
- }
- for (U32 i = 2; i < NUM_MATRIX_MODES; ++i)
+ if (do_normal)
+ {
+ S32 loc = shader->getUniformLocation("normal_matrix");
+ if (loc > -1)
+ {
+ U32 i = MM_MODELVIEW;
+
+ glh::matrix4f norm = mMatrix[i][mMatIdx[i]].inverse().transpose();
+
+ F32 norm_mat[] =
+ {
+ norm.m[0], norm.m[1], norm.m[2],
+ norm.m[4], norm.m[5], norm.m[6],
+ norm.m[8], norm.m[9], norm.m[10]
+ };
+
+ shader->uniformMatrix3fv("normal_matrix", 1, GL_FALSE, norm_mat);
+ }
+ }
+
+ if (do_mvp)
+ {
+ S32 loc = shader->getUniformLocation("modelview_projection_matrix");
+ if (loc > -1)
+ {
+ U32 mv = MM_MODELVIEW;
+ U32 proj = MM_PROJECTION;
+
+ glh::matrix4f mvp = mMatrix[mv][mMatIdx[mv]];
+ mvp.mult_left(mMatrix[proj][mMatIdx[proj]]);
+
+ shader->uniformMatrix4fv("modelview_projection_matrix", 1, GL_FALSE, mvp.m);
+ }
+ }
+ }
+ else
{
- if (mMatHash[i] != mCurMatHash[i])
+ for (U32 i = 0; i < 2; ++i)
{
- gGL.getTexUnit(i-2)->activate();
- glMatrixMode(mode[i]);
- glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
- mCurMatHash[i] = mMatHash[i];
+ if (mMatHash[i] != mCurMatHash[i])
+ {
+ glMatrixMode(mode[i]);
+ glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
+ mCurMatHash[i] = mMatHash[i];
+ }
+ }
+
+ for (U32 i = 2; i < NUM_MATRIX_MODES; ++i)
+ {
+ if (mMatHash[i] != mCurMatHash[i])
+ {
+ gGL.getTexUnit(i-2)->activate();
+ glMatrixMode(mode[i]);
+ glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
+ mCurMatHash[i] = mMatHash[i];
+ }
}
}
-
+
+ stop_glerror();
}
void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index ec1a813790..c98b99b15a 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord0;
@@ -51,9 +53,7 @@ void main()
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- gl_Position = gl_ProjectionMatrix * pos;
-
- //gl_Position = gl_ModelViewProjectionMatrix * position;
+ gl_Position = projection_matrix * pos;
gl_FogFragCoord = length(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index 31db10ae85..9a19fb928b 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -35,12 +39,12 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- 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 = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
index f07e5c124b..21a9e91bf5 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -41,5 +43,5 @@ void main()
gl_FrontColor = diffuse_color;
gl_TexCoord[0] = vec4(texcoord0,0,1);
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index 2c2b58d59b..9deb9a701e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -21,7 +21,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -86,14 +88,14 @@ void main()
vec3 norm;
mat4 trans = getObjectSkinnedTransform();
- trans = gl_ModelViewMatrix * trans;
+ trans = modelview_matrix * trans;
pos = trans * vec4(position.xyz, 1.0);
norm = position.xyz + normal.xyz;
- norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz);
+ norm = normalize(( trans*vec4(norojrm, 1.0) ).xyz-pos.xyz);
- vec4 frag_pos = gl_ProjectionMatrix * pos;
+ vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
vary_position = pos.xyz;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 7a2f34ca1d..51e7c0780d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -23,6 +23,11 @@
* $/LicenseInfo$
*/
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec4 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -85,12 +90,12 @@ void main()
//transform vertex
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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * 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;
@@ -126,7 +131,7 @@ void main()
gl_FogFragCoord = pos.z;
- pos = gl_ModelViewProjectionMatrix * vert;
+ pos = modelview_projection_matrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
index e03615eebb..fc055e555d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
@@ -22,6 +22,10 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
+uniform mat4 texture_matrix0;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -31,16 +35,16 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
gl_FrontColor = diffuse_color;
- vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0);
+ vec4 p = projection_matrix * vec4(pos, 1.0);
p.z = max(p.z, -p.w+0.01);
gl_Position = p;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
index e15727f6f7..df4de4f432 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord0;
@@ -96,7 +98,7 @@ void main()
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- vec4 frag_pos = gl_ProjectionMatrix * pos;
+ vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
vary_position = pos.xyz;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index 58efa47567..d5c20a22d9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -34,10 +37,10 @@ varying vec3 vary_normal;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * normal);
+ vary_normal = normalize(normal_matrix * normal);
gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index 543e998def..6835b9c021 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -23,7 +23,7 @@
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
mat4 getSkinnedTransform();
@@ -52,7 +52,7 @@ void main()
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- pos = gl_ProjectionMatrix * pos;
+ pos = projection_matrix * pos;
post_pos = pos;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index 66e9119e28..704845d310 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -23,6 +23,8 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord0;
@@ -54,7 +56,7 @@ void main()
vary_normal = norm;
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
index 0168c40ae5..5339e38018 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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 421299d4a7..cf93430217 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
@@ -22,6 +22,10 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec3 normal;
@@ -36,11 +40,11 @@ mat4 getObjectSkinnedTransform();
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
@@ -53,6 +57,6 @@ void main()
vary_mat1 = vec3(t.y, b.y, n.y);
vary_mat2 = vec3(t.z, b.z, n.z);
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
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 b724def93d..9ec31383ac 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec3 normal;
@@ -36,11 +40,11 @@ varying vec3 vary_mat2;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 n = normalize(gl_NormalMatrix * normal);
- vec3 b = normalize(gl_NormalMatrix * binormal);
+ vec3 n = normalize(normal_matrix * normal);
+ vec3 b = normalize(normal_matrix * binormal);
vec3 t = cross(b, n);
vary_mat0 = vec3(t.x, b.x, n.x);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index 297b3904a6..67b5e7fb83 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
@@ -60,7 +62,7 @@ void main()
{
// World / view / projection
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_TexCoord[0] = vec4(texcoord0,0,1);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
index ff9578e253..37864578ec 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
@@ -1,10 +1,31 @@
/**
* @file diffuseNoColorV.glsl
*
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -16,8 +37,8 @@ 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);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * normal);
+ vary_normal = normalize(normal_matrix * normal);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
index 02fb34af32..880a7ea0a2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
@@ -22,7 +22,9 @@
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -35,11 +37,11 @@ mat4 getObjectSkinnedTransform();
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
vec4 norm = vec4(position.xyz, 1.0);
@@ -51,5 +53,5 @@ void main()
gl_FrontColor = diffuse_color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*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 553cfff52f..e158df13f7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec4 position;
attribute vec4 diffuse_color;
@@ -35,11 +38,11 @@ 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);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
vary_texture_index = position.w;
- vary_normal = normalize(gl_NormalMatrix * normal);
+ vary_normal = normalize(normal_matrix * normal);
gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
index 9841943fe6..fccf8554d2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
@@ -1,10 +1,31 @@
/**
* @file emissiveV.glsl
*
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec4 position;
attribute float emissive;
@@ -23,12 +44,12 @@ void main()
{
//transform vertex
vec4 vert = vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * vert);
+ vec4 pos = (modelview_matrix * vert);
vary_texture_index = position.w;
- gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
index 93571058dc..2759165471 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec4 position;
attribute vec4 diffuse_color;
@@ -41,12 +45,12 @@ void main()
{
//transform vertex
vec4 vert = vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * vert);
+ vec4 pos = (modelview_matrix * vert);
vary_texture_index = position.w;
- gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
index 1a23be349e..2766691bd0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -35,7 +37,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
index 28ba2c432d..645b0d793a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -30,8 +33,8 @@ attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
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 3f2e07cf08..dafc55a6ff 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -34,7 +35,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
index 39e60b6cc8..1d54d7bede 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -31,7 +32,7 @@ varying vec4 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_fragcoord = pos;
gl_Position = pos;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index afaf58020b..cab9817583 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -23,6 +23,8 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec4 vary_fragcoord;
@@ -30,7 +32,7 @@ varying vec4 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_fragcoord = pos;
gl_Position = pos;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
index 74a9df64e0..b11f26fbae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -35,7 +37,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_Position = pos;
vary_tc = (pos.xy*0.5+0.5)*tc_scale;
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 a3751be1fb..61c6393648 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
@@ -22,6 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -32,7 +34,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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 bbd7516337..f7bed00214 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -32,12 +35,12 @@ varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix*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);
+ gl_TexCoord[0] = texture_matrix0 * 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 1ac3dbd5de..190cac9e2c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec4 post_pos;
@@ -30,7 +32,7 @@ varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix*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 23171fe940..e97d3e0828 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
@@ -58,7 +60,7 @@ void main()
{
// World / view / projection
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
index 4b6b3c242e..7d1e99b4aa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -32,7 +33,7 @@ varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
index dbd2b5595a..1fcb05ef2c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -31,7 +33,7 @@ attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
index d19e67b67d..10751304ae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
@@ -22,6 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -32,7 +34,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index 793106f2cf..7f84ef1cff 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -48,12 +52,12 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_normal = normalize(gl_NormalMatrix * normal);
+ vary_normal = normalize(normal_matrix * normal);
// Transform and pass tex coords
- gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
vec4 t = vec4(texcoord1,0,1);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
index 42ce2f5226..c695d374ac 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
@@ -1,9 +1,30 @@
/**
* @file treeShadowV.glsl
*
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -13,11 +34,11 @@ varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix*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);
+ gl_TexCoord[0] = texture_matrix0 * 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 2ec7398024..45bfc0ce09 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+uniform mat3 normal_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -33,10 +36,10 @@ varying vec3 vary_normal;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * normal);
+ vary_normal = normalize(normal_matrix * normal);
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 2f808b25db..ac51cb1741 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -50,7 +52,7 @@ void main()
{
//transform vertex
vec4 pos = vec4(position.xyz, 1.0);
- mat4 modelViewProj = gl_ModelViewProjectionMatrix;
+ mat4 modelViewProj = modelview_projection_matrix;
vec4 oPosition;
@@ -69,7 +71,7 @@ void main()
oPosition = vec4(position, 1.0);
oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
- vary_position = gl_ModelViewMatrix * oPosition;
+ vary_position = modelview_matrix * oPosition;
oPosition = modelViewProj * oPosition;
refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
@@ -81,7 +83,7 @@ void main()
//push position for further horizon effect.
pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
pos.w = 1.0;
- pos = gl_ModelViewMatrix*pos;
+ pos = modelview_matrix*pos;
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
index b5f6cb62d9..628489296f 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -23,13 +23,15 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position, 1.0);
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 e8fd7a796d..615ca6a0b4 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -23,6 +23,8 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
@@ -30,7 +32,7 @@ uniform vec2 glowDelta;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position, 1.0);
gl_TexCoord[0].xy = texcoord0 + glowDelta*(-3.5);
gl_TexCoord[1].xy = texcoord0 + glowDelta*(-2.5);
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index 8facc1ca96..04b3033dd8 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -22,7 +22,15 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 texture_matrix2;
+uniform mat4 texture_matrix3;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -51,17 +59,17 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = gl_ModelViewMatrix * position;
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec4 pos = modelview_matrix * position;
+ vec3 norm = normalize(normal_matrix * normal);
vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color);
gl_FrontColor = color;
- 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);
+ gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
+ gl_TexCoord[1] = texture_matrix1*vec4(texcoord1,0,1);
+ gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
+ gl_TexCoord[3] = texture_matrix3*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 831a7de0ea..99433ada7b 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -46,7 +48,7 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
void main()
{
//transform vertex
- mat4 modelViewProj = gl_ModelViewProjectionMatrix;
+ mat4 modelViewProj = modelview_projection_matrix;
vec4 oPosition;
@@ -77,7 +79,7 @@ void main()
vec4 pos;
pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
pos.w = 1.0;
- pos = gl_ModelViewMatrix*pos;
+ pos = modelview_matrix*pos;
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
index df67f76ad5..5bbc7deff0 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -30,7 +32,7 @@ attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * 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/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
index 2f64fdb7bc..cd3d090e52 100644
--- a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
@@ -23,10 +23,12 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
index f54876135e..bd5dd6046b 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
@@ -1,17 +1,37 @@
/**
* @file glowcombineFXAAV.glsl
*
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_tc;
void main()
{
- vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
gl_Position = pos;
vary_tc = pos.xy*0.5+0.5;
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
index 303535ee31..94edbe5ab1 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
@@ -22,14 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
attribute vec2 texcoord1;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * 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/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index 1d312313a8..6bb5affd93 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -22,14 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * 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 62fe4a2ce5..43dcd5dbe2 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
@@ -23,10 +23,12 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
index 7df45e90e6..615412c7a2 100644
--- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
@@ -2,9 +2,28 @@
* @file onetexturenocolorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -12,7 +31,7 @@ attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1);
+ gl_Position = modelview_projection_matrix * 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 be03d19290..45e6a9febc 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -22,6 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -29,7 +31,7 @@ attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * 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/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
index 085970f549..2b471d99e8 100644
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
@@ -22,14 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
attribute vec4 diffuse_color;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * 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/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
index 80c57e7766..2a36feaa21 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -30,7 +31,7 @@ attribute vec2 texcoord1;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * 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 faef21689e..a9e42a432f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -31,8 +33,8 @@ attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_Position = modelview_projection_matrix * vec4(position, 1);
+ gl_TexCoord[0] = texture_matrix0 * 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 7d38e07d65..dccc692593 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -31,7 +34,7 @@ attribute vec2 texcoord1;
void main()
{
//transform vertex
- 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_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1 * vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
index 78668711ac..e2a00e8440 100644
--- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
@@ -1,10 +1,31 @@
/**
* @file emissiveSkinnedV.glsl
*
- * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
- * $License$
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
attribute vec3 position;
attribute float emissive;
@@ -16,18 +37,18 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * 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_Position = projection_matrix*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
index 05d7cc397f..dedf00f374 100644
--- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
@@ -1,10 +1,32 @@
/**
* @file emissiveV.glsl
*
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec4 position;
attribute float emissive;
attribute vec2 texcoord0;
@@ -17,10 +39,10 @@ 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);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
calcAtmospherics(pos.xyz);
gl_FrontColor = vec4(0,0,0,emissive);
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
index 57d98038e0..b9c1078c30 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
@@ -2,9 +2,31 @@
* @file fullbrightNoColorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
attribute vec3 normal;
@@ -15,9 +37,9 @@ 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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
index ebbcb2f719..546b7cad4a 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
@@ -22,6 +22,10 @@
* $/LicenseInfo$
*/
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 projection_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -35,7 +39,7 @@ void main()
{
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
vec4 norm = vec4(position.xyz, 1.0);
@@ -45,14 +49,14 @@ void main()
vec3 ref = reflect(pos.xyz, -norm.xyz);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
gl_FrontColor = diffuse_color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
index e8126daee0..a9b086e215 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -36,15 +41,15 @@ uniform vec4 origin;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
- vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
calcAtmospherics(pos.xyz);
gl_FrontColor = diffuse_color;
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
index 276f423eea..f0722a1e4d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
@@ -22,6 +22,9 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -33,18 +36,18 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
calcAtmospherics(pos.xyz);
gl_FrontColor = diffuse_color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
index 159e34f044..d8f223d403 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -32,9 +36,9 @@ 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);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
index f175e3e76d..69007610c6 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -31,6 +33,6 @@ attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index 555c59c37e..3771c2e795 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -2,9 +2,32 @@
* @file previewV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord0;
@@ -15,11 +38,11 @@ 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);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
index f0bea5f3e7..7e5c8ca2d5 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
@@ -22,6 +22,11 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -35,7 +40,7 @@ void main()
{
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
vec4 norm = vec4(position.xyz, 1.0);
@@ -45,13 +50,13 @@ void main()
vec3 ref = reflect(pos.xyz, -norm.xyz);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
gl_FrontColor = color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*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 e8b6b71b3d..da47f8a58a 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -35,10 +40,10 @@ uniform vec4 origin;
void main()
{
//transform vertex
- vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0));
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
@@ -46,7 +51,7 @@ void main()
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0*vec4(ref,1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
index 54c262885e..d1d8126cb4 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
@@ -2,9 +2,32 @@
* @file simpleNoColorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord0;
@@ -15,11 +38,11 @@ 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);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
index 14c4a3aa8d..bf083a55c4 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
@@ -22,6 +22,10 @@
* $/LicenseInfo$
*/
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -34,11 +38,11 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
vec4 norm = vec4(position.xyz, 1.0);
@@ -51,7 +55,7 @@ void main()
vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
gl_FrontColor = color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
index bbc170b1af..87ece3972e 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -34,11 +39,11 @@ 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);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
index 1e9e7f4b0b..64ca63731b 100644
--- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
@@ -2,10 +2,31 @@
* @file treeV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -19,12 +40,12 @@ 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);
+ gl_Position = modelview_projection_matrix*vert;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
- vec4 pos = (gl_ModelViewMatrix * vert);
+ vec4 pos = (modelview_matrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
index c0065f0bbe..43e19909d4 100644
--- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec4 diffuse_color;
@@ -35,11 +39,11 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- 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 = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index 501fcb004b..df4d26997a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -21,6 +21,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -79,15 +84,15 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position, 1.0)).xyz;
- gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = projection_matrix * vec4(pos, 1.0);
vec4 n = vec4(position, 1.0);
n.xyz += normal.xyz;
@@ -128,7 +133,7 @@ void main()
gl_FogFragCoord = pos.z;
- pos.xyz = (gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0)).xyz;
+ pos.xyz = (modelview_projection_matrix * 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 b0ae0107fb..996203ffd6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
attribute vec4 position;
attribute vec3 normal;
attribute vec4 diffuse_color;
@@ -84,12 +89,12 @@ void main()
//transform vertex
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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * 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;
@@ -123,7 +128,7 @@ void main()
gl_FogFragCoord = pos.z;
- pos = gl_ModelViewProjectionMatrix * vert;
+ pos = modelview_projection_matrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index f35af53f95..3e35675784 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -99,7 +100,7 @@ void main()
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
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;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
index 964f12afcf..1f5470db3c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -32,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index e52edcba41..424299269f 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -22,7 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
@@ -33,7 +34,7 @@ varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_Position = pos;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index 2cf7375d4d..60ba2d7ad4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -32,7 +34,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
index 556e131d34..4fd4b101ff 100644
--- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
@@ -22,7 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -34,7 +35,7 @@ uniform float blurWidth;
void main(void)
{
// Transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0);
diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
index fbb87b6578..d3c93ab05f 100644
--- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
@@ -22,7 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -32,7 +33,7 @@ attribute vec2 texcoord1;
void main(void)
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * 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 1a7edbd61b..69f4d4ae45 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec3 normal;
@@ -52,10 +56,10 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = gl_ModelViewMatrix * vec4(position.xyz, 1.0);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec4 pos = modelview_matrix * vec4(position.xyz, 1.0);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
@@ -67,7 +71,7 @@ void main()
gl_FrontColor = color;
// Transform and pass tex coords
- 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;
+ gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
vec4 t = vec4(texcoord1,0,1);
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
index 8a88957659..b9eff87a13 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
void calcAtmospherics(vec3 inPositionEye);
@@ -41,14 +46,14 @@ void main()
//transform vertex
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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
index f5ff1d1d00..b7f7af7885 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec4 position;
attribute vec2 texcoord0;
@@ -39,9 +42,9 @@ void main()
//transform vertex
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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
index d6fca4cda7..4511c4bc91 100644
--- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec4 position;
attribute vec2 texcoord0;
@@ -42,14 +47,14 @@ void main()
//transform vertex
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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1);
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
index d2a83c9724..5f78495ae3 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
@@ -2,10 +2,31 @@
* @file simpleNonIndexedV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -20,12 +41,12 @@ 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);
+ gl_Position = modelview_projection_matrix*vert;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
- vec4 pos = (gl_ModelViewMatrix * vert);
+ vec4 pos = (modelview_matrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
index c2db1e1949..91ee5e016e 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
attribute vec4 position;
attribute vec2 texcoord0;
@@ -40,13 +43,13 @@ void main()
//transform vertex
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);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
- vec3 norm = normalize(gl_NormalMatrix * normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 297b3904a6..67b5e7fb83 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec2 texcoord0;
@@ -60,7 +62,7 @@ void main()
{
// World / view / projection
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_TexCoord[0] = vec4(texcoord0,0,1);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 84e1f827d6..50fdba64c2 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -59,7 +60,7 @@ void main()
{
// World / view / projection
- gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
index f1d06b4fec..c10635c898 100644
--- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 projection_matrix;
+
attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord0;
@@ -123,7 +125,7 @@ void main()
vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0));
gl_FrontColor = color;
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
gl_TexCoord[2] = vec4(pos.xyz, 1.0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
index 870d4c36bc..5e75aec171 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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 76206f88d9..969b6e2f1c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
@@ -32,7 +34,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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 1a23be349e..2766691bd0 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
attribute vec4 diffuse_color;
attribute vec2 texcoord0;
@@ -35,7 +37,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
index a2606f2fb2..d0205fa824 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -33,7 +35,7 @@ attribute vec4 diffuse_color;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
index 2d0b60d513..2d7fa22edc 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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 25bdfdce45..e9c6f3e27b 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
@@ -22,7 +22,9 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * 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 9e07a4d219..8e405de9a3 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
@@ -22,7 +22,8 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
attribute vec3 position;
attribute vec2 texcoord0;
@@ -34,7 +35,7 @@ varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 917462c1ee..7155311f8e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -380,7 +380,7 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
mReservedUniforms.push_back("lastNormalGIMap");
mReservedUniforms.push_back("lastMinpGIMap");
mReservedUniforms.push_back("lastMaxpGIMap");
-
+
mWLUniforms.push_back("camPosLocal");
mTerrainUniforms.reserve(5);