Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
148fe362
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,发现更多精彩内容 >>
未验证
提交
148fe362
编写于
2月 13, 2018
作者:
M
Mr.doob
提交者:
GitHub
2月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13158 from dmarcos/standingMatrix
Reintroduce standing matrix
上级
25b71ec2
907c5fd3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
14 deletion
+34
-14
examples/js/vr/ViveController.js
examples/js/vr/ViveController.js
+2
-0
examples/webvr_vive.html
examples/webvr_vive.html
+2
-1
examples/webvr_vive_dragging.html
examples/webvr_vive_dragging.html
+2
-1
examples/webvr_vive_paint.html
examples/webvr_vive_paint.html
+2
-1
examples/webvr_vive_sculpt.html
examples/webvr_vive_sculpt.html
+2
-1
src/Three.Legacy.js
src/Three.Legacy.js
+0
-10
src/renderers/webvr/WebVRManager.js
src/renderers/webvr/WebVRManager.js
+24
-0
未找到文件。
examples/js/vr/ViveController.js
浏览文件 @
148fe362
...
...
@@ -40,6 +40,7 @@ THREE.ViveController = function ( id ) {
}
this
.
matrixAutoUpdate
=
false
;
this
.
standingMatrix
=
new
THREE
.
Matrix4
();
this
.
getGamepad
=
function
()
{
...
...
@@ -71,6 +72,7 @@ THREE.ViveController = function ( id ) {
if
(
pose
.
position
!==
null
)
scope
.
position
.
fromArray
(
pose
.
position
);
if
(
pose
.
orientation
!==
null
)
scope
.
quaternion
.
fromArray
(
pose
.
orientation
);
scope
.
matrix
.
compose
(
scope
.
position
,
scope
.
quaternion
,
scope
.
scale
);
scope
.
matrix
.
premultiply
(
scope
.
standingMatrix
);
scope
.
matrixWorldNeedsUpdate
=
true
;
scope
.
visible
=
true
;
...
...
examples/webvr_vive.html
浏览文件 @
148fe362
...
...
@@ -58,7 +58,6 @@
scene
.
background
=
new
THREE
.
Color
(
0x505050
);
var
user
=
new
THREE
.
Group
();
user
.
position
.
set
(
0
,
1.6
,
0
);
scene
.
add
(
user
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
10
);
...
...
@@ -165,9 +164,11 @@
// controllers
controller1
=
new
THREE
.
ViveController
(
0
);
controller1
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
user
.
add
(
controller1
);
controller2
=
new
THREE
.
ViveController
(
1
);
controller2
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
user
.
add
(
controller2
);
var
loader
=
new
THREE
.
OBJLoader
();
...
...
examples/webvr_vive_dragging.html
浏览文件 @
148fe362
...
...
@@ -59,7 +59,6 @@
scene
.
background
=
new
THREE
.
Color
(
0x808080
);
var
user
=
new
THREE
.
Group
();
user
.
position
.
set
(
0
,
1.6
,
0
);
scene
.
add
(
user
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
10
);
...
...
@@ -143,11 +142,13 @@
// controllers
controller1
=
new
THREE
.
ViveController
(
0
);
controller1
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
controller1
.
addEventListener
(
'
triggerdown
'
,
onTriggerDown
);
controller1
.
addEventListener
(
'
triggerup
'
,
onTriggerUp
);
user
.
add
(
controller1
);
controller2
=
new
THREE
.
ViveController
(
1
);
controller2
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
controller2
.
addEventListener
(
'
triggerdown
'
,
onTriggerDown
);
controller2
.
addEventListener
(
'
triggerup
'
,
onTriggerUp
);
user
.
add
(
controller2
);
...
...
examples/webvr_vive_paint.html
浏览文件 @
148fe362
...
...
@@ -70,7 +70,6 @@
scene
.
background
=
new
THREE
.
Color
(
0x222222
);
var
user
=
new
THREE
.
Group
();
user
.
position
.
set
(
0
,
1.6
,
0
);
scene
.
add
(
user
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
...
...
@@ -142,11 +141,13 @@
// controllers
controller1
=
new
THREE
.
PaintViveController
(
0
);
controller1
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
controller1
.
userData
.
points
=
[
new
THREE
.
Vector3
(),
new
THREE
.
Vector3
()
];
controller1
.
userData
.
matrices
=
[
new
THREE
.
Matrix4
(),
new
THREE
.
Matrix4
()
];
user
.
add
(
controller1
);
controller2
=
new
THREE
.
PaintViveController
(
1
);
controller2
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
controller2
.
userData
.
points
=
[
new
THREE
.
Vector3
(),
new
THREE
.
Vector3
()
];
controller2
.
userData
.
matrices
=
[
new
THREE
.
Matrix4
(),
new
THREE
.
Matrix4
()
];
user
.
add
(
controller2
);
...
...
examples/webvr_vive_sculpt.html
浏览文件 @
148fe362
...
...
@@ -60,7 +60,6 @@
scene
.
background
=
new
THREE
.
Color
(
0x222222
);
var
user
=
new
THREE
.
Group
();
user
.
position
.
set
(
0
,
1.6
,
0
);
scene
.
add
(
user
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
...
...
@@ -124,9 +123,11 @@
// controllers
controller1
=
new
THREE
.
ViveController
(
0
);
controller1
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
user
.
add
(
controller1
);
controller2
=
new
THREE
.
ViveController
(
1
);
controller2
.
standingMatrix
=
renderer
.
vr
.
getStandingMatrix
();
user
.
add
(
controller2
);
var
loader
=
new
THREE
.
OBJLoader
();
...
...
src/Three.Legacy.js
浏览文件 @
148fe362
...
...
@@ -1587,16 +1587,6 @@ Object.defineProperties( WebGLRenderTarget.prototype, {
//
Object
.
assign
(
WebVRManager
.
prototype
,
{
getStandingMatrix
:
function
()
{
console
.
warn
(
'
THREE.WebVRManager: .getStandingMatrix() has been removed.
'
);
}
}
);
Object
.
defineProperties
(
WebVRManager
.
prototype
,
{
standing
:
{
...
...
src/renderers/webvr/WebVRManager.js
浏览文件 @
148fe362
...
...
@@ -16,6 +16,11 @@ function WebVRManager( renderer ) {
var
poseTarget
=
null
;
var
standingMatrix
=
new
Matrix4
();
var
standingMatrixInverse
=
new
Matrix4
();
scope
.
userHeight
=
1.6
;
if
(
typeof
window
!==
'
undefined
'
&&
'
VRFrameData
'
in
window
)
{
frameData
=
new
window
.
VRFrameData
();
...
...
@@ -119,6 +124,16 @@ function WebVRManager( renderer ) {
}
var
stageParameters
=
device
.
stageParameters
;
if
(
stageParameters
)
{
standingMatrix
.
fromArray
(
stageParameters
.
sittingToStandingTransform
);
}
else
{
standingMatrix
.
makeTranslation
(
0
,
scope
.
userHeight
,
0
);
}
standingMatrixInverse
.
getInverse
(
standingMatrix
);
poseObject
.
position
.
applyMatrix4
(
standingMatrix
);
poseObject
.
updateMatrixWorld
();
if
(
device
.
isPresenting
===
false
)
return
camera
;
...
...
@@ -137,6 +152,9 @@ function WebVRManager( renderer ) {
cameraL
.
matrixWorldInverse
.
fromArray
(
frameData
.
leftViewMatrix
);
cameraR
.
matrixWorldInverse
.
fromArray
(
frameData
.
rightViewMatrix
);
cameraL
.
matrixWorldInverse
.
multiply
(
standingMatrixInverse
);
cameraR
.
matrixWorldInverse
.
multiply
(
standingMatrixInverse
);
var
parent
=
poseObject
.
parent
;
if
(
parent
!==
null
)
{
...
...
@@ -187,6 +205,12 @@ function WebVRManager( renderer ) {
};
this
.
getStandingMatrix
=
function
()
{
return
standingMatrix
;
};
this
.
submitFrame
=
function
()
{
if
(
device
&&
device
.
isPresenting
)
device
.
submitFrame
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录