diff --git a/CHANGES.md b/CHANGES.md index 7883952f1238..d6fd5d1024a4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Change Log * Fixed a bug that caused KML ground overlays to appear distorted when rotation was applied. [#5914](https://github.com/AnalyticalGraphicsInc/cesium/issues/5914) * KML files load when a Network Link fails [#5871](https://github.com/AnalyticalGraphicsInc/cesium/pull/5871) * Adds `invertClassification` and `invertClassificationColor` to `Scene`. When `invertClassification` is `true`, any 3D Tiles geometry that is not classified by a `ClassificationPrimitive` or `GroundPrimitive` will have its color multiplied by `invertClassificationColor`. [#5836](https://github.com/AnalyticalGraphicsInc/cesium/pull/5836) +* Added `eyeSeparation` and `focalLength` properties to `Scene` to configure VR settings. [#5917](https://github.com/AnalyticalGraphicsInc/cesium/pull/5917) * Added `customTags` property to the UrlTemplateImageryProvider to allow custom keywords in the template URL. [#5696](https://github.com/AnalyticalGraphicsInc/cesium/pull/5696) * Improved CZML Reference Properties example [#5754](https://github.com/AnalyticalGraphicsInc/cesium/pull/5754) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index f93620ea04bf..6329d5364404 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -653,6 +653,18 @@ define([ this._actualInvertClassificationColor = Color.clone(this._invertClassificationColor); this._invertClassification = new InvertClassification(); + /** + * The focal length for use when with cardboard or WebVR. + * @type {Number} + */ + this.focalLength = undefined; + + /** + * The eye separation distance in meters for use with cardboard or WebVR. + * @type {Number} + */ + this.eyeSeparation = undefined; + this._brdfLutGenerator = new BrdfLutGenerator(); this._terrainExaggeration = defaultValue(options.terrainExaggeration, 1.0); @@ -2282,8 +2294,8 @@ define([ var savedCamera = Camera.clone(camera, scene._cameraVR); var near = camera.frustum.near; - var fo = near * 5.0; - var eyeSeparation = fo / 30.0; + var fo = near * defaultValue(scene.focalLength, 5.0); + var eyeSeparation = defaultValue(scene.eyeSeparation, fo / 30.0); var eyeTranslation = Cartesian3.multiplyByScalar(savedCamera.right, eyeSeparation * 0.5, scratchEyeTranslation); camera.frustum.aspectRatio = viewport.width / viewport.height;