super-three 0.169.0 → 0.169.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +15 -569
- package/build/three.module.js +15 -569
- package/build/three.module.min.js +1 -1
- package/package.json +1 -1
- package/src/renderers/WebGLRenderer.js +1 -9
- package/src/renderers/webvr/WebVRManager.js +0 -495
- package/src/renderers/webvr/WebVRUtils.js +0 -66
package/build/three.cjs
CHANGED
|
@@ -26838,20 +26838,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
26838
26838
|
|
|
26839
26839
|
}
|
|
26840
26840
|
|
|
26841
|
-
class Group extends Object3D {
|
|
26842
|
-
|
|
26843
|
-
constructor() {
|
|
26844
|
-
|
|
26845
|
-
super();
|
|
26846
|
-
|
|
26847
|
-
this.isGroup = true;
|
|
26848
|
-
|
|
26849
|
-
this.type = 'Group';
|
|
26850
|
-
|
|
26851
|
-
}
|
|
26852
|
-
|
|
26853
|
-
}
|
|
26854
|
-
|
|
26855
26841
|
class ArrayCamera extends PerspectiveCamera {
|
|
26856
26842
|
|
|
26857
26843
|
constructor( array = [] ) {
|
|
@@ -26866,553 +26852,6 @@ class ArrayCamera extends PerspectiveCamera {
|
|
|
26866
26852
|
|
|
26867
26853
|
}
|
|
26868
26854
|
|
|
26869
|
-
/**
|
|
26870
|
-
* @author jsantell / https://www.jsantell.com/
|
|
26871
|
-
* @author mrdoob / http://mrdoob.com/
|
|
26872
|
-
*/
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
var cameraLPos = new Vector3();
|
|
26876
|
-
var cameraRPos = new Vector3();
|
|
26877
|
-
|
|
26878
|
-
/**
|
|
26879
|
-
* Assumes 2 cameras that are parallel and share an X-axis, and that
|
|
26880
|
-
* the cameras' projection and world matrices have already been set.
|
|
26881
|
-
* And that near and far planes are identical for both cameras.
|
|
26882
|
-
* Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
|
|
26883
|
-
*/
|
|
26884
|
-
function setProjectionFromUnion( camera, cameraL, cameraR ) {
|
|
26885
|
-
|
|
26886
|
-
cameraLPos.setFromMatrixPosition( cameraL.matrixWorld );
|
|
26887
|
-
cameraRPos.setFromMatrixPosition( cameraR.matrixWorld );
|
|
26888
|
-
|
|
26889
|
-
var ipd = cameraLPos.distanceTo( cameraRPos );
|
|
26890
|
-
|
|
26891
|
-
var projL = cameraL.projectionMatrix.elements;
|
|
26892
|
-
var projR = cameraR.projectionMatrix.elements;
|
|
26893
|
-
|
|
26894
|
-
// VR systems will have identical far and near planes, and
|
|
26895
|
-
// most likely identical top and bottom frustum extents.
|
|
26896
|
-
// Use the left camera for these values.
|
|
26897
|
-
var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
|
|
26898
|
-
var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
|
|
26899
|
-
var topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];
|
|
26900
|
-
var bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];
|
|
26901
|
-
|
|
26902
|
-
var leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];
|
|
26903
|
-
var rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];
|
|
26904
|
-
var left = near * leftFov;
|
|
26905
|
-
var right = near * rightFov;
|
|
26906
|
-
|
|
26907
|
-
// Calculate the new camera's position offset from the
|
|
26908
|
-
// left camera. xOffset should be roughly half `ipd`.
|
|
26909
|
-
var zOffset = ipd / ( - leftFov + rightFov );
|
|
26910
|
-
var xOffset = zOffset * - leftFov;
|
|
26911
|
-
|
|
26912
|
-
// TODO: Better way to apply this offset?
|
|
26913
|
-
cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );
|
|
26914
|
-
camera.translateX( xOffset );
|
|
26915
|
-
camera.translateZ( zOffset );
|
|
26916
|
-
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
|
|
26917
|
-
camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
|
|
26918
|
-
|
|
26919
|
-
// Find the union of the frustum values of the cameras and scale
|
|
26920
|
-
// the values so that the near plane's position does not change in world space,
|
|
26921
|
-
// although must now be relative to the new union camera.
|
|
26922
|
-
var near2 = near + zOffset;
|
|
26923
|
-
var far2 = far + zOffset;
|
|
26924
|
-
var left2 = left - xOffset;
|
|
26925
|
-
var right2 = right + ( ipd - xOffset );
|
|
26926
|
-
var top2 = topFov * far / far2 * near2;
|
|
26927
|
-
var bottom2 = bottomFov * far / far2 * near2;
|
|
26928
|
-
|
|
26929
|
-
camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
|
|
26930
|
-
|
|
26931
|
-
}
|
|
26932
|
-
|
|
26933
|
-
/**
|
|
26934
|
-
* @author mrdoob / http://mrdoob.com/
|
|
26935
|
-
*/
|
|
26936
|
-
|
|
26937
|
-
|
|
26938
|
-
function WebVRManager( renderer ) {
|
|
26939
|
-
|
|
26940
|
-
var renderWidth, renderHeight;
|
|
26941
|
-
var scope = this;
|
|
26942
|
-
|
|
26943
|
-
var device = null;
|
|
26944
|
-
var frameData = null;
|
|
26945
|
-
|
|
26946
|
-
var poseTarget = null;
|
|
26947
|
-
|
|
26948
|
-
var controllers = [];
|
|
26949
|
-
var standingMatrix = new Matrix4();
|
|
26950
|
-
var standingMatrixInverse = new Matrix4();
|
|
26951
|
-
|
|
26952
|
-
var framebufferScaleFactor = 1.0;
|
|
26953
|
-
|
|
26954
|
-
var referenceSpaceType = 'local-floor';
|
|
26955
|
-
|
|
26956
|
-
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
|
|
26957
|
-
|
|
26958
|
-
frameData = new window.VRFrameData();
|
|
26959
|
-
window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
|
|
26960
|
-
|
|
26961
|
-
}
|
|
26962
|
-
|
|
26963
|
-
var matrixWorldInverse = new Matrix4();
|
|
26964
|
-
var tempQuaternion = new Quaternion();
|
|
26965
|
-
var tempPosition = new Vector3();
|
|
26966
|
-
|
|
26967
|
-
var cameraL = new PerspectiveCamera();
|
|
26968
|
-
cameraL.viewport = new Vector4();
|
|
26969
|
-
cameraL.layers.enable( 1 );
|
|
26970
|
-
|
|
26971
|
-
var cameraR = new PerspectiveCamera();
|
|
26972
|
-
cameraR.viewport = new Vector4();
|
|
26973
|
-
cameraR.layers.enable( 2 );
|
|
26974
|
-
|
|
26975
|
-
var cameraVR = new ArrayCamera( [ cameraL, cameraR ] );
|
|
26976
|
-
cameraVR.layers.enable( 1 );
|
|
26977
|
-
cameraVR.layers.enable( 2 );
|
|
26978
|
-
|
|
26979
|
-
var currentSize = new Vector2(), currentPixelRatio;
|
|
26980
|
-
|
|
26981
|
-
function onVRDisplayPresentChange() {
|
|
26982
|
-
|
|
26983
|
-
var isPresenting = scope.isPresenting = device !== null && device.isPresenting === true;
|
|
26984
|
-
|
|
26985
|
-
if ( isPresenting ) {
|
|
26986
|
-
|
|
26987
|
-
var eyeParameters = device.getEyeParameters( 'left' );
|
|
26988
|
-
renderWidth = 2 * eyeParameters.renderWidth * framebufferScaleFactor;
|
|
26989
|
-
renderHeight = eyeParameters.renderHeight * framebufferScaleFactor;
|
|
26990
|
-
|
|
26991
|
-
currentPixelRatio = renderer.getPixelRatio();
|
|
26992
|
-
renderer.getSize( currentSize );
|
|
26993
|
-
|
|
26994
|
-
renderer.setDrawingBufferSize( renderWidth, renderHeight, 1 );
|
|
26995
|
-
|
|
26996
|
-
cameraL.viewport.set( 0, 0, renderWidth / 2, renderHeight );
|
|
26997
|
-
cameraR.viewport.set( renderWidth / 2, 0, renderWidth / 2, renderHeight );
|
|
26998
|
-
|
|
26999
|
-
animation.start();
|
|
27000
|
-
|
|
27001
|
-
scope.dispatchEvent( { type: 'sessionstart' } );
|
|
27002
|
-
|
|
27003
|
-
} else {
|
|
27004
|
-
|
|
27005
|
-
if ( scope.enabled ) {
|
|
27006
|
-
|
|
27007
|
-
renderer.setDrawingBufferSize( currentSize.width, currentSize.height, currentPixelRatio );
|
|
27008
|
-
|
|
27009
|
-
}
|
|
27010
|
-
|
|
27011
|
-
animation.stop();
|
|
27012
|
-
|
|
27013
|
-
scope.dispatchEvent( { type: 'sessionend' } );
|
|
27014
|
-
|
|
27015
|
-
}
|
|
27016
|
-
|
|
27017
|
-
}
|
|
27018
|
-
|
|
27019
|
-
//
|
|
27020
|
-
|
|
27021
|
-
var triggers = [];
|
|
27022
|
-
var grips = [];
|
|
27023
|
-
|
|
27024
|
-
function findGamepad( id ) {
|
|
27025
|
-
|
|
27026
|
-
var gamepads = navigator.getGamepads && navigator.getGamepads();
|
|
27027
|
-
|
|
27028
|
-
for ( var i = 0, l = gamepads.length; i < l; i ++ ) {
|
|
27029
|
-
|
|
27030
|
-
var gamepad = gamepads[ i ];
|
|
27031
|
-
|
|
27032
|
-
if ( gamepad && ( gamepad.id === 'Daydream Controller' ||
|
|
27033
|
-
gamepad.id === 'Gear VR Controller' || gamepad.id === 'Oculus Go Controller' ||
|
|
27034
|
-
gamepad.id === 'OpenVR Gamepad' || gamepad.id.startsWith( 'Oculus Touch' ) ||
|
|
27035
|
-
gamepad.id.startsWith( 'HTC Vive Focus' ) ||
|
|
27036
|
-
gamepad.id.startsWith( 'Spatial Controller' ) ) ) {
|
|
27037
|
-
|
|
27038
|
-
var hand = gamepad.hand;
|
|
27039
|
-
|
|
27040
|
-
if ( id === 0 && ( hand === '' || hand === 'right' ) ) return gamepad;
|
|
27041
|
-
if ( id === 1 && ( hand === 'left' ) ) return gamepad;
|
|
27042
|
-
|
|
27043
|
-
}
|
|
27044
|
-
|
|
27045
|
-
}
|
|
27046
|
-
|
|
27047
|
-
}
|
|
27048
|
-
|
|
27049
|
-
function updateControllers() {
|
|
27050
|
-
|
|
27051
|
-
for ( var i = 0; i < controllers.length; i ++ ) {
|
|
27052
|
-
|
|
27053
|
-
var controller = controllers[ i ];
|
|
27054
|
-
|
|
27055
|
-
var gamepad = findGamepad( i );
|
|
27056
|
-
|
|
27057
|
-
if ( gamepad !== undefined && gamepad.pose !== undefined ) {
|
|
27058
|
-
|
|
27059
|
-
if ( gamepad.pose === null ) return;
|
|
27060
|
-
|
|
27061
|
-
// Pose
|
|
27062
|
-
|
|
27063
|
-
var pose = gamepad.pose;
|
|
27064
|
-
|
|
27065
|
-
if ( pose.hasPosition === false ) controller.position.set( 0.2, - 0.6, - 0.05 );
|
|
27066
|
-
|
|
27067
|
-
if ( pose.position !== null ) controller.position.fromArray( pose.position );
|
|
27068
|
-
if ( pose.orientation !== null ) controller.quaternion.fromArray( pose.orientation );
|
|
27069
|
-
controller.matrix.compose( controller.position, controller.quaternion, controller.scale );
|
|
27070
|
-
controller.matrix.premultiply( standingMatrix );
|
|
27071
|
-
controller.matrix.decompose( controller.position, controller.quaternion, controller.scale );
|
|
27072
|
-
controller.matrixWorldNeedsUpdate = true;
|
|
27073
|
-
controller.visible = true;
|
|
27074
|
-
|
|
27075
|
-
// Trigger
|
|
27076
|
-
|
|
27077
|
-
var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1;
|
|
27078
|
-
|
|
27079
|
-
if ( triggers[ i ] === undefined ) triggers[ i ] = false;
|
|
27080
|
-
|
|
27081
|
-
if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
27082
|
-
|
|
27083
|
-
triggers[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
27084
|
-
|
|
27085
|
-
if ( triggers[ i ] === true ) {
|
|
27086
|
-
|
|
27087
|
-
controller.dispatchEvent( { type: 'selectstart' } );
|
|
27088
|
-
|
|
27089
|
-
} else {
|
|
27090
|
-
|
|
27091
|
-
controller.dispatchEvent( { type: 'selectend' } );
|
|
27092
|
-
controller.dispatchEvent( { type: 'select' } );
|
|
27093
|
-
|
|
27094
|
-
}
|
|
27095
|
-
|
|
27096
|
-
}
|
|
27097
|
-
|
|
27098
|
-
// Grip
|
|
27099
|
-
buttonId = 2;
|
|
27100
|
-
|
|
27101
|
-
if ( grips[ i ] === undefined ) grips[ i ] = false;
|
|
27102
|
-
|
|
27103
|
-
// Skip if the grip button doesn't exist on this controller
|
|
27104
|
-
if ( gamepad.buttons[ buttonId ] !== undefined ) {
|
|
27105
|
-
|
|
27106
|
-
if ( grips[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
27107
|
-
|
|
27108
|
-
grips[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
27109
|
-
|
|
27110
|
-
if ( grips[ i ] === true ) {
|
|
27111
|
-
|
|
27112
|
-
controller.dispatchEvent( { type: 'squeezestart' } );
|
|
27113
|
-
|
|
27114
|
-
} else {
|
|
27115
|
-
|
|
27116
|
-
controller.dispatchEvent( { type: 'squeezeend' } );
|
|
27117
|
-
controller.dispatchEvent( { type: 'squeeze' } );
|
|
27118
|
-
|
|
27119
|
-
}
|
|
27120
|
-
|
|
27121
|
-
}
|
|
27122
|
-
|
|
27123
|
-
}
|
|
27124
|
-
|
|
27125
|
-
} else {
|
|
27126
|
-
|
|
27127
|
-
controller.visible = false;
|
|
27128
|
-
|
|
27129
|
-
}
|
|
27130
|
-
|
|
27131
|
-
}
|
|
27132
|
-
|
|
27133
|
-
}
|
|
27134
|
-
|
|
27135
|
-
function updateViewportFromBounds( viewport, bounds ) {
|
|
27136
|
-
|
|
27137
|
-
if ( bounds !== null && bounds.length === 4 ) {
|
|
27138
|
-
|
|
27139
|
-
viewport.set( bounds[ 0 ] * renderWidth, bounds[ 1 ] * renderHeight, bounds[ 2 ] * renderWidth, bounds[ 3 ] * renderHeight );
|
|
27140
|
-
|
|
27141
|
-
}
|
|
27142
|
-
|
|
27143
|
-
}
|
|
27144
|
-
|
|
27145
|
-
//
|
|
27146
|
-
|
|
27147
|
-
this.enabled = false;
|
|
27148
|
-
|
|
27149
|
-
this.getController = function ( id ) {
|
|
27150
|
-
|
|
27151
|
-
var controller = controllers[ id ];
|
|
27152
|
-
|
|
27153
|
-
if ( controller === undefined ) {
|
|
27154
|
-
|
|
27155
|
-
controller = new Group();
|
|
27156
|
-
controller.matrixAutoUpdate = false;
|
|
27157
|
-
controller.visible = false;
|
|
27158
|
-
|
|
27159
|
-
controllers[ id ] = controller;
|
|
27160
|
-
|
|
27161
|
-
}
|
|
27162
|
-
|
|
27163
|
-
return controller;
|
|
27164
|
-
|
|
27165
|
-
};
|
|
27166
|
-
|
|
27167
|
-
this.getDevice = function () {
|
|
27168
|
-
|
|
27169
|
-
return device;
|
|
27170
|
-
|
|
27171
|
-
};
|
|
27172
|
-
|
|
27173
|
-
this.setDevice = function ( value ) {
|
|
27174
|
-
|
|
27175
|
-
if ( value !== undefined ) device = value;
|
|
27176
|
-
|
|
27177
|
-
animation.setContext( value );
|
|
27178
|
-
|
|
27179
|
-
};
|
|
27180
|
-
|
|
27181
|
-
this.setFramebufferScaleFactor = function ( value ) {
|
|
27182
|
-
|
|
27183
|
-
framebufferScaleFactor = value;
|
|
27184
|
-
|
|
27185
|
-
};
|
|
27186
|
-
|
|
27187
|
-
this.setReferenceSpaceType = function ( value ) {
|
|
27188
|
-
|
|
27189
|
-
referenceSpaceType = value;
|
|
27190
|
-
|
|
27191
|
-
};
|
|
27192
|
-
|
|
27193
|
-
this.setPoseTarget = function ( object ) {
|
|
27194
|
-
|
|
27195
|
-
if ( object !== undefined ) poseTarget = object;
|
|
27196
|
-
|
|
27197
|
-
};
|
|
27198
|
-
|
|
27199
|
-
//
|
|
27200
|
-
|
|
27201
|
-
this.cameraAutoUpdate = true;
|
|
27202
|
-
|
|
27203
|
-
this.updateCamera = function ( camera ) {
|
|
27204
|
-
|
|
27205
|
-
var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
|
|
27206
|
-
|
|
27207
|
-
device.depthNear = camera.near;
|
|
27208
|
-
device.depthFar = camera.far;
|
|
27209
|
-
|
|
27210
|
-
device.getFrameData( frameData );
|
|
27211
|
-
|
|
27212
|
-
//
|
|
27213
|
-
|
|
27214
|
-
if ( referenceSpaceType === 'local-floor' ) {
|
|
27215
|
-
|
|
27216
|
-
var stageParameters = device.stageParameters;
|
|
27217
|
-
|
|
27218
|
-
if ( stageParameters ) {
|
|
27219
|
-
|
|
27220
|
-
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
|
|
27221
|
-
|
|
27222
|
-
} else {
|
|
27223
|
-
|
|
27224
|
-
standingMatrix.makeTranslation( 0, userHeight, 0 );
|
|
27225
|
-
|
|
27226
|
-
}
|
|
27227
|
-
|
|
27228
|
-
}
|
|
27229
|
-
|
|
27230
|
-
|
|
27231
|
-
var pose = frameData.pose;
|
|
27232
|
-
var poseObject = poseTarget !== null ? poseTarget : camera;
|
|
27233
|
-
|
|
27234
|
-
// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
|
|
27235
|
-
poseObject.matrix.copy( standingMatrix );
|
|
27236
|
-
poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
|
|
27237
|
-
|
|
27238
|
-
if ( pose.orientation !== null ) {
|
|
27239
|
-
|
|
27240
|
-
tempQuaternion.fromArray( pose.orientation );
|
|
27241
|
-
poseObject.quaternion.multiply( tempQuaternion );
|
|
27242
|
-
|
|
27243
|
-
}
|
|
27244
|
-
|
|
27245
|
-
if ( pose.position !== null ) {
|
|
27246
|
-
|
|
27247
|
-
tempQuaternion.setFromRotationMatrix( standingMatrix );
|
|
27248
|
-
tempPosition.fromArray( pose.position );
|
|
27249
|
-
tempPosition.applyQuaternion( tempQuaternion );
|
|
27250
|
-
poseObject.position.add( tempPosition );
|
|
27251
|
-
|
|
27252
|
-
}
|
|
27253
|
-
|
|
27254
|
-
poseObject.updateMatrixWorld();
|
|
27255
|
-
|
|
27256
|
-
var children = poseObject.children;
|
|
27257
|
-
for ( var i = 0, l = children.length; i < l; i ++ ) {
|
|
27258
|
-
|
|
27259
|
-
children[ i ].updateMatrixWorld( true );
|
|
27260
|
-
|
|
27261
|
-
}
|
|
27262
|
-
|
|
27263
|
-
//
|
|
27264
|
-
|
|
27265
|
-
cameraL.near = camera.near;
|
|
27266
|
-
cameraR.near = camera.near;
|
|
27267
|
-
|
|
27268
|
-
cameraL.far = camera.far;
|
|
27269
|
-
cameraR.far = camera.far;
|
|
27270
|
-
|
|
27271
|
-
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
27272
|
-
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
27273
|
-
|
|
27274
|
-
// TODO (mrdoob) Double check this code
|
|
27275
|
-
|
|
27276
|
-
standingMatrixInverse.copy( standingMatrix ).invert();
|
|
27277
|
-
|
|
27278
|
-
if ( referenceSpaceType === 'local-floor' ) {
|
|
27279
|
-
|
|
27280
|
-
cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
27281
|
-
cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
27282
|
-
|
|
27283
|
-
}
|
|
27284
|
-
|
|
27285
|
-
var parent = poseObject.parent;
|
|
27286
|
-
|
|
27287
|
-
if ( parent !== null ) {
|
|
27288
|
-
|
|
27289
|
-
matrixWorldInverse.copy( parent.matrixWorld ).invert();
|
|
27290
|
-
|
|
27291
|
-
cameraL.matrixWorldInverse.multiply( matrixWorldInverse );
|
|
27292
|
-
cameraR.matrixWorldInverse.multiply( matrixWorldInverse );
|
|
27293
|
-
|
|
27294
|
-
}
|
|
27295
|
-
|
|
27296
|
-
// envMap and Mirror needs camera.matrixWorld
|
|
27297
|
-
|
|
27298
|
-
cameraL.matrixWorld.copy( cameraL.matrixWorldInverse ).invert();
|
|
27299
|
-
cameraR.matrixWorld.copy( cameraR.matrixWorldInverse ).invert();
|
|
27300
|
-
|
|
27301
|
-
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
|
|
27302
|
-
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
|
|
27303
|
-
|
|
27304
|
-
setProjectionFromUnion( cameraVR, cameraL, cameraR );
|
|
27305
|
-
|
|
27306
|
-
//
|
|
27307
|
-
|
|
27308
|
-
var layers = device.getLayers();
|
|
27309
|
-
|
|
27310
|
-
if ( layers.length ) {
|
|
27311
|
-
|
|
27312
|
-
var layer = layers[ 0 ];
|
|
27313
|
-
|
|
27314
|
-
updateViewportFromBounds( cameraL.viewport, layer.leftBounds );
|
|
27315
|
-
updateViewportFromBounds( cameraR.viewport, layer.rightBounds );
|
|
27316
|
-
|
|
27317
|
-
}
|
|
27318
|
-
|
|
27319
|
-
updateControllers();
|
|
27320
|
-
|
|
27321
|
-
return cameraVR;
|
|
27322
|
-
|
|
27323
|
-
};
|
|
27324
|
-
|
|
27325
|
-
this.getCamera = function () {
|
|
27326
|
-
|
|
27327
|
-
return cameraVR;
|
|
27328
|
-
|
|
27329
|
-
};
|
|
27330
|
-
|
|
27331
|
-
// Dummy getFoveation/setFoveation to have the same API as WebXR
|
|
27332
|
-
|
|
27333
|
-
this.getFoveation = function () {
|
|
27334
|
-
|
|
27335
|
-
return 1;
|
|
27336
|
-
|
|
27337
|
-
};
|
|
27338
|
-
|
|
27339
|
-
this.setFoveation = function ( foveation ) {
|
|
27340
|
-
|
|
27341
|
-
if ( foveation !== 1 ) {
|
|
27342
|
-
|
|
27343
|
-
console.warn( 'THREE.WebVRManager: setFoveation() not used in WebVR.' );
|
|
27344
|
-
|
|
27345
|
-
}
|
|
27346
|
-
|
|
27347
|
-
};
|
|
27348
|
-
|
|
27349
|
-
// Dummy getEnvironmentBlendMode to have the same API as WebXR
|
|
27350
|
-
|
|
27351
|
-
this.getEnvironmentBlendMode = function () {
|
|
27352
|
-
|
|
27353
|
-
if ( scope.isPresenting ) {
|
|
27354
|
-
|
|
27355
|
-
return 'opaque';
|
|
27356
|
-
|
|
27357
|
-
}
|
|
27358
|
-
|
|
27359
|
-
};
|
|
27360
|
-
|
|
27361
|
-
//
|
|
27362
|
-
|
|
27363
|
-
this.getStandingMatrix = function () {
|
|
27364
|
-
|
|
27365
|
-
return standingMatrix;
|
|
27366
|
-
|
|
27367
|
-
};
|
|
27368
|
-
|
|
27369
|
-
this.isPresenting = false;
|
|
27370
|
-
|
|
27371
|
-
// Animation Loop
|
|
27372
|
-
|
|
27373
|
-
var animation = new WebGLAnimation();
|
|
27374
|
-
|
|
27375
|
-
this.setAnimationLoop = function ( callback ) {
|
|
27376
|
-
|
|
27377
|
-
animation.setAnimationLoop( callback );
|
|
27378
|
-
|
|
27379
|
-
if ( this.isPresenting ) animation.start();
|
|
27380
|
-
|
|
27381
|
-
};
|
|
27382
|
-
|
|
27383
|
-
this.submitFrame = function () {
|
|
27384
|
-
|
|
27385
|
-
if ( this.isPresenting ) device.submitFrame();
|
|
27386
|
-
|
|
27387
|
-
};
|
|
27388
|
-
|
|
27389
|
-
this.dispose = function () {
|
|
27390
|
-
|
|
27391
|
-
if ( typeof window !== 'undefined' ) {
|
|
27392
|
-
|
|
27393
|
-
window.removeEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange );
|
|
27394
|
-
|
|
27395
|
-
}
|
|
27396
|
-
|
|
27397
|
-
};
|
|
27398
|
-
|
|
27399
|
-
// DEPRECATED
|
|
27400
|
-
|
|
27401
|
-
this.setFrameOfReferenceType = function () {
|
|
27402
|
-
|
|
27403
|
-
console.warn( 'THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.' );
|
|
27404
|
-
|
|
27405
|
-
};
|
|
27406
|
-
|
|
27407
|
-
}
|
|
27408
|
-
|
|
27409
|
-
Object.assign( WebVRManager.prototype, {
|
|
27410
|
-
addEventListener: EventDispatcher.prototype.addEventListener,
|
|
27411
|
-
hasEventListener: EventDispatcher.prototype.hasEventListener,
|
|
27412
|
-
removeEventListener: EventDispatcher.prototype.removeEventListener,
|
|
27413
|
-
dispatchEvent: EventDispatcher.prototype.dispatchEvent
|
|
27414
|
-
} );
|
|
27415
|
-
|
|
27416
26855
|
/**
|
|
27417
26856
|
* @author fernandojsg / http://fernandojsg.com
|
|
27418
26857
|
* @author Takahiro https://github.com/takahirox
|
|
@@ -27446,6 +26885,20 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
|
27446
26885
|
|
|
27447
26886
|
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
27448
26887
|
|
|
26888
|
+
class Group extends Object3D {
|
|
26889
|
+
|
|
26890
|
+
constructor() {
|
|
26891
|
+
|
|
26892
|
+
super();
|
|
26893
|
+
|
|
26894
|
+
this.isGroup = true;
|
|
26895
|
+
|
|
26896
|
+
this.type = 'Group';
|
|
26897
|
+
|
|
26898
|
+
}
|
|
26899
|
+
|
|
26900
|
+
}
|
|
26901
|
+
|
|
27449
26902
|
const _moveEvent = { type: 'move' };
|
|
27450
26903
|
|
|
27451
26904
|
class WebXRController {
|
|
@@ -30025,7 +29478,7 @@ class WebGLRenderer {
|
|
|
30025
29478
|
|
|
30026
29479
|
// xr
|
|
30027
29480
|
|
|
30028
|
-
const xr =
|
|
29481
|
+
const xr = new WebXRManager( _this, _gl );
|
|
30029
29482
|
|
|
30030
29483
|
this.xr = xr;
|
|
30031
29484
|
|
|
@@ -30985,13 +30438,6 @@ class WebGLRenderer {
|
|
|
30985
30438
|
|
|
30986
30439
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
30987
30440
|
|
|
30988
|
-
textures.runDeferredUploads();
|
|
30989
|
-
|
|
30990
|
-
if ( xr.enabled && xr.submitFrame ) {
|
|
30991
|
-
|
|
30992
|
-
xr.submitFrame();
|
|
30993
|
-
|
|
30994
|
-
}
|
|
30995
30441
|
// _gl.finish();
|
|
30996
30442
|
|
|
30997
30443
|
bindingStates.resetDefaultState();
|