Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
03b1efa8
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,发现更多精彩内容 >>
提交
03b1efa8
编写于
4月 23, 2019
作者:
F
Fernando Serrano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Average last frame times on the multiview demo
上级
96f46dfe
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
26 deletion
+21
-26
examples/webvr_ballshooter_multiview.html
examples/webvr_ballshooter_multiview.html
+13
-6
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+6
-10
src/renderers/webgl/WebGLCapabilities.js
src/renderers/webgl/WebGLCapabilities.js
+1
-1
src/renderers/webgl/WebGLMultiview.js
src/renderers/webgl/WebGLMultiview.js
+1
-1
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+0
-8
未找到文件。
examples/webvr_ballshooter_multiview.html
浏览文件 @
03b1efa8
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webvr - ball shooter
</title>
<title>
three.js webvr - ball shooter
with multiview
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, user-scalable=no"
>
<style>
...
...
@@ -28,9 +28,12 @@
var
container
;
var
ms
;
var
camera
,
scene
,
renderer
;
var
controller1
,
controller2
;
var
avgCounter
=
new
Array
(
240
,
0
);
var
room
;
var
count
=
0
;
...
...
@@ -118,12 +121,12 @@
}
// @todo Change enabled for requested and check renderer.vr.multiview
info
.
innerHTML
=
'
<b>OVR_multiview2</b> demo<br/>requested:
'
+
colorize
(
multiview
)
+
` <a href="?num=
${
numObjects
}
&
${
multiview
?
''
:
'
enableMultiview
'
}
">toggle</a>`
+
`<br/>available:
${
colorize
(
renderer
.
multiview
.
isAvailable
()
)
}
<br/>enabled:
${
colorize
(
renderer
.
multiview
.
isEnabled
()
)
}
<br/>
${
addNumLink
(
200
)}
${
addNumLink
(
500
)}
${
addNumLink
(
1000
)}
${
addNumLink
(
2500
)}
${
addNumLink
(
5000
)}
<br/>`
;
container
.
appendChild
(
info
);
...
...
@@ -131,9 +134,6 @@
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
...
...
@@ -291,7 +291,14 @@
var
ts
=
performance
.
now
();
renderer
.
render
(
scene
,
camera
);
ms.innerHTML =
'
renderer
.
render
time
:
'
+ (performance.now() - ts).toFixed(2) +
'
ms
'
;
var
trender
=
performance
.
now
()
-
ts
;
// Compute average of the last frames
for
(
var
i
=
0
;
i
<
avgCounter
.
length
-
1
;
++
i
)
avgCounter
[
i
]
=
avgCounter
[
i
+
1
];
avgCounter
[
avgCounter
.
length
-
1
]
=
trender
;
var
avg
=
avgCounter
.
reduce
(
function
(
a
,
b
)
{
return
a
+
b
;
})
/
avgCounter
.
length
;
ms
.
innerHTML
=
`renderer.render time:
${
trender
.
toFixed
(
2
)
}
ms (avg:
${
avg
.
toFixed
(
2
)
}
ms)`
;
}
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
03b1efa8
...
...
@@ -84,7 +84,7 @@ function WebGLRenderer( parameters ) {
* Enables error checking and reporting when shader programs are being compiled
* @type {boolean}
*/
checkShaderErrors
:
tru
e
checkShaderErrors
:
fals
e
};
// clearing
...
...
@@ -315,7 +315,7 @@ function WebGLRenderer( parameters ) {
this
.
vr
=
vr
;
var
multiview
=
this
.
multiview
=
new
WebGLMultiview
(
_multiviewRequested
,
_gl
,
_canvas
,
extensions
,
capabilities
);
var
multiview
=
this
.
multiview
=
new
WebGLMultiview
(
_multiviewRequested
,
_gl
,
_canvas
,
extensions
,
capabilities
);
// shadow map
...
...
@@ -1385,7 +1385,6 @@ function WebGLRenderer( parameters ) {
}
_gl
.
viewport
(
0
,
0
,
width
,
height
);
renderer
.
setViewport
(
0
,
0
,
width
,
height
);
_gl
.
clear
(
_gl
.
COLOR_BUFFER_BIT
|
_gl
.
DEPTH_BUFFER_BIT
|
_gl
.
STENCIL_BUFFER_BIT
);
...
...
@@ -1745,7 +1744,7 @@ function WebGLRenderer( parameters ) {
if
(
multiview
.
isEnabled
()
)
{
if
(
false
&&
vr
.
isPresenting
()
)
{
if
(
camera
.
isArrayCamera
)
{
// @todo Obviously remove the map :)
p_uniforms
.
setValue
(
_gl
,
'
projectionMatrices
'
,
camera
.
cameras
.
map
(
c
=>
c
.
projectionMatrix
)
);
...
...
@@ -1754,7 +1753,7 @@ function WebGLRenderer( parameters ) {
p_uniforms
.
setValue
(
_gl
,
'
projectionMatrices
'
,
[
camera
.
projectionMatrix
,
camera
.
projectionMatrix
]
);
}
}
}
else
{
...
...
@@ -1810,17 +1809,14 @@ function WebGLRenderer( parameters ) {
if
(
multiview
.
isEnabled
()
)
{
if
(
vr
.
isPresenting
()
)
{
if
(
camera
.
isArrayCamera
)
{
// @todo Obviously remove the map :)
p_uniforms
.
setValue
(
_gl
,
'
viewMatrix
'
,
camera
.
cameras
.
map
(
c
=>
c
.
matrixWorldInverse
)
);
}
else
{
var
newMat
=
camera
.
matrixWorldInverse
.
clone
();
var
newMat
=
new
Matrix4
();
p_uniforms
.
setValue
(
_gl
,
'
viewMatrices
'
,
[
camera
.
matrixWorldInverse
,
newMat
]
);
p_uniforms
.
setValue
(
_gl
,
'
viewMatrices
'
,
[
camera
.
matrixWorldInverse
,
camera
.
matrixWorldInverse
]
);
}
...
...
src/renderers/webgl/WebGLCapabilities.js
浏览文件 @
03b1efa8
...
...
@@ -88,7 +88,7 @@ function WebGLCapabilities( gl, extensions, parameters ) {
var
multiviewExt
=
extensions
.
get
(
'
OVR_multiview2
'
);
var
multiview
=
isWebGL2
&&
(
!!
multiviewExt
);
var
maxMultiviewViews
=
multiview
?
gl
.
getParameter
(
multiviewExt
.
MAX_VIEWS_OVR
)
:
1
;
var
maxMultiviewViews
=
multiview
?
gl
.
getParameter
(
multiviewExt
.
MAX_VIEWS_OVR
)
:
1
;
return
{
...
...
src/renderers/webgl/WebGLMultiview.js
浏览文件 @
03b1efa8
...
...
@@ -45,7 +45,7 @@ function WebGLMultiview( requested, gl, canvas, extensions, capabilities ) {
};
// @todo Get ArrayCamera
// @todo Get ArrayCamera
this
.
createMultiviewRenderTargetTexture
=
function
()
{
var
halfWidth
=
Math
.
floor
(
canvas
.
width
*
0.5
);
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
03b1efa8
...
...
@@ -668,16 +668,8 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
var
vertexGlsl
=
prefixVertex
+
vertexShader
;
var
fragmentGlsl
=
prefixFragment
+
fragmentShader
;
<<<<<<<
HEAD
// console.log( '*VERTEX*', vertexGlsl );
// console.log( '*FRAGMENT*', fragmentGlsl );
var
glVertexShader
=
WebGLShader
(
gl
,
gl
.
VERTEX_SHADER
,
vertexGlsl
);
var
glFragmentShader
=
WebGLShader
(
gl
,
gl
.
FRAGMENT_SHADER
,
fragmentGlsl
);
=======
var
glVertexShader
=
WebGLShader
(
gl
,
gl
.
VERTEX_SHADER
,
vertexGlsl
,
renderer
.
debug
.
checkShaderErrors
);
var
glFragmentShader
=
WebGLShader
(
gl
,
gl
.
FRAGMENT_SHADER
,
fragmentGlsl
,
renderer
.
debug
.
checkShaderErrors
);
>>>>>>>
Initial
working
implementation
gl
.
attachShader
(
program
,
glVertexShader
);
gl
.
attachShader
(
program
,
glFragmentShader
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录