Browse Source

Merge pull request #2859 from sebavan/master

Add Depth Options
sebavan 8 years ago
parent
commit
80be81e340

File diff suppressed because it is too large
+ 11443 - 11440
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


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


File diff suppressed because it is too large
+ 1977 - 1944
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


File diff suppressed because it is too large
+ 11443 - 11440
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 2 - 2
src/Cameras/Inputs/babylon.arcRotateCameraKeyboardMoveInput.ts

@@ -121,7 +121,7 @@ module BABYLON {
                             camera.inertialPanningY += 1 / this.panningSensibility;
                         }
                         else if (this._altPressed && this.useAltToZoom) {
-                            camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;
+                            camera.inertialRadiusOffset += 1 / this.zoomingSensibility;
                         }
                         else {
                             camera.inertialBetaOffset -= 0.01;
@@ -137,7 +137,7 @@ module BABYLON {
                             camera.inertialPanningY -= 1 / this.panningSensibility;
                         }
                         else if (this._altPressed && this.useAltToZoom) {
-                            camera.inertialRadiusOffset += 1 / this.zoomingSensibility;
+                            camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;
                         }
                         else {
                             camera.inertialBetaOffset += 0.01;

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

@@ -285,11 +285,29 @@
         public alphaMode = Engine.ALPHA_COMBINE;
 
         @serialize()
-        public needDepthPrePass = false;
+        private _needDepthPrePass = false;
+        public set needDepthPrePass(value : boolean) {
+            if (this._needDepthPrePass === value) {
+                return;
+            }
+            this._needDepthPrePass = value;
+            if (this._needDepthPrePass) {
+                this.checkReadyOnEveryCall = true;
+            }
+        }
+        public get needDepthPrePass(): boolean {
+            return this._needDepthPrePass;
+        }   
 
         @serialize()
         public disableDepthWrite = false;
 
+        @serialize()
+        public forceDepthWrite = false;
+
+        @serialize()
+        public separateCullingPass = false;
+
         @serialize("fogEnabled")
         private _fogEnabled = true;
         public set fogEnabled(value : boolean) {

+ 11 - 0
src/Mesh/babylon.mesh.ts

@@ -1187,6 +1187,10 @@
 
             this._effectiveMaterial._preBind(effect);
 
+            if (this._effectiveMaterial.forceDepthWrite) {
+                engine.setDepthWrite(true);
+            }
+
             // Bind
             var fillMode = scene.forcePointsCloud ? Material.PointFillMode : (scene.forceWireframe ? Material.WireFrameFillMode : this._effectiveMaterial.fillMode);
 
@@ -1202,6 +1206,13 @@
                 this._effectiveMaterial.bind(world, this);
             }
 
+            if (!this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass) {
+                var reverse = this.sideOrientation === Material.ClockWiseSideOrientation;
+                engine.setState(true, this._effectiveMaterial.zOffset, false, !reverse);
+                this._processRendering(subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);
+                engine.setState(true, this._effectiveMaterial.zOffset, false, reverse);
+            }
+
             // Draw
             this._processRendering(subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);