MAINT-775 Cleanup of some weird corner cases on animated child prims.

master
Dave Parks 2012-04-19 17:29:32 -05:00
parent 5334c410ea
commit d953cce386
5 changed files with 74 additions and 14 deletions

View File

@ -8060,6 +8060,18 @@
<real>0</real>
</map>
<key>RenderDepthPrePass</key>
<map>
<key>Comment</key>
<string>EXPERIMENTAL: Prime the depth buffer with simple prim geometry before rendering with textures.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>RenderDepthOfField</key>
<map>
<key>Comment</key>

View File

@ -182,7 +182,7 @@ LLVOVolume* LLDrawable::getVOVolume() const
const LLMatrix4& LLDrawable::getRenderMatrix() const
{
return isRoot() || isState(LLDrawable::ANIMATED_CHILD) ? getWorldMatrix() : getParent()->getWorldMatrix();
return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix();
}
BOOL LLDrawable::isLight() const
@ -538,13 +538,12 @@ F32 LLDrawable::updateXform(BOOL undamped)
target_rot = new_rot;
target_scale = new_scale;
}
else
else if (mVObjp->getAngularVelocity().isExactlyZero())
{
// snap to final position
// snap to final position (only if no target omega is applied)
dist_squared = 0.0f;
if (getVOVolume() && !isRoot() && !isState(LLDrawable::ANIMATED_CHILD))
if (getVOVolume() && !isRoot())
{ //child prim snapping to some position, needs a rebuild
setState(LLDrawable::ANIMATED_CHILD);
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
}
}
@ -558,8 +557,7 @@ F32 LLDrawable::updateXform(BOOL undamped)
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
}
else if (!isRoot() &&
(dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED ||
!mVObjp->getAngularVelocity().isExactlyZero() ||
(!mVObjp->getAngularVelocity().isExactlyZero() ||
target_pos != mXform.getPosition() ||
target_rot != mXform.getRotation()))
{ //child prim moving relative to parent, tag as needing to be rendered atomically and rebuild

View File

@ -889,6 +889,28 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
{
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
LLMemType mt_rg(LLMemType::MTYPE_DISPLAY_RENDER_GEOM);
if (gSavedSettings.getBOOL("RenderDepthPrePass") && LLGLSLShader::sNoFixedFunction)
{
gGL.setColorMask(false, false);
U32 types[] = {
LLRenderPass::PASS_SIMPLE,
LLRenderPass::PASS_FULLBRIGHT,
LLRenderPass::PASS_SHINY
};
U32 num_types = LL_ARRAY_SIZE(types);
gOcclusionProgram.bind();
for (U32 i = 0; i < num_types; i++)
{
gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
}
gOcclusionProgram.unbind();
}
gGL.setColorMask(true, false);
if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
{

View File

@ -684,7 +684,7 @@ void LLVOVolume::updateTextures()
{
updateTextureVirtualSize();
if (mDrawable.notNull() && !isVisible())
if (mDrawable.notNull() && !isVisible() && !mDrawable->isActive())
{ //delete vertex buffer to free up some VRAM
LLSpatialGroup* group = mDrawable->getSpatialGroup();
if (group)
@ -1438,7 +1438,7 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global)
BOOL rebuild = mDrawable->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED);
// bool rigged = false;
// bool rigged = false;
LLVolume* volume = mRiggedVolume;
if (!volume)
{
@ -1493,7 +1493,7 @@ void LLVOVolume::preRebuild()
}
}
void LLVOVolume::updateRelativeXform()
void LLVOVolume::updateRelativeXform(bool force_identity)
{
if (mVolumeImpl)
{
@ -1517,14 +1517,14 @@ void LLVOVolume::updateRelativeXform()
mRelativeXform.invert();
mRelativeXformInvTrans.transpose();
}
else if (drawable->isActive())
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 = drawable->isSpatialRoot() || drawable->isState(LLDrawable::ANIMATED_CHILD);
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();
@ -3969,7 +3969,14 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
if (drawable->isActive())
{
model_mat = &drawable->getRenderMatrix();
if (drawable->isState(LLDrawable::ANIMATED_CHILD))
{
model_mat = &drawable->getWorldMatrix();
}
else
{
model_mat = &drawable->getRenderMatrix();
}
}
else
{
@ -4618,6 +4625,11 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
LLVOVolume* vobj = drawablep->getVOVolume();
vobj->preRebuild();
if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
{
vobj->updateRelativeXform(true);
}
LLVolume* volume = vobj->getVolume();
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
{
@ -4637,6 +4649,12 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
}
}
}
if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
{
vobj->updateRelativeXform();
}
drawablep->clearState(LLDrawable::REBUILD_ALL);
}
@ -4951,10 +4969,20 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
LLVOVolume* vobj = drawablep->getVOVolume();
LLVolume* volume = vobj->getVolume();
if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
{
vobj->updateRelativeXform(true);
}
U32 te_idx = facep->getTEOffset();
facep->getGeometryVolume(*volume, te_idx,
vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset);
if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
{
vobj->updateRelativeXform(false);
}
}
}

View File

@ -203,7 +203,7 @@ public:
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status);
void updateRelativeXform();
void updateRelativeXform(bool force_identity = false);
/*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
/*virtual*/ void updateFaceSize(S32 idx);
/*virtual*/ BOOL updateLOD();