@@ -641,6 +641,15 @@ void LLVOVolume::animateTextures()
641
641
if (!facep->mTextureMatrix )
642
642
{
643
643
facep->mTextureMatrix = new LLMatrix4 ();
644
+ if (facep->getVirtualSize () > MIN_TEX_ANIM_SIZE)
645
+ {
646
+ // Fix the one edge case missed in
647
+ // LLVOVolume::updateTextureVirtualSize when the
648
+ // mTextureMatrix is not yet present
649
+ gPipeline .markRebuild (mDrawable , LLDrawable::REBUILD_TCOORD);
650
+ mDrawable ->getSpatialGroup ()->dirtyGeom ();
651
+ gPipeline .markRebuild (mDrawable ->getSpatialGroup ());
652
+ }
644
653
}
645
654
646
655
LLMatrix4& tex_mat = *facep->mTextureMatrix ;
@@ -832,12 +841,25 @@ void LLVOVolume::updateTextureVirtualSize(bool forced)
832
841
// if the face has gotten small enough to turn off texture animation and texture
833
842
// animation is running, rebuild the render batch for this face to turn off
834
843
// texture animation
844
+ // Do the opposite when the face gets big enough.
845
+ // If a face is animatable, it will always have non-null mTextureMatrix
846
+ // pointer defined after the first call to LLVOVolume::animateTextures,
847
+ // although the animation is not always turned on.
835
848
if (face->mTextureMatrix != NULL )
836
849
{
837
- if ((vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE) ||
838
- (vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE))
850
+ if ((vsize > MIN_TEX_ANIM_SIZE) != (old_size > MIN_TEX_ANIM_SIZE))
839
851
{
840
852
gPipeline .markRebuild (mDrawable , LLDrawable::REBUILD_TCOORD);
853
+ // dirtyGeom+markRebuild tells the engine to call
854
+ // LLVolumeGeometryManager::rebuildGeom, which rebuilds the
855
+ // LLDrawInfo for the spatial group containing this LLFace,
856
+ // safely copying the mTextureMatrix from the LLFace the the
857
+ // LLDrawInfo. While it's not ideal to call it here, prims with
858
+ // animated faces get moved to a smaller partition to reduce
859
+ // side-effects of their updates (see shrinkWrap in
860
+ // LLVOVolume::animateTextures).
861
+ mDrawable ->getSpatialGroup ()->dirtyGeom ();
862
+ gPipeline .markRebuild (mDrawable ->getSpatialGroup ());
841
863
}
842
864
}
843
865
0 commit comments