Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ded9bdbd
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ded9bdbd
编写于
4月 10, 2020
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds
上级
00140d02
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
801 addition
and
733 deletion
+801
-733
build/three.js
build/three.js
+152
-118
build/three.min.js
build/three.min.js
+497
-497
build/three.module.js
build/three.module.js
+152
-118
未找到文件。
build/three.js
浏览文件 @
ded9bdbd
...
...
@@ -22858,6 +22858,143 @@
} );
/**
* @author Mugen87 / https://github.com/Mugen87
*/
function WebXRController() {
this._targetRay = null;
this._grip = null;
}
Object.assign( WebXRController.prototype, {
constructor: WebXRController,
getTargetRaySpace: function () {
if ( this._targetRay === null ) {
this._targetRay = new Group();
this._targetRay.matrixAutoUpdate = false;
this._targetRay.visible = false;
}
return this._targetRay;
},
getGripSpace: function () {
if ( this._grip === null ) {
this._grip = new Group();
this._grip.matrixAutoUpdate = false;
this._grip.visible = false;
}
return this._grip;
},
dispatchEvent: function ( event ) {
if ( this._targetRay !== null ) {
this._targetRay.dispatchEvent( event );
}
if ( this._grip !== null ) {
this._grip.dispatchEvent( event );
}
return this;
},
disconnect: function ( inputSource ) {
this.dispatchEvent( { type: 'disconnected', data: inputSource } );
if ( this._targetRay !== null ) {
this._targetRay.visible = false;
}
if ( this._grip !== null ) {
this._grip.visible = false;
}
return this;
},
update: function ( inputSource, frame, referenceSpace ) {
var inputPose = null;
var gripPose = null;
var targetRay = this._targetRay;
var grip = this._grip;
if ( inputSource ) {
if ( targetRay !== null ) {
inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
if ( inputPose !== null ) {
targetRay.matrix.fromArray( inputPose.transform.matrix );
targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
}
}
if ( grip !== null && inputSource.gripSpace ) {
gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
if ( gripPose !== null ) {
grip.matrix.fromArray( gripPose.transform.matrix );
grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
}
}
}
if ( targetRay !== null ) {
targetRay.visible = ( inputPose !== null );
}
if ( grip !== null ) {
grip.visible = ( gripPose !== null );
}
return this;
}
} );
/**
* @author mrdoob / http://mrdoob.com/
*/
...
...
@@ -22901,49 +23038,33 @@
this.isPresenting = false;
this.getController = function ( i
d
) {
this.getController = function ( i
ndex
) {
var controller = controllers[ i
d
];
var controller = controllers[ i
ndex
];
if ( controller === undefined ) {
controller = {};
controllers[ id ] = controller;
}
if ( controller.targetRay === undefined ) {
controller.targetRay = new Group();
controller.targetRay.matrixAutoUpdate = false;
controller.targetRay.visible = false;
controller = new WebXRController();
controllers[ index ] = controller;
}
return controller.
targetRay
;
return controller.
getTargetRaySpace()
;
};
this.getControllerGrip = function ( i
d
) {
this.getControllerGrip = function ( i
ndex
) {
var controller = controllers[ i
d
];
var controller = controllers[ i
ndex
];
if ( controller === undefined ) {
controller = {};
controllers[ id ] = controller;
}
if ( controller.grip === undefined ) {
controller.grip = new Group();
controller.grip.matrixAutoUpdate = false;
controller.grip.visible = false;
controller = new WebXRController();
controllers[ index ] = controller;
}
return controller.g
rip
;
return controller.g
etGripSpace()
;
};
...
...
@@ -22955,17 +23076,7 @@
if ( controller ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: event.type } );
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: event.type } );
}
controller.dispatchEvent( { type: event.type } );
}
...
...
@@ -22975,19 +23086,7 @@
inputSourcesMap.forEach( function ( controller, inputSource ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
controller.targetRay.visible = false;
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
controller.grip.visible = false;
}
controller.disconnect( inputSource );
} );
...
...
@@ -23109,18 +23208,7 @@
if ( controller ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
}
controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
inputSourcesMap.delete( inputSource );
}
...
...
@@ -23136,17 +23224,7 @@
if ( controller ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: 'connected', data: inputSource } );
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: 'connected', data: inputSource } );
}
controller.dispatchEvent( { type: 'connected', data: inputSource } );
}
...
...
@@ -23322,53 +23400,9 @@
for ( var i = 0; i < controllers.length; i ++ ) {
var controller = controllers[ i ];
var inputSource = inputSources[ i ];
var inputPose = null;
var gripPose = null;
if ( inputSource ) {
if ( controller.targetRay ) {
inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
if ( inputPose !== null ) {
controller.targetRay.matrix.fromArray( inputPose.transform.matrix );
controller.targetRay.matrix.decompose( controller.targetRay.position, controller.targetRay.rotation, controller.targetRay.scale );
}
}
if ( controller.grip && inputSource.gripSpace ) {
gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
if ( gripPose !== null ) {
controller.grip.matrix.fromArray( gripPose.transform.matrix );
controller.grip.matrix.decompose( controller.grip.position, controller.grip.rotation, controller.grip.scale );
}
}
}
if ( controller.targetRay ) {
controller.targetRay.visible = inputPose !== null;
}
if ( controller.grip ) {
controller.grip.visible = gripPose !== null;
}
controller.update( inputSource, frame, referenceSpace );
}
build/three.min.js
浏览文件 @
ded9bdbd
此差异已折叠。
点击以展开。
build/three.module.js
浏览文件 @
ded9bdbd
...
...
@@ -22850,6 +22850,143 @@ Group.prototype = Object.assign( Object.create( Object3D.prototype ), {
} );
/**
* @author Mugen87 / https://github.com/Mugen87
*/
function WebXRController() {
this._targetRay = null;
this._grip = null;
}
Object.assign( WebXRController.prototype, {
constructor: WebXRController,
getTargetRaySpace: function () {
if ( this._targetRay === null ) {
this._targetRay = new Group();
this._targetRay.matrixAutoUpdate = false;
this._targetRay.visible = false;
}
return this._targetRay;
},
getGripSpace: function () {
if ( this._grip === null ) {
this._grip = new Group();
this._grip.matrixAutoUpdate = false;
this._grip.visible = false;
}
return this._grip;
},
dispatchEvent: function ( event ) {
if ( this._targetRay !== null ) {
this._targetRay.dispatchEvent( event );
}
if ( this._grip !== null ) {
this._grip.dispatchEvent( event );
}
return this;
},
disconnect: function ( inputSource ) {
this.dispatchEvent( { type: 'disconnected', data: inputSource } );
if ( this._targetRay !== null ) {
this._targetRay.visible = false;
}
if ( this._grip !== null ) {
this._grip.visible = false;
}
return this;
},
update: function ( inputSource, frame, referenceSpace ) {
var inputPose = null;
var gripPose = null;
var targetRay = this._targetRay;
var grip = this._grip;
if ( inputSource ) {
if ( targetRay !== null ) {
inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
if ( inputPose !== null ) {
targetRay.matrix.fromArray( inputPose.transform.matrix );
targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
}
}
if ( grip !== null && inputSource.gripSpace ) {
gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
if ( gripPose !== null ) {
grip.matrix.fromArray( gripPose.transform.matrix );
grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
}
}
}
if ( targetRay !== null ) {
targetRay.visible = ( inputPose !== null );
}
if ( grip !== null ) {
grip.visible = ( gripPose !== null );
}
return this;
}
} );
/**
* @author mrdoob / http://mrdoob.com/
*/
...
...
@@ -22893,49 +23030,33 @@ function WebXRManager( renderer, gl ) {
this.isPresenting = false;
this.getController = function ( i
d
) {
this.getController = function ( i
ndex
) {
var controller = controllers[ i
d
];
var controller = controllers[ i
ndex
];
if ( controller === undefined ) {
controller = {};
controllers[ id ] = controller;
}
if ( controller.targetRay === undefined ) {
controller.targetRay = new Group();
controller.targetRay.matrixAutoUpdate = false;
controller.targetRay.visible = false;
controller = new WebXRController();
controllers[ index ] = controller;
}
return controller.
targetRay
;
return controller.
getTargetRaySpace()
;
};
this.getControllerGrip = function ( i
d
) {
this.getControllerGrip = function ( i
ndex
) {
var controller = controllers[ i
d
];
var controller = controllers[ i
ndex
];
if ( controller === undefined ) {
controller = {};
controllers[ id ] = controller;
}
if ( controller.grip === undefined ) {
controller.grip = new Group();
controller.grip.matrixAutoUpdate = false;
controller.grip.visible = false;
controller = new WebXRController();
controllers[ index ] = controller;
}
return controller.g
rip
;
return controller.g
etGripSpace()
;
};
...
...
@@ -22947,17 +23068,7 @@ function WebXRManager( renderer, gl ) {
if ( controller ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: event.type } );
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: event.type } );
}
controller.dispatchEvent( { type: event.type } );
}
...
...
@@ -22967,19 +23078,7 @@ function WebXRManager( renderer, gl ) {
inputSourcesMap.forEach( function ( controller, inputSource ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
controller.targetRay.visible = false;
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
controller.grip.visible = false;
}
controller.disconnect( inputSource );
} );
...
...
@@ -23101,18 +23200,7 @@ function WebXRManager( renderer, gl ) {
if ( controller ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
}
controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
inputSourcesMap.delete( inputSource );
}
...
...
@@ -23128,17 +23216,7 @@ function WebXRManager( renderer, gl ) {
if ( controller ) {
if ( controller.targetRay ) {
controller.targetRay.dispatchEvent( { type: 'connected', data: inputSource } );
}
if ( controller.grip ) {
controller.grip.dispatchEvent( { type: 'connected', data: inputSource } );
}
controller.dispatchEvent( { type: 'connected', data: inputSource } );
}
...
...
@@ -23314,53 +23392,9 @@ function WebXRManager( renderer, gl ) {
for ( var i = 0; i < controllers.length; i ++ ) {
var controller = controllers[ i ];
var inputSource = inputSources[ i ];
var inputPose = null;
var gripPose = null;
if ( inputSource ) {
if ( controller.targetRay ) {
inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
if ( inputPose !== null ) {
controller.targetRay.matrix.fromArray( inputPose.transform.matrix );
controller.targetRay.matrix.decompose( controller.targetRay.position, controller.targetRay.rotation, controller.targetRay.scale );
}
}
if ( controller.grip && inputSource.gripSpace ) {
gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
if ( gripPose !== null ) {
controller.grip.matrix.fromArray( gripPose.transform.matrix );
controller.grip.matrix.decompose( controller.grip.position, controller.grip.rotation, controller.grip.scale );
}
}
}
if ( controller.targetRay ) {
controller.targetRay.visible = inputPose !== null;
}
if ( controller.grip ) {
controller.grip.visible = gripPose !== null;
}
controller.update( inputSource, frame, referenceSpace );
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录