ソースを参照

Build ExternalConfigurations

Sebastien Vandenberghe 8 年 前
コミット
f906bc3d85

ファイルの差分が大きいため隠しています
+ 572 - 567
dist/preview release/customConfigurations/minimalViewer/babylon.d.ts


ファイルの差分が大きいため隠しています
+ 26 - 26
dist/preview release/customConfigurations/minimalViewer/babylon.js


+ 37 - 11
dist/preview release/customConfigurations/minimalViewer/babylon.max.js

@@ -8731,7 +8731,11 @@ var BABYLON;
             var fragment = baseName.fragmentElement || baseName.fragment || baseName;
             var name = vertex + "+" + fragment + "@" + (defines ? defines : attributesNamesOrOptions.defines);
             if (this._compiledEffects[name]) {
-                return this._compiledEffects[name];
+                var compiledEffect = this._compiledEffects[name];
+                if (onCompiled && compiledEffect.isReady()) {
+                    onCompiled(compiledEffect);
+                }
+                return compiledEffect;
             }
             var effect = new BABYLON.Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters);
             effect._key = name;
@@ -8793,6 +8797,7 @@ var BABYLON;
             if (effect.onBind) {
                 effect.onBind(effect);
             }
+            effect.onBindObservable.notifyObservers(effect);
         };
         Engine.prototype.setIntArray = function (uniform, array) {
             if (!uniform)
@@ -22553,6 +22558,9 @@ var BABYLON;
         function Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {
             var _this = this;
             this.uniqueId = 0;
+            this.onCompileObservable = new BABYLON.Observable();
+            this.onErrorObservable = new BABYLON.Observable();
+            this.onBindObservable = new BABYLON.Observable();
             this._uniformBuffersNames = {};
             this._isReady = false;
             this._compilationError = "";
@@ -22667,6 +22675,17 @@ var BABYLON;
             return this._evaluateDefinesOnString(this._engine.getFragmentShaderSource(this._program));
         };
         // Methods
+        Effect.prototype.executeWhenCompiled = function (func) {
+            var _this = this;
+            if (this.isReady()) {
+                func(this);
+                return;
+            }
+            var observer = this.onCompileObservable.add(function (effect) {
+                _this.onCompileObservable.remove(observer);
+                func(effect);
+            });
+        };
         Effect.prototype._loadVertexShader = function (vertex, callback) {
             // DOM element ?
             if (vertex instanceof HTMLElement) {
@@ -22900,6 +22919,7 @@ var BABYLON;
                 if (this.onCompiled) {
                     this.onCompiled(this);
                 }
+                this.onCompileObservable.notifyObservers(this);
             }
             catch (e) {
                 this._compilationError = e.message;
@@ -22922,6 +22942,7 @@ var BABYLON;
                     if (this.onError) {
                         this.onError(this, this._compilationError);
                     }
+                    this.onErrorObservable.notifyObservers(this);
                 }
             }
         };
@@ -32845,6 +32866,9 @@ var BABYLON;
         PostProcess.prototype.getEngine = function () {
             return this._engine;
         };
+        PostProcess.prototype.getEffect = function () {
+            return this._effect;
+        };
         PostProcess.prototype.shareOutputWith = function (postProcess) {
             this._disposeTextures();
             this._shareOutputWithPostProcess = postProcess;
@@ -32852,9 +32876,6 @@ var BABYLON;
         };
         PostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {
             this._effect = this._engine.createEffect({ vertex: this._vertexUrl, fragment: this._fragmentUrl }, ["position"], uniforms || this._parameters, samplers || this._samplers, defines !== undefined ? defines : "", null, onCompiled, onError, indexParameters || this._indexParameters);
-            if (onCompiled && this._effect.isReady()) {
-                onCompiled(this._effect);
-            }
         };
         PostProcess.prototype.isReusable = function () {
             return this._reusable;
@@ -33031,10 +33052,9 @@ var BABYLON;
 (function (BABYLON) {
     var PassPostProcess = (function (_super) {
         __extends(PassPostProcess, _super);
-        function PassPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {
+        function PassPostProcess(name, options, camera, samplingMode, engine, reusable, textureType) {
             if (textureType === void 0) { textureType = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
-            if (blockCompilation === void 0) { blockCompilation = false; }
-            return _super.call(this, name, "pass", null, null, options, camera, samplingMode, engine, reusable, null, textureType, "postprocess", null, blockCompilation) || this;
+            return _super.call(this, name, "pass", null, null, options, camera, samplingMode, engine, reusable, null, textureType) || this;
         }
         return PassPostProcess;
     }(BABYLON.PostProcess));
@@ -44280,9 +44300,11 @@ var BABYLON;
          * @param height Desired height
          * @return Generated texture
          */
-        TextureTools.CreateResizedCopy = function (texture, width, height) {
+        TextureTools.CreateResizedCopy = function (texture, width, height, useBilinearMode) {
+            if (useBilinearMode === void 0) { useBilinearMode = true; }
             var rtt = new BABYLON.RenderTargetTexture('resized' + texture.name, { width: width, height: height }, scene, !texture.noMipmap, true, texture._texture.type, false, texture._samplingMode, false);
             var scene = texture.getScene();
+            var engine = scene.getEngine();
             rtt.wrapU = texture.wrapU;
             rtt.wrapV = texture.wrapV;
             rtt.uOffset = texture.uOffset;
@@ -44295,15 +44317,19 @@ var BABYLON;
             rtt.coordinatesIndex = texture.coordinatesIndex;
             rtt.level = texture.level;
             rtt.anisotropicFilteringLevel = texture.anisotropicFilteringLevel;
-            var passPostProcess = new BABYLON.PassPostProcess("pass", 1, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT, true);
-            passPostProcess.updateEffect(null, null, null, null, function () {
+            rtt._texture.isReady = false;
+            texture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
+            texture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
+            var passPostProcess = new BABYLON.PassPostProcess("pass", 1, null, useBilinearMode ? BABYLON.Texture.BILINEAR_SAMPLINGMODE : BABYLON.Texture.NEAREST_SAMPLINGMODE, engine, false, BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT);
+            passPostProcess.getEffect().executeWhenCompiled(function () {
                 passPostProcess.onApply = function (effect) {
                     effect.setTexture("textureSampler", texture);
                 };
                 scene.postProcessManager.directRender([passPostProcess], rtt.getInternalTexture());
-                scene.getEngine().restoreDefaultFramebuffer();
+                engine.unBindFramebuffer(rtt.getInternalTexture());
                 rtt.disposeFramebufferObjects();
                 passPostProcess.dispose();
+                rtt._texture.isReady = true;
             });
             return rtt;
         };

ファイルの差分が大きいため隠しています
+ 572 - 567
dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts