Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b1f94dac
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,体验更适合开发者的 AI 搜索 >>
提交
b1f94dac
编写于
2月 08, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SpotLight: Implemented @sgrif's penumbra with @WestLangley suggestions. See #5080.
上级
8e5c48cc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
10 addition
and
10 deletion
+10
-10
src/lights/Light.js
src/lights/Light.js
+1
-1
src/lights/SpotLight.js
src/lights/SpotLight.js
+3
-3
src/loaders/ObjectLoader.js
src/loaders/ObjectLoader.js
+1
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+1
-1
src/renderers/shaders/ShaderChunk/lights_pars.glsl
src/renderers/shaders/ShaderChunk/lights_pars.glsl
+2
-2
src/renderers/shaders/UniformsLib.js
src/renderers/shaders/UniformsLib.js
+1
-1
src/renderers/webgl/WebGLLights.js
src/renderers/webgl/WebGLLights.js
+1
-1
未找到文件。
src/lights/Light.js
浏览文件 @
b1f94dac
...
...
@@ -42,7 +42,7 @@ THREE.Light.prototype.toJSON = function ( meta ) {
if
(
this
.
distance
!==
undefined
)
data
.
object
.
distance
=
this
.
distance
;
if
(
this
.
angle
!==
undefined
)
data
.
object
.
angle
=
this
.
angle
;
if
(
this
.
decay
!==
undefined
)
data
.
object
.
decay
=
this
.
decay
;
if
(
this
.
exponent
!==
undefined
)
data
.
object
.
exponent
=
this
.
exponent
;
if
(
this
.
penumbra
!==
undefined
)
data
.
object
.
penumbra
=
this
.
penumbra
;
return
data
;
...
...
src/lights/SpotLight.js
浏览文件 @
b1f94dac
...
...
@@ -2,7 +2,7 @@
* @author alteredq / http://alteredqualia.com/
*/
THREE
.
SpotLight
=
function
(
color
,
intensity
,
distance
,
angle
,
exponent
,
decay
)
{
THREE
.
SpotLight
=
function
(
color
,
intensity
,
distance
,
angle
,
penumbra
,
decay
)
{
THREE
.
Light
.
call
(
this
,
color
,
intensity
);
...
...
@@ -15,7 +15,7 @@ THREE.SpotLight = function ( color, intensity, distance, angle, exponent, decay
this
.
distance
=
(
distance
!==
undefined
)
?
distance
:
0
;
this
.
angle
=
(
angle
!==
undefined
)
?
angle
:
Math
.
PI
/
3
;
this
.
exponent
=
(
exponent
!==
undefined
)
?
exponent
:
1
0
;
this
.
penumbra
=
(
penumbra
!==
undefined
)
?
penumbra
:
0
;
this
.
decay
=
(
decay
!==
undefined
)
?
decay
:
1
;
// for physically correct lights, should be 2.
this
.
shadow
=
new
THREE
.
LightShadow
(
new
THREE
.
PerspectiveCamera
(
50
,
1
,
0.5
,
500
)
);
...
...
@@ -31,7 +31,7 @@ THREE.SpotLight.prototype.copy = function ( source ) {
this
.
distance
=
source
.
distance
;
this
.
angle
=
source
.
angle
;
this
.
exponent
=
source
.
exponent
;
this
.
penumbra
=
source
.
penumbra
;
this
.
decay
=
source
.
decay
;
this
.
target
=
source
.
target
.
clone
();
...
...
src/loaders/ObjectLoader.js
浏览文件 @
b1f94dac
...
...
@@ -514,7 +514,7 @@ THREE.ObjectLoader.prototype = {
case
'
SpotLight
'
:
object
=
new
THREE
.
SpotLight
(
data
.
color
,
data
.
intensity
,
data
.
distance
,
data
.
angle
,
data
.
exponent
,
data
.
decay
);
object
=
new
THREE
.
SpotLight
(
data
.
color
,
data
.
intensity
,
data
.
distance
,
data
.
angle
,
data
.
penumbra
,
data
.
decay
);
break
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
b1f94dac
...
...
@@ -2702,7 +2702,7 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms
.
direction
.
transformDirection
(
viewMatrix
);
uniforms
.
angleCos
=
Math
.
cos
(
light
.
angle
);
uniforms
.
exponent
=
light
.
exponent
;
uniforms
.
penumbra
=
Math
.
cos
(
light
.
angle
)
*
light
.
penumbra
;
uniforms
.
decay
=
(
light
.
distance
===
0
)
?
0.0
:
light
.
decay
;
uniforms
.
shadow
=
light
.
castShadow
;
...
...
src/renderers/shaders/ShaderChunk/lights_pars.glsl
浏览文件 @
b1f94dac
...
...
@@ -68,7 +68,7 @@
float
distance
;
float
decay
;
float
angleCos
;
float
exponent
;
float
penumbra
;
int
shadow
;
float
shadowBias
;
...
...
@@ -90,7 +90,7 @@
if
(
spotEffect
>
spotLight
.
angleCos
)
{
float
spotEffect
=
dot
(
spotLight
.
direction
,
directLight
.
direction
);
spotEffect
=
saturate
(
pow
(
saturate
(
spotEffect
),
spotLight
.
exponent
)
);
spotEffect
*=
clamp
(
(
spotEffect
-
spotLight
.
angleCos
)
/
spotLight
.
penumbra
,
0
.
0
,
1
.
0
);
directLight
.
color
=
spotLight
.
color
;
directLight
.
color
*=
(
spotEffect
*
calcLightAttenuation
(
length
(
lVector
),
spotLight
.
distance
,
spotLight
.
decay
)
);
...
...
src/renderers/shaders/UniformsLib.js
浏览文件 @
b1f94dac
...
...
@@ -112,7 +112,7 @@ THREE.UniformsLib = {
"
direction
"
:
{
type
:
"
v3
"
},
"
distance
"
:
{
type
:
"
f
"
},
"
angleCos
"
:
{
type
:
"
f
"
},
"
exponent
"
:
{
type
:
"
f
"
},
"
penumbra
"
:
{
type
:
"
f
"
},
"
decay
"
:
{
type
:
"
f
"
},
"
shadow
"
:
{
type
:
"
i
"
},
...
...
src/renderers/webgl/WebGLLights.js
浏览文件 @
b1f94dac
...
...
@@ -37,7 +37,7 @@ THREE.WebGLLights = function () {
color
:
new
THREE
.
Color
(),
distance
:
0
,
angleCos
:
0
,
exponent
:
0
,
penumbra
:
0
,
decay
:
0
,
shadow
:
false
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录