-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configurable eye separation and focal length for VR #5917
Changes from all commits
9def4ab
b3a0d51
ccb3c60
4ebbca8
c2734cd
fcd035c
6731353
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the default value. |
||
* @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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure this should be done here and not at initialization like Cesium does everywhere else? Is it valid to set this back to |
||
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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the units and the default value.