Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
5bb55bf4
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 搜索 >>
提交
5bb55bf4
编写于
12月 30, 2017
作者:
W
WestLangley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RectAreaLight: light intensity is now light brightness
上级
22aa2162
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
91 deletion
+16
-91
docs/api/lights/RectAreaLight.html
docs/api/lights/RectAreaLight.html
+8
-67
examples/webgl_lights_rectarealight.html
examples/webgl_lights_rectarealight.html
+4
-8
src/lights/RectAreaLight.js
src/lights/RectAreaLight.js
+0
-10
src/renderers/webgl/WebGLLights.js
src/renderers/webgl/WebGLLights.js
+4
-6
未找到文件。
docs/api/lights/RectAreaLight.html
浏览文件 @
5bb55bf4
...
...
@@ -13,27 +13,25 @@
<h1>
[name]
</h1>
<div
class=
"desc"
>
This light gets emitted uniformly across the face a rectangular plane. This can be
used to simulate things like bright windows or strip lighting.
<br
/><br
/>
<em>
NOTE:
</em>
this class is currently under active development and is probably not
production ready yet (as of r83). Check back in a month or two! And feel free to try it out in the meantime.
RectAreaLight emits light uniformly across the face a rectangular plane. This light type can be
used to simulate light sources such as bright windows or strip lighting.
<br
/><br
/>
RectAreaLight does not support shadows.
<br
/><br
/>
</div>
<h2>
Examples
</h2>
<div>
[example:webgl_lights_rectarealight WebGL / rectarealight ]
<code>
var width =
2
;
var width =
10
;
var height = 10;
var
rectLight = new THREE.RectAreaLight( 0xffffff, undefined, width, height )
;
rectLight.intensity = 70.0
;
var
intensity = 1
;
var rectLight = new THREE.RectAreaLight( 0xffffff, intensity, width, height )
;
rectLight.position.set( 5, 5, 0 );
rectLight.lookAt( 0, 0, 0 );
scene.add( rectLight )
rectLightHelper = new THREE.RectAreaLightHelper( rectLight );
...
...
@@ -43,16 +41,13 @@ scene.add( rectLightHelper );
</div>
<h2>
Constructor
</h2>
<h3>
[name]( [page:Integer color], [page:Float intensity], [page:Float width], [page:Float height] )
</h3>
<div>
[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
<br
/>
[page:Float intensity] - (optional)
numeric value of the light's strength/intensity
. Default is 1.
<br
/>
[page:Float intensity] - (optional)
the light's intensity, or brightness
. Default is 1.
<br
/>
[page:Float width] - (optional) width of the light. Default is 10.
<br
/>
[page:Float height] - (optional) height of the light. Default is 10.
<br
/><br
/>
...
...
@@ -64,29 +59,6 @@ scene.add( rectLightHelper );
See the base [page:Light Light] class for common properties.
</div>
<h3>
[property:Boolean castShadow]
</h3>
<div>
<em>
Note:
</em>
this is not yet implemented for this light type! (r83)
</div>
<h3>
[property:Float decay]
</h3>
<div>
The amount the light dims along the distance of the light.
<br
/>
In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to
physically realistic light falloff. The default is *1*.
<br
/><br
/>
<em>
Note:
</em>
this is not yet implemented for this light type! (r83)
</div>
<h3>
[property:Float distance]
</h3>
<div>
If non-zero, light will attenuate linearly from maximum intensity at the light's
position down to zero at this distance from the light. Default is *0.0*.
<br
/><br
/>
<em>
Note:
</em>
this is not yet implemented for this light type! (r83)
</div>
<h3>
[property:Boolean isRectAreaLight]
</h3>
<div>
Used to check whether this or derived classes are RectAreaLights. Default is *true*.
<br
/><br
/>
...
...
@@ -94,37 +66,6 @@ scene.add( rectLightHelper );
You should not change this, as it used internally for optimisation.
</div>
<h3>
[property:Vector3 position]
</h3>
<div>
This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
</div>
<h3>
[property:Object3D target]
</h3>
<div>
The RectAreaLight points from its [page:.position position] to target.position. The default
position of the target is *(0, 0, 0)*.
<br
/>
*Note*: For the the target's position to be changed to anything other than the default,
it must be added to the [page:Scene scene] using
<code>
scene.add( light.target );
</code>
This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically
updated each frame.
<br
/><br
/>
It is also possible to set the target to be another object in the scene (anything with a
[page:Object3D.position position] property), like so:
<code>
var targetObject = new THREE.Object3D();
scene.add(targetObject);
light.target = targetObject;
</code>
The RectAreaLight will now track the target object.
</div>
<h2>
Methods
</h2>
<div>
See the base [page:Light Light] class for common methods.
...
...
examples/webgl_lights_rectarealight.html
浏览文件 @
5bb55bf4
...
...
@@ -125,16 +125,12 @@
camera
.
position
.
set
(
0
,
20
,
35
);
rectLight
=
new
THREE
.
RectAreaLight
(
0xffffff
,
200
,
10
,
10
);
rectLight
=
new
THREE
.
RectAreaLight
(
0xffffff
,
1
,
10
,
10
);
rectLight
.
position
.
set
(
5
,
5
,
0
);
// TODO: ensure RectAreaLight handles target param correctly
rectLightHelper
=
new
THREE
.
RectAreaLightHelper
(
rectLight
);
scene
.
add
(
rectLightHelper
);
// TODO (abelnation): rect light shadow
scene
.
add
(
camera
);
scene
.
add
(
origin
);
...
...
@@ -246,13 +242,13 @@
var
lightFolder
=
gui
.
addFolder
(
'
Light
'
);
lightFolder
.
add
(
param
,
'
width
'
,
0.1
,
20
).
onChange
(
function
(
val
)
{
lightFolder
.
add
(
param
,
'
width
'
,
1
,
20
).
step
(
0.1
).
onChange
(
function
(
val
)
{
rectLight
.
width
=
val
;
}
);
lightFolder
.
add
(
param
,
'
height
'
,
0.1
,
20
).
onChange
(
function
(
val
)
{
lightFolder
.
add
(
param
,
'
height
'
,
1
,
20
).
step
(
0.1
).
onChange
(
function
(
val
)
{
rectLight
.
height
=
val
;
...
...
@@ -264,7 +260,7 @@
}
);
lightFolder
.
add
(
param
,
'
intensity
'
,
0.0
,
400
).
onChange
(
function
(
val
)
{
lightFolder
.
add
(
param
,
'
intensity
'
,
0.0
,
2
).
step
(
0.01
).
onChange
(
function
(
val
)
{
rectLight
.
intensity
=
val
;
...
...
src/lights/RectAreaLight.js
浏览文件 @
5bb55bf4
...
...
@@ -10,21 +10,11 @@ function RectAreaLight( color, intensity, width, height ) {
this
.
type
=
'
RectAreaLight
'
;
this
.
position
.
set
(
0
,
1
,
0
);
this
.
updateMatrix
();
this
.
width
=
(
width
!==
undefined
)
?
width
:
10
;
this
.
height
=
(
height
!==
undefined
)
?
height
:
10
;
// TODO (abelnation): distance/decay
// TODO (abelnation): update method for RectAreaLight to update transform to lookat target
// TODO (abelnation): shadows
}
// TODO (abelnation): RectAreaLight update when light shape is changed
RectAreaLight
.
prototype
=
Object
.
assign
(
Object
.
create
(
Light
.
prototype
),
{
constructor
:
RectAreaLight
,
...
...
src/renderers/webgl/WebGLLights.js
浏览文件 @
5bb55bf4
...
...
@@ -224,13 +224,11 @@ function WebGLLights() {
var
uniforms
=
cache
.
get
(
light
);
// (a) intensity controls irradiance of entire light
uniforms
.
color
.
copy
(
color
)
.
multiplyScalar
(
intensity
/
(
light
.
width
*
light
.
height
)
);
// (a) intensity is the total visible light emitted
//uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );
// (b) intensity
controls the radiance per light area
//
uniforms.color.copy( color ).multiplyScalar( intensity );
// (b) intensity
is the brightness of the light
uniforms
.
color
.
copy
(
color
).
multiplyScalar
(
intensity
);
uniforms
.
position
.
setFromMatrixPosition
(
light
.
matrixWorld
);
uniforms
.
position
.
applyMatrix4
(
viewMatrix
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录