瀏覽代碼

Adding sprites to debugLayer

David Catuhe 10 年之前
父節點
當前提交
a363619c6e

+ 8 - 7
Babylon/Actions/babylon.action.js

@@ -20,21 +20,22 @@ var BABYLON;
             return this._triggerParameter;
         };
         Action.prototype._executeCurrent = function (evt) {
-            if (this._condition) {
+            if (this._nextActiveAction._condition) {
+                var condition = this._nextActiveAction._condition;
                 var currentRenderId = this._actionManager.getScene().getRenderId();
                 // We cache the current evaluation for the current frame
-                if (this._condition._evaluationId === currentRenderId) {
-                    if (!this._condition._currentResult) {
+                if (condition._evaluationId === currentRenderId) {
+                    if (!condition._currentResult) {
                         return;
                     }
                 }
                 else {
-                    this._condition._evaluationId = currentRenderId;
-                    if (!this._condition.isValid()) {
-                        this._condition._currentResult = false;
+                    condition._evaluationId = currentRenderId;
+                    if (!condition.isValid()) {
+                        condition._currentResult = false;
                         return;
                     }
-                    this._condition._currentResult = true;
+                    condition._currentResult = true;
                 }
             }
             this._nextActiveAction.execute(evt);

+ 8 - 7
Babylon/Actions/babylon.action.ts

@@ -30,23 +30,24 @@
         }
 
         public _executeCurrent(evt: ActionEvent): void {
-            if (this._condition) {
+            if (this._nextActiveAction._condition) {
+                var condition = this._nextActiveAction._condition;
                 var currentRenderId = this._actionManager.getScene().getRenderId();
 
                 // We cache the current evaluation for the current frame
-                if (this._condition._evaluationId === currentRenderId) {
-                    if (!this._condition._currentResult) {
+                if (condition._evaluationId === currentRenderId) {
+                    if (!condition._currentResult) {
                         return;
                     }
                 } else {
-                    this._condition._evaluationId = currentRenderId;
+                    condition._evaluationId = currentRenderId;
 
-                    if (!this._condition.isValid()) {
-                        this._condition._currentResult = false;
+                    if (!condition.isValid()) {
+                        condition._currentResult = false;
                         return;
                     }
 
-                    this._condition._currentResult = true;
+                    condition._currentResult = true;
                 }
             }
 

+ 1 - 1
Babylon/Actions/babylon.interpolateValueAction.ts

@@ -43,7 +43,7 @@
                 return;
             }
 
-            var animation = new BABYLON.Animation("InterpolateValueAction", this._property, 100 * (1000.0 / this.duration), dataType, Animation.ANIMATIONLOOPMODE_CONSTANT);
+            var animation = new Animation("InterpolateValueAction", this._property, 100 * (1000.0 / this.duration), dataType, Animation.ANIMATIONLOOPMODE_CONSTANT);
 
             animation.setKeys(keys);
 

+ 3 - 0
Babylon/Debug/babylon.debugLayer.js

@@ -555,6 +555,9 @@ var BABYLON;
                 this._generateCheckBox(this._optionsSubsetDiv, "Skeletons", this._scene.skeletonsEnabled, function (element) {
                     _this._scene.skeletonsEnabled = element.checked;
                 });
+                this._generateCheckBox(this._optionsSubsetDiv, "Sprites", this._scene.spritesEnabled, function (element) {
+                    _this._scene.spritesEnabled = element.checked;
+                });
                 this._generateCheckBox(this._optionsSubsetDiv, "Textures", this._scene.texturesEnabled, function (element) {
                     _this._scene.texturesEnabled = element.checked;
                 });

File diff suppressed because it is too large
+ 1 - 1
Babylon/Debug/babylon.debugLayer.js.map


+ 1 - 0
Babylon/Debug/babylon.debugLayer.ts

@@ -648,6 +648,7 @@
                 this._generateCheckBox(this._optionsSubsetDiv, "Render targets", this._scene.renderTargetsEnabled, (element) => { this._scene.renderTargetsEnabled = element.checked });
                 this._generateCheckBox(this._optionsSubsetDiv, "Shadows", this._scene.shadowsEnabled, (element) => { this._scene.shadowsEnabled = element.checked });
                 this._generateCheckBox(this._optionsSubsetDiv, "Skeletons", this._scene.skeletonsEnabled, (element) => { this._scene.skeletonsEnabled = element.checked });
+                this._generateCheckBox(this._optionsSubsetDiv, "Sprites", this._scene.spritesEnabled, (element) => { this._scene.spritesEnabled = element.checked });
                 this._generateCheckBox(this._optionsSubsetDiv, "Textures", this._scene.texturesEnabled, (element) => { this._scene.texturesEnabled = element.checked });
 
                 this._globalDiv.appendChild(this._statsDiv);

+ 1 - 1
Babylon/Rendering/babylon.renderingManager.js

@@ -24,7 +24,7 @@ var BABYLON;
             this._scene._particlesDuration += BABYLON.Tools.Now - beforeParticlesDate;
         };
         RenderingManager.prototype._renderSprites = function (index) {
-            if (this._scene.spriteManagers.length === 0) {
+            if (!this._scene.spritesEnabled || this._scene.spriteManagers.length === 0) {
                 return;
             }
             // Sprites       

+ 1 - 1
Babylon/Rendering/babylon.renderingManager.ts

@@ -34,7 +34,7 @@
         }
 
         private _renderSprites(index: number): void {
-            if (this._scene.spriteManagers.length === 0) {
+            if (!this._scene.spritesEnabled || this._scene.spriteManagers.length === 0) {
                 return;
             }
 

+ 0 - 1
Babylon/Shaders/chromaticAberration.fragment.fx

@@ -20,7 +20,6 @@ uniform float screen_height;
 // varyings
 varying vec2 vUV;
 
-
 void main(void)
 {
 	vec2 centered_screen_pos = vec2(vUV.x-0.5, vUV.y-0.5);

+ 3 - 2
Babylon/Tools/babylon.filesInput.js

@@ -71,7 +71,8 @@ var BABYLON;
                     switch (filesToLoad[i].type) {
                         case "image/jpeg":
                         case "image/png":
-                            BABYLON.FilesInput.FilesTextures[filesToLoad[i].name] = filesToLoad[i];
+                        case "image/bmp":
+                            FilesInput.FilesTextures[filesToLoad[i].name] = filesToLoad[i];
                             break;
                         case "image/targa":
                         case "image/vnd.ms-dds":
@@ -82,7 +83,7 @@ var BABYLON;
                         case "audio/mpeg3":
                         case "audio/x-mpeg-3":
                         case "audio/ogg":
-                            BABYLON.FilesInput.FilesToLoad[filesToLoad[i].name] = filesToLoad[i];
+                            FilesInput.FilesToLoad[filesToLoad[i].name] = filesToLoad[i];
                             break;
                         default:
                             if (filesToLoad[i].name.indexOf(".babylon") !== -1 && filesToLoad[i].name.indexOf(".manifest") === -1 && filesToLoad[i].name.indexOf(".incremental") === -1 && filesToLoad[i].name.indexOf(".babylonmeshdata") === -1 && filesToLoad[i].name.indexOf(".babylongeometrydata") === -1) {

+ 8 - 7
Babylon/Tools/babylon.filesInput.ts

@@ -1,7 +1,7 @@
 module BABYLON {
     export class FilesInput {
-        private engine: BABYLON.Engine;
-        private currentScene: BABYLON.Scene;
+        private engine: Engine;
+        private currentScene: Scene;
         private canvas: HTMLCanvasElement;
         private sceneLoadedCallback;
         private progressCallback;
@@ -14,7 +14,7 @@
 
         /// Register to core BabylonJS object: engine, scene, rendering canvas, callback function when the scene will be loaded,
         /// loading progress callback and optionnal addionnal logic to call in the rendering loop
-        constructor(p_engine: BABYLON.Engine, p_scene: BABYLON.Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback,
+        constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback,
             p_progressCallback, p_additionnalRenderLoopLogicCallback, p_textureLoadingCallback, p_startingProcessingFilesCallback) {
             this.engine = p_engine;
             this.canvas = p_canvas;
@@ -86,7 +86,8 @@
                     switch (filesToLoad[i].type) {
                         case "image/jpeg":
                         case "image/png":
-                            BABYLON.FilesInput.FilesTextures[filesToLoad[i].name] = filesToLoad[i];
+                        case "image/bmp":
+                            FilesInput.FilesTextures[filesToLoad[i].name] = filesToLoad[i];
                             break;
                         case "image/targa":
                         case "image/vnd.ms-dds":
@@ -97,7 +98,7 @@
                         case "audio/mpeg3":
                         case "audio/x-mpeg-3":
                         case "audio/ogg":
-                            BABYLON.FilesInput.FilesToLoad[filesToLoad[i].name] = filesToLoad[i];
+                            FilesInput.FilesToLoad[filesToLoad[i].name] = filesToLoad[i];
                             break;
                         default:
                             if (filesToLoad[i].name.indexOf(".babylon") !== -1 && filesToLoad[i].name.indexOf(".manifest") === -1
@@ -116,7 +117,7 @@
                         this.currentScene.dispose();
                     }
 
-                    BABYLON.SceneLoader.Load("file:", sceneFileToLoad, this.engine, (newScene) => {
+                    SceneLoader.Load("file:", sceneFileToLoad, this.engine, (newScene) => {
                         that.currentScene = newScene;
 
                         // Wait for textures and shaders to be ready
@@ -137,7 +138,7 @@
                     });
                 }
                 else {
-                    BABYLON.Tools.Error("Please provide a valid .babylon file.");
+                    Tools.Error("Please provide a valid .babylon file.");
                 }
             }
         }

+ 1 - 0
Babylon/babylon.scene.js

@@ -74,6 +74,7 @@ var BABYLON;
             this.particlesEnabled = true;
             this.particleSystems = new Array();
             // Sprites
+            this.spritesEnabled = true;
             this.spriteManagers = new Array();
             // Layers
             this.layers = new Array();

+ 1 - 0
Babylon/babylon.scene.ts

@@ -137,6 +137,7 @@
         public particleSystems = new Array<ParticleSystem>();
 
         // Sprites
+        public spritesEnabled = true;
         public spriteManagers = new Array<SpriteManager>();
 
         // Layers

File diff suppressed because it is too large
+ 17 - 11
babylon.2.1-alpha.debug.js


File diff suppressed because it is too large
+ 9 - 9
babylon.2.1-alpha.js