Migration to LLMatrix4a instead of glh::matrix4f
This commit is contained in:
@@ -266,9 +266,9 @@ void LLCubeMap::setMatrix(S32 stage)
|
||||
gGL.getTexUnit(stage)->activate();
|
||||
}
|
||||
|
||||
LLVector3 x(gGLModelView.mMatrix[0].getF32ptr());
|
||||
LLVector3 y(gGLModelView.mMatrix[1].getF32ptr());
|
||||
LLVector3 z(gGLModelView.mMatrix[2].getF32ptr());
|
||||
LLVector3 x(gGLModelView.getRow<0>().getF32ptr());
|
||||
LLVector3 y(gGLModelView.getRow<1>().getF32ptr());
|
||||
LLVector3 z(gGLModelView.getRow<2>().getF32ptr());
|
||||
|
||||
LLMatrix3 mat3;
|
||||
mat3.setRows(x,y,z);
|
||||
|
||||
@@ -2179,7 +2179,7 @@ void parse_glsl_version(S32& major, S32& minor)
|
||||
LLStringUtil::convertToS32(minor_str, minor);
|
||||
}
|
||||
|
||||
LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply)
|
||||
LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const LLMatrix4a& modelview, const LLMatrix4a& projection, bool apply)
|
||||
{
|
||||
mApply = apply;
|
||||
|
||||
@@ -2194,27 +2194,33 @@ LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& mode
|
||||
|
||||
void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
|
||||
{
|
||||
glh::matrix4f& P = mProjection;
|
||||
glh::matrix4f& M = mModelview;
|
||||
|
||||
glh::matrix4f invtrans_MVP = (P * M).inverse().transpose();
|
||||
glh::vec4f oplane(a,b,c,d);
|
||||
glh::vec4f cplane;
|
||||
invtrans_MVP.mult_matrix_vec(oplane, cplane);
|
||||
LLMatrix4a& P = mProjection;
|
||||
LLMatrix4a& M = mModelview;
|
||||
|
||||
cplane /= fabs(cplane[2]); // normalize such that depth is not scaled
|
||||
cplane[3] -= 1;
|
||||
LLMatrix4a invtrans_MVP;
|
||||
invtrans_MVP.setMul(P,M);
|
||||
invtrans_MVP.invert();
|
||||
invtrans_MVP.transpose();
|
||||
|
||||
if(cplane[2] < 0)
|
||||
cplane *= -1;
|
||||
LLVector4a oplane(a,b,c,d);
|
||||
LLVector4a cplane;
|
||||
invtrans_MVP.rotate4(oplane,cplane);
|
||||
|
||||
cplane.div(cplane.getScalarAt<2>().getAbs());
|
||||
cplane.sub(LLVector4a(0.f,0.f,0.f,1.f));
|
||||
|
||||
cplane.setSelectWithMask( LLVector4a(cplane.getScalarAt<2>().getQuad()).lessThan( _mm_setzero_ps() ), -(LLSimdScalar)cplane, cplane );
|
||||
|
||||
LLMatrix4a suffix;
|
||||
suffix.setIdentity();
|
||||
suffix.setColumn<2>(cplane);
|
||||
LLMatrix4a newP;
|
||||
newP.setMul(suffix,P);
|
||||
|
||||
glh::matrix4f suffix;
|
||||
suffix.set_row(2, cplane);
|
||||
glh::matrix4f newP = suffix * P;
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(newP.m);
|
||||
gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
|
||||
gGL.loadMatrix(newP.getF32ptr());
|
||||
//gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "llstring.h"
|
||||
#include "stdtypes.h"
|
||||
#include "v4math.h"
|
||||
#include "llmatrix4a.h"
|
||||
#include "llplane.h"
|
||||
#include "llgltypes.h"
|
||||
#include "llinstancetracker.h"
|
||||
@@ -325,7 +326,7 @@ class LLGLUserClipPlane
|
||||
{
|
||||
public:
|
||||
|
||||
LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply = true);
|
||||
LLGLUserClipPlane(const LLPlane& plane, const LLMatrix4a& modelview, const LLMatrix4a& projection, bool apply = true);
|
||||
~LLGLUserClipPlane();
|
||||
|
||||
void setPlane(F32 a, F32 b, F32 c, F32 d);
|
||||
@@ -333,8 +334,8 @@ public:
|
||||
private:
|
||||
bool mApply;
|
||||
|
||||
glh::matrix4f mProjection;
|
||||
glh::matrix4f mModelview;
|
||||
LLMatrix4a mProjection;
|
||||
LLMatrix4a mModelview;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -311,16 +311,19 @@ public:
|
||||
/*virtual*/ S32 getDepthChannel() const { return 1; }
|
||||
/*virtual*/ QuadType preDraw()
|
||||
{
|
||||
glh::matrix4f inv_proj(gGLModelView.getF32ptr());
|
||||
inv_proj.mult_left(gGLProjection.getF32ptr());
|
||||
inv_proj = inv_proj.inverse();
|
||||
glh::matrix4f prev_proj(gGLPreviousModelView.getF32ptr());
|
||||
prev_proj.mult_left(gGLProjection.getF32ptr());
|
||||
const LLMatrix4a& M = gGLModelView;
|
||||
const LLMatrix4a& P = gGLProjection;
|
||||
LLMatrix4a inv_proj;
|
||||
inv_proj.setMul(gGLProjection,gGLModelView);
|
||||
inv_proj.invert();
|
||||
const LLMatrix4a& MPrev = gGLPreviousModelView;
|
||||
LLMatrix4a prev_proj;
|
||||
prev_proj.setMul(P,MPrev);
|
||||
|
||||
LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
|
||||
|
||||
getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.m);
|
||||
getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.m);
|
||||
getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.getF32ptr());
|
||||
getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.getF32ptr());
|
||||
getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
|
||||
getShader().uniform1i(sBlurStrength, mStrength);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user