提交 c48a756d 编写于 作者: M Mr.doob

Updated builds.

上级 86026807
......@@ -13888,6 +13888,8 @@
Object.assign( Plane.prototype, {
isPlane: true,
set: function ( normal, constant ) {
this.normal.copy( normal );
......@@ -22397,6 +22399,7 @@
if ( gamepad && ( gamepad.id === 'Daydream Controller' ||
gamepad.id === 'Gear VR Controller' || gamepad.id === 'Oculus Go Controller' ||
gamepad.id === 'OpenVR Gamepad' || gamepad.id.startsWith( 'Oculus Touch' ) ||
gamepad.id.startsWith( 'HTC Vive Focus' ) ||
gamepad.id.startsWith( 'Spatial Controller' ) ) ) {
if ( j === id ) return gamepad;
......@@ -151,12 +151,12 @@ new Y;x.layers.enable(1);var y=new ja;y.viewport=new Y;y.layers.enable(2);var A=
a&&(m=a)};this.getCamera=function(a){var c="local-floor"===r?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near;h.depthFar=a.far;h.getFrameData(k);if("local-floor"===r){var e=h.stageParameters;e?p.fromArray(e.sittingToStandingTransform):p.makeTranslation(0,c,0)}c=k.pose;e=null!==m?m:a;e.matrix.copy(p);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(w.fromArray(c.orientation),e.quaternion.multiply(w));null!==c.position&&(w.setFromRotationMatrix(p),
z.fromArray(c.position),z.applyQuaternion(w),e.position.add(z));e.updateMatrixWorld();x.near=a.near;y.near=a.near;x.far=a.far;y.far=a.far;x.matrixWorldInverse.fromArray(k.leftViewMatrix);y.matrixWorldInverse.fromArray(k.rightViewMatrix);u.getInverse(p);"local-floor"===r&&(x.matrixWorldInverse.multiply(u),y.matrixWorldInverse.multiply(u));a=e.parent;null!==a&&(v.getInverse(a.matrixWorld),x.matrixWorldInverse.multiply(v),y.matrixWorldInverse.multiply(v));x.matrixWorld.getInverse(x.matrixWorldInverse);
y.matrixWorld.getInverse(y.matrixWorldInverse);x.projectionMatrix.fromArray(k.leftProjectionMatrix);y.projectionMatrix.fromArray(k.rightProjectionMatrix);vf(A,x,y);a=h.getLayers();a.length&&(a=a[0],d(x.viewport,a.leftBounds),d(y.viewport,a.rightBounds));a:for(a=0;a<q.length;a++){c=q[a];b:{e=a;for(var f=navigator.getGamepads&&navigator.getGamepads(),g=0,l=0,t=f.length;g<t;g++){var n=f[g];if(n&&("Daydream Controller"===n.id||"Gear VR Controller"===n.id||"Oculus Go Controller"===n.id||"OpenVR Gamepad"===
n.id||n.id.startsWith("Oculus Touch")||n.id.startsWith("Spatial Controller"))){if(l===e){e=n;break b}l++}}e=void 0}if(void 0!==e&&void 0!==e.pose){if(null===e.pose)break a;f=e.pose;!1===f.hasPosition&&c.position.set(.2,-.6,-.05);null!==f.position&&c.position.fromArray(f.position);null!==f.orientation&&c.quaternion.fromArray(f.orientation);c.matrix.compose(c.position,c.quaternion,c.scale);c.matrix.premultiply(p);c.matrix.decompose(c.position,c.quaternion,c.scale);c.matrixWorldNeedsUpdate=!0;c.visible=
!0;f="Daydream Controller"===e.id?0:1;void 0===ya[a]&&(ya[a]=!1);ya[a]!==e.buttons[f].pressed&&(ya[a]=e.buttons[f].pressed,!0===ya[a]?c.dispatchEvent({type:"selectstart"}):(c.dispatchEvent({type:"selectend"}),c.dispatchEvent({type:"select"})))}else c.visible=!1}return A};this.getStandingMatrix=function(){return p};this.isPresenting=b;var F=new ke;this.setAnimationLoop=function(a){F.setAnimationLoop(a);b()&&F.start()};this.submitFrame=function(){b()&&h.submitFrame()};this.dispose=function(){"undefined"!==
typeof window&&window.removeEventListener("vrdisplaypresentchange",c)};this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function yf(a){function b(){return null!==k&&null!==m}function c(a){for(var b=0;b<l.length;b++)t[b]===a.inputSource&&l[b].dispatchEvent({type:a.type})}function d(){a.setFramebuffer(null);a.setRenderTarget(a.getRenderTarget());x.stop();g.dispatchEvent({type:"sessionend"})}function e(a){m=a;x.setContext(k);
x.start();g.dispatchEvent({type:"sessionstart"})}function f(a,b){null===b?a.matrixWorld.copy(a.matrix):a.matrixWorld.multiplyMatrices(b.matrixWorld,a.matrix);a.matrixWorldInverse.getInverse(a.matrixWorld)}var g=this,h=a.context,k=null,m=null,q="local-floor",p=null,l=[],t=[],r=new ja;r.layers.enable(1);r.viewport=new Y;var n=new ja;n.layers.enable(2);n.viewport=new Y;var w=new Nc([r,n]);w.layers.enable(1);w.layers.enable(2);this.enabled=!1;this.getController=function(a){var b=l[a];void 0===b&&(b=new Zb,
b.matrixAutoUpdate=!1,b.visible=!1,l[a]=b);return b};this.setFramebufferScaleFactor=function(a){};this.setReferenceSpaceType=function(a){q=a};this.getSession=function(){return k};this.setSession=function(a){k=a;null!==k&&(k.addEventListener("select",c),k.addEventListener("selectstart",c),k.addEventListener("selectend",c),k.addEventListener("end",d),k.updateRenderState({baseLayer:new XRWebGLLayer(k,h)}),k.requestReferenceSpace(q).then(e),t=k.inputSources,k.addEventListener("inputsourceschange",function(){t=
k.inputSources;console.log(t);for(var a=0;a<l.length;a++)l[a].userData.inputSource=t[a]}))};this.getCamera=function(a){if(b()){var c=a.parent,d=w.cameras;f(w,c);for(var e=0;e<d.length;e++)f(d[e],c);a.matrixWorld.copy(w.matrixWorld);a=a.children;e=0;for(c=a.length;e<c;e++)a[e].updateMatrixWorld(!0);vf(w,r,n);return w}return a};this.isPresenting=b;var z=null,x=new ke;x.setAnimationLoop(function(b,c){p=c.getViewerPose(m);if(null!==p){var d=p.views,e=k.renderState.baseLayer;a.setFramebuffer(e.framebuffer);
n.id||n.id.startsWith("Oculus Touch")||n.id.startsWith("HTC Vive Focus")||n.id.startsWith("Spatial Controller"))){if(l===e){e=n;break b}l++}}e=void 0}if(void 0!==e&&void 0!==e.pose){if(null===e.pose)break a;f=e.pose;!1===f.hasPosition&&c.position.set(.2,-.6,-.05);null!==f.position&&c.position.fromArray(f.position);null!==f.orientation&&c.quaternion.fromArray(f.orientation);c.matrix.compose(c.position,c.quaternion,c.scale);c.matrix.premultiply(p);c.matrix.decompose(c.position,c.quaternion,c.scale);
c.matrixWorldNeedsUpdate=!0;c.visible=!0;f="Daydream Controller"===e.id?0:1;void 0===ya[a]&&(ya[a]=!1);ya[a]!==e.buttons[f].pressed&&(ya[a]=e.buttons[f].pressed,!0===ya[a]?c.dispatchEvent({type:"selectstart"}):(c.dispatchEvent({type:"selectend"}),c.dispatchEvent({type:"select"})))}else c.visible=!1}return A};this.getStandingMatrix=function(){return p};this.isPresenting=b;var F=new ke;this.setAnimationLoop=function(a){F.setAnimationLoop(a);b()&&F.start()};this.submitFrame=function(){b()&&h.submitFrame()};
this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",c)};this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function yf(a){function b(){return null!==k&&null!==m}function c(a){for(var b=0;b<l.length;b++)t[b]===a.inputSource&&l[b].dispatchEvent({type:a.type})}function d(){a.setFramebuffer(null);a.setRenderTarget(a.getRenderTarget());x.stop();g.dispatchEvent({type:"sessionend"})}
function e(a){m=a;x.setContext(k);x.start();g.dispatchEvent({type:"sessionstart"})}function f(a,b){null===b?a.matrixWorld.copy(a.matrix):a.matrixWorld.multiplyMatrices(b.matrixWorld,a.matrix);a.matrixWorldInverse.getInverse(a.matrixWorld)}var g=this,h=a.context,k=null,m=null,q="local-floor",p=null,l=[],t=[],r=new ja;r.layers.enable(1);r.viewport=new Y;var n=new ja;n.layers.enable(2);n.viewport=new Y;var w=new Nc([r,n]);w.layers.enable(1);w.layers.enable(2);this.enabled=!1;this.getController=function(a){var b=
l[a];void 0===b&&(b=new Zb,b.matrixAutoUpdate=!1,b.visible=!1,l[a]=b);return b};this.setFramebufferScaleFactor=function(a){};this.setReferenceSpaceType=function(a){q=a};this.getSession=function(){return k};this.setSession=function(a){k=a;null!==k&&(k.addEventListener("select",c),k.addEventListener("selectstart",c),k.addEventListener("selectend",c),k.addEventListener("end",d),k.updateRenderState({baseLayer:new XRWebGLLayer(k,h)}),k.requestReferenceSpace(q).then(e),t=k.inputSources,k.addEventListener("inputsourceschange",
function(){t=k.inputSources;console.log(t);for(var a=0;a<l.length;a++)l[a].userData.inputSource=t[a]}))};this.getCamera=function(a){if(b()){var c=a.parent,d=w.cameras;f(w,c);for(var e=0;e<d.length;e++)f(d[e],c);a.matrixWorld.copy(w.matrixWorld);a=a.children;e=0;for(c=a.length;e<c;e++)a[e].updateMatrixWorld(!0);vf(w,r,n);return w}return a};this.isPresenting=b;var z=null,x=new ke;x.setAnimationLoop(function(b,c){p=c.getViewerPose(m);if(null!==p){var d=p.views,e=k.renderState.baseLayer;a.setFramebuffer(e.framebuffer);
for(var f=0;f<d.length;f++){var g=d[f],h=e.getViewport(g),q=w.cameras[f];q.matrix.fromArray(g.transform.inverse.matrix).getInverse(q.matrix);q.projectionMatrix.fromArray(g.projectionMatrix);q.viewport.set(h.x,h.y,h.width,h.height);0===f&&w.matrix.copy(q.matrix)}}for(f=0;f<l.length;f++){d=l[f];if(e=t[f])if(e=c.getPose(e.targetRaySpace,m),null!==e){d.matrix.fromArray(e.transform.matrix);d.matrix.decompose(d.position,d.rotation,d.scale);d.visible=!0;continue}d.visible=!1}z&&z(b)});this.setAnimationLoop=
function(a){z=a};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new L};this.getDevice=function(){console.warn("THREE.WebXRManager: getDevice() has been deprecated.")};this.setDevice=function(){console.warn("THREE.WebXRManager: setDevice() has been deprecated.")};this.setFrameOfReferenceType=function(){console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.")};this.submitFrame=
function(){}}function oe(a){var b;function c(){ma=new ig(N);Fa=new gg(N,ma,a);Fa.isWebGL2||(ma.get("WEBGL_depth_texture"),ma.get("OES_texture_float"),ma.get("OES_texture_half_float"),ma.get("OES_texture_half_float_linear"),ma.get("OES_standard_derivatives"),ma.get("OES_element_index_uint"),ma.get("ANGLE_instanced_arrays"));ma.get("OES_texture_float_linear");ka=new uf(N,ma,Fa);da=new kh(N,ma,ka,Fa);da.scissor(aa.copy(ia).multiplyScalar(ca));da.viewport(W.copy(fa).multiplyScalar(ca));ha=new lg(N);Z=
......@@ -553,8 +553,8 @@ a);this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return
this.view&&this.view.enabled){var g=f.fullWidth,h=f.fullHeight;e+=f.offsetX*d/g;b-=f.offsetY*c/h;d*=f.width/g;c*=f.height/h}f=this.filmOffset;0!==f&&(e+=a*f/this.getFilmWidth());this.projectionMatrix.makePerspective(e,e+d,b,b-c,a,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(a){a=H.prototype.toJSON.call(this,a);a.object.fov=this.fov;a.object.zoom=this.zoom;a.object.near=this.near;a.object.far=this.far;a.object.focus=this.focus;a.object.aspect=this.aspect;
null!==this.view&&(a.object.view=Object.assign({},this.view));a.object.filmGauge=this.filmGauge;a.object.filmOffset=this.filmOffset;return a}});Vb.prototype=Object.create(H.prototype);Vb.prototype.constructor=Vb;kb.prototype=Object.create(Ta.prototype);kb.prototype.constructor=kb;kb.prototype.isWebGLRenderTargetCube=!0;kb.prototype.fromEquirectangularTexture=function(a,b){this.texture.type=b.type;this.texture.format=b.format;this.texture.encoding=b.encoding;var c=new Cc,d=new pa({type:"CubemapFromEquirect",
uniforms:zb({tEquirect:{value:null}}),vertexShader:"varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}",
side:1,blending:0});d.uniforms.tEquirect.value=b;b=new sa(new ib(5,5,5),d);c.add(b);d=new Vb(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Ab.prototype=Object.create(U.prototype);Ab.prototype.constructor=Ab;Ab.prototype.isDataTexture=!0;Object.assign(Wa.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;
return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new n,b=new n;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();
side:1,blending:0});d.uniforms.tEquirect.value=b;b=new sa(new ib(5,5,5),d);c.add(b);d=new Vb(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Ab.prototype=Object.create(U.prototype);Ab.prototype.constructor=Ab;Ab.prototype.isDataTexture=!0;Object.assign(Wa.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=
d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new n,b=new n;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();
this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new n);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(){var a=new n;
return function(b,c){void 0===c&&(console.warn("THREE.Plane: .intersectLine() target is now required"),c=new n);var d=b.delta(a),e=this.normal.dot(d);if(0===e){if(0===this.distanceToPoint(b.start))return c.copy(b.start)}else if(e=-(b.start.dot(this.normal)+this.constant)/e,!(0>e||1<e))return c.copy(d).multiplyScalar(e).add(b.start)}}(),intersectsLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectsBox:function(a){return a.intersectsPlane(this)},
intersectsSphere:function(a){return a.intersectsPlane(this)},coplanarPoint:function(a){void 0===a&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),a=new n);return a.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new n,b=new ia;return function(c,d){d=d||b.getNormalMatrix(c);c=this.coplanarPoint(a).applyMatrix4(c);d=this.normal.applyMatrix3(d).normalize();this.constant=-c.dot(d);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);
......
......@@ -13882,6 +13882,8 @@ function Plane( normal, constant ) {
Object.assign( Plane.prototype, {
isPlane: true,
set: function ( normal, constant ) {
this.normal.copy( normal );
......@@ -22391,6 +22393,7 @@ function WebVRManager( renderer ) {
if ( gamepad && ( gamepad.id === 'Daydream Controller' ||
gamepad.id === 'Gear VR Controller' || gamepad.id === 'Oculus Go Controller' ||
gamepad.id === 'OpenVR Gamepad' || gamepad.id.startsWith( 'Oculus Touch' ) ||
gamepad.id.startsWith( 'HTC Vive Focus' ) ||
gamepad.id.startsWith( 'Spatial Controller' ) ) ) {
if ( j === id ) return gamepad;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册