Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
24302ae5
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
24302ae5
编写于
4月 23, 2019
作者:
F
Fernando Serrano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add multiview status on example
上级
87f40038
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
20 deletion
+36
-20
examples/webvr_ballshooter_multiview.html
examples/webvr_ballshooter_multiview.html
+25
-13
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+5
-5
src/renderers/webgl/WebGLMultiview.js
src/renderers/webgl/WebGLMultiview.js
+4
-0
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+2
-2
未找到文件。
examples/webvr_ballshooter_multiview.html
浏览文件 @
24302ae5
...
...
@@ -44,23 +44,12 @@
animate
();
function
init
()
{
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
const
multiview
=
urlParams
.
has
(
'
enableMultiview
'
);
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
var
info
=
document
.
createElement
(
'
div
'
);
info
.
style
.
position
=
'
absolute
'
;
info
.
style
.
top
=
'
10px
'
;
info
.
style
.
width
=
'
100%
'
;
info
.
style
.
textAlign
=
'
center
'
;
// @todo Change enabled for requested and check renderer.vr.multiview
info
.
innerHTML
=
'
OVR_multiview2 demo -
'
+
(
multiview
?
'
<b style="color:#3f3">multiview enabled</b>
'
:
'
<b style="color:#f33">multiview not enabled</b>
'
)
+
` <a href="
${
multiview
?
'
?
'
:
'
?enableMultiview
'
}
">toggle</a>`
;
container
.
appendChild
(
info
);
ms
=
document
.
createElement
(
'
div
'
);
ms
.
innerHTML
=
''
;
info
.
appendChild
(
ms
);
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
const
multiview
=
urlParams
.
has
(
'
enableMultiview
'
);
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0x505050
);
...
...
@@ -111,6 +100,29 @@
//
var
info
=
document
.
createElement
(
'
div
'
);
info
.
style
.
position
=
'
absolute
'
;
info
.
style
.
top
=
'
10px
'
;
info
.
style
.
width
=
'
100%
'
;
info
.
style
.
textAlign
=
'
center
'
;
function
colorize
(
value
)
{
return
value
?
'
<b style="color:#3f3">true</b>
'
:
'
<b style="color:#f33">false</b>
'
;
}
// @todo Change enabled for requested and check renderer.vr.multiview
info
.
innerHTML
=
'
<b>OVR_multiview2</b> demo<br/>requested:
'
+
colorize
(
multiview
)
+
` <a href="
${
multiview
?
'
?
'
:
'
?enableMultiview
'
}
">toggle</a>`
+
`<br/>available:
${
colorize
(
renderer
.
multiview
.
isAvailable
()
)
}
<br/>enabled:
${
colorize
(
renderer
.
multiview
.
isEnabled
()
)
}
<br/><br/>`
;
container
.
appendChild
(
info
);
ms
=
document
.
createElement
(
'
div
'
);
ms
.
innerHTML
=
''
;
info
.
appendChild
(
ms
);
//+ (multiview ? '
<
b
style
=
"
color:#3f3
"
>
true
<
/b>' : '<b style="color:#f33">false</
b
>
'
)
//
document.body.appendChild( WEBVR.createButton( renderer ) );
// controllers
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
24302ae5
...
...
@@ -59,7 +59,7 @@ function WebGLRenderer( parameters ) {
var
_canvas
=
parameters
.
canvas
!==
undefined
?
parameters
.
canvas
:
document
.
createElementNS
(
'
http://www.w3.org/1999/xhtml
'
,
'
canvas
'
),
_context
=
parameters
.
context
!==
undefined
?
parameters
.
context
:
null
,
_multiview
=
parameters
.
multiview
!==
undefined
?
parameters
.
multiview
:
false
,
_multiview
Requested
=
parameters
.
multiview
!==
undefined
?
parameters
.
multiview
:
false
,
_alpha
=
parameters
.
alpha
!==
undefined
?
parameters
.
alpha
:
false
,
_depth
=
parameters
.
depth
!==
undefined
?
parameters
.
depth
:
true
,
...
...
@@ -315,8 +315,8 @@ function WebGLRenderer( parameters ) {
this
.
vr
=
vr
;
var
multiview
Object
=
new
WebGLMultiview
(
_multiview
,
_gl
,
_canvas
,
extensions
,
capabilities
);
var
multiviewEnabled
=
this
.
multiviewEnabled
=
multiview
Object
.
isEnabled
();
var
multiview
=
this
.
multiview
=
new
WebGLMultiview
(
_multiviewRequested
,
_gl
,
_canvas
,
extensions
,
capabilities
);
var
multiviewEnabled
=
this
.
multiviewEnabled
=
multiview
.
isEnabled
();
// shadow map
...
...
@@ -1370,7 +1370,7 @@ function WebGLRenderer( parameters ) {
if
(
multiviewEnabled
)
{
multiview
Object
.
bindMultiviewFrameBuffer
(
camera
);
multiview
.
bindMultiviewFrameBuffer
(
camera
);
_gl
.
disable
(
_gl
.
SCISSOR_TEST
);
...
...
@@ -1403,7 +1403,7 @@ function WebGLRenderer( parameters ) {
}
multiview
Object
.
unbindMultiviewFrameBuffer
(
camera
);
multiview
.
unbindMultiviewFrameBuffer
(
camera
);
}
else
{
...
...
src/renderers/webgl/WebGLMultiview.js
浏览文件 @
24302ae5
/**
* @author fernandojsg / http://fernandojsg.com
*/
function
WebGLMultiview
(
requested
,
gl
,
canvas
,
extensions
,
capabilities
)
{
this
.
isAvailable
=
function
()
{
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
24302ae5
...
...
@@ -432,10 +432,10 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
renderer
.
multiviewEnabled
?
[
'
uniform mat4 modelViewMatrix;
'
,
'
uniform mat4 projectionMatrices[2];
'
,
'
uniform mat3 normalMatrix;
'
,
'
uniform mat4 viewMatrices[2];
'
,
'
uniform mat4 projectionMatrices[2];
'
,
'
#define viewMatrix viewMatrices[VIEW_ID]
'
,
'
#define projectionMatrix projectionMatrices[VIEW_ID]
'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录