Selaa lähdekoodia

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

David Catuhe 5 vuotta sitten
vanhempi
commit
38c6cd216e

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

@@ -68,6 +68,7 @@
 - Ambiant and metallic maps are displayed correctly on PBR material even when using ORM packed texture ([Deltakosh](https://github.com/deltakosh/))
 - Added support for inspectable strings ([Deltakosh](https://github.com/deltakosh/))
 - Added support for CreateScreenshotUsingRenderTarget ([13djwright](https://github.com/13djwright/))
+- Added support for `Material.depthFunction` property ([Popov72](https://github.com/Popov72))
 
 ### Tools
 
@@ -212,6 +213,7 @@
 - Cloning of `ShaderMaterial` also clone `shaderPath` and `options` properties ([Popov72](https://github.com/Popov72))
 - Prevent an infinite loop when calling `engine.dispose()` in a scene with multiple `SoundTracks` defined ([kirbysayshi](https://github.com/kirbysayshi))
 - Fixed missing properties in serialization / parsing of `coneParticleEmitter` ([Popov72](https://github.com/Popov72))
+- Fix a bug with exit VR and Edge ([RaananW](https://github.com/RaananW/))
 
 ## Breaking changes
 

+ 13 - 0
inspector/src/components/actionTabs/tabs/propertyGrids/materials/commonMaterialPropertyGridComponent.tsx

@@ -4,6 +4,7 @@ import { Observable } from "babylonjs/Misc/observable";
 import { Material } from "babylonjs/Materials/material";
 import { PBRMaterial } from "babylonjs/Materials/PBR/pbrMaterial";
 import { Constants } from "babylonjs/Engines/constants";
+import { Engine } from "babylonjs/Engines/engine";
 
 import { PropertyChangedEvent } from "../../../../propertyChangedEvent";
 import { CheckBoxLineComponent } from "../../../lines/checkBoxLineComponent";
@@ -52,6 +53,17 @@ export class CommonMaterialPropertyGridComponent extends React.Component<ICommon
             { label: "Pre-multiplied", value: Constants.ALPHA_PREMULTIPLIED },
         ];
 
+        var depthfunctionOptions = [
+            { label: "Never", value: Engine.NEVER },
+            { label: "Always", value: Engine.ALWAYS },
+            { label: "Equal", value: Engine.EQUAL },
+            { label: "Less", value: Engine.LESS },
+            { label: "Less or equal", value: Engine.LEQUAL },
+            { label: "Greater", value: Engine.GREATER },
+            { label: "Greater or equal", value: Engine.GEQUAL },
+            { label: "Not equal", value: Engine.NOTEQUAL },
+        ];
+
         return (
             <div>
                 <CustomPropertyGridComponent globalState={this.props.globalState} target={material}
@@ -65,6 +77,7 @@ export class CommonMaterialPropertyGridComponent extends React.Component<ICommon
                     <OptionsLineComponent label="Orientation" options={orientationOptions} target={material} propertyName="sideOrientation" onPropertyChangedObservable={this.props.onPropertyChangedObservable} onSelect={(value) => this.setState({ mode: value })} />
                     <CheckBoxLineComponent label="Disable lighting" target={material} propertyName="disableLighting" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
                     <CheckBoxLineComponent label="Disable depth write" target={material} propertyName="disableDepthWrite" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
+                    <OptionsLineComponent label="Depth function" options={depthfunctionOptions} target={material} propertyName="depthFunction" onPropertyChangedObservable={this.props.onPropertyChangedObservable} onSelect={(value) => this.setState({ depthFunction: value })} />
                     <CheckBoxLineComponent label="Need depth pre-pass" target={material} propertyName="needDepthPrePass" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
                     <CheckBoxLineComponent label="Wireframe" target={material} propertyName="wireframe" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
                     <CheckBoxLineComponent label="Point cloud" target={material} propertyName="pointsCloud" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />

+ 4 - 4
src/Cameras/VR/vrExperienceHelper.ts

@@ -776,7 +776,7 @@ export class VRExperienceHelper {
                 if (!this.isInVRMode) {
                     this.enterVR();
                 } else {
-                    this.exitVR();
+                    this._scene.getEngine().disableVR();
                 }
             });
         }
@@ -1107,9 +1107,6 @@ export class VRExperienceHelper {
             if (this._deviceOrientationCamera) {
                 this._deviceOrientationCamera.position = this._position;
                 this._scene.activeCamera = this._deviceOrientationCamera;
-                if (this._inputElement) {
-                    this._scene.activeCamera.attachControl(this._inputElement);
-                }
 
                 // Restore angular sensibility
                 if (this._cachedAngularSensibility.angularSensibilityX) {
@@ -1127,6 +1124,9 @@ export class VRExperienceHelper {
             } else if (this._existingCamera) {
                 this._existingCamera.position = this._position;
                 this._scene.activeCamera = this._existingCamera;
+                if (this._inputElement) {
+                    this._scene.activeCamera.attachControl(this._inputElement);
+                }
 
                 // Restore angular sensibility
                 if (this._cachedAngularSensibility.angularSensibilityX) {

+ 8 - 0
src/Engines/Extensions/engine.webVR.ts

@@ -269,6 +269,14 @@ Engine.prototype._connectVREvents = function(canvas?: HTMLCanvasElement, documen
     };
 
     this._onVRDisplayPointerUnrestricted = () => {
+        // Edge fix - for some reason document is not present and this is window
+        if (!document) {
+            let hostWindow = this.getHostWindow()!;
+            if (hostWindow.document && hostWindow.document.exitPointerLock) {
+                hostWindow.document.exitPointerLock();
+            }
+            return;
+        }
         if (!document.exitPointerLock) {
             return;
         }