Browse Source

fix projection mode issue

David Catuhe 7 năm trước cách đây
mục cha
commit
eb6a100b11
27 tập tin đã thay đổi với 19429 bổ sung19264 xóa
  1. 17 17
      Playground/package.json
  2. 42 40
      Tools/Gulp/package.json
  3. 4709 4709
      dist/preview release/babylon.d.ts
  4. 46 46
      dist/preview release/babylon.js
  5. 109 5
      dist/preview release/babylon.max.js
  6. 4709 4709
      dist/preview release/babylon.module.d.ts
  7. 45 45
      dist/preview release/babylon.worker.js
  8. 4698 4677
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  9. 46 46
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  10. 16 2
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  11. 4698 4677
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  12. 3 3
      dist/preview release/gui/babylon.gui.min.js
  13. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  14. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  16. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  17. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  18. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  19. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  20. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  22. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  23. 4 4
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  24. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  25. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  26. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  27. 4 1
      src/Materials/Textures/babylon.texture.ts

+ 17 - 17
Playground/package.json

@@ -1,17 +1,17 @@
-{
-  "name": "babylonjsplayground",
-  "version": "3.0.0",
-  "description": "Babylon.js is a 3D engine based on webgl and javascript",
-  "main": "",
-  "repository": {
-    "url": "https://github.com/BabylonJS/Babylon.js/"
-  },
-  "readme": "https://github.com/BabylonJS/Babylon.js/blob/master/readme.md",
-  "license": "(Apache-2.0)",
-  "devDependencies": {
-    "monaco-editor": "~0.10.0"
-  },
-  "scripts": {
-    "test": "browser-sync start --server --files **/* --no-inject-changes --startPath index.html"
-  }
-}
+{
+  "name": "babylonjsplayground",
+  "version": "3.0.0",
+  "description": "Babylon.js is a 3D engine based on webgl and javascript",
+  "main": "",
+  "repository": {
+    "url": "https://github.com/BabylonJS/Babylon.js/"
+  },
+  "readme": "https://github.com/BabylonJS/Babylon.js/blob/master/readme.md",
+  "license": "(Apache-2.0)",
+  "devDependencies": {
+    "monaco-editor": "~0.10.0"
+  },
+  "scripts": {
+    "test": "browser-sync start --server --files **/* --no-inject-changes --startPath index.html"
+  }
+}

+ 42 - 40
Tools/Gulp/package.json

@@ -1,40 +1,42 @@
-{
-  "name": "BabylonJS",
-  "version": "3.0.0",
-  "description": "Babylon.js is a 3D engine based on webgl and javascript",
-  "main": "",
-  "repository": { "url": "https://github.com/BabylonJS/Babylon.js/" },
-  "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
-  "license": "(Apache-2.0)",
-  "devDependencies": {
-    "gulp": "^3.8.11",
-    "gulp-uglify": "^2.1.2",
-    "gulp-sourcemaps": "~1.9.1",
-    "typescript": "~2.5.3",
-    "gulp-typescript": "^3.2.2",
-    "through2": "~0.6.5",
-    "gulp-util": "~3.0.4",
-    "gulp-concat": "~2.5.2",
-    "merge2": "~0.3.5",
-    "gulp-rename": "~1.2.2",
-    "gulp-clean-ts-extends": "~0.1.1",
-    "gulp-changed-in-place": "2.0.3",
-    "run-sequence": "~1.1.0",
-    "gulp-replace": "~0.5.3",
-    "gulp-content-to-variable": "^0.1.0",
-    "gulp-expect-file": "^0.0.7",
-    "gulp-optimize-js": "^1.0.2",
-    "gulp-webserver": "^0.9.1",
-    "gulp-debug": "^3.0.0",
-    "gulp-sass": "2.3.2",
-    "webpack-stream": "^3.2.0",
-    "css-loader": "^0.25.0",
-    "style-loader": "^0.13.1",
-    "exports-loader": "^0.6.3",
-    "imports-loader": "^0.7.0",
-    "del": "2.2.2"
-  },
-  "scripts": {
-    "install": "npm --prefix ../../Playground/ install ../../Playground/ && gulp typescript-compile && gulp typescript-libraries && gulp deployLocalDev"
-  }
-}
+{
+  "name": "BabylonJS",
+  "version": "3.0.0",
+  "description": "Babylon.js is a 3D engine based on webgl and javascript",
+  "main": "",
+  "repository": {
+    "url": "https://github.com/BabylonJS/Babylon.js/"
+  },
+  "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
+  "license": "(Apache-2.0)",
+  "devDependencies": {
+    "gulp": "^3.8.11",
+    "gulp-uglify": "^2.1.2",
+    "gulp-sourcemaps": "~1.9.1",
+    "typescript": "~2.5.3",
+    "gulp-typescript": "^3.2.2",
+    "through2": "~0.6.5",
+    "gulp-util": "~3.0.4",
+    "gulp-concat": "~2.5.2",
+    "merge2": "~0.3.5",
+    "gulp-rename": "~1.2.2",
+    "gulp-clean-ts-extends": "~0.1.1",
+    "gulp-changed-in-place": "2.0.3",
+    "run-sequence": "~1.1.0",
+    "gulp-replace": "~0.5.3",
+    "gulp-content-to-variable": "^0.1.0",
+    "gulp-expect-file": "^0.0.7",
+    "gulp-optimize-js": "^1.0.2",
+    "gulp-webserver": "^0.9.1",
+    "gulp-debug": "^3.0.0",
+    "gulp-sass": "3.1.0",
+    "webpack-stream": "^3.2.0",
+    "css-loader": "^0.25.0",
+    "style-loader": "^0.13.1",
+    "exports-loader": "^0.6.3",
+    "imports-loader": "^0.7.0",
+    "del": "2.2.2"
+  },
+  "scripts": {
+    "install": "npm --prefix ../../Playground/ install ../../Playground/ && gulp typescript-compile && gulp typescript-libraries && gulp deployLocalDev"
+  }
+}

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


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


+ 109 - 5
dist/preview release/babylon.max.js

@@ -8931,6 +8931,14 @@ var BABYLON;
                 this._gl.disable(this._gl.DITHER);
             }
         };
+        Engine.prototype.setRasterizerState = function (value) {
+            if (value) {
+                this._gl.disable(this._gl.RASTERIZER_DISCARD);
+            }
+            else {
+                this._gl.enable(this._gl.RASTERIZER_DISCARD);
+            }
+        };
         /**
          * stop executing a render loop function and remove it from the execution array
          * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
@@ -12105,8 +12113,9 @@ var BABYLON;
         Engine.prototype.bindTransformFeedback = function (value) {
             this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);
         };
-        Engine.prototype.beginTransformFeedback = function () {
-            this._gl.beginTransformFeedback(this._gl.TRIANGLES);
+        Engine.prototype.beginTransformFeedback = function (usePoints) {
+            if (usePoints === void 0) { usePoints = true; }
+            this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);
         };
         Engine.prototype.endTransformFeedback = function () {
             this._gl.endTransformFeedback();
@@ -12114,6 +12123,9 @@ var BABYLON;
         Engine.prototype.setTranformFeedbackVaryings = function (program, value) {
             this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);
         };
+        Engine.prototype.bindTransformFeedbackBuffer = function (value) {
+            this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value);
+        };
         // Statics
         Engine.isSupported = function () {
             try {
@@ -22193,6 +22205,8 @@ var BABYLON;
             }
             if (!this._cachedTextureMatrix) {
                 this._cachedTextureMatrix = BABYLON.Matrix.Zero();
+            }
+            if (!this._projectionModeMatrix) {
                 this._projectionModeMatrix = BABYLON.Matrix.Zero();
             }
             this._cachedUOffset = this.uOffset;
@@ -44865,7 +44879,11 @@ var BABYLON;
             this.name = name;
             this.emitter = null;
             this.renderingGroupId = 0;
-            this.layerMask = 0x0FFFFFFF;
+            this.layerMask = 0x0FFFFFFF; // TODO
+            this._updateVertexBuffers = {};
+            this._renderVertexBuffers = {};
+            this._currentRenderId = -1;
+            this._started = true;
             /**
             * An event triggered when the system is disposed.
             * @type {BABYLON.Observable}
@@ -44873,8 +44891,10 @@ var BABYLON;
             this.onDisposeObservable = new BABYLON.Observable();
             this.id = name;
             this._scene = scene || BABYLON.Engine.LastCreatedScene;
+            this._capacity = capacity;
+            this._engine = this._scene.getEngine();
             this._scene.particleSystems.push(this);
-            this._renderingEffect = new BABYLON.Effect("gpuRenderParticles", ["position", "age", "life", "velocity"], [], [], this._scene.getEngine());
+            this._renderEffect = new BABYLON.Effect("gpuRenderParticles", ["position", "age", "life", "velocity"], [], [], this._scene.getEngine());
             var updateEffectOptions = {
                 attributes: ["position", "age", "life", "velocity"],
                 uniformsNames: [],
@@ -44891,11 +44911,94 @@ var BABYLON;
             this._updateEffect = new BABYLON.Effect("gpuUpdateParticles", updateEffectOptions, this._scene.getEngine());
         }
         GPUParticleSystem.prototype.isStarted = function () {
-            return false;
+            return this._started;
+        };
+        GPUParticleSystem.prototype.start = function () {
+            this._started = true;
+        };
+        GPUParticleSystem.prototype.stop = function () {
+            this._started = false;
         };
         GPUParticleSystem.prototype.animate = function () {
+            // Do nothing
+        };
+        GPUParticleSystem.prototype._initialize = function () {
+            if (this._renderVAO) {
+                return;
+            }
+            var data = new Array();
+            for (var particleIndex = 0; particleIndex < this._capacity; particleIndex++) {
+                // position
+                data.push(0.0);
+                data.push(0.0);
+                data.push(0.0);
+                var life = 1 + Math.random() * 10; // TODO: var
+                data.push(life + 1); // create the particle as a dead one to create a new one at start
+                data.push(life);
+                // velocity
+                data.push(0.0);
+                data.push(0.0);
+                data.push(0.0);
+            }
+            // Update VAO
+            this._updateBuffer = new BABYLON.Buffer(this._scene.getEngine(), data, false, 0);
+            this._updateVertexBuffers["position"] = this._updateBuffer.createVertexBuffer("position", 0, 3, 3);
+            this._updateVertexBuffers["age"] = this._updateBuffer.createVertexBuffer("age", 3, 1, 1);
+            this._updateVertexBuffers["life"] = this._updateBuffer.createVertexBuffer("life", 4, 1, 1);
+            this._updateVertexBuffers["velocity"] = this._updateBuffer.createVertexBuffer("velocity", 5, 3, 3);
+            this._updateVAO = this._engine.recordVertexArrayObject(this._updateVertexBuffers, null, this._updateEffect);
+            this._engine.bindArrayBuffer(null);
+            // Render VAO
+            this._renderBuffer = new BABYLON.Buffer(this._scene.getEngine(), data, false, 0);
+            this._renderVertexBuffers["position"] = this._renderBuffer.createVertexBuffer("position", 0, 3, 3);
+            this._renderVertexBuffers["age"] = this._renderBuffer.createVertexBuffer("age", 3, 1, 1);
+            this._renderVertexBuffers["life"] = this._renderBuffer.createVertexBuffer("life", 4, 1, 1);
+            this._renderVertexBuffers["velocity"] = this._renderBuffer.createVertexBuffer("velocity", 5, 3, 3);
+            this._renderVAO = this._engine.recordVertexArrayObject(this._renderVertexBuffers, null, this._renderEffect);
+            this._engine.bindArrayBuffer(null);
+            // Links
+            this._sourceVAO = this._updateVAO;
+            this._targetVAO = this._renderVAO;
+            this._sourceBuffer = this._updateBuffer;
+            this._targetBuffer = this._renderBuffer;
         };
         GPUParticleSystem.prototype.render = function () {
+            if (!this.emitter || !this._updateEffect.isReady() || !this._renderEffect.isReady()) {
+                return 0;
+            }
+            // Get everything ready to render
+            this._initialize();
+            if (this._currentRenderId === this._scene.getRenderId()) {
+                return 0;
+            }
+            this._currentRenderId = this._scene.getRenderId();
+            // Enable update effect
+            this._engine.enableEffect(this._updateEffect);
+            this._engine.setState(false);
+            // Bind source VAO
+            this._engine.bindVertexArrayObject(this._sourceVAO, null);
+            // Update
+            this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer());
+            this._engine.setRasterizerState(false);
+            this._engine.beginTransformFeedback();
+            this._engine.drawPointClouds(0, this._capacity);
+            this._engine.endTransformFeedback();
+            this._engine.setRasterizerState(true);
+            this._engine.bindTransformFeedbackBuffer(null);
+            // Enable render effect
+            this._engine.enableEffect(this._renderEffect);
+            // Bind source VAO
+            this._engine.bindVertexArrayObject(this._targetVAO, null);
+            // Render
+            this._engine.drawPointClouds(0, this._capacity);
+            // Switch VAOs
+            var tmpVAO = this._sourceVAO;
+            this._sourceVAO = this._targetVAO;
+            this._targetVAO = tmpVAO;
+            // Switch buffers
+            var tmpBuffer = this._sourceBuffer;
+            this._sourceBuffer = this._targetBuffer;
+            this._targetBuffer = tmpBuffer;
             return 0;
         };
         GPUParticleSystem.prototype.rebuild = function () {
@@ -44905,6 +45008,7 @@ var BABYLON;
             if (index > -1) {
                 this._scene.particleSystems.splice(index, 1);
             }
+            //TODO: this._dataBuffer.dispose();
             // Callback
             this.onDisposeObservable.notifyObservers(this);
             this.onDisposeObservable.clear();

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


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


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


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


+ 16 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -8931,6 +8931,14 @@ var BABYLON;
                 this._gl.disable(this._gl.DITHER);
             }
         };
+        Engine.prototype.setRasterizerState = function (value) {
+            if (value) {
+                this._gl.disable(this._gl.RASTERIZER_DISCARD);
+            }
+            else {
+                this._gl.enable(this._gl.RASTERIZER_DISCARD);
+            }
+        };
         /**
          * stop executing a render loop function and remove it from the execution array
          * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
@@ -12105,8 +12113,9 @@ var BABYLON;
         Engine.prototype.bindTransformFeedback = function (value) {
             this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);
         };
-        Engine.prototype.beginTransformFeedback = function () {
-            this._gl.beginTransformFeedback(this._gl.TRIANGLES);
+        Engine.prototype.beginTransformFeedback = function (usePoints) {
+            if (usePoints === void 0) { usePoints = true; }
+            this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);
         };
         Engine.prototype.endTransformFeedback = function () {
             this._gl.endTransformFeedback();
@@ -12114,6 +12123,9 @@ var BABYLON;
         Engine.prototype.setTranformFeedbackVaryings = function (program, value) {
             this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);
         };
+        Engine.prototype.bindTransformFeedbackBuffer = function (value) {
+            this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value);
+        };
         // Statics
         Engine.isSupported = function () {
             try {
@@ -22193,6 +22205,8 @@ var BABYLON;
             }
             if (!this._cachedTextureMatrix) {
                 this._cachedTextureMatrix = BABYLON.Matrix.Zero();
+            }
+            if (!this._projectionModeMatrix) {
                 this._projectionModeMatrix = BABYLON.Matrix.Zero();
             }
             this._cachedUOffset = this.uOffset;

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


+ 4 - 1
src/Materials/Textures/babylon.texture.ts

@@ -316,9 +316,12 @@
 
             if (!this._cachedTextureMatrix) {
                 this._cachedTextureMatrix = Matrix.Zero();
+            }
+            
+            if (!this._projectionModeMatrix) {
                 this._projectionModeMatrix = Matrix.Zero();
             }
-
+            
             this._cachedUOffset = this.uOffset;
             this._cachedVOffset = this.vOffset;
             this._cachedUScale = this.uScale;