|
@@ -19861,6 +19861,9 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
var poseTarget = null;
|
|
|
|
|
|
+ var standingMatrix = new Matrix4();
|
|
|
+ var standingMatrixInverse = new Matrix4();
|
|
|
+
|
|
|
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
|
|
|
|
|
|
frameData = new window.VRFrameData();
|
|
@@ -19915,6 +19918,7 @@ function WebVRManager( renderer ) {
|
|
|
//
|
|
|
|
|
|
this.enabled = false;
|
|
|
+ this.userHeight = 1.6;
|
|
|
|
|
|
this.getDevice = function () {
|
|
|
|
|
@@ -19964,6 +19968,19 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ var stageParameters = device.stageParameters;
|
|
|
+
|
|
|
+ if ( stageParameters ) {
|
|
|
+
|
|
|
+ standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ poseObject.position.applyMatrix4( standingMatrix );
|
|
|
poseObject.updateMatrixWorld();
|
|
|
|
|
|
if ( device.isPresenting === false ) return camera;
|
|
@@ -19982,6 +19999,13 @@ function WebVRManager( renderer ) {
|
|
|
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
|
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
|
|
|
|
+ // TODO (mrdoob) Double check this code
|
|
|
+
|
|
|
+ standingMatrixInverse.getInverse( standingMatrix );
|
|
|
+
|
|
|
+ cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
|
+ cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
|
+
|
|
|
var parent = poseObject.parent;
|
|
|
|
|
|
if ( parent !== null ) {
|
|
@@ -20001,7 +20025,7 @@ function WebVRManager( renderer ) {
|
|
|
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
|
|
|
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
|
|
|
|
|
|
- // HACK @mrdoob
|
|
|
+ // HACK (mrdoob)
|
|
|
// https://github.com/w3c/webvr/issues/203
|
|
|
|
|
|
cameraVR.projectionMatrix.copy( cameraL.projectionMatrix );
|
|
@@ -20032,6 +20056,12 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
+ this.getStandingMatrix = function () {
|
|
|
+
|
|
|
+ return standingMatrix;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
this.submitFrame = function () {
|
|
|
|
|
|
if ( device && device.isPresenting ) device.submitFrame();
|
|
@@ -20521,12 +20551,16 @@ function UniformsCache() {
|
|
|
|
|
|
}
|
|
|
|
|
|
-function WebGLLights( stateId ) {
|
|
|
+var count = 0;
|
|
|
+
|
|
|
+function WebGLLights() {
|
|
|
|
|
|
var cache = new UniformsCache();
|
|
|
|
|
|
var state = {
|
|
|
|
|
|
+ id: count ++,
|
|
|
+
|
|
|
hash: '',
|
|
|
|
|
|
ambient: [ 0, 0, 0 ],
|
|
@@ -20733,8 +20767,7 @@ function WebGLLights( stateId ) {
|
|
|
state.point.length = pointLength;
|
|
|
state.hemi.length = hemiLength;
|
|
|
|
|
|
- // TODO (sam-g-steel) why aren't we using join
|
|
|
- state.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + shadows.length + ',' + stateId;
|
|
|
+ state.hash = state.id + ',' + directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + shadows.length;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -20749,13 +20782,9 @@ function WebGLLights( stateId ) {
|
|
|
* @author Mugen87 / https://github.com/Mugen87
|
|
|
*/
|
|
|
|
|
|
-var count = 0;
|
|
|
-
|
|
|
function WebGLRenderState() {
|
|
|
|
|
|
- var id = count ++;
|
|
|
-
|
|
|
- var lights = new WebGLLights( id );
|
|
|
+ var lights = new WebGLLights();
|
|
|
|
|
|
var lightsArray = [];
|
|
|
var shadowsArray = [];
|
|
@@ -45305,16 +45334,6 @@ Object.defineProperties( WebGLRenderTarget.prototype, {
|
|
|
|
|
|
//
|
|
|
|
|
|
-Object.assign( WebVRManager.prototype, {
|
|
|
-
|
|
|
- getStandingMatrix: function () {
|
|
|
-
|
|
|
- console.warn( 'THREE.WebVRManager: .getStandingMatrix() has been removed.' );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-} );
|
|
|
-
|
|
|
Object.defineProperties( WebVRManager.prototype, {
|
|
|
|
|
|
standing: {
|