Skip to content

Commit

Permalink
Merge pull request #5917 from AnalyticalGraphicsInc/eye-separation
Browse files Browse the repository at this point in the history
Add configurable eye separation and focal length for VR
  • Loading branch information
lilleyse authored Oct 20, 2017
2 parents 2e4c3e8 + 6731353 commit 1317bad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 14 additions & 2 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1317bad

Please sign in to comment.