Conflicts:
	indra/newview/llnetmap.cpp - Thankies Shyotl~
This commit is contained in:
Inusaito Sayori
2014-07-21 23:31:59 -04:00
111 changed files with 2419 additions and 3960 deletions

View File

@@ -564,29 +564,28 @@ void LLVOVolume::animateTextures()
if (!facep->mTextureMatrix)
{
facep->mTextureMatrix = new LLMatrix4();
facep->mTextureMatrix = new LLMatrix4a();
}
LLMatrix4& tex_mat = *facep->mTextureMatrix;
LLMatrix4a& tex_mat = *facep->mTextureMatrix;
tex_mat.setIdentity();
LLVector3 trans ;
{
trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f));
tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f));
trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f));
tex_mat.setTranslate_affine(LLVector3(-0.5f, -0.5f, 0.f));
}
LLVector3 scale(scale_s, scale_t, 1.f);
LLQuaternion quat;
quat.setQuat(rot, 0, 0, -1.f);
LLVector3 scale(scale_s, scale_t, 1.f);
tex_mat.setMul(gGL.genRot(rot*RAD_TO_DEG,0.f,0.f,-1.f),tex_mat); //left mul
tex_mat.rotate(quat);
LLMatrix4a scale_mat;
scale_mat.setIdentity();
scale_mat.applyScale_affine(scale);
tex_mat.setMul(scale_mat, tex_mat); //left mul
LLMatrix4 mat;
mat.initAll(scale, LLQuaternion(), LLVector3());
tex_mat *= mat;
tex_mat.translate(trans);
}
tex_mat.translate_affine(trans);
}
}
else
{
@@ -1510,93 +1509,53 @@ void LLVOVolume::updateRelativeXform(bool force_identity)
{ //rigged volume (which is in agent space) is used for generating bounding boxes etc
//inverse of render matrix should go to partition space
mRelativeXform = getRenderMatrix();
F32* dst = (F32*) mRelativeXformInvTrans.mMatrix;
F32* src = (F32*) mRelativeXform.mMatrix;
dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];
dst[3] = src[4]; dst[4] = src[5]; dst[5] = src[6];
dst[6] = src[8]; dst[7] = src[9]; dst[8] = src[10];
mRelativeXformInvTrans = mRelativeXform;
mRelativeXform.invert();
mRelativeXformInvTrans.transpose();
}
else if (drawable->isActive() || force_identity)
{
// setup relative transforms
LLQuaternion delta_rot;
LLVector3 delta_pos, delta_scale;
//matrix from local space to parent relative/global space
bool use_identity = force_identity || drawable->isSpatialRoot();
delta_rot = use_identity ? LLQuaternion() : mDrawable->getRotation();
delta_pos = use_identity ? LLVector3(0,0,0) : mDrawable->getPosition();
delta_scale = mDrawable->getScale();
// Vertex transform (4x4)
LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot;
LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot;
LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot;
mRelativeXform.initRows(LLVector4(x_axis, 0.f),
LLVector4(y_axis, 0.f),
LLVector4(z_axis, 0.f),
LLVector4(delta_pos, 1.f));
// compute inverse transpose for normals
// mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
// mRelativeXformInvTrans.invert();
// mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis);
// grumble - invert is NOT a matrix invert, so we do it by hand:
LLMatrix3 rot_inverse = LLMatrix3(~delta_rot);
LLMatrix3 scale_inverse;
scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / delta_scale.mV[VX],
LLVector3(0.0, 1.0, 0.0) / delta_scale.mV[VY],
LLVector3(0.0, 0.0, 1.0) / delta_scale.mV[VZ]);
mRelativeXformInvTrans = rot_inverse * scale_inverse;
if(use_identity)
{
mRelativeXform.setIdentity();
mRelativeXform.applyScale_affine(mDrawable->getScale());
}
else
{
mRelativeXform = LLQuaternion2(mDrawable->getRotation());
mRelativeXform.applyScale_affine(mDrawable->getScale());
mRelativeXform.setTranslate_affine(mDrawable->getPosition());
}
mRelativeXformInvTrans = mRelativeXform;
mRelativeXformInvTrans.invert();
mRelativeXformInvTrans.transpose();
}
else
{
LLVector3 pos = getPosition();
LLVector3 scale = getScale();
LLQuaternion rot = getRotation();
LLVector4a pos;
pos.load3(getPosition().mV);
LLQuaternion2 rot(getRotation());
if (mParent)
{
pos *= mParent->getRotation();
pos += mParent->getPosition();
rot *= mParent->getRotation();
LLMatrix4a lrot = LLQuaternion2(mParent->getRotation());
lrot.rotate(pos,pos);
LLVector4a lpos;
lpos.load3(mParent->getPosition().mV);
pos.add(lpos);
rot.mul(LLQuaternion2(mParent->getRotation()));
}
//LLViewerRegion* region = getRegion();
//pos += region->getOriginAgent();
LLVector3 x_axis = LLVector3(scale.mV[VX], 0.f, 0.f) * rot;
LLVector3 y_axis = LLVector3(0.f, scale.mV[VY], 0.f) * rot;
LLVector3 z_axis = LLVector3(0.f, 0.f, scale.mV[VZ]) * rot;
mRelativeXform.initRows(LLVector4(x_axis, 0.f),
LLVector4(y_axis, 0.f),
LLVector4(z_axis, 0.f),
LLVector4(pos, 1.f));
// compute inverse transpose for normals
LLMatrix3 rot_inverse = LLMatrix3(~rot);
LLMatrix3 scale_inverse;
scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / scale.mV[VX],
LLVector3(0.0, 1.0, 0.0) / scale.mV[VY],
LLVector3(0.0, 0.0, 1.0) / scale.mV[VZ]);
mRelativeXformInvTrans = rot_inverse * scale_inverse;
mRelativeXform = rot;
mRelativeXform.applyScale_affine(getScale());
mRelativeXform.setTranslate_affine(LLVector3(pos.getF32ptr()));
mRelativeXformInvTrans = mRelativeXform;
mRelativeXformInvTrans.invert();
mRelativeXformInvTrans.transpose();
}
}
@@ -1734,11 +1693,6 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
// Update face flags
updateFaceFlags();
if(compiled)
{
LLPipeline::sCompiles++;
}
mVolumeChanged = FALSE;
mLODChanged = FALSE;
mSculptChanged = FALSE;
@@ -3032,10 +2986,10 @@ void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_p
}
updateRelativeXform();
LLMatrix4 trans_mat = mRelativeXform;
LLMatrix4a trans_mat = mRelativeXform;
if (mDrawable->isStatic())
{
trans_mat.translate(getRegion()->getOriginAgent());
trans_mat.translate_affine(getRegion()->getOriginAgent());
}
volume->generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals, view_vector, trans_mat, mRelativeXformInvTrans, nodep->getTESelectMask());
@@ -3082,7 +3036,7 @@ BOOL LLVOVolume::isHUDAttachment() const
}
const LLMatrix4 LLVOVolume::getRenderMatrix() const
const LLMatrix4a& LLVOVolume::getRenderMatrix() const
{
if (mDrawable->isActive() && !mDrawable->isRoot())
{
@@ -3564,7 +3518,7 @@ void LLVOVolume::onShift(const LLVector4a &shift_vector)
updateRelativeXform();
}
const LLMatrix4& LLVOVolume::getWorldMatrix(LLXformMatrix* xform) const
const LLMatrix4a& LLVOVolume::getWorldMatrix(LLXformMatrix* xform) const
{
if (mVolumeImpl)
{
@@ -3924,7 +3878,6 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
//build matrix palette
LLMatrix4a mp[JOINT_COUNT];
LLMatrix4* mat = (LLMatrix4*) mp;
U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
@@ -3939,8 +3892,9 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
}
if (joint)
{
mat[j] = skin->mInvBindMatrix[j];
mat[j] *= joint->getWorldMatrix();
LLMatrix4a mat;
mat.loadu((F32*)skin->mInvBindMatrix[j].mMatrix);
mp[j].setMul(joint->getWorldMatrix(), mat);
}
}
@@ -4183,13 +4137,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
return;
}
const LLMatrix4* tex_mat = NULL;
const LLMatrix4a* tex_mat = NULL;
if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE)
{
tex_mat = facep->mTextureMatrix;
}
const LLMatrix4* model_mat = NULL;
const LLMatrix4a* model_mat = NULL;
LLDrawable* drawable = facep->getDrawable();
@@ -4206,6 +4160,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
model_mat = &(drawable->getRegion()->mRenderMatrix);
}
if(model_mat && model_mat->isIdentity())
{
model_mat = NULL;
}
//drawable->getVObj()->setDebugText(llformat("%d", drawable->isState(LLDrawable::ANIMATED_CHILD)));
LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get();
@@ -4558,8 +4517,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
vobj->isMesh() &&
gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj);
//bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic();
bool is_rigged = false;
static const LLCachedControl<bool> alt_batching("SHAltBatching",true);
@@ -5577,8 +5534,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
LLViewerTexture* tex = facep->getTexture();
LLMaterialPtr mat = facep->getTextureEntry()->getMaterialParams();
//bool bake_sunlight = LLPipeline::sBakeSunlight && facep->getDrawable()->isStatic();
static const LLCachedControl<bool> alt_batching("SHAltBatching",true);
if (!alt_batching && distance_sort)
{