Browse Source

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js into davrous

# Conflicts:
#	Playground/babylon.d.txt
#	dist/preview release/babylon.d.ts
#	dist/preview release/babylon.js
#	dist/preview release/babylon.worker.js
#	dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
David Rousset 7 năm trước cách đây
mục cha
commit
09d0d25cb2

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5355 - 5355
Playground/babylon.d.txt


+ 7 - 7
Playground/css/index.css

@@ -104,19 +104,19 @@ body {
     background-color:#CDC8F9;
 }
 
-.pbt-back-white{ 
-    background-color: white
-}
-
 .pbt-margin-decor-on {
     background-color: #364249; 
     width:5px;
+} 
+
+.pbt-back-highlight-dark {
+    background-color:#364249; 
 }
 
-.pbt-margin-decor-off {
-    background-color: #FF0000;
+.pbt-margin-decor-on-dark {
+    background-color: #CDC8F9;
     width:5px;
-}     
+}      
 
 .wrapper #jsEditor {
     padding-top:5px;

+ 75 - 15
Playground/js/pbt.js

@@ -1,10 +1,15 @@
 // jsEditor Manipulation
-var PBT = function() {
+var PBT = function() {    
     this.decorationStyles = new Array();
     this.decorations = new Array();
     this.lineRanges = new Array();
     var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
-    
+    var background = "pbt-back-highlight";
+    var margin = "pbt-margin-decor-on";
+    if(localStorage.getItem("bjs-playground-theme") =="dark") {
+        background += "-dark";
+        margin +="-dark";
+    }
     this.clearDecorLines = function() {
         this.decorations = jsEditor.deltaDecorations(this.decorations, []);
     }
@@ -16,8 +21,8 @@ var PBT = function() {
         this.decorationStyles.push({ range: new monaco.Range(1,1,endLineNm,1), options: { isWholeLine: true, inlineClassName: 'pbt-fade' }});
         
         for(var i = 0; i < lineRanges.length; i +=2) {          
-            this.decorationStyles.push({ range: new monaco.Range(lineRanges[i],1,lineRanges[i + 1],1), options: { isWholeLine: true, linesDecorationsClassName: 'pbt-margin-decor-on' }});
-            this.decorationStyles.push({ range: new monaco.Range(lineRanges[i],1,lineRanges[i + 1],1), options: { isWholeLine: true, className: 'pbt-back-highlight' }});
+            this.decorationStyles.push({ range: new monaco.Range(lineRanges[i],1,lineRanges[i + 1],1), options: { isWholeLine: true, linesDecorationsClassName: margin }});
+            this.decorationStyles.push({ range: new monaco.Range(lineRanges[i],1,lineRanges[i + 1],1), options: { isWholeLine: true, className: background }});
             this.decorationStyles.push({ range: new monaco.Range(lineRanges[i],1,lineRanges[i + 1],1), options: { isWholeLine: true, inlineClassName: 'pbt-darken' }});
         }
 
@@ -275,8 +280,10 @@ var PBT = function() {
         var type = type||"C"; 
         type = type.substr(0,1).toUpperCase();
         if(type !="R") {
-            if(type != "C") {
-                type = "C";
+            if(type != "S") {
+                if(type != "C") {
+                    type = "C";
+                }
             }
         }
         this.type = type;   
@@ -285,9 +292,21 @@ var PBT = function() {
         this.addButton = function(text, func, checked) {
             this.buttons.push({
                 text: text||"", 
-                func: func||null, 
+                func: func||function(){}, 
                 checked: checked||false
-        });
+            });
+        }
+
+        this.addSlider = function(text, func, unit, onVal, min, max, value) {        
+            this.buttons.push({
+                text: text||"",                
+                func: func||function(){},
+                unit: unit||"", 
+                onVal: onVal||function(){},
+                min: min||0,
+                max: max||10,
+                value: value||0
+            });
         }
         return this;
     }
@@ -295,7 +314,7 @@ var PBT = function() {
     this.SelectionDialog = function(options) {
         options = options||{};
         var justStarted = true;
-        var width = options.width||0.15;
+        var width = options.width||0.3;
         var top = options.top||0;
         var left = options.left||0;  
         var verticalAlignment = options.verticalAlignment||BABYLON.GUI.Control.VERTICAL_ALIGNMENT_BOTTOM;
@@ -304,10 +323,12 @@ var PBT = function() {
         this.container = new BABYLON.GUI.Rectangle();
         this.container.verticalAlignment = verticalAlignment;
         this.container.horizontalAlignment = horizontalAlignment;   
-        this.container.width = 0.25;
         var height = 36 * groups.length;
         for(var i = 0; i < groups.length; i++) {
             height += 32 * groups[i].buttons.length;
+            if(groups[i].type == "S") {
+                height += 31 * groups[i].buttons.length;
+            }
         }
         this.container.height = height + "px";
         this.container.cornerRadius = 10;
@@ -316,6 +337,7 @@ var PBT = function() {
         this.container.background = "#CDC8F9";
         this.container.top = top;
         this.container.left = left;
+        this.container.width = width;
         advancedTexture.addControl(this.container);
         
         var panel = new BABYLON.GUI.StackPanel(); 
@@ -325,7 +347,7 @@ var PBT = function() {
         panel.left = 5;
         this.container.addControl(panel);
 
-    var addRadio = function(text, parent, group, func, checked) {
+        var addRadio = function(text, parent, group, func, checked) {
             checked = checked || false;
             var button = new BABYLON.GUI.RadioButton();
             button.width = "20px";
@@ -337,16 +359,18 @@ var PBT = function() {
             button.justStarted = true;
             button.func = func;
 
-        button.onIsCheckedChangedObservable.add(function(state) {                       		
+            button.onIsCheckedChangedObservable.add(function(state) {                       		
                 if (state && !justStarted) {                  
                     func();
                 }
             }); 
 
-        var header = BABYLON.GUI.Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
+            var header = BABYLON.GUI.Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
             header.height = "30px";
+            header.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
+            header.left = "4px";
 
-        parent.addControl(header);    
+            parent.addControl(header);    
             button.isChecked = checked; 
         }
 
@@ -365,19 +389,49 @@ var PBT = function() {
             
             var header = BABYLON.GUI.Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
             header.height = "30px";
+            header.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
+            header.left = "4px";
             
             parent.addControl(header);    
             button.isChecked = checked;
         }
 
+        var addSldr = function(text, parent, func, unit, onValueChange, min, max, value) {         
+            var button = new BABYLON.GUI.Slider();  
+            button.value = value;
+            button.minimum = min;
+            button.maximum = max;
+            button.width = "200px";
+            button.height = "20px";
+            button.color = "#364249";
+            button.background = "white"; 
+            button.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
+            button.left = "4px";
+
+            var header = new BABYLON.GUI.TextBlock();
+            header.text = text+": " + value + " " + unit;
+            header.height = "30px";
+            header.color = "#364249";
+            header.textHorizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
+            header.left = "4px";
+            parent.addControl(header);  
+
+            button.onValueChangedObservable.add(function(value) {
+                header.text = "Y-rotation: " + onValueChange(value) + " " + unit;
+                func(value);
+            });
+            parent.addControl(button);
+        }
+
         var groupHeader = function(name) {
             var groupHeading = new BABYLON.GUI.TextBlock("groupHead", name);
             groupHeading.width = 0.9;
             groupHeading.height = "30px";
             groupHeading.textWrapping = true;
             groupHeading.color = "black";
+            groupHeading.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
             groupHeading.textHorizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
-            groupHeading.left = "-2px";
+            groupHeading.left = "2px";
             panel.addControl(groupHeading);
         }
 
@@ -399,6 +453,11 @@ var PBT = function() {
                     addRadio(group.buttons[i].text, panel, group.name, group.buttons[i].func, group.buttons[i].checked);
                 }
             }
+            else if(group.type == "S") {
+                for(var i = 0; i < group.buttons.length; i++) {
+                    addSldr(group.buttons[i].text, panel, group.buttons[i].func, group.buttons[i].unit, group.buttons[i].onVal, group.buttons[i].min, group.buttons[i].max, group.buttons[i].value);
+                }
+            }
             else {
                 for(var i = 0; i < group.buttons.length; i++) {
                     addCheckbox(group.buttons[i].text, panel, group.buttons[i].func, group.buttons[i].checked);
@@ -469,4 +528,5 @@ showBJSPGMenu = function() {
         headings[i].style.visibility = 'visible';
     }
 }
+
     

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13181 - 13181
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 11 - 11
dist/preview release/babylon.js


+ 21 - 19
dist/preview release/babylon.max.js

@@ -8014,7 +8014,7 @@ var BABYLON;
             this._alphaMode = Engine.ALPHA_DISABLE;
             // Cache
             this._internalTexturesCache = new Array();
-            this._activeTexturesCache = {};
+            this._boundTexturesCache = {};
             this._compiledEffects = {};
             this._vertexAttribArraysEnabled = [];
             this._uintIndicesCurrentlySet = false;
@@ -8872,8 +8872,8 @@ var BABYLON;
             }
         };
         Engine.prototype.resetTextureCache = function () {
-            for (var key in this._activeTexturesCache) {
-                this._activeTexturesCache[key] = null;
+            for (var key in this._boundTexturesCache) {
+                this._boundTexturesCache[key] = null;
             }
         };
         Engine.prototype.isDeterministicLockStep = function () {
@@ -10447,7 +10447,7 @@ var BABYLON;
                 if (!hostingScene) {
                     hostingScene = _this.scenes[_this.scenes.length - 1];
                 }
-                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt);
+                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);
                 _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination);
                 _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
                 _this.unBindFramebuffer(rtt);
@@ -11518,9 +11518,9 @@ var BABYLON;
             }
         };
         Engine.prototype._bindTextureDirectly = function (target, texture) {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
                 this._gl.bindTexture(target, texture ? texture._webGLTexture : null);
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         };
         Engine.prototype._bindTexture = function (channel, texture) {
@@ -11554,7 +11554,7 @@ var BABYLON;
         Engine.prototype._setTexture = function (channel, texture) {
             // Not ready?
             if (!texture) {
-                if (this._activeTexturesCache[channel] != null) {
+                if (this._boundTexturesCache[channel] != null) {
                     this.activateTextureChannel(this._gl.TEXTURE0 + channel);
                     this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                     this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -11591,7 +11591,7 @@ var BABYLON;
             if (!alreadyActivated) {
                 this.activateTextureChannel(this._gl.TEXTURE0 + channel);
             }
-            if (this._activeTexturesCache[this._activeTextureChannel] === internalTexture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] === internalTexture) {
                 return false;
             }
             if (internalTexture && internalTexture.is3D) {
@@ -47433,14 +47433,16 @@ var BABYLON;
             var options = {
                 attributes: [BABYLON.VertexBuffer.PositionKind],
                 uniforms: ["world", "viewProjection"],
-                needAlphaBlending: false,
+                needAlphaBlending: true,
                 defines: defines
             };
+            if (useVertexAlpha === false) {
+                options.needAlphaBlending = false;
+            }
             if (!useVertexColor) {
                 options.uniforms.push("color");
             }
             else {
-                options.needAlphaBlending = (useVertexAlpha) ? true : false;
                 options.defines.push("#define VERTEXCOLOR");
                 options.attributes.push(BABYLON.VertexBuffer.ColorKind);
             }
@@ -48396,7 +48398,7 @@ var BABYLON;
          * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
          * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).
          * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
@@ -48452,7 +48454,7 @@ var BABYLON;
          * The parameter `points` is an array successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * The optional parameter `colors` is an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).
          * When updating an instance, remember that only point positions can change, not the number of points.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
          */
@@ -67441,7 +67443,7 @@ var BABYLON;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67468,7 +67470,7 @@ var BABYLON;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67488,7 +67490,7 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         return PhysicsHelper;
@@ -67552,7 +67554,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsRadialExplosionEvent.prototype.cleanup = function (force) {
+        PhysicsRadialExplosionEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -67625,7 +67627,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsGravitationalFieldEvent.prototype.cleanup = function (force) {
+        PhysicsGravitationalFieldEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -77133,8 +77135,8 @@ var BABYLON;
         NullEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, vertices, offset, count) {
         };
         NullEngine.prototype._bindTextureDirectly = function (target, texture) {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         };
         NullEngine.prototype._bindTexture = function (channel, texture) {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 11 - 11
dist/preview release/babylon.worker.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7047 - 7049
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7 - 7
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 19 - 17
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -8014,7 +8014,7 @@ var BABYLON;
             this._alphaMode = Engine.ALPHA_DISABLE;
             // Cache
             this._internalTexturesCache = new Array();
-            this._activeTexturesCache = {};
+            this._boundTexturesCache = {};
             this._compiledEffects = {};
             this._vertexAttribArraysEnabled = [];
             this._uintIndicesCurrentlySet = false;
@@ -8872,8 +8872,8 @@ var BABYLON;
             }
         };
         Engine.prototype.resetTextureCache = function () {
-            for (var key in this._activeTexturesCache) {
-                this._activeTexturesCache[key] = null;
+            for (var key in this._boundTexturesCache) {
+                this._boundTexturesCache[key] = null;
             }
         };
         Engine.prototype.isDeterministicLockStep = function () {
@@ -10447,7 +10447,7 @@ var BABYLON;
                 if (!hostingScene) {
                     hostingScene = _this.scenes[_this.scenes.length - 1];
                 }
-                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt);
+                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);
                 _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination);
                 _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
                 _this.unBindFramebuffer(rtt);
@@ -11518,9 +11518,9 @@ var BABYLON;
             }
         };
         Engine.prototype._bindTextureDirectly = function (target, texture) {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
                 this._gl.bindTexture(target, texture ? texture._webGLTexture : null);
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         };
         Engine.prototype._bindTexture = function (channel, texture) {
@@ -11554,7 +11554,7 @@ var BABYLON;
         Engine.prototype._setTexture = function (channel, texture) {
             // Not ready?
             if (!texture) {
-                if (this._activeTexturesCache[channel] != null) {
+                if (this._boundTexturesCache[channel] != null) {
                     this.activateTextureChannel(this._gl.TEXTURE0 + channel);
                     this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                     this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -11591,7 +11591,7 @@ var BABYLON;
             if (!alreadyActivated) {
                 this.activateTextureChannel(this._gl.TEXTURE0 + channel);
             }
-            if (this._activeTexturesCache[this._activeTextureChannel] === internalTexture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] === internalTexture) {
                 return false;
             }
             if (internalTexture && internalTexture.is3D) {
@@ -47279,14 +47279,16 @@ var BABYLON;
             var options = {
                 attributes: [BABYLON.VertexBuffer.PositionKind],
                 uniforms: ["world", "viewProjection"],
-                needAlphaBlending: false,
+                needAlphaBlending: true,
                 defines: defines
             };
+            if (useVertexAlpha === false) {
+                options.needAlphaBlending = false;
+            }
             if (!useVertexColor) {
                 options.uniforms.push("color");
             }
             else {
-                options.needAlphaBlending = (useVertexAlpha) ? true : false;
                 options.defines.push("#define VERTEXCOLOR");
                 options.attributes.push(BABYLON.VertexBuffer.ColorKind);
             }
@@ -48242,7 +48244,7 @@ var BABYLON;
          * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
          * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).
          * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
@@ -48298,7 +48300,7 @@ var BABYLON;
          * The parameter `points` is an array successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * The optional parameter `colors` is an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).
          * When updating an instance, remember that only point positions can change, not the number of points.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
          */
@@ -67287,7 +67289,7 @@ var BABYLON;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67314,7 +67316,7 @@ var BABYLON;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67334,7 +67336,7 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         return PhysicsHelper;
@@ -67398,7 +67400,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsRadialExplosionEvent.prototype.cleanup = function (force) {
+        PhysicsRadialExplosionEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -67471,7 +67473,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsGravitationalFieldEvent.prototype.cleanup = function (force) {
+        PhysicsGravitationalFieldEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {

+ 3 - 1
dist/preview release/gui/babylon.gui.d.ts

@@ -29,6 +29,8 @@ declare module BABYLON.GUI {
         private _renderAtIdealSize;
         private _focusedControl;
         private _blockNextFocusCheck;
+        private _renderScale;
+        renderScale: number;
         background: string;
         idealWidth: number;
         idealHeight: number;
@@ -54,7 +56,7 @@ declare module BABYLON.GUI {
         private _manageFocus();
         private _attachToOnPointerOut(scene);
         static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
-        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>): AdvancedDynamicTexture;
+        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
     }
 }
 

+ 22 - 6
dist/preview release/gui/babylon.gui.js

@@ -40,6 +40,7 @@ var BABYLON;
                 _this._idealHeight = 0;
                 _this._renderAtIdealSize = false;
                 _this._blockNextFocusCheck = false;
+                _this._renderScale = 1;
                 scene = _this.getScene();
                 if (!scene || !_this._texture) {
                     return _this;
@@ -63,6 +64,20 @@ var BABYLON;
                 _this._texture.isReady = true;
                 return _this;
             }
+            Object.defineProperty(AdvancedDynamicTexture.prototype, "renderScale", {
+                get: function () {
+                    return this._renderScale;
+                },
+                set: function (value) {
+                    if (value === this._renderScale) {
+                        return;
+                    }
+                    this._renderScale = value;
+                    this._onResize();
+                },
+                enumerable: true,
+                configurable: true
+            });
             Object.defineProperty(AdvancedDynamicTexture.prototype, "background", {
                 get: function () {
                     return this._background;
@@ -234,8 +249,8 @@ var BABYLON;
                 // Check size
                 var engine = scene.getEngine();
                 var textureSize = this.getSize();
-                var renderWidth = engine.getRenderWidth();
-                var renderHeight = engine.getRenderHeight();
+                var renderWidth = engine.getRenderWidth() * this._renderScale;
+                var renderHeight = engine.getRenderHeight() * this._renderScale;
                 if (this._renderAtIdealSize) {
                     if (this._idealWidth) {
                         renderHeight = (renderHeight * this._idealWidth) / renderWidth;
@@ -326,8 +341,8 @@ var BABYLON;
                 var engine = scene.getEngine();
                 var textureSize = this.getSize();
                 if (this._isFullscreen) {
-                    x = x * (textureSize.width / engine.getRenderWidth());
-                    y = y * (textureSize.height / engine.getRenderHeight());
+                    x = x * ((textureSize.width / this._renderScale) / engine.getRenderWidth());
+                    y = y * ((textureSize.height / this._renderScale) / engine.getRenderHeight());
                 }
                 if (this._capturingControl) {
                     this._capturingControl._processObservables(type, x, y, buttonIndex);
@@ -459,10 +474,11 @@ var BABYLON;
                 result.attachToMesh(mesh, supportPointerMove);
                 return result;
             };
-            AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene) {
+            AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling) {
                 if (foreground === void 0) { foreground = true; }
                 if (scene === void 0) { scene = null; }
-                var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
+                if (sampling === void 0) { sampling = BABYLON.Texture.BILINEAR_SAMPLINGMODE; }
+                var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);
                 // Display
                 var layer = new BABYLON.Layer(name + "_layer", null, scene, !foreground);
                 layer.texture = result;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


+ 3 - 1
dist/preview release/gui/babylon.gui.module.d.ts

@@ -34,6 +34,8 @@ declare module BABYLON.GUI {
         private _renderAtIdealSize;
         private _focusedControl;
         private _blockNextFocusCheck;
+        private _renderScale;
+        renderScale: number;
         background: string;
         idealWidth: number;
         idealHeight: number;
@@ -59,7 +61,7 @@ declare module BABYLON.GUI {
         private _manageFocus();
         private _attachToOnPointerOut(scene);
         static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
-        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>): AdvancedDynamicTexture;
+        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
     }
 }
 

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

@@ -51,6 +51,7 @@
 - Added `pivot` property to the SPS solid particles ([jerome](https://github.com/jbousquie)) 
 - Added the mesh facet depth sort to FacetData  ([jerome](https://github.com/jbousquie)) 
 - Added `LineSystem` and `LineMesh` per point colors ([jerome](https://github.com/jbousquie))  
+- Added `AdvancedDynamicTexture.renderScale` to allow users to render at higher DPI ([deltakosh](https://github.com/deltakosh))
 
 ## Bug fixes
 - Fixed a bug with PBR on iOS ([sebavan](https://github.com/sebavan))

+ 49 - 34
gui/src/advancedDynamicTexture.ts

@@ -31,6 +31,21 @@ module BABYLON.GUI {
         private _renderAtIdealSize = false;
         private _focusedControl: Nullable<IFocusableControl>;
         private _blockNextFocusCheck = false;
+        private _renderScale = 1;
+
+        public get renderScale(): number {
+            return this._renderScale;
+        }
+
+        public set renderScale(value: number) {
+            if (value === this._renderScale) {
+                return;
+            }
+
+            this._renderScale = value;
+
+            this._onResize();
+        }
 
         public get background(): string {
             return this._background;
@@ -71,7 +86,7 @@ module BABYLON.GUI {
             this._idealHeight = value;
             this.markAsDirty();
             this._rootContainer._markAllAsDirty();
-        }     
+        }
 
         public get renderAtIdealSize(): boolean {
             return this._renderAtIdealSize;
@@ -84,11 +99,11 @@ module BABYLON.GUI {
 
             this._renderAtIdealSize = value;
             this._onResize();
-        }    
+        }
 
         public get layer(): Nullable<Layer> {
             return this._layerToDispose;
-        }   
+        }
 
         public get rootContainer(): Container {
             return this._rootContainer;
@@ -113,7 +128,7 @@ module BABYLON.GUI {
 
             this._focusedControl = control;
         }
-        
+
         public get isForeground(): boolean {
             if (!this.layer) {
                 return true;
@@ -124,15 +139,15 @@ module BABYLON.GUI {
         public set isForeground(value: boolean) {
             if (!this.layer) {
                 return;
-            }            
+            }
             if (this.layer.isBackground === !value) {
                 return;
             }
             this.layer.isBackground = !value;
-        }   
-       
+        }
+
         constructor(name: string, width = 0, height = 0, scene: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE) {
-            super(name, {width: width, height: height}, scene, generateMipMaps, samplingMode, Engine.TEXTUREFORMAT_RGBA);
+            super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Engine.TEXTUREFORMAT_RGBA);
 
             scene = this.getScene();
 
@@ -170,7 +185,7 @@ module BABYLON.GUI {
                 container = this._rootContainer;
             }
 
-            for (var child of container.children) {               
+            for (var child of container.children) {
                 if ((<any>child).children) {
                     this.executeOnAllControls(func, (<Container>child));
                     continue;
@@ -236,16 +251,16 @@ module BABYLON.GUI {
 
         private _onResize(): void {
             let scene = this.getScene();
-            
+
             if (!scene) {
                 return;
-            }            
+            }
 
             // Check size
             var engine = scene.getEngine();
             var textureSize = this.getSize();
-            var renderWidth = engine.getRenderWidth();
-            var renderHeight = engine.getRenderHeight();
+            var renderWidth = engine.getRenderWidth() * this._renderScale;
+            var renderHeight = engine.getRenderHeight() * this._renderScale;
 
             if (this._renderAtIdealSize) {
                 if (this._idealWidth) {
@@ -253,7 +268,7 @@ module BABYLON.GUI {
                     renderWidth = this._idealWidth;
                 } else if (this._idealHeight) {
                     renderWidth = (renderWidth * this._idealHeight) / renderHeight;
-                    renderHeight = this._idealHeight;                    
+                    renderHeight = this._idealHeight;
                 }
             }
 
@@ -264,7 +279,7 @@ module BABYLON.GUI {
 
                 if (this._idealWidth || this._idealHeight) {
                     this._rootContainer._markAllAsDirty();
-                }                
+                }
             }
         }
 
@@ -297,13 +312,13 @@ module BABYLON.GUI {
                     var mesh = control._linkedMesh;
 
                     if (!mesh || mesh.isDisposed()) {
-                        Tools.SetImmediate(()=>{
+                        Tools.SetImmediate(() => {
                             control.linkWithMesh(null);
                         });
-                        
+
                         continue;
                     }
-                    
+
                     var position = mesh.getBoundingInfo().boundingSphere.center;
                     var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
 
@@ -358,10 +373,10 @@ module BABYLON.GUI {
             var textureSize = this.getSize();
 
             if (this._isFullscreen) {
-                x = x * (textureSize.width / engine.getRenderWidth());
-                y = y * (textureSize.height / engine.getRenderHeight());
+                x = x * ((textureSize.width / this._renderScale) / engine.getRenderWidth());
+                y = y * ((textureSize.height / this._renderScale) / engine.getRenderHeight());
             }
-            
+
             if (this._capturingControl) {
                 this._capturingControl._processObservables(type, x, y, buttonIndex);
                 return;
@@ -373,7 +388,7 @@ module BABYLON.GUI {
                     if (this._lastControlOver) {
                         this._lastControlOver._onPointerOut(this._lastControlOver);
                     }
-                    
+
                     this._lastControlOver = null;
                 }
             }
@@ -388,7 +403,7 @@ module BABYLON.GUI {
             }
 
             this._pointerMoveObserver = scene.onPrePointerObservable.add((pi, state) => {
-                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE 
+                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE
                     && pi.type !== BABYLON.PointerEventTypes.POINTERUP
                     && pi.type !== BABYLON.PointerEventTypes.POINTERDOWN) {
                     return;
@@ -421,9 +436,9 @@ module BABYLON.GUI {
             var scene = this.getScene();
             if (!scene) {
                 return;
-            }            
+            }
             this._pointerObserver = scene.onPointerObservable.add((pi, state) => {
-                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE 
+                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE
                     && pi.type !== BABYLON.PointerEventTypes.POINTERUP
                     && pi.type !== BABYLON.PointerEventTypes.POINTERDOWN) {
                     return;
@@ -440,13 +455,13 @@ module BABYLON.GUI {
                     if (this._lastControlDown) {
                         this._lastControlDown.forcePointerUp();
                     }
-                    this._lastControlDown = null;  
+                    this._lastControlDown = null;
 
                     this.focusedControl = null;
                 } else if (pi.type === BABYLON.PointerEventTypes.POINTERMOVE) {
                     if (this._lastControlOver) {
                         this._lastControlOver._onPointerOut(this._lastControlOver);
-                    }              
+                    }
                     this._lastControlOver = null;
                 }
             });
@@ -454,13 +469,13 @@ module BABYLON.GUI {
             mesh.enablePointerMoveEvents = supportPointerMove;
             this._attachToOnPointerOut(scene);
         }
-        
+
         public moveFocusToControl(control: IFocusableControl): void {
             this.focusedControl = control;
             this._lastPickedControl = <any>control;
             this._blockNextFocusCheck = true;
         }
-        
+
         private _manageFocus(): void {
             if (this._blockNextFocusCheck) {
                 this._blockNextFocusCheck = false;
@@ -484,13 +499,13 @@ module BABYLON.GUI {
             this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add(() => {
                 if (this._lastControlOver) {
                     this._lastControlOver._onPointerOut(this._lastControlOver);
-                }            
+                }
                 this._lastControlOver = null;
 
                 if (this._lastControlDown) {
                     this._lastControlDown.forcePointerUp();
                 }
-                this._lastControlDown = null;                
+                this._lastControlDown = null;
             });
         }
 
@@ -512,8 +527,8 @@ module BABYLON.GUI {
             return result;
         }
 
-        public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Nullable<Scene> = null): AdvancedDynamicTexture {
-            var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, Texture.BILINEAR_SAMPLINGMODE);
+        public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Nullable<Scene> = null, sampling = Texture.BILINEAR_SAMPLINGMODE): AdvancedDynamicTexture {
+            var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);
 
             // Display
             var layer = new BABYLON.Layer(name + "_layer", null, scene, !foreground);
@@ -527,5 +542,5 @@ module BABYLON.GUI {
 
             return result;
         }
-    }    
+    }
 }

+ 8 - 8
src/Engine/babylon.engine.ts

@@ -749,7 +749,7 @@
         // Cache
         private _internalTexturesCache = new Array<InternalTexture>();
         protected _activeTextureChannel: number;
-        protected _activeTexturesCache: { [key: string]: Nullable<WebGLTexture> } = {};
+        protected _boundTexturesCache: { [key: string]: Nullable<InternalTexture> } = {};
         protected _currentEffect: Nullable<Effect>;
         protected _currentProgram: Nullable<WebGLProgram>;
         private _compiledEffects: { [key: string]: Effect } = {}
@@ -1302,8 +1302,8 @@
         }
 
         public resetTextureCache() {
-            for (var key in this._activeTexturesCache) {
-                this._activeTexturesCache[key] = null;
+            for (var key in this._boundTexturesCache) {
+                this._boundTexturesCache[key] = null;
             }
         }
 
@@ -3181,7 +3181,7 @@
                 if (!hostingScene) {
                     hostingScene = this.scenes[this.scenes.length - 1];
                 }
-                hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt);
+                hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt, true);
 
                 this._bindTextureDirectly(this._gl.TEXTURE_2D, destination);
                 this._gl.copyTexImage2D(this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
@@ -4530,9 +4530,9 @@
         }
 
         public _bindTextureDirectly(target: number, texture: Nullable<InternalTexture>): void {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
                 this._gl.bindTexture(target, texture ? texture._webGLTexture : null);
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         }
 
@@ -4573,7 +4573,7 @@
         private _setTexture(channel: number, texture: Nullable<BaseTexture>): boolean {
             // Not ready?
             if (!texture) {
-                if (this._activeTexturesCache[channel] != null) {
+                if (this._boundTexturesCache[channel] != null) {
                     this.activateTextureChannel(this._gl.TEXTURE0 + channel);
                     this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                     this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -4613,7 +4613,7 @@
                 this.activateTextureChannel(this._gl.TEXTURE0 + channel);
             }
 
-            if (this._activeTexturesCache[this._activeTextureChannel] === internalTexture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] === internalTexture) {
                 return false;
             }
 

+ 2 - 2
src/Engine/babylon.nullEngine.ts

@@ -368,8 +368,8 @@
         }
 
         public _bindTextureDirectly(target: number, texture: InternalTexture): void {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         }
 

+ 5 - 2
src/Mesh/babylon.linesMesh.ts

@@ -48,15 +48,18 @@
             var options = {
                 attributes: [VertexBuffer.PositionKind],
                 uniforms: ["world", "viewProjection"],
-                needAlphaBlending: false,
+                needAlphaBlending: true,
                 defines: defines
             };
             
+            if (useVertexAlpha === false) {
+                options.needAlphaBlending = false;
+            }
+            
             if (!useVertexColor) {
                 options.uniforms.push("color");
             }
             else {
-                options.needAlphaBlending = (useVertexAlpha) ? true : false;
                 options.defines.push("#define VERTEXCOLOR");
                 options.attributes.push(VertexBuffer.ColorKind);
             }

+ 2 - 2
src/Mesh/babylon.meshBuilder.ts

@@ -359,7 +359,7 @@
          * The parameter `lines` is an array of lines, each line being an array of successive Vector3.   
          * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for 
          * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.  
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.  
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).  
          * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines   
          * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.      
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.  
@@ -418,7 +418,7 @@
          * The parameter `points` is an array successive Vector3.   
          * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines    
          * The optional parameter `colors` is an array of successive Color4, one per line point.  
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.  
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).  
          * When updating an instance, remember that only point positions can change, not the number of points.      
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.  
          */

+ 5 - 5
src/Physics/babylon.physicsHelper.ts

@@ -51,7 +51,7 @@ module BABYLON {
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
 
-            event.cleanup(false);
+            event.dispose(false);
 
             return event;
         }
@@ -85,7 +85,7 @@ module BABYLON {
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             })
 
-            event.cleanup(false);
+            event.dispose(false);
 
             return event;
         }
@@ -109,7 +109,7 @@ module BABYLON {
 
             var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
 
-            event.cleanup(false);
+            event.dispose(false);
 
             return event;
         }
@@ -190,7 +190,7 @@ module BABYLON {
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        public cleanup(force: boolean = true) {
+        public dispose(force: boolean = true) {
             if (force) {
                 this._radialSphere.dispose();
             } else {
@@ -299,7 +299,7 @@ module BABYLON {
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        public cleanup(force: boolean = true) {
+        public dispose(force: boolean = true) {
             if (force) {
                 this._radialSphere.dispose();
             } else {