Ver código fonte

Update babylon.engine.ts

Texture size and 'ready' boolean set before the processFunction, in order to access these attributes when the texture 'onload' function is called.
Temechon 10 anos atrás
pai
commit
80166c329c
1 arquivos alterados com 6 adições e 5 exclusões
  1. 6 5
      Babylon/babylon.engine.ts

+ 6 - 5
Babylon/babylon.engine.ts

@@ -310,6 +310,12 @@
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
 
 
+        texture._baseWidth = width;
+        texture._baseHeight = height;
+        texture._width = potWidth;
+        texture._height = potHeight;
+        texture.isReady = true;
+        
         processFunction(potWidth, potHeight);
         processFunction(potWidth, potHeight);
 
 
         var filters = getSamplingParameters(samplingMode, !noMipmap, gl);
         var filters = getSamplingParameters(samplingMode, !noMipmap, gl);
@@ -324,11 +330,6 @@
         gl.bindTexture(gl.TEXTURE_2D, null);
         gl.bindTexture(gl.TEXTURE_2D, null);
 
 
         engine._activeTexturesCache = [];
         engine._activeTexturesCache = [];
-        texture._baseWidth = width;
-        texture._baseHeight = height;
-        texture._width = potWidth;
-        texture._height = potHeight;
-        texture.isReady = true;
         texture.samplingMode = samplingMode;
         texture.samplingMode = samplingMode;
         scene._removePendingData(texture);
         scene._removePendingData(texture);
     };
     };