Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
377ee97f
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,发现更多精彩内容 >>
提交
377ee97f
编写于
1月 15, 2018
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebGLRenderer: Rename WebGLRenderContext to WebGLRenderState
上级
31225559
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
34 deletion
+34
-34
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+24
-24
src/renderers/webgl/WebGLRenderStates.js
src/renderers/webgl/WebGLRenderStates.js
+10
-10
未找到文件。
src/renderers/WebGLRenderer.js
浏览文件 @
377ee97f
...
...
@@ -28,7 +28,7 @@ import { WebGLClipping } from './webgl/WebGLClipping.js';
import
{
Frustum
}
from
'
../math/Frustum.js
'
;
import
{
Vector4
}
from
'
../math/Vector4.js
'
;
import
{
WebGLUtils
}
from
'
./webgl/WebGLUtils.js
'
;
import
{
WebGLRender
Contexts
}
from
'
./webgl/WebGLRenderContext
s.js
'
;
import
{
WebGLRender
States
}
from
'
./webgl/WebGLRenderState
s.js
'
;
/**
* @author supereggbert / http://www.paulbrunt.co.uk/
...
...
@@ -56,7 +56,7 @@ function WebGLRenderer( parameters ) {
_powerPreference
=
parameters
.
powerPreference
!==
undefined
?
parameters
.
powerPreference
:
'
default
'
;
var
currentRenderList
=
null
;
var
currentRender
Context
=
null
;
var
currentRender
State
=
null
;
// public properties
...
...
@@ -251,7 +251,7 @@ function WebGLRenderer( parameters ) {
var
extensions
,
capabilities
,
state
;
var
properties
,
textures
,
attributes
,
geometries
,
objects
;
var
programCache
,
renderLists
,
render
Context
s
;
var
programCache
,
renderLists
,
render
State
s
;
var
background
,
morphtargets
,
bufferRenderer
,
indexedBufferRenderer
;
var
spriteRenderer
;
...
...
@@ -286,7 +286,7 @@ function WebGLRenderer( parameters ) {
morphtargets
=
new
WebGLMorphtargets
(
_gl
);
programCache
=
new
WebGLPrograms
(
_this
,
extensions
,
capabilities
);
renderLists
=
new
WebGLRenderLists
();
render
Contexts
=
new
WebGLRenderContext
s
();
render
States
=
new
WebGLRenderState
s
();
background
=
new
WebGLBackground
(
_this
,
state
,
geometries
,
_premultipliedAlpha
);
...
...
@@ -521,7 +521,7 @@ function WebGLRenderer( parameters ) {
_canvas
.
removeEventListener
(
'
webglcontextrestored
'
,
onContextRestore
,
false
);
renderLists
.
dispose
();
render
Context
s
.
dispose
();
render
State
s
.
dispose
();
properties
.
dispose
();
objects
.
dispose
();
...
...
@@ -991,17 +991,17 @@ function WebGLRenderer( parameters ) {
this
.
compile
=
function
(
scene
,
camera
)
{
currentRender
Context
.
init
();
currentRender
State
.
init
();
scene
.
traverse
(
function
(
object
)
{
if
(
object
.
isLight
)
{
currentRender
Context
.
pushLight
(
object
);
currentRender
State
.
pushLight
(
object
);
if
(
object
.
castShadow
)
{
currentRender
Context
.
pushShadow
(
object
);
currentRender
State
.
pushShadow
(
object
);
}
...
...
@@ -1009,7 +1009,7 @@ function WebGLRenderer( parameters ) {
}
);
currentRender
Context
.
setupLights
(
camera
);
currentRender
State
.
setupLights
(
camera
);
scene
.
traverse
(
function
(
object
)
{
...
...
@@ -1120,8 +1120,8 @@ function WebGLRenderer( parameters ) {
//
currentRender
Context
=
renderContext
s
.
get
(
scene
,
camera
);
currentRender
Context
.
init
();
currentRender
State
=
renderState
s
.
get
(
scene
,
camera
);
currentRender
State
.
init
();
scene
.
onBeforeRender
(
_this
,
scene
,
camera
,
renderTarget
);
...
...
@@ -1146,11 +1146,11 @@ function WebGLRenderer( parameters ) {
if
(
_clippingEnabled
)
_clipping
.
beginShadows
();
var
shadowsArray
=
currentRender
Context
.
state
.
shadowsArray
;
var
shadowsArray
=
currentRender
State
.
state
.
shadowsArray
;
shadowMap
.
render
(
shadowsArray
,
scene
,
camera
);
currentRender
Context
.
setupLights
(
camera
);
currentRender
State
.
setupLights
(
camera
);
if
(
_clippingEnabled
)
_clipping
.
endShadows
();
...
...
@@ -1196,7 +1196,7 @@ function WebGLRenderer( parameters ) {
// custom renderers
var
spritesArray
=
currentRender
Context
.
state
.
spritesArray
;
var
spritesArray
=
currentRender
State
.
state
.
spritesArray
;
spriteRenderer
.
render
(
spritesArray
,
scene
,
camera
);
...
...
@@ -1293,11 +1293,11 @@ function WebGLRenderer( parameters ) {
if
(
object
.
isLight
)
{
currentRender
Context
.
pushLight
(
object
);
currentRender
State
.
pushLight
(
object
);
if
(
object
.
castShadow
)
{
currentRender
Context
.
pushShadow
(
object
);
currentRender
State
.
pushShadow
(
object
);
}
...
...
@@ -1305,7 +1305,7 @@ function WebGLRenderer( parameters ) {
if
(
!
object
.
frustumCulled
||
_frustum
.
intersectsSprite
(
object
)
)
{
currentRender
Context
.
pushSprite
(
object
);
currentRender
State
.
pushSprite
(
object
);
}
...
...
@@ -1432,7 +1432,7 @@ function WebGLRenderer( parameters ) {
function
renderObject
(
object
,
scene
,
camera
,
geometry
,
material
,
group
)
{
object
.
onBeforeRender
(
_this
,
scene
,
camera
,
geometry
,
material
,
group
);
restoreRender
Context
(
scene
,
_currentArrayCamera
||
camera
);
restoreRender
State
(
scene
,
_currentArrayCamera
||
camera
);
object
.
modelViewMatrix
.
multiplyMatrices
(
camera
.
matrixWorldInverse
,
object
.
matrixWorld
);
object
.
normalMatrix
.
getNormalMatrix
(
object
.
modelViewMatrix
);
...
...
@@ -1456,7 +1456,7 @@ function WebGLRenderer( parameters ) {
}
object
.
onAfterRender
(
_this
,
scene
,
camera
,
geometry
,
material
,
group
);
restoreRender
Context
(
scene
,
_currentArrayCamera
||
camera
);
restoreRender
State
(
scene
,
_currentArrayCamera
||
camera
);
}
...
...
@@ -1464,8 +1464,8 @@ function WebGLRenderer( parameters ) {
var
materialProperties
=
properties
.
get
(
material
);
var
lights
=
currentRender
Context
.
state
.
lights
;
var
shadowsArray
=
currentRender
Context
.
state
.
shadowsArray
;
var
lights
=
currentRender
State
.
state
.
lights
;
var
shadowsArray
=
currentRender
State
.
state
.
shadowsArray
;
var
parameters
=
programCache
.
getParameters
(
material
,
lights
.
state
,
shadowsArray
,
fog
,
_clipping
.
numPlanes
,
_clipping
.
numIntersection
,
object
);
...
...
@@ -1621,7 +1621,7 @@ function WebGLRenderer( parameters ) {
_usedTextureUnits
=
0
;
var
materialProperties
=
properties
.
get
(
material
);
var
lights
=
currentRender
Context
.
state
.
lights
;
var
lights
=
currentRender
State
.
state
.
lights
;
if
(
_clippingEnabled
)
{
...
...
@@ -2321,9 +2321,9 @@ function WebGLRenderer( parameters ) {
//
function
restoreRender
Context
(
scene
,
camera
)
{
function
restoreRender
State
(
scene
,
camera
)
{
currentRender
Context
=
renderContext
s
.
get
(
scene
,
camera
);
currentRender
State
=
renderState
s
.
get
(
scene
,
camera
);
}
...
...
src/renderers/webgl/WebGLRender
Context
s.js
→
src/renderers/webgl/WebGLRender
State
s.js
浏览文件 @
377ee97f
...
...
@@ -6,7 +6,7 @@ import { WebGLLights } from './WebGLLights.js';
var
count
=
0
;
function
WebGLRender
Context
()
{
function
WebGLRender
State
()
{
var
id
=
count
++
;
...
...
@@ -68,30 +68,30 @@ function WebGLRenderContext() {
}
function
WebGLRender
Context
s
()
{
function
WebGLRender
State
s
()
{
var
render
Context
s
=
{};
var
render
State
s
=
{};
function
get
(
scene
,
camera
)
{
var
hash
=
scene
.
id
+
'
,
'
+
camera
.
id
;
var
render
Context
=
renderContext
s
[
hash
];
var
render
State
=
renderState
s
[
hash
];
if
(
render
Context
===
undefined
)
{
if
(
render
State
===
undefined
)
{
render
Context
=
new
WebGLRenderContext
();
render
Contexts
[
hash
]
=
renderContext
;
render
State
=
new
WebGLRenderState
();
render
States
[
hash
]
=
renderState
;
}
return
render
Context
;
return
render
State
;
}
function
dispose
()
{
render
Context
s
=
{};
render
State
s
=
{};
}
...
...
@@ -103,4 +103,4 @@ function WebGLRenderContexts() {
}
export
{
WebGLRender
Context
s
};
export
{
WebGLRender
State
s
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录