Merge branch 'master' of https://bitbucket.org/Shyotl/singularityviewer-internal
Conflicts: indra/newview/llnetmap.cpp - Thankies Shyotl~
This commit is contained in:
@@ -206,7 +206,7 @@ void LLFace::destroy()
|
||||
|
||||
if (mTextureMatrix)
|
||||
{
|
||||
delete mTextureMatrix;
|
||||
ll_aligned_free_16(mTextureMatrix);
|
||||
mTextureMatrix = NULL;
|
||||
|
||||
if (mDrawablep.notNull())
|
||||
@@ -493,7 +493,11 @@ void LLFace::updateCenterAgent()
|
||||
{
|
||||
if (mDrawablep->isActive())
|
||||
{
|
||||
mCenterAgent = mCenterLocal * getRenderMatrix();
|
||||
LLVector4a local_pos;
|
||||
local_pos.load3(mCenterLocal.mV);
|
||||
|
||||
getRenderMatrix().affineTransform(local_pos,local_pos);
|
||||
mCenterAgent.set(local_pos.getF32ptr());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -521,15 +525,21 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
|
||||
gGL.getTexUnit(0)->bind(imagep);
|
||||
|
||||
gGL.pushMatrix();
|
||||
|
||||
const LLMatrix4a* model_matrix = NULL;
|
||||
if (mDrawablep->isActive())
|
||||
{
|
||||
gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
|
||||
model_matrix = &(mDrawablep->getRenderMatrix());
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
|
||||
model_matrix = &mDrawablep->getRegion()->mRenderMatrix;
|
||||
}
|
||||
|
||||
if(model_matrix && !model_matrix->isIdentity())
|
||||
{
|
||||
gGL.multMatrix(*model_matrix);
|
||||
}
|
||||
|
||||
if (mDrawablep->isState(LLDrawable::RIGGED))
|
||||
{
|
||||
LLVOVolume* volume = mDrawablep->getVOVolume();
|
||||
@@ -540,7 +550,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
|
||||
{
|
||||
LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.f, -1.f);
|
||||
gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
|
||||
gGL.multMatrix(volume->getRelativeXform());
|
||||
const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset());
|
||||
|
||||
// Singu Note: Implementation changed to utilize a VBO, avoiding fixed functions unless required
|
||||
@@ -808,14 +818,14 @@ bool less_than_max_mag(const LLVector4a& vec)
|
||||
}
|
||||
|
||||
BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
|
||||
const LLMatrix4& mat_vert_in, BOOL global_volume)
|
||||
const LLMatrix4a& mat_vert_in, BOOL global_volume)
|
||||
{
|
||||
//get bounding box
|
||||
if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))
|
||||
{
|
||||
//VECTORIZE THIS
|
||||
LLMatrix4a mat_vert;
|
||||
mat_vert.loadu(mat_vert_in);
|
||||
const LLMatrix4a& mat_vert = mat_vert_in;
|
||||
//mat_vert.loadu(mat_vert_in);
|
||||
|
||||
LLVector4a min,max;
|
||||
|
||||
@@ -956,9 +966,9 @@ LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, const LLVector4a& po
|
||||
|
||||
if (mTextureMatrix) // if we have a texture matrix, use it
|
||||
{
|
||||
LLVector3 tc3(tc);
|
||||
tc3 = tc3 * *mTextureMatrix;
|
||||
tc = LLVector2(tc3);
|
||||
LLVector4a tc4(tc.mV[VX],tc.mV[VY],0.f);
|
||||
mTextureMatrix->affineTransform(tc4,tc4);
|
||||
tc.set(tc4.getF32ptr());
|
||||
}
|
||||
|
||||
else // otherwise use the texture entry parameters
|
||||
@@ -975,7 +985,7 @@ LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, const LLVector4a& po
|
||||
// by planarProjection(). This is needed to match planar texgen parameters.
|
||||
void LLFace::getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const
|
||||
{
|
||||
const LLMatrix4& vol_mat = getWorldMatrix();
|
||||
const LLMatrix4a& vol_mat = getWorldMatrix();
|
||||
const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset);
|
||||
const LLVector4a& normal4a = vf.mNormals[0];
|
||||
const LLVector4a& tangent = vf.mTangents[0];
|
||||
@@ -994,13 +1004,20 @@ void LLFace::getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_po
|
||||
F32 ang = acos(projected_binormal.mV[VY]);
|
||||
ang = (projected_binormal.mV[VX] < 0.f) ? -ang : ang;
|
||||
|
||||
//VECTORIZE THIS
|
||||
LLVector3 binormal(binormal4a.getF32ptr());
|
||||
LLVector3 normal(normal4a.getF32ptr());
|
||||
binormal.rotVec(ang, normal);
|
||||
LLQuaternion local_rot( binormal % normal, binormal, normal );
|
||||
*face_rot = local_rot * vol_mat.quaternion();
|
||||
*face_pos = vol_mat.getTranslation();
|
||||
LLMatrix4a rot = gGL.genRot(ang, normal4a);
|
||||
rot.rotate(binormal4a, binormal4a);
|
||||
|
||||
LLVector4a x_axis;
|
||||
x_axis.setCross3(binormal4a, normal4a);
|
||||
|
||||
LLQuaternion2 local_rot(LLQuaternion( LLVector3(x_axis.getF32ptr()), LLVector3(binormal4a.getF32ptr()), LLVector3(normal4a.getF32ptr()) ));
|
||||
|
||||
LLMatrix4 vol_mat2(vol_mat.getF32ptr());
|
||||
|
||||
local_rot.mul(LLQuaternion2(vol_mat2.quaternion()));
|
||||
|
||||
*face_rot = LLQuaternion(local_rot.getVector4a().getF32ptr());
|
||||
face_pos->set(vol_mat.getRow<VW>().getF32ptr());
|
||||
}
|
||||
|
||||
// Returns the necessary texture transform to align this face's TE to align_to's TE
|
||||
@@ -1083,7 +1100,7 @@ bool LLFace::canRenderAsMask()
|
||||
static const LLCachedControl<F32> auto_mask_max_rmse("SHAutoMaskMaxRMSE",.09f);
|
||||
if ((te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
|
||||
(te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
|
||||
(!getViewerObject()->isAttachment() && getTexture()->getIsAlphaMask(use_rmse_auto_mask ? auto_mask_max_rmse : -1.f))) // texture actually qualifies for masking (lazily recalculated but expensive)
|
||||
(getTexture()->getIsAlphaMask((!getViewerObject()->isAttachment() && use_rmse_auto_mask) ? auto_mask_max_rmse : -1.f))) // texture actually qualifies for masking (lazily recalculated but expensive)
|
||||
{
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
@@ -1202,7 +1219,7 @@ static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_PLANAR("Quick Planar");
|
||||
|
||||
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
const S32 &f,
|
||||
const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in,
|
||||
const LLMatrix4a& mat_vert_in, const LLMatrix4a& mat_norm_in,
|
||||
const U16 &index_offset,
|
||||
bool force_rebuild)
|
||||
{
|
||||
@@ -1349,8 +1366,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
}
|
||||
}
|
||||
|
||||
LLMatrix4a mat_normal;
|
||||
mat_normal.loadu(mat_norm_in);
|
||||
const LLMatrix4a& mat_normal = mat_norm_in;
|
||||
|
||||
F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0;
|
||||
bool do_xform = false;
|
||||
@@ -1409,7 +1425,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
LLGLSLShader* cur_shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix((GLfloat*) mat_vert_in.mMatrix);
|
||||
gGL.loadMatrix(mat_vert_in);
|
||||
|
||||
if (rebuild_pos)
|
||||
{
|
||||
@@ -1550,7 +1566,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
LLQuaternion bump_quat;
|
||||
if (mDrawablep->isActive())
|
||||
{
|
||||
bump_quat = LLQuaternion(mDrawablep->getRenderMatrix());
|
||||
bump_quat = LLQuaternion(LLMatrix4(mDrawablep->getRenderMatrix().getF32ptr()));
|
||||
}
|
||||
|
||||
if (bump_code)
|
||||
@@ -1712,16 +1728,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
else
|
||||
{ //do tex mat, no texgen, no atlas, no bump
|
||||
for (S32 i = 0; i < num_vertices; i++)
|
||||
{
|
||||
LLVector2 tc(vf.mTexCoords[i]);
|
||||
{
|
||||
//LLVector4a& norm = vf.mNormals[i];
|
||||
//LLVector4a& center = *(vf.mCenter);
|
||||
|
||||
LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
|
||||
tmp = tmp * *mTextureMatrix;
|
||||
tc.mV[0] = tmp.mV[0];
|
||||
tc.mV[1] = tmp.mV[1];
|
||||
*tex_coords0++ = tc;
|
||||
LLVector4a tc(vf.mTexCoords[i].mV[VX],vf.mTexCoords[i].mV[VY],0.f);
|
||||
mTextureMatrix->affineTransform(tc,tc);
|
||||
(tex_coords0++)->set(tc.getF32ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1739,12 +1751,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
vec.mul(scalea);
|
||||
planarProjection(tc, norm, center, vec);
|
||||
|
||||
LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
|
||||
tmp = tmp * *mTextureMatrix;
|
||||
tc.mV[0] = tmp.mV[0];
|
||||
tc.mV[1] = tmp.mV[1];
|
||||
|
||||
*tex_coords0++ = tc;
|
||||
LLVector4a tmp(tc.mV[VX],tc.mV[VY],0.f);
|
||||
mTextureMatrix->affineTransform(tmp,tmp);
|
||||
(tex_coords0++)->set(tmp.getF32ptr());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1854,10 +1863,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
|
||||
if (tex_mode && mTextureMatrix)
|
||||
{
|
||||
LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
|
||||
tmp = tmp * *mTextureMatrix;
|
||||
tc.mV[0] = tmp.mV[0];
|
||||
tc.mV[1] = tmp.mV[1];
|
||||
LLVector4a tmp(tc.mV[VX],tc.mV[VY],0.f);
|
||||
mTextureMatrix->affineTransform(tmp,tmp);
|
||||
tc.set(tmp.getF32ptr());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1935,8 +1943,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
|
||||
mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range);
|
||||
|
||||
LLMatrix4a mat_vert;
|
||||
mat_vert.loadu(mat_vert_in);
|
||||
const LLMatrix4a& mat_vert = mat_vert_in;
|
||||
|
||||
F32* dst = (F32*) vert.get();
|
||||
F32* end_f32 = dst+mGeomCount*4;
|
||||
@@ -2053,10 +2060,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
|
||||
mVObjp->getVolume()->genTangents(f);
|
||||
|
||||
LLVector4Logical mask;
|
||||
mask.clear();
|
||||
mask.setElement<3>();
|
||||
|
||||
LLVector4a* src = vf.mTangents;
|
||||
LLVector4a* end = vf.mTangents+num_vertices;
|
||||
|
||||
@@ -2065,7 +2068,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
LLVector4a tangent_out;
|
||||
mat_normal.rotate(*src, tangent_out);
|
||||
tangent_out.normalize3fast();
|
||||
tangent_out.setSelectWithMask(mask, *src, tangent_out);
|
||||
tangent_out.copyComponent<3>(*src);
|
||||
tangent_out.store4a(tangents);
|
||||
|
||||
src++;
|
||||
@@ -2529,7 +2532,7 @@ S32 LLFace::pushVertices(const U16* index_array) const
|
||||
return mIndicesCount;
|
||||
}
|
||||
|
||||
const LLMatrix4& LLFace::getRenderMatrix() const
|
||||
const LLMatrix4a& LLFace::getRenderMatrix() const
|
||||
{
|
||||
return mDrawablep->getRenderMatrix();
|
||||
}
|
||||
@@ -2545,7 +2548,7 @@ S32 LLFace::renderElements(const U16 *index_array) const
|
||||
else
|
||||
{
|
||||
gGL.pushMatrix();
|
||||
gGL.multMatrix((float*)getRenderMatrix().mMatrix);
|
||||
gGL.multMatrix(getRenderMatrix());
|
||||
ret = pushVertices(index_array);
|
||||
gGL.popMatrix();
|
||||
}
|
||||
@@ -2605,7 +2608,10 @@ LLVector3 LLFace::getPositionAgent() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return mCenterLocal * getRenderMatrix();
|
||||
LLVector4a center_local;
|
||||
center_local.load3(mCenterLocal.mV);
|
||||
getRenderMatrix().affineTransform(center_local,center_local);
|
||||
return LLVector3(center_local.getF32ptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user