Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
fdd9f271
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,发现更多精彩内容 >>
提交
fdd9f271
编写于
3月 31, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebGLRenderer: Moved shadowMap* properties to WebGLShadowMap.
上级
c9f312d5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
23 deletion
+75
-23
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+56
-11
src/renderers/webgl/WebGLShadowMap.js
src/renderers/webgl/WebGLShadowMap.js
+19
-12
未找到文件。
src/renderers/WebGLRenderer.js
浏览文件 @
fdd9f271
...
...
@@ -284,12 +284,9 @@ THREE.WebGLRenderer = function ( parameters ) {
// shadow map
this
.
shadowMap
=
new
THREE
.
WebGLShadowMap
(
this
,
lights
,
_webglObjects
,
_webglObjectsImmediate
);
this
.
shadowMapEnabled
=
false
;
this
.
shadowMapType
=
THREE
.
PCFShadowMap
;
this
.
shadowMapCullFace
=
THREE
.
CullFaceFront
;
this
.
shadowMapDebug
=
false
;
this
.
shadowMapCascade
=
false
;
var
shadowMap
=
new
THREE
.
WebGLShadowMap
(
this
,
lights
,
_webglObjects
,
_webglObjectsImmediate
);
this
.
shadowMap
=
shadowMap
;
// GPU capabilities
...
...
@@ -1890,7 +1887,7 @@ THREE.WebGLRenderer = function ( parameters ) {
//
this
.
shadowMap
.
render
(
scene
,
camera
);
shadowMap
.
render
(
scene
,
camera
);
//
...
...
@@ -2718,10 +2715,10 @@ THREE.WebGLRenderer = function ( parameters ) {
maxHemiLights
:
maxLightCount
.
hemi
,
maxShadows
:
maxShadows
,
shadowMapEnabled
:
_this
.
shadowMapE
nabled
&&
object
.
receiveShadow
&&
maxShadows
>
0
,
shadowMapType
:
_this
.
shadowMapT
ype
,
shadowMapDebug
:
_this
.
shadowMapD
ebug
,
shadowMapCascade
:
_this
.
shadowMapC
ascade
,
shadowMapEnabled
:
shadowMap
.
e
nabled
&&
object
.
receiveShadow
&&
maxShadows
>
0
,
shadowMapType
:
shadowMap
.
t
ype
,
shadowMapDebug
:
shadowMap
.
d
ebug
,
shadowMapCascade
:
shadowMap
.
c
ascade
,
alphaTest
:
material
.
alphaTest
,
metal
:
material
.
metal
,
...
...
@@ -4780,4 +4777,52 @@ THREE.WebGLRenderer = function ( parameters ) {
};
Object
.
defineProperties
(
this
,
{
shadowMapEnabled
:
{
get
:
function
()
{
return
this
.
shadowMap
.
enabled
;
},
set
:
function
(
value
)
{
THREE
.
warn
(
'
THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.
'
);
this
.
shadowMap
.
enabled
=
value
;
}
},
shadowMapType
:
{
get
:
function
()
{
return
this
.
shadowMap
.
type
;
},
set
:
function
(
value
)
{
THREE
.
warn
(
'
THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.
'
);
this
.
shadowMap
.
type
=
value
;
}
},
shadowMapCullFace
:
{
get
:
function
()
{
return
this
.
shadowMap
.
cullFace
;
},
set
:
function
(
value
)
{
THREE
.
warn
(
'
THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.
'
);
this
.
shadowMap
.
cullFace
=
value
;
}
},
shadowMapDebug
:
{
get
:
function
()
{
return
this
.
shadowMap
.
debug
;
},
set
:
function
(
value
)
{
THREE
.
warn
(
'
THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.
'
);
this
.
shadowMap
.
debug
=
value
;
}
},
shadowMapCascade
:
{
get
:
function
()
{
return
this
.
shadowMap
.
cascade
;
},
set
:
function
(
value
)
{
THREE
.
warn
(
'
THREE.WebGLRenderer: .shadowMapCascade is now .shadowMap.cascade.
'
);
this
.
shadowMap
.
cascade
=
value
;
}
}
}
);
};
src/renderers/webgl/WebGLShadowMap.js
浏览文件 @
fdd9f271
...
...
@@ -5,10 +5,7 @@
THREE
.
WebGLShadowMap
=
function
(
_renderer
,
_lights
,
_webglObjects
,
_webglObjectsImmediate
)
{
var
_gl
=
_renderer
.
context
;
var
_depthMaterial
,
_depthMaterialMorph
,
_depthMaterialSkin
,
_depthMaterialMorphSkin
,
var
_gl
=
_renderer
.
context
,
_frustum
=
new
THREE
.
Frustum
(),
_projScreenMatrix
=
new
THREE
.
Matrix4
(),
...
...
@@ -24,27 +21,27 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _webglObjects, _webglObjec
var
depthShader
=
THREE
.
ShaderLib
[
"
depthRGBA
"
];
var
depthUniforms
=
THREE
.
UniformsUtils
.
clone
(
depthShader
.
uniforms
);
_depthMaterial
=
new
THREE
.
ShaderMaterial
(
{
var
_depthMaterial
=
new
THREE
.
ShaderMaterial
(
{
uniforms
:
depthUniforms
,
vertexShader
:
depthShader
.
vertexShader
,
fragmentShader
:
depthShader
.
fragmentShader
}
);
_depthMaterialMorph
=
new
THREE
.
ShaderMaterial
(
{
var
_depthMaterialMorph
=
new
THREE
.
ShaderMaterial
(
{
uniforms
:
depthUniforms
,
vertexShader
:
depthShader
.
vertexShader
,
fragmentShader
:
depthShader
.
fragmentShader
,
morphTargets
:
true
}
);
_depthMaterialSkin
=
new
THREE
.
ShaderMaterial
(
{
var
_depthMaterialSkin
=
new
THREE
.
ShaderMaterial
(
{
uniforms
:
depthUniforms
,
vertexShader
:
depthShader
.
vertexShader
,
fragmentShader
:
depthShader
.
fragmentShader
,
skinning
:
true
}
);
_depthMaterialMorphSkin
=
new
THREE
.
ShaderMaterial
(
{
var
_depthMaterialMorphSkin
=
new
THREE
.
ShaderMaterial
(
{
uniforms
:
depthUniforms
,
vertexShader
:
depthShader
.
vertexShader
,
fragmentShader
:
depthShader
.
fragmentShader
,
...
...
@@ -57,9 +54,19 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _webglObjects, _webglObjec
_depthMaterialSkin
.
_shadowPass
=
true
;
_depthMaterialMorphSkin
.
_shadowPass
=
true
;
//
var
scope
=
this
;
this
.
enabled
=
false
;
this
.
type
=
THREE
.
PCFShadowMap
;
this
.
cullFace
=
THREE
.
CullFaceFront
;
this
.
debug
=
false
;
this
.
cascade
=
false
;
this
.
render
=
function
(
scene
,
camera
)
{
if
(
_renderer
.
shadowMapE
nabled
===
false
)
return
;
if
(
scope
.
e
nabled
===
false
)
return
;
var
i
,
il
,
j
,
jl
,
n
,
...
...
@@ -80,7 +87,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _webglObjects, _webglObjec
_gl
.
enable
(
_gl
.
CULL_FACE
);
_gl
.
frontFace
(
_gl
.
CCW
);
if
(
_renderer
.
shadowMapC
ullFace
===
THREE
.
CullFaceFront
)
{
if
(
scope
.
c
ullFace
===
THREE
.
CullFaceFront
)
{
_gl
.
cullFace
(
_gl
.
FRONT
);
...
...
@@ -157,7 +164,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _webglObjects, _webglObjec
var
shadowFilter
=
THREE
.
LinearFilter
;
if
(
_renderer
.
shadowMapT
ype
===
THREE
.
PCFSoftShadowMap
)
{
if
(
scope
.
t
ype
===
THREE
.
PCFSoftShadowMap
)
{
shadowFilter
=
THREE
.
NearestFilter
;
...
...
@@ -339,7 +346,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _webglObjects, _webglObjec
_gl
.
clearColor
(
clearColor
.
r
,
clearColor
.
g
,
clearColor
.
b
,
clearAlpha
);
_gl
.
enable
(
_gl
.
BLEND
);
if
(
_renderer
.
shadowMapC
ullFace
===
THREE
.
CullFaceFront
)
{
if
(
scope
.
c
ullFace
===
THREE
.
CullFaceFront
)
{
_gl
.
cullFace
(
_gl
.
BACK
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录