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