Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
f45c1a05
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,发现更多精彩内容 >>
提交
f45c1a05
编写于
4月 30, 2019
作者:
F
Fernando Serrano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up WebGLMultiview allocations and simplify update matrices code
上级
ec8d510b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
60 deletion
+33
-60
src/renderers/webgl/WebGLMultiview.js
src/renderers/webgl/WebGLMultiview.js
+30
-57
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+3
-3
未找到文件。
src/renderers/webgl/WebGLMultiview.js
浏览文件 @
f45c1a05
...
...
@@ -18,6 +18,7 @@ function WebGLMultiview( renderer, requested, options ) {
var
properties
=
renderer
.
properties
;
var
renderTarget
,
currentRenderTarget
;
var
mat3
,
mat4
,
cameraArray
;
this
.
getMaxViews
=
function
()
{
...
...
@@ -31,14 +32,14 @@ function WebGLMultiview( renderer, requested, options ) {
};
// Auxiliary matrices to be used when updating arrays of uniforms
var
mat4
=
[];
var
mat3
=
[];
f
or
(
var
i
=
0
;
i
<
this
.
getMaxViews
();
i
++
)
{
f
unction
getCameraArray
(
camera
)
{
mat4
[
i
]
=
new
Matrix4
();
mat3
[
i
]
=
new
Matrix3
();
if
(
camera
.
isArrayCamera
)
return
camera
.
cameras
;
cameraArray
[
0
]
=
camera
;
return
cameraArray
;
}
...
...
@@ -70,25 +71,14 @@ function WebGLMultiview( renderer, requested, options ) {
}
this
.
updateCameraProjectionMatrices
=
function
(
camera
,
uniforms
)
{
var
numViews
=
this
.
getNumViews
();
if
(
camera
.
isArrayCamera
)
{
for
(
var
i
=
0
;
i
<
numViews
;
i
++
)
{
mat4
[
i
].
copy
(
camera
.
cameras
[
i
].
projectionMatrix
);
}
}
else
{
this
.
updateCameraProjectionMatrices
=
function
(
camera
,
uniforms
)
{
for
(
var
i
=
0
;
i
<
numViews
;
i
++
)
{
var
cameras
=
getCameraArray
(
camera
);
mat4
[
i
].
copy
(
camera
.
projectionMatrix
);
for
(
var
i
=
0
;
i
<
cameras
.
length
;
i
++
)
{
}
mat4
[
i
].
copy
(
cameras
[
i
].
projectionMatrix
);
}
...
...
@@ -98,23 +88,11 @@ function WebGLMultiview( renderer, requested, options ) {
this
.
updateCameraViewMatrices
=
function
(
camera
,
uniforms
)
{
var
numViews
=
this
.
getNumViews
();
if
(
camera
.
isArrayCamera
)
{
for
(
var
i
=
0
;
i
<
numViews
;
i
++
)
{
mat4
[
i
].
copy
(
camera
.
cameras
[
i
].
matrixWorldInverse
);
var
cameras
=
getCameraArray
(
camera
);
}
}
else
{
for
(
var
i
=
0
;
i
<
cameras
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
numViews
;
i
++
)
{
mat4
[
i
].
copy
(
camera
.
matrixWorldInverse
);
}
mat4
[
i
].
copy
(
cameras
[
i
].
matrixWorldInverse
);
}
...
...
@@ -124,29 +102,12 @@ function WebGLMultiview( renderer, requested, options ) {
this
.
updateObjectMatrices
=
function
(
object
,
camera
,
uniforms
)
{
var
numViews
=
this
.
getNumViews
();
if
(
camera
.
isArrayCamera
)
{
for
(
var
i
=
0
;
i
<
numViews
;
i
++
)
{
mat4
[
i
].
multiplyMatrices
(
camera
.
cameras
[
i
].
matrixWorldInverse
,
object
.
matrixWorld
);
mat3
[
i
].
getNormalMatrix
(
mat4
[
i
]
);
var
cameras
=
getCameraArray
(
camera
);
}
}
else
{
for
(
var
i
=
0
;
i
<
cameras
.
length
;
i
++
)
{
// In this case we still need to provide an array of matrices but just the first one will be used
mat4
[
0
].
multiplyMatrices
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
);
mat3
[
0
].
getNormalMatrix
(
mat4
[
0
]
);
for
(
var
i
=
1
;
i
<
numViews
;
i
++
)
{
mat4
[
i
].
copy
(
mat4
[
0
]
);
mat3
[
i
].
copy
(
mat3
[
0
]
);
}
mat4
[
i
].
multiplyMatrices
(
cameras
[
i
].
matrixWorldInverse
,
object
.
matrixWorld
);
mat3
[
i
].
getNormalMatrix
(
mat4
[
i
]
);
}
...
...
@@ -225,6 +186,18 @@ function WebGLMultiview( renderer, requested, options ) {
renderTarget
=
new
WebGLMultiviewRenderTarget
(
canvas
.
width
,
canvas
.
height
,
this
.
numViews
);
// Auxiliary matrices to be used when updating arrays of uniforms
mat4
=
[];
mat3
=
[];
cameraArray
=
[];
for
(
var
i
=
0
;
i
<
this
.
getMaxViews
();
i
++
)
{
mat4
[
i
]
=
new
Matrix4
();
mat3
[
i
]
=
new
Matrix3
();
}
}
}
...
...
src/renderers/webgl/WebGLTextures.js
浏览文件 @
f45c1a05
...
...
@@ -1022,11 +1022,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl
.
bindFramebuffer
(
_gl
.
FRAMEBUFFER
,
null
);
_gl
.
bindTexture
(
_gl
.
TEXTURE_2D_ARRAY
,
null
);
}
}
else
{
}
else
{
console
.
warn
(
'
THREE.WebGLRenderer: WebGLMultiviewRenderTarget can only be used with WebGL2 and Multiview extension support.
'
);
console
.
warn
(
'
THREE.WebGLRenderer: WebGLMultiviewRenderTarget can only be used with WebGL2 and Multiview extension support.
'
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录