Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3b54f69c
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,发现更多精彩内容 >>
提交
3b54f69c
编写于
1月 31, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactored light structs in shaders. Fixed StandardMaterial breakage.
上级
945a88ec
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
62 deletion
+71
-62
src/renderers/shaders/ShaderChunk/common.glsl
src/renderers/shaders/ShaderChunk/common.glsl
+71
-0
src/renderers/shaders/ShaderChunk/lights_pars.glsl
src/renderers/shaders/ShaderChunk/lights_pars.glsl
+0
-54
src/renderers/shaders/ShaderLib.js
src/renderers/shaders/ShaderLib.js
+0
-8
未找到文件。
src/renderers/shaders/ShaderChunk/common.glsl
浏览文件 @
3b54f69c
...
...
@@ -31,6 +31,77 @@ struct GeometricContext {
};
#if NUM_DIR_LIGHTS > 0
struct
DirectionalLight
{
vec3
direction
;
vec3
color
;
bool
shadowEnabled
;
float
shadowBias
;
float
shadowRadius
;
vec2
shadowMapSize
;
mat4
shadowMatrix
;
};
uniform
DirectionalLight
directionalLights
[
NUM_DIR_LIGHTS
];
#endif
#if NUM_SPOT_LIGHTS > 0
struct
SpotLight
{
vec3
position
;
vec3
direction
;
vec3
color
;
float
distance
;
float
decay
;
float
angleCos
;
float
exponent
;
bool
shadowEnabled
;
float
shadowBias
;
float
shadowRadius
;
vec2
shadowMapSize
;
mat4
shadowMatrix
;
};
uniform
SpotLight
spotLights
[
NUM_SPOT_LIGHTS
];
#endif
#if NUM_POINT_LIGHTS > 0
struct
PointLight
{
vec3
position
;
vec3
color
;
float
distance
;
float
decay
;
bool
shadowEnabled
;
float
shadowBias
;
float
shadowRadius
;
vec2
shadowMapSize
;
mat4
shadowMatrix
;
};
uniform
PointLight
pointLights
[
NUM_POINT_LIGHTS
];
#endif
#if NUM_HEMI_LIGHTS > 0
struct
HemisphereLight
{
vec3
direction
;
vec3
skyColor
;
vec3
groundColor
;
};
uniform
HemisphereLight
hemisphereLights
[
NUM_HEMI_LIGHTS
];
#endif
vec3
transformDirection
(
in
vec3
dir
,
in
mat4
matrix
)
{
return
normalize
(
(
matrix
*
vec4
(
dir
,
0
.
0
)
).
xyz
);
...
...
src/renderers/shaders/ShaderChunk/lights_pars.glsl
浏览文件 @
3b54f69c
#if NUM_DIR_LIGHTS > 0
struct
DirectionalLight
{
vec3
direction
;
vec3
color
;
bool
shadowEnabled
;
float
shadowBias
;
float
shadowRadius
;
vec2
shadowMapSize
;
mat4
shadowMatrix
;
};
uniform
DirectionalLight
directionalLights
[
NUM_DIR_LIGHTS
];
IncidentLight
getDirectionalDirectLight
(
const
in
DirectionalLight
directionalLight
,
const
in
GeometricContext
geometry
)
{
IncidentLight
directLight
;
...
...
@@ -29,21 +16,6 @@
#if NUM_POINT_LIGHTS > 0
struct
PointLight
{
vec3
position
;
vec3
color
;
float
distance
;
float
decay
;
bool
shadowEnabled
;
float
shadowBias
;
float
shadowRadius
;
vec2
shadowMapSize
;
mat4
shadowMatrix
;
};
uniform
PointLight
pointLights
[
NUM_POINT_LIGHTS
];
IncidentLight
getPointDirectLight
(
const
in
PointLight
pointLight
,
const
in
GeometricContext
geometry
)
{
IncidentLight
directLight
;
...
...
@@ -63,24 +35,6 @@
#if NUM_SPOT_LIGHTS > 0
struct
SpotLight
{
vec3
position
;
vec3
direction
;
vec3
color
;
float
distance
;
float
decay
;
float
angleCos
;
float
exponent
;
bool
shadowEnabled
;
float
shadowBias
;
float
shadowRadius
;
vec2
shadowMapSize
;
mat4
shadowMatrix
;
};
uniform
SpotLight
spotLights
[
NUM_SPOT_LIGHTS
];
IncidentLight
getSpotDirectLight
(
const
in
SpotLight
spotLight
,
const
in
GeometricContext
geometry
)
{
IncidentLight
directLight
;
...
...
@@ -113,14 +67,6 @@
#if NUM_HEMI_LIGHTS > 0
struct
HemisphereLight
{
vec3
direction
;
vec3
skyColor
;
vec3
groundColor
;
};
uniform
HemisphereLight
hemisphereLights
[
NUM_HEMI_LIGHTS
];
vec3
getHemisphereLightIrradiance
(
const
in
HemisphereLight
hemiLight
,
const
in
GeometricContext
geometry
)
{
float
dotNL
=
dot
(
geometry
.
normal
,
hemiLight
.
direction
);
...
...
src/renderers/shaders/ShaderLib.js
浏览文件 @
3b54f69c
...
...
@@ -25,8 +25,6 @@ THREE.ShaderLib = {
THREE
.
ShaderChunk
[
"
uv_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
uv2_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
envmap_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
bsdfs
"
],
THREE
.
ShaderChunk
[
"
lights_pars
"
],
THREE
.
ShaderChunk
[
"
color_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
morphtarget_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
skinning_pars_vertex
"
],
...
...
@@ -312,8 +310,6 @@ THREE.ShaderLib = {
THREE
.
ShaderChunk
[
"
uv2_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
displacementmap_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
envmap_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
bsdfs
"
],
THREE
.
ShaderChunk
[
"
lights_pars
"
],
THREE
.
ShaderChunk
[
"
lights_phong_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
color_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
morphtarget_pars_vertex
"
],
...
...
@@ -468,8 +464,6 @@ THREE.ShaderLib = {
THREE
.
ShaderChunk
[
"
uv2_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
displacementmap_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
envmap_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
bsdfs
"
],
THREE
.
ShaderChunk
[
"
lights_pars
"
],
THREE
.
ShaderChunk
[
"
color_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
morphtarget_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
skinning_pars_vertex
"
],
...
...
@@ -607,8 +601,6 @@ THREE.ShaderLib = {
"
uniform float scale;
"
,
THREE
.
ShaderChunk
[
"
common
"
],
THREE
.
ShaderChunk
[
"
bsdfs
"
],
THREE
.
ShaderChunk
[
"
lights_pars
"
],
THREE
.
ShaderChunk
[
"
color_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
shadowmap_pars_vertex
"
],
THREE
.
ShaderChunk
[
"
logdepthbuf_pars_vertex
"
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录