This commit is contained in:
TighMacFanatic
2011-11-19 21:36:32 -05:00
33 changed files with 225 additions and 152 deletions

View File

@@ -60,7 +60,7 @@ inline void LLMatrix3a::setTranspose(const LLMatrix3a& src)
const LLQuad srcCol1 = src.mColumns[1]; const LLQuad srcCol1 = src.mColumns[1];
const LLQuad unpacklo = _mm_unpacklo_ps( srcCol0, srcCol1 ); const LLQuad unpacklo = _mm_unpacklo_ps( srcCol0, srcCol1 );
mColumns[0] = _mm_movelh_ps( unpacklo, src.mColumns[2] ); mColumns[0] = _mm_movelh_ps( unpacklo, src.mColumns[2] );
mColumns[1] = _mm_shuffle_ps( _mm_movehl_ps( srcCol0, unpacklo ), src.mColumns[2], _MM_SHUFFLE(0, 1, 1, 0) ); mColumns[1] = _mm_shuffle_ps( unpacklo, src.mColumns[2], _MM_SHUFFLE(0, 1, 3, 2) );
mColumns[2] = _mm_shuffle_ps( _mm_unpackhi_ps( srcCol0, srcCol1 ), src.mColumns[2], _MM_SHUFFLE(0, 2, 1, 0) ); mColumns[2] = _mm_shuffle_ps( _mm_unpackhi_ps( srcCol0, srcCol1 ), src.mColumns[2], _MM_SHUFFLE(0, 2, 1, 0) );
} }

View File

@@ -105,24 +105,42 @@ public:
mMatrix[3].setAdd(a.mMatrix[3],d3); mMatrix[3].setAdd(a.mMatrix[3],d3);
} }
inline void rotate(const LLVector4a& v, LLVector4a& res) inline void rotate(const LLVector4a& v, LLVector4a& res) const
{ {
res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0)); LLVector4a x,y,z;
res.mul(mMatrix[0]);
LLVector4a y;
y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
y.mul(mMatrix[1]);
LLVector4a z; x = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2)); z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
x.mul(mMatrix[0]);
y.mul(mMatrix[1]);
z.mul(mMatrix[2]); z.mul(mMatrix[2]);
res.add(y); x.add(y);
res.add(z); res.setAdd(x,z);
}
inline void rotate4(const LLVector4a& v, LLVector4a& res) const
{
LLVector4a x,y,z,w;
x = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
w = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3, 3, 3, 3));
x.mul(mMatrix[0]);
y.mul(mMatrix[1]);
z.mul(mMatrix[2]);
w.mul(mMatrix[3]);
x.add(y);
z.add(w);
res.setAdd(x,z);
} }
inline void affineTransform(const LLVector4a& v, LLVector4a& res) inline void affineTransform(const LLVector4a& v, LLVector4a& res) const
{ {
LLVector4a x,y,z; LLVector4a x,y,z;

View File

@@ -270,9 +270,9 @@ void LLCubeMap::setMatrix(S32 stage)
gGL.getTexUnit(stage)->activate(); gGL.getTexUnit(stage)->activate();
} }
LLVector3 x(LLVector3d(gGLModelView+0)); LLVector3 x(gGLModelView+0);
LLVector3 y(LLVector3d(gGLModelView+4)); LLVector3 y(gGLModelView+4);
LLVector3 z(LLVector3d(gGLModelView+8)); LLVector3 z(gGLModelView+8);
LLMatrix3 mat3; LLMatrix3 mat3;
mat3.setRows(x,y,z); mat3.setRows(x,y,z);

View File

@@ -1009,10 +1009,9 @@ void LLGLSLShader::uniformMatrix4fv(const string& uniform, U32 count, GLboolean
} }
void LLGLSLShader::setAlphaRange(F32 minimum, F32 maximum) void LLGLSLShader::setMinimumAlpha(F32 minimum)
{ {
uniform1f("minimum_alpha", minimum); uniform1f("minimum_alpha", minimum);
uniform1f("maximum_alpha", maximum);
} }
void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)

View File

@@ -116,7 +116,7 @@ public:
void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
void setAlphaRange(F32 minimum, F32 maximum); void setMinimumAlpha(F32 minimum);
void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void vertexAttrib4fv(U32 index, GLfloat* v); void vertexAttrib4fv(U32 index, GLfloat* v);

View File

@@ -741,7 +741,10 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
{ {
if (mAutoGenMips) if (mAutoGenMips)
{ {
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE); if (!gGLManager.mHasFramebufferObject)
{
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE);
}
stop_glerror(); stop_glerror();
{ {
// LLFastTimer t2(LLFastTimer::FTM_TEMP4); // LLFastTimer t2(LLFastTimer::FTM_TEMP4);
@@ -770,6 +773,12 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
stop_glerror(); stop_glerror();
} }
} }
if (gGLManager.mHasFramebufferObject)
{
//GL_EXT_framebuffer_object implies glGenerateMipmap
glGenerateMipmap(LLTexUnit::getInternalType(mBindTarget));
}
} }
else else
{ {

View File

@@ -44,11 +44,12 @@
LLRender gGL; LLRender gGL;
// Handy copies of last good GL matrices // Handy copies of last good GL matrices
F64 gGLModelView[16]; //Would be best to migrate these to LLMatrix4a and LLVector4a, but that's too divergent right now.
F64 gGLLastModelView[16]; LL_ALIGN_16(F32 gGLModelView[16]);
F64 gGLLastProjection[16]; LL_ALIGN_16(F32 gGLLastModelView[16]);
F64 gGLProjection[16]; LL_ALIGN_16(F32 gGLLastProjection[16]);
S32 gGLViewport[4]; LL_ALIGN_16(F32 gGLProjection[16]);
LL_ALIGN_16(S32 gGLViewport[4]);
U32 LLTexUnit::sWhiteTexture = 0; U32 LLTexUnit::sWhiteTexture = 0;

View File

@@ -408,10 +408,10 @@ private:
F32 mMaxAnisotropy; F32 mMaxAnisotropy;
}; };
extern F64 gGLModelView[16]; extern F32 gGLModelView[16];
extern F64 gGLLastModelView[16]; extern F32 gGLLastModelView[16];
extern F64 gGLLastProjection[16]; extern F32 gGLLastProjection[16];
extern F64 gGLProjection[16]; extern F32 gGLProjection[16];
extern S32 gGLViewport[4]; extern S32 gGLViewport[4];
extern LLRender gGL; extern LLRender gGL;

View File

@@ -7,7 +7,6 @@
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
@@ -17,7 +16,7 @@ void main()
{ {
vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
if (col.a < minimum_alpha || col.a > maximum_alpha) if (col.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -8,13 +8,12 @@
varying vec3 vary_normal; varying vec3 vary_normal;
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
void main() void main()
{ {
vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
if (col.a < minimum_alpha || col.a > maximum_alpha) if (col.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
uniform sampler2D normalMap; uniform sampler2D normalMap;
@@ -15,7 +14,7 @@ uniform sampler2D specularMap;
void main() void main()
{ {
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
if (col.a < minimum_alpha || col.a > maximum_alpha) if (col.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
@@ -16,7 +15,7 @@ void main()
{ {
float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a; float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a;
if (alpha < minimum_alpha || alpha > maximum_alpha) if (alpha < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light);
@@ -17,7 +16,7 @@ void main()
{ {
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -7,7 +7,6 @@
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
vec3 atmosLighting(vec3 light); vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light); vec3 scaleSoftClip(vec3 light);
@@ -16,7 +15,7 @@ void default_lighting()
{ {
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -7,7 +7,6 @@
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
@@ -19,7 +18,7 @@ void default_lighting()
{ {
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light);
@@ -15,7 +14,7 @@ void fullbright_lighting()
{ {
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light);
@@ -17,7 +16,7 @@ void fullbright_lighting()
{ {
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
vec4 diffuseLookup(vec2 texcoord); vec4 diffuseLookup(vec2 texcoord);
@@ -17,7 +16,7 @@ void fullbright_lighting_water()
{ {
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
@@ -17,7 +16,7 @@ void fullbright_lighting_water()
{ {
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
vec3 atmosLighting(vec3 light); vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color); vec4 applyWaterFog(vec4 color);
@@ -15,7 +14,7 @@ void default_lighting_water()
{ {
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -6,7 +6,6 @@
*/ */
uniform float minimum_alpha; uniform float minimum_alpha;
uniform float maximum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
@@ -17,7 +16,7 @@ void default_lighting_water()
{ {
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
if (color.a < minimum_alpha || color.a > maximum_alpha) if (color.a < minimum_alpha)
{ {
discard; discard;
} }

View File

@@ -462,7 +462,7 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params)
if (params.mModelMatrix != gGLLastMatrix) if (params.mModelMatrix != gGLLastMatrix)
{ {
gGLLastMatrix = params.mModelMatrix; gGLLastMatrix = params.mModelMatrix;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
if (params.mModelMatrix) if (params.mModelMatrix)
{ {
glMultMatrixf((GLfloat*) params.mModelMatrix->mMatrix); glMultMatrixf((GLfloat*) params.mModelMatrix->mMatrix);

View File

@@ -97,7 +97,7 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass)
{ {
LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS);
gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.bind();
gDeferredDiffuseAlphaMaskProgram.setAlphaRange(0.33f, 1.f); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f);
//render alpha masked objects //render alpha masked objects
LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
@@ -143,7 +143,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
simple_shader = NULL; simple_shader = NULL;
fullbright_shader = NULL; fullbright_shader = NULL;
gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.bind();
gObjectFullbrightAlphaMaskProgram.setAlphaRange(0.33f, 1.f); gObjectFullbrightAlphaMaskProgram.setMinimumAlpha(0.33f);
} }
deferred_render = TRUE; deferred_render = TRUE;
@@ -236,14 +236,14 @@ void LLDrawPoolAlpha::render(S32 pass)
if (!LLPipeline::sRenderDeferred || !deferred_render) if (!LLPipeline::sRenderDeferred || !deferred_render)
{ {
simple_shader->bind(); simple_shader->bind();
simple_shader->setAlphaRange(0.33f, 1.f); simple_shader->setMinimumAlpha(0.33f);
pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
} }
if (fullbright_shader) if (fullbright_shader)
{ {
fullbright_shader->bind(); fullbright_shader->bind();
fullbright_shader->setAlphaRange(0.33f, 1.f); fullbright_shader->setMinimumAlpha(0.33f);
} }
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
//LLGLSLShader::bindNoShader(); //LLGLSLShader::bindNoShader();
@@ -279,16 +279,16 @@ void LLDrawPoolAlpha::render(S32 pass)
if (LLPipeline::sImpostorRender) if (LLPipeline::sImpostorRender)
{ {
fullbright_shader->bind(); fullbright_shader->bind();
fullbright_shader->setAlphaRange(0.5f, 1.f); fullbright_shader->setMinimumAlpha(0.5f);
simple_shader->bind(); simple_shader->bind();
simple_shader->setAlphaRange(0.5f, 1.f); simple_shader->setMinimumAlpha(0.5f);
} }
else else
{ {
fullbright_shader->bind(); fullbright_shader->bind();
fullbright_shader->setAlphaRange(0.f, 1.f); fullbright_shader->setMinimumAlpha(0.f);
simple_shader->bind(); simple_shader->bind();
simple_shader->setAlphaRange(0.f, 1.f); simple_shader->setMinimumAlpha(0.f);
} }
} }
else else

View File

@@ -678,7 +678,7 @@ void LLDrawPoolAvatar::beginImpostor()
if (LLGLSLShader::sNoFixedFunction) if (LLGLSLShader::sNoFixedFunction)
{ {
gImpostorProgram.bind(); gImpostorProgram.bind();
gImpostorProgram.setAlphaRange(0.01f, 1.f); gImpostorProgram.setMinimumAlpha(0.01f);
} }
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
@@ -710,7 +710,7 @@ void LLDrawPoolAvatar::beginRigid()
if (sVertexProgram != NULL) if (sVertexProgram != NULL)
{ //eyeballs render with the specular shader { //eyeballs render with the specular shader
sVertexProgram->bind(); sVertexProgram->bind();
sVertexProgram->setAlphaRange(0.2f, 1.f); sVertexProgram->setMinimumAlpha(0.2f);
} }
} }
else else
@@ -743,7 +743,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor()
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind(); sVertexProgram->bind();
sVertexProgram->setAlphaRange(0.01f, 1.f); sVertexProgram->setMinimumAlpha(0.01f);
} }
void LLDrawPoolAvatar::endDeferredImpostor() void LLDrawPoolAvatar::endDeferredImpostor()
@@ -829,7 +829,7 @@ void LLDrawPoolAvatar::beginSkinned()
//if (LLGLSLShader::sNoFixedFunction) //Singu Note: sNoFixedFunction being false does not imply shaders are off, unlike in V3. //if (LLGLSLShader::sNoFixedFunction) //Singu Note: sNoFixedFunction being false does not imply shaders are off, unlike in V3.
if (gPipeline.canUseVertexShaders()) //Check if shaders are REALLY used. if (gPipeline.canUseVertexShaders()) //Check if shaders are REALLY used.
{ {
sVertexProgram->setAlphaRange(0.2f, 1.f); sVertexProgram->setMinimumAlpha(0.2f);
} }
} }

View File

@@ -267,7 +267,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass)
if (mVertexShaderLevel > 0) if (mVertexShaderLevel > 0)
{ {
simple_shader->bind(); simple_shader->bind();
simple_shader->setAlphaRange(0.5f, 1.f); simple_shader->setMinimumAlpha(0.5f);
} }
else else
{ {
@@ -324,7 +324,7 @@ void LLDrawPoolGrass::renderDeferred(S32 pass)
LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS);
//LLFastTimer t(FTM_RENDER_GRASS_DEFERRED); //LLFastTimer t(FTM_RENDER_GRASS_DEFERRED);
gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind();
gDeferredNonIndexedDiffuseAlphaMaskProgram.setAlphaRange(0.5f, 1.f); gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f);
//render grass //render grass
LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
} }

View File

@@ -80,7 +80,7 @@ void LLDrawPoolTree::beginRenderPass(S32 pass)
if (gPipeline.canUseVertexShaders()) if (gPipeline.canUseVertexShaders())
{ {
shader->bind(); shader->bind();
shader->setAlphaRange(0.5f, 1.f); shader->setMinimumAlpha(0.5f);
} }
else else
{ {
@@ -149,7 +149,7 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass)
shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram; shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram;
shader->bind(); shader->bind();
shader->setAlphaRange(0.5f, 1.f); shader->setMinimumAlpha(0.5f);
} }
void LLDrawPoolTree::renderDeferred(S32 pass) void LLDrawPoolTree::renderDeferred(S32 pass)
@@ -175,7 +175,7 @@ void LLDrawPoolTree::beginShadowPass(S32 pass)
static const LLCachedControl<F32> render_deferred_bias("RenderDeferredTreeShadowBias",1.f); static const LLCachedControl<F32> render_deferred_bias("RenderDeferredTreeShadowBias",1.f);
glPolygonOffset(render_deferred_offset,render_deferred_bias); glPolygonOffset(render_deferred_offset,render_deferred_bias);
gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.bind();
gDeferredShadowAlphaMaskProgram.setAlphaRange(0.5f, 1.f); gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.5f);
} }
void LLDrawPoolTree::renderShadow(S32 pass) void LLDrawPoolTree::renderShadow(S32 pass)
@@ -233,13 +233,10 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
} }
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
//glPushMatrix(); //glPushMatrix();
F32 mat[16];
for (U32 i = 0; i < 16; i++)
mat[i] = (F32) gGLModelView[i];
LLMatrix4 matrix(mat); LLMatrix4 matrix(gGLModelView);
// Translate to tree base HACK - adjustment in Z plants tree underground // Translate to tree base HACK - adjustment in Z plants tree underground
const LLVector3 &pos_agent = treep->getPositionAgent(); const LLVector3 &pos_agent = treep->getPositionAgent();

View File

@@ -54,6 +54,8 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent,
hud_render_text(wstr, pos_agent, font, style, x_offset, y_offset, color, orthographic); hud_render_text(wstr, pos_agent, font, style, x_offset, y_offset, color, orthographic);
} }
int glProjectf(const LLVector3& object, const F32* modelview, const F32* projection, const LLRect& viewport, LLVector3& windowCoordinate);
void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
const LLFontGL &font, const LLFontGL &font,
const U8 style, const U8 style,
@@ -103,17 +105,15 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
//get the render_pos in screen space //get the render_pos in screen space
F64 winX, winY, winZ; LLVector3 window_coordinates;
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); F32& winX = window_coordinates.mV[VX];
S32 viewport[4]; F32& winY = window_coordinates.mV[VY];
viewport[0] = world_view_rect.mLeft; F32& winZ = window_coordinates.mV[VZ];
viewport[1] = world_view_rect.mBottom;
viewport[2] = world_view_rect.getWidth(); const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw();
viewport[3] = world_view_rect.getHeight();
gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2], glProjectf(render_pos, gGLModelView, gGLProjection, world_view_rect, window_coordinates);
gGLModelView, gGLProjection, (GLint*) viewport,
&winX, &winY, &winZ);
//fonts all render orthographically, set up projection`` //fonts all render orthographically, set up projection``
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPushMatrix(); glPushMatrix();

View File

@@ -4868,9 +4868,6 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**)
LLSelectMgr::getInstance()->highlightObjectAndFamily(objects); LLSelectMgr::getInstance()->highlightObjectAndFamily(objects);
} }
extern LLGLdouble gGLModelView[16];
void LLSelectMgr::updateSilhouettes() void LLSelectMgr::updateSilhouettes()
{ {
S32 num_sils_genned = 0; S32 num_sils_genned = 0;
@@ -5632,13 +5629,13 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
if (drawable->isActive()) if (drawable->isActive())
{ {
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix); glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
} }
else if (!is_hud_object) else if (!is_hud_object)
{ {
glLoadIdentity(); glLoadIdentity();
glMultMatrixd(gGLModelView); glMultMatrixf(gGLModelView);
LLVector3 trans = objectp->getRegion()->getOriginAgent(); LLVector3 trans = objectp->getRegion()->getOriginAgent();
glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]); glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
} }
@@ -5721,7 +5718,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
if (!is_hud_object) if (!is_hud_object)
{ {
glLoadIdentity(); glLoadIdentity();
glMultMatrixd(gGLModelView); glMultMatrixf(gGLModelView);
} }

View File

@@ -2911,7 +2911,7 @@ void renderRaycast(LLDrawable* drawablep)
// draw intersection point // draw intersection point
glPushMatrix(); glPushMatrix();
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
LLVector3 translate = gDebugRaycastIntersection; LLVector3 translate = gDebugRaycastIntersection;
glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]); glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]);
LLCoordFrame orient; LLCoordFrame orient;
@@ -3004,7 +3004,7 @@ public:
gGL.flush(); gGL.flush();
glPushMatrix(); glPushMatrix();
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
renderVisibility(group, mCamera); renderVisibility(group, mCamera);
stop_glerror(); stop_glerror();
gGLLastMatrix = NULL; gGLLastMatrix = NULL;

View File

@@ -219,8 +219,15 @@ void LLViewerCamera::calcProjection(const F32 far_distance) const
void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks) void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks)
{ {
GLint* viewport = (GLint*) gGLViewport; GLint* viewport = (GLint*) gGLViewport;
GLdouble* model = gGLModelView; F64 model[16];
GLdouble* proj = gGLProjection; F64 proj[16];
for (U32 i = 0; i < 16; i++)
{
model[i] = (F64) gGLModelView[i];
proj[i] = (F64) gGLProjection[i];
}
GLdouble objX,objY,objZ; GLdouble objX,objY,objZ;
LLVector3 frust[8]; LLVector3 frust[8];
@@ -444,24 +451,93 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
// screen coordinates to the agent's region. // screen coordinates to the agent's region.
void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent) const void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent) const
{ {
GLdouble x, y, z; GLdouble x, y, z;
F64 mdlv[16];
F64 proj[16];
for (U32 i = 0; i < 16; i++)
{
mdlv[i] = (F64) gGLModelView[i];
proj[i] = (F64) gGLProjection[i];
}
gluUnProject( gluUnProject(
GLdouble(screen_x), GLdouble(screen_y), 0.0, GLdouble(screen_x), GLdouble(screen_y), 0.0,
gGLModelView, gGLProjection, (GLint*)gGLViewport, mdlv, proj, (GLint*)gGLViewport,
&x, &x,
&y, &y,
&z ); &z );
pos_agent->setVec( (F32)x, (F32)y, (F32)z ); pos_agent->setVec( (F32)x, (F32)y, (F32)z );
} }
//Based off of http://www.opengl.org/wiki/GluProject_and_gluUnProject_code
int glProjectf(const LLVector3& object, const F32* modelview, const F32* projection, const LLRect& viewport, LLVector3& windowCoordinate)
{
const LLVector4a obj_vector(object.mV[VX],object.mV[VY],object.mV[VZ]);
LLVector4a temp_matrix;
const LLMatrix4a &view_matrix=*(LLMatrix4a*)modelview;
const LLMatrix4a &proj_matrix=*(LLMatrix4a*)projection;
view_matrix.affineTransform(obj_vector, temp_matrix);
//Passing temp_matrix as v and res is safe. res not altered until after all other calculations
proj_matrix.rotate4(temp_matrix, temp_matrix);
if(temp_matrix[VW]==0.0)
return 0;
temp_matrix.div(temp_matrix[VW]);
//Map x, y to range 0-1
temp_matrix.mul(.5f);
temp_matrix.add(.5f);
//Window coordinates
windowCoordinate[0]=temp_matrix[VX]*viewport.getWidth()+viewport.mLeft;
windowCoordinate[1]=temp_matrix[VY]*viewport.getHeight()+viewport.mBottom;
//This is only correct when glDepthRange(0.0, 1.0)
windowCoordinate[2]=temp_matrix[VZ];
return 1;
}
void MultiplyMatrices4by4OpenGL_FLOAT(LLMatrix4a& dest_matrix, const LLMatrix4a& input_matrix1, const LLMatrix4a& input_matrix2)
{
input_matrix1.rotate4(input_matrix2.mMatrix[VX],dest_matrix.mMatrix[VX]);
input_matrix1.rotate4(input_matrix2.mMatrix[VY],dest_matrix.mMatrix[VY]);
input_matrix1.rotate4(input_matrix2.mMatrix[VZ],dest_matrix.mMatrix[VZ]);
input_matrix1.rotate4(input_matrix2.mMatrix[VW],dest_matrix.mMatrix[VW]);
//Those four lines do this:
/*
result[0]=matrix1[0]*matrix2[0]+matrix1[4]*matrix2[1]+matrix1[8]*matrix2[2]+matrix1[12]*matrix2[3];
result[1]=matrix1[1]*matrix2[0]+matrix1[5]*matrix2[1]+matrix1[9]*matrix2[2]+matrix1[13]*matrix2[3];
result[2]=matrix1[2]*matrix2[0]+matrix1[6]*matrix2[1]+matrix1[10]*matrix2[2]+matrix1[14]*matrix2[3];
result[3]=matrix1[3]*matrix2[0]+matrix1[7]*matrix2[1]+matrix1[11]*matrix2[2]+matrix1[15]*matrix2[3];
result[4]=matrix1[0]*matrix2[4]+matrix1[4]*matrix2[5]+matrix1[8]*matrix2[6]+matrix1[12]*matrix2[7];
result[5]=matrix1[1]*matrix2[4]+matrix1[5]*matrix2[5]+matrix1[9]*matrix2[6]+matrix1[13]*matrix2[7];
result[6]=matrix1[2]*matrix2[4]+matrix1[6]*matrix2[5]+matrix1[10]*matrix2[6]+matrix1[14]*matrix2[7];
result[7]=matrix1[3]*matrix2[4]+matrix1[7]*matrix2[5]+matrix1[11]*matrix2[6]+matrix1[15]*matrix2[7];
result[8]=matrix1[0]*matrix2[8]+matrix1[4]*matrix2[9]+matrix1[8]*matrix2[10]+matrix1[12]*matrix2[11];
result[9]=matrix1[1]*matrix2[8]+matrix1[5]*matrix2[9]+matrix1[9]*matrix2[10]+matrix1[13]*matrix2[11];
result[10]=matrix1[2]*matrix2[8]+matrix1[6]*matrix2[9]+matrix1[10]*matrix2[10]+matrix1[14]*matrix2[11];
result[11]=matrix1[3]*matrix2[8]+matrix1[7]*matrix2[9]+matrix1[11]*matrix2[10]+matrix1[15]*matrix2[11];
result[12]=matrix1[0]*matrix2[12]+matrix1[4]*matrix2[13]+matrix1[8]*matrix2[14]+matrix1[12]*matrix2[15];
result[13]=matrix1[1]*matrix2[12]+matrix1[5]*matrix2[13]+matrix1[9]*matrix2[14]+matrix1[13]*matrix2[15];
result[14]=matrix1[2]*matrix2[12]+matrix1[6]*matrix2[13]+matrix1[10]*matrix2[14]+matrix1[14]*matrix2[15];
result[15]=matrix1[3]*matrix2[12]+ matrix1[7]*matrix2[13]+matrix1[11]*matrix2[14]+matrix1[15]*matrix2[15];
*/
}
// Uses the last GL matrices set in set_perspective to project a point from // Uses the last GL matrices set in set_perspective to project a point from
// the agent's region space to screen coordinates. Returns TRUE if point in within // the agent's region space to screen coordinates. Returns TRUE if point in within
// the current window. // the current window.
BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const
{ {
BOOL in_front = TRUE; BOOL in_front = TRUE;
GLdouble x, y, z; // object's window coords, GL-style LLVector3 window_coordinates;
LLVector3 dir_to_point = pos_agent - getOrigin(); LLVector3 dir_to_point = pos_agent - getOrigin();
dir_to_point /= dir_to_point.magVec(); dir_to_point /= dir_to_point.magVec();
@@ -478,17 +554,13 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
} }
} }
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw();
S32 viewport[4];
viewport[0] = world_view_rect.mLeft;
viewport[1] = world_view_rect.mBottom;
viewport[2] = world_view_rect.getWidth();
viewport[3] = world_view_rect.getHeight();
if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ], if (GL_TRUE == glProjectf(pos_agent, gGLModelView, gGLProjection, world_view_rect, window_coordinates))
gGLModelView, gGLProjection, (GLint*)viewport,
&x, &y, &z))
{ {
F32 &x = window_coordinates.mV[VX];
F32 &y = window_coordinates.mV[VY];
// convert screen coordinates to virtual UI coordinates // convert screen coordinates to virtual UI coordinates
x /= gViewerWindow->getDisplayScale().mV[VX]; x /= gViewerWindow->getDisplayScale().mV[VX];
y /= gViewerWindow->getDisplayScale().mV[VY]; y /= gViewerWindow->getDisplayScale().mV[VY];
@@ -581,18 +653,14 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
in_front = FALSE; in_front = FALSE;
} }
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw();
S32 viewport[4]; LLVector3 window_coordinates;
viewport[0] = world_view_rect.mLeft;
viewport[1] = world_view_rect.mBottom; if (GL_TRUE == glProjectf(pos_agent, gGLModelView, gGLProjection, world_view_rect, window_coordinates))
viewport[2] = world_view_rect.getWidth();
viewport[3] = world_view_rect.getHeight();
GLdouble x, y, z; // object's window coords, GL-style
if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY],
pos_agent.mV[VZ], gGLModelView,
gGLProjection, (GLint*)viewport,
&x, &y, &z))
{ {
F32 &x = window_coordinates.mV[VX];
F32 &y = window_coordinates.mV[VY];
x /= gViewerWindow->getDisplayScale().mV[VX]; x /= gViewerWindow->getDisplayScale().mV[VX];
y /= gViewerWindow->getDisplayScale().mV[VY]; y /= gViewerWindow->getDisplayScale().mV[VY];
// should now have the x,y coords of grab_point in screen space // should now have the x,y coords of grab_point in screen space

View File

@@ -1200,7 +1200,7 @@ void render_ui(F32 zoom_factor, int subfield, bool tiling)
if (!gSnapshot) if (!gSnapshot)
{ {
glPushMatrix(); glPushMatrix();
glLoadMatrixd(gGLLastModelView); glLoadMatrixf(gGLLastModelView);
glh_set_current_modelview(glh_copy_matrix(gGLLastModelView)); glh_set_current_modelview(glh_copy_matrix(gGLLastModelView));
} }

View File

@@ -202,13 +202,10 @@ U32 nhpo2(U32 v)
return r; return r;
} }
glh::matrix4f glh_copy_matrix(GLdouble* src) glh::matrix4f glh_copy_matrix(F32* src)
{ {
glh::matrix4f ret; glh::matrix4f ret;
for (U32 i = 0; i < 16; i++) ret.set_value(src);
{
ret.m[i] = (F32) src[i];
}
return ret; return ret;
} }
@@ -232,7 +229,7 @@ glh::matrix4f glh_get_last_projection()
return glh_copy_matrix(gGLLastProjection); return glh_copy_matrix(gGLLastProjection);
} }
void glh_copy_matrix(const glh::matrix4f& src, GLdouble* dst) void glh_copy_matrix(const glh::matrix4f& src, F32* dst)
{ {
for (U32 i = 0; i < 16; i++) for (U32 i = 0; i < 16; i++)
{ {
@@ -1920,11 +1917,11 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPushMatrix(); glPushMatrix();
glLoadMatrixd(gGLLastProjection); glLoadMatrixf(gGLLastProjection);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLLastModelView); glLoadMatrixf(gGLLastModelView);
LLVertexBuffer::unbind(); LLVertexBuffer::unbind();
@@ -3536,7 +3533,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
{ {
occlude = FALSE; occlude = FALSE;
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
LLGLSLShader::bindNoShader(); LLGLSLShader::bindNoShader();
doOcclusion(camera); doOcclusion(camera);
} }
@@ -3547,7 +3544,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
LLFastTimer t(LLFastTimer::FTM_POOLRENDER); LLFastTimer t(LLFastTimer::FTM_POOLRENDER);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
for( S32 i = 0; i < poolp->getNumPasses(); i++ ) for( S32 i = 0; i < poolp->getNumPasses(); i++ )
{ {
@@ -3596,13 +3593,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
LLVertexBuffer::unbind(); LLVertexBuffer::unbind();
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
if (occlude) if (occlude)
{ {
occlude = FALSE; occlude = FALSE;
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
LLGLSLShader::bindNoShader(); LLGLSLShader::bindNoShader();
doOcclusion(camera); doOcclusion(camera);
} }
@@ -3731,7 +3728,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
LLFastTimer t(LLFastTimer::FTM_POOLRENDER); LLFastTimer t(LLFastTimer::FTM_POOLRENDER);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ ) for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
{ {
@@ -3781,7 +3778,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
} }
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
gGL.setColorMask(true, false); gGL.setColorMask(true, false);
} }
@@ -3814,7 +3811,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
{ {
occlude = FALSE; occlude = FALSE;
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
LLGLSLShader::bindNoShader(); LLGLSLShader::bindNoShader();
doOcclusion(camera); doOcclusion(camera);
gGL.setColorMask(true, false); gGL.setColorMask(true, false);
@@ -3826,7 +3823,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
LLFastTimer t(LLFastTimer::FTM_POOLRENDER); LLFastTimer t(LLFastTimer::FTM_POOLRENDER);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ ) for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ )
{ {
@@ -3876,17 +3873,17 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
} }
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
if (occlude) if (occlude)
{ {
occlude = FALSE; occlude = FALSE;
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
LLGLSLShader::bindNoShader(); LLGLSLShader::bindNoShader();
doOcclusion(camera); doOcclusion(camera);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
} }
} }
@@ -3910,7 +3907,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0) if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0)
{ {
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ ) for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ )
{ {
@@ -3951,7 +3948,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
} }
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
} }
@@ -3982,7 +3979,7 @@ void LLPipeline::renderDebug()
gGL.color4f(1,1,1,1); gGL.color4f(1,1,1,1);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
gGL.setColorMask(true, false); gGL.setColorMask(true, false);
bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
@@ -4193,7 +4190,7 @@ void LLPipeline::renderDebug()
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
gGL.pushMatrix(); gGL.pushMatrix();
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter) for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter)
@@ -5797,10 +5794,10 @@ void LLPipeline::resetVertexBuffers()
void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture) void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture)
{ {
assertInitialized(); assertInitialized();
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
mSimplePool->pushBatches(type, mask); mSimplePool->pushBatches(type, mask);
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
} }
@@ -6687,7 +6684,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
{ {
cube_map->enable(channel); cube_map->enable(channel);
cube_map->bind(); cube_map->bind();
F64* m = gGLModelView; F32* m = gGLModelView;
F32 mat[] = { m[0], m[1], m[2], F32 mat[] = { m[0], m[1], m[2],
@@ -8075,7 +8072,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
glLoadMatrixf(proj.m); glLoadMatrixf(proj.m);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
stop_glerror(); stop_glerror();
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
@@ -8129,7 +8126,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
{ {
LLFastTimer ftm(LLFastTimer::FTM_SHADOW_ALPHA); LLFastTimer ftm(LLFastTimer::FTM_SHADOW_ALPHA);
gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.bind();
gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f); gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.6f);
renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE);
glColor4f(1,1,1,1); glColor4f(1,1,1,1);
renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
@@ -8138,7 +8135,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
//glCullFace(GL_BACK); //glCullFace(GL_BACK);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixf(gGLModelView);
doOcclusion(shadow_cam); doOcclusion(shadow_cam);
if (use_shader) if (use_shader)

View File

@@ -71,7 +71,7 @@ BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn
bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0); bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0);
BOOL setup_hud_matrices(); // use whole screen to render hud BOOL setup_hud_matrices(); // use whole screen to render hud
BOOL setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking) BOOL setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking)
glh::matrix4f glh_copy_matrix(GLdouble* src); glh::matrix4f glh_copy_matrix(F32* src);
glh::matrix4f glh_get_current_modelview(); glh::matrix4f glh_get_current_modelview();
void glh_set_current_modelview(const glh::matrix4f& mat); void glh_set_current_modelview(const glh::matrix4f& mat);
glh::matrix4f glh_get_current_projection(); glh::matrix4f glh_get_current_projection();