Przeglądaj źródła

Fix sprite check when there is no visible sprites

David Catuhe 6 lat temu
rodzic
commit
3280f82d1d

+ 3 - 0
Tools/Gulp/package.json

@@ -11,5 +11,8 @@
     "scripts": {
     "scripts": {
         "install": "cd ../../ && npm install && cd Playground/ && npm install && cd ../Viewer && npm install && cd ../Tools/Gulp/",
         "install": "cd ../../ && npm install && cd Playground/ && npm install && cd ../Viewer && npm install && cd ../Tools/Gulp/",
         "build": "gulp --max-old-space-size=8192 --tsLintFix"
         "build": "gulp --max-old-space-size=8192 --tsLintFix"
+    },
+    "dependencies": {
+        "typescript": "^3.3.3333"
     }
     }
 }
 }

+ 1 - 1
dist/preview release/what's new.md

@@ -35,7 +35,7 @@
   - Added sheen support to PBR ([Sebavan](https://github.com/Sebavan)) **** NEED DEMO or DOC LINK)
   - Added sheen support to PBR ([Sebavan](https://github.com/Sebavan)) **** NEED DEMO or DOC LINK)
 
 
 ## Optimizations
 ## Optimizations
-- Moved all shaders to mediump by default. High precision is still available under an engine options ([Deltakosh](https://github.com/deltakosh))
+- Added an engine creation option to compile all shaders with medium precision ([Deltakosh](https://github.com/deltakosh))
 - Optimized effect reused for shadow maps ([Deltakosh](https://github.com/deltakosh))
 - Optimized effect reused for shadow maps ([Deltakosh](https://github.com/deltakosh))
 - Added support for Scissor testing ([Deltakosh](https://github.com/deltakosh))
 - Added support for Scissor testing ([Deltakosh](https://github.com/deltakosh))
 - Improved shader precision detection ([Deltakosh](https://github.com/deltakosh))
 - Improved shader precision detection ([Deltakosh](https://github.com/deltakosh))

+ 7 - 0
src/Sprites/spriteManager.ts

@@ -328,12 +328,14 @@ export class SpriteManager implements ISpriteManager {
         var rowSize = baseSize.width / this.cellWidth;
         var rowSize = baseSize.width / this.cellWidth;
 
 
         var offset = 0;
         var offset = 0;
+        let noSprite = true;
         for (var index = 0; index < max; index++) {
         for (var index = 0; index < max; index++) {
             var sprite = this.sprites[index];
             var sprite = this.sprites[index];
             if (!sprite || !sprite.isVisible) {
             if (!sprite || !sprite.isVisible) {
                 continue;
                 continue;
             }
             }
 
 
+            noSprite = false;
             sprite._animate(deltaTime);
             sprite._animate(deltaTime);
 
 
             this._appendSpriteVertex(offset++, sprite, 0, 0, rowSize);
             this._appendSpriteVertex(offset++, sprite, 0, 0, rowSize);
@@ -341,6 +343,11 @@ export class SpriteManager implements ISpriteManager {
             this._appendSpriteVertex(offset++, sprite, 1, 1, rowSize);
             this._appendSpriteVertex(offset++, sprite, 1, 1, rowSize);
             this._appendSpriteVertex(offset++, sprite, 0, 1, rowSize);
             this._appendSpriteVertex(offset++, sprite, 0, 1, rowSize);
         }
         }
+
+        if (noSprite) {
+            return;
+        }
+
         this._buffer.update(this._vertexData);
         this._buffer.update(this._vertexData);
 
 
         // Render
         // Render