Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
867baa06
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,体验更适合开发者的 AI 搜索 >>
提交
867baa06
编写于
3月 17, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebGLRenderer: More shadow collection refactoring. See #8379.
上级
c2824abf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
42 deletion
+32
-42
examples/webgl_shadowmap_viewer.html
examples/webgl_shadowmap_viewer.html
+1
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+27
-14
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+0
-2
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+2
-5
src/renderers/webgl/WebGLShadowMap.js
src/renderers/webgl/WebGLShadowMap.js
+2
-20
未找到文件。
examples/webgl_shadowmap_viewer.html
浏览文件 @
867baa06
...
...
@@ -106,7 +106,7 @@
color
:
0xff0000
,
shininess
:
150
,
specular
:
0x222222
,
shading
:
THREE
.
SmoothShading
,
shading
:
THREE
.
SmoothShading
}
);
torusKnot
=
new
THREE
.
Mesh
(
geometry
,
material
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
867baa06
...
...
@@ -139,8 +139,7 @@ THREE.WebGLRenderer = function ( parameters ) {
pointShadowMatrix
:
[],
hemi
:
[],
shadows
:
0
,
shadowsPointLight
:
0
shadows
:
[]
},
...
...
@@ -303,7 +302,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// shadow map
var
shadowMap
=
new
THREE
.
WebGLShadowMap
(
this
,
lights
,
objects
);
var
shadowMap
=
new
THREE
.
WebGLShadowMap
(
this
,
_
lights
,
objects
);
this
.
shadowMap
=
shadowMap
;
...
...
@@ -1160,6 +1159,8 @@ THREE.WebGLRenderer = function ( parameters ) {
//
setupShadows
(
lights
);
shadowMap
.
render
(
scene
,
camera
);
setupLights
(
lights
,
camera
);
...
...
@@ -1625,7 +1626,8 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if
(
materialProperties
.
lightsHash
!==
_lights
.
hash
)
{
if
(
materialProperties
.
lightsHash
!==
undefined
&&
materialProperties
.
lightsHash
!==
_lights
.
hash
)
{
material
.
needsUpdate
=
true
;
...
...
@@ -2588,6 +2590,26 @@ THREE.WebGLRenderer = function ( parameters ) {
}
function
setupShadows
(
lights
)
{
var
lightShadowsLength
=
0
;
for
(
var
i
=
0
,
l
=
lights
.
length
;
i
<
l
;
i
++
)
{
var
light
=
lights
[
i
];
if
(
light
.
castShadow
)
{
_lights
.
shadows
[
lightShadowsLength
++
]
=
light
;
}
}
_lights
.
shadows
.
length
=
lightShadowsLength
;
}
function
setupLights
(
lights
,
camera
)
{
var
l
,
ll
,
light
,
...
...
@@ -2603,9 +2625,6 @@ THREE.WebGLRenderer = function ( parameters ) {
spotLength
=
0
,
hemiLength
=
0
;
_lights
.
shadows
=
0
;
_lights
.
shadowsPointLight
=
0
;
for
(
l
=
0
,
ll
=
lights
.
length
;
l
<
ll
;
l
++
)
{
light
=
lights
[
l
];
...
...
@@ -2638,8 +2657,6 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms
.
shadowRadius
=
light
.
shadow
.
radius
;
uniforms
.
shadowMapSize
=
light
.
shadow
.
mapSize
;
_lights
.
shadows
++
;
}
_lights
.
directionalShadowMap
[
directionalLength
]
=
light
.
shadow
.
map
;
...
...
@@ -2673,8 +2690,6 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms
.
shadowRadius
=
light
.
shadow
.
radius
;
uniforms
.
shadowMapSize
=
light
.
shadow
.
mapSize
;
_lights
.
shadows
++
;
}
_lights
.
spotShadowMap
[
spotLength
]
=
light
.
shadow
.
map
;
...
...
@@ -2700,8 +2715,6 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms
.
shadowRadius
=
light
.
shadow
.
radius
;
uniforms
.
shadowMapSize
=
light
.
shadow
.
mapSize
;
_lights
.
shadows
++
;
}
_lights
.
pointShadowMap
[
pointLength
]
=
light
.
shadow
.
map
;
...
...
@@ -2745,7 +2758,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_lights
.
point
.
length
=
pointLength
;
_lights
.
hemi
.
length
=
hemiLength
;
_lights
.
hash
=
directionalLength
+
'
,
'
+
pointLength
+
'
,
'
+
spotLength
+
'
,
'
+
hemiLength
+
'
,
'
+
_lights
.
shadows
;
_lights
.
hash
=
directionalLength
+
'
,
'
+
pointLength
+
'
,
'
+
spotLength
+
'
,
'
+
hemiLength
+
'
,
'
+
_lights
.
shadows
.
length
;
}
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
867baa06
...
...
@@ -418,7 +418,6 @@ THREE.WebGLProgram = ( function () {
parameters
.
shadowMapEnabled
?
'
#define USE_SHADOWMAP
'
:
''
,
parameters
.
shadowMapEnabled
?
'
#define
'
+
shadowMapTypeDefine
:
''
,
parameters
.
pointLightShadows
>
0
?
'
#define POINT_LIGHT_SHADOWS
'
:
''
,
parameters
.
sizeAttenuation
?
'
#define USE_SIZEATTENUATION
'
:
''
,
...
...
@@ -520,7 +519,6 @@ THREE.WebGLProgram = ( function () {
parameters
.
shadowMapEnabled
?
'
#define USE_SHADOWMAP
'
:
''
,
parameters
.
shadowMapEnabled
?
'
#define
'
+
shadowMapTypeDefine
:
''
,
parameters
.
pointLightShadows
>
0
?
'
#define POINT_LIGHT_SHADOWS
'
:
''
,
parameters
.
premultipliedAlpha
?
"
#define PREMULTIPLIED_ALPHA
"
:
''
,
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
867baa06
...
...
@@ -23,8 +23,7 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
"
maxBones
"
,
"
useVertexTexture
"
,
"
morphTargets
"
,
"
morphNormals
"
,
"
maxMorphTargets
"
,
"
maxMorphNormals
"
,
"
premultipliedAlpha
"
,
"
numDirLights
"
,
"
numPointLights
"
,
"
numSpotLights
"
,
"
numHemiLights
"
,
"
shadowMapEnabled
"
,
"
pointLightShadows
"
,
"
toneMapping
"
,
'
physicallyCorrectLights
'
,
"
shadowMapType
"
,
"
shadowMapEnabled
"
,
"
shadowMapType
"
,
"
toneMapping
"
,
'
physicallyCorrectLights
'
,
"
alphaTest
"
,
"
doubleSided
"
,
"
flipSided
"
];
...
...
@@ -170,9 +169,7 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
numSpotLights
:
lights
.
spot
.
length
,
numHemiLights
:
lights
.
hemi
.
length
,
pointLightShadows
:
lights
.
shadowsPointLight
,
shadowMapEnabled
:
renderer
.
shadowMap
.
enabled
&&
object
.
receiveShadow
&&
lights
.
shadows
>
0
,
shadowMapEnabled
:
renderer
.
shadowMap
.
enabled
&&
object
.
receiveShadow
&&
lights
.
shadows
.
length
>
0
,
shadowMapType
:
renderer
.
shadowMap
.
type
,
toneMapping
:
renderer
.
toneMapping
,
...
...
src/renderers/webgl/WebGLShadowMap.js
浏览文件 @
867baa06
...
...
@@ -10,7 +10,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
_frustum
=
new
THREE
.
Frustum
(),
_projScreenMatrix
=
new
THREE
.
Matrix4
(),
_lightShadows
=
[]
,
_lightShadows
=
_lights
.
shadows
,
_shadowMapSize
=
new
THREE
.
Vector2
(),
...
...
@@ -97,25 +97,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
if
(
scope
.
enabled
===
false
)
return
;
if
(
scope
.
autoUpdate
===
false
&&
scope
.
needsUpdate
===
false
)
return
;
// Collect lights with shadows
var
lightShadowsLength
=
0
;
for
(
var
i
=
0
,
l
=
_lights
.
length
;
i
<
l
;
i
++
)
{
var
light
=
_lights
[
i
];
if
(
light
.
castShadow
)
{
_lightShadows
[
lightShadowsLength
++
]
=
light
;
}
}
if
(
lightShadowsLength
===
0
)
return
;
_lightShadows
.
length
=
lightShadowsLength
;
if
(
_lightShadows
.
length
===
0
)
return
;
// Set GL state for depth map.
_state
.
clearColor
(
1
,
1
,
1
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录