@@ -41,6 +41,7 @@ function EntityData(entity) {
4141 this . entity = entity ;
4242 this . billboard = undefined ;
4343 this . textureValue = undefined ;
44+ this . subRegion = undefined ;
4445}
4546
4647/**
@@ -128,10 +129,12 @@ BillboardVisualizer.prototype.update = function (time) {
128129 billboard . id = entity ;
129130 item . billboard = billboard ;
130131 item . textureValue = undefined ;
132+ item . subRegion = undefined ;
131133 }
132134
133135 billboard . show = show ;
134- if ( item . textureValue !== textureValue ) {
136+ const imageUpdated = item . textureValue !== textureValue ;
137+ if ( imageUpdated ) {
135138 billboard . image = textureValue ;
136139 item . textureValue = textureValue ;
137140 }
@@ -232,13 +235,16 @@ BillboardVisualizer.prototype.update = function (time) {
232235 time ,
233236 boundingRectangleScratch ,
234237 ) ;
235- if (
236- defined ( subRegion ) &&
237- ! BoundingRectangle . equals ( subRegion , item . subRegion )
238- ) {
239- billboard . setImageSubRegion ( billboard . image , subRegion ) ;
238+ const subRegionUpdated = ! BoundingRectangle . equals (
239+ subRegion ,
240+ item . subRegion ,
241+ ) ;
242+ if ( subRegionUpdated ) {
240243 item . subRegion = BoundingRectangle . clone ( subRegion , item . subRegion ) ;
241244 }
245+ if ( defined ( subRegion ) && ( imageUpdated || subRegionUpdated ) ) {
246+ billboard . setImageSubRegion ( billboard . image , subRegion ) ;
247+ }
242248 }
243249 return true ;
244250} ;
0 commit comments