@@ -752,6 +752,8 @@ class RenderWebGL extends EventEmitter {
752
752
const color = __touchingColor ;
753
753
const hasMask = Boolean ( mask3b ) ;
754
754
755
+ drawable . updateCPURenderAttributes ( ) ;
756
+
755
757
// Scratch Space - +y is top
756
758
for ( let y = bounds . bottom ; y <= bounds . top ; y ++ ) {
757
759
if ( bounds . width * ( y - bounds . bottom ) * ( candidates . length + 1 ) >= maxPixelsForCPU ) {
@@ -895,6 +897,8 @@ class RenderWebGL extends EventEmitter {
895
897
const drawable = this . _allDrawables [ drawableID ] ;
896
898
const point = __isTouchingDrawablesPoint ;
897
899
900
+ drawable . updateCPURenderAttributes ( ) ;
901
+
898
902
// This is an EXTREMELY brute force collision detector, but it is
899
903
// still faster than asking the GPU to give us the pixels.
900
904
for ( let x = bounds . left ; x <= bounds . right ; x ++ ) {
@@ -971,12 +975,7 @@ class RenderWebGL extends EventEmitter {
971
975
const bounds = this . clientSpaceToScratchBounds ( centerX , centerY , touchWidth , touchHeight ) ;
972
976
const worldPos = twgl . v3 . create ( ) ;
973
977
974
- drawable . updateMatrix ( ) ;
975
- if ( drawable . skin ) {
976
- drawable . skin . updateSilhouette ( this . _getDrawableScreenSpaceScale ( drawable ) ) ;
977
- } else {
978
- log . warn ( `Could not find skin for drawable with id: ${ drawableID } ` ) ;
979
- }
978
+ drawable . updateCPURenderAttributes ( ) ;
980
979
981
980
for ( worldPos [ 1 ] = bounds . bottom ; worldPos [ 1 ] <= bounds . top ; worldPos [ 1 ] ++ ) {
982
981
for ( worldPos [ 0 ] = bounds . left ; worldPos [ 0 ] <= bounds . right ; worldPos [ 0 ] ++ ) {
@@ -1007,12 +1006,7 @@ class RenderWebGL extends EventEmitter {
1007
1006
const drawable = this . _allDrawables [ id ] ;
1008
1007
// default pick list ignores visible and ghosted sprites.
1009
1008
if ( drawable . getVisible ( ) && drawable . getUniforms ( ) . u_ghost !== 0 ) {
1010
- drawable . updateMatrix ( ) ;
1011
- if ( drawable . skin ) {
1012
- drawable . skin . updateSilhouette ( this . _getDrawableScreenSpaceScale ( drawable ) ) ;
1013
- } else {
1014
- log . warn ( `Could not find skin for drawable with id: ${ id } ` ) ;
1015
- }
1009
+ drawable . updateCPURenderAttributes ( ) ;
1016
1010
return true ;
1017
1011
}
1018
1012
return false ;
@@ -1244,8 +1238,6 @@ class RenderWebGL extends EventEmitter {
1244
1238
/** @todo remove this once URL-based skin setting is removed. */
1245
1239
if ( ! drawable . skin || ! drawable . skin . getTexture ( [ 100 , 100 ] ) ) return null ;
1246
1240
1247
- drawable . updateMatrix ( ) ;
1248
- drawable . skin . updateSilhouette ( this . _getDrawableScreenSpaceScale ( drawable ) ) ;
1249
1241
const bounds = drawable . getFastBounds ( ) ;
1250
1242
1251
1243
// Limit queries to the stage size.
@@ -1282,8 +1274,7 @@ class RenderWebGL extends EventEmitter {
1282
1274
const drawable = this . _allDrawables [ id ] ;
1283
1275
if ( drawable . skin && drawable . _visible ) {
1284
1276
// Update the CPU position data
1285
- drawable . updateMatrix ( ) ;
1286
- drawable . skin . updateSilhouette ( this . _getDrawableScreenSpaceScale ( drawable ) ) ;
1277
+ drawable . updateCPURenderAttributes ( ) ;
1287
1278
const candidateBounds = drawable . getFastBounds ( ) ;
1288
1279
if ( bounds . intersects ( candidateBounds ) ) {
1289
1280
result . push ( {
@@ -1763,15 +1754,14 @@ class RenderWebGL extends EventEmitter {
1763
1754
_getConvexHullPointsForDrawable ( drawableID ) {
1764
1755
const drawable = this . _allDrawables [ drawableID ] ;
1765
1756
1766
- drawable . updateMatrix ( ) ;
1767
- drawable . skin . updateSilhouette ( this . _getDrawableScreenSpaceScale ( drawable ) ) ;
1768
-
1769
1757
const [ width , height ] = drawable . skin . size ;
1770
1758
// No points in the hull if invisible or size is 0.
1771
1759
if ( ! drawable . getVisible ( ) || width === 0 || height === 0 ) {
1772
1760
return [ ] ;
1773
1761
}
1774
1762
1763
+ drawable . updateCPURenderAttributes ( ) ;
1764
+
1775
1765
/**
1776
1766
* Return the determinant of two vectors, the vector from A to B and
1777
1767
* the vector from A to C.
0 commit comments