Sfoglia il codice sorgente

Changed my mind: Automatically switching to CW when RH is on

David Catuhe 9 anni fa
parent
commit
a1496a573f

File diff suppressed because it is too large
+ 10 - 10
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 5371 - 5370
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 10 - 10
dist/preview release/babylon.js


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

@@ -16292,7 +16292,6 @@ var BABYLON;
             this._geometries = new Array();
             this.materials = new Array();
             this.multiMaterials = new Array();
-            this.defaultMaterial = new BABYLON.StandardMaterial("default material", this);
             // Textures
             this.texturesEnabled = true;
             this.textures = new Array();
@@ -16468,6 +16467,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Scene.prototype, "defaultMaterial", {
+            get: function () {
+                if (!this._defaultMaterial) {
+                    this._defaultMaterial = new BABYLON.StandardMaterial("default material", this);
+                }
+                return this._defaultMaterial;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "debugLayer", {
             // Properties
             get: function () {
@@ -25255,7 +25264,12 @@ var BABYLON;
             this._fillMode = Material.TriangleFillMode;
             this.id = name;
             this._scene = scene;
-            this.sideOrientation = Material.CounterClockWiseSideOrientation;
+            if (scene.useRightHandedSystem) {
+                this.sideOrientation = Material.ClockWiseSideOrientation;
+            }
+            else {
+                this.sideOrientation = Material.CounterClockWiseSideOrientation;
+            }
             if (!doNotAdd) {
                 scene.materials.push(this);
             }

File diff suppressed because it is too large
+ 10 - 10
dist/preview release/babylon.noworker.js


+ 6 - 1
src/Materials/babylon.material.js

@@ -95,7 +95,12 @@ var BABYLON;
             this._fillMode = Material.TriangleFillMode;
             this.id = name;
             this._scene = scene;
-            this.sideOrientation = Material.CounterClockWiseSideOrientation;
+            if (scene.useRightHandedSystem) {
+                this.sideOrientation = Material.ClockWiseSideOrientation;
+            }
+            else {
+                this.sideOrientation = Material.CounterClockWiseSideOrientation;
+            }
             if (!doNotAdd) {
                 scene.materials.push(this);
             }

+ 7 - 1
src/Materials/babylon.material.ts

@@ -208,7 +208,12 @@
             this.id = name;
 
             this._scene = scene;
-            this.sideOrientation = Material.CounterClockWiseSideOrientation;
+
+            if (scene.useRightHandedSystem) {
+                this.sideOrientation = Material.ClockWiseSideOrientation;
+            } else {
+                this.sideOrientation = Material.CounterClockWiseSideOrientation;
+            }
 
             if (!doNotAdd) {
                 scene.materials.push(this);
@@ -268,6 +273,7 @@
 
         public _preBind(): void {
             var engine = this._scene.getEngine();
+
             var reverse = this.sideOrientation === Material.ClockWiseSideOrientation;
 
             engine.enableEffect(this._effect);

+ 10 - 1
src/babylon.scene.js

@@ -239,7 +239,6 @@ var BABYLON;
             this._geometries = new Array();
             this.materials = new Array();
             this.multiMaterials = new Array();
-            this.defaultMaterial = new BABYLON.StandardMaterial("default material", this);
             // Textures
             this.texturesEnabled = true;
             this.textures = new Array();
@@ -415,6 +414,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Scene.prototype, "defaultMaterial", {
+            get: function () {
+                if (!this._defaultMaterial) {
+                    this._defaultMaterial = new BABYLON.StandardMaterial("default material", this);
+                }
+                return this._defaultMaterial;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "debugLayer", {
             // Properties
             get: function () {

+ 9 - 1
src/babylon.scene.ts

@@ -344,7 +344,15 @@
 
         public materials = new Array<Material>();
         public multiMaterials = new Array<MultiMaterial>();
-        public defaultMaterial = new StandardMaterial("default material", this);
+        private _defaultMaterial: StandardMaterial;
+
+        public get defaultMaterial(): StandardMaterial {
+            if (!this._defaultMaterial) {
+                this._defaultMaterial = new StandardMaterial("default material", this);
+            }
+
+            return this._defaultMaterial;
+        }
 
         // Textures
         public texturesEnabled = true;