|
@@ -10,26 +10,25 @@
|
|
|
<body>
|
|
|
[page:Object3D] → [page:Light] →
|
|
|
|
|
|
- <h1>[name]</h1>
|
|
|
+ <h1>聚光灯([name])</h1>
|
|
|
|
|
|
<p class="desc">
|
|
|
- This light gets emitted from a single point in one direction, along a cone that increases in size
|
|
|
- the further from the light it gets. <br /><br />
|
|
|
+ 聚光灯是从一个方向上的一个点发出,沿着一个圆锥体,它离光越远,它的尺寸就越大。 <br /><br />
|
|
|
|
|
|
- This light can cast shadows - see the [page:SpotLightShadow] page for details.
|
|
|
+ 该光源可以投射阴影 - 跳转至 [page:SpotLightShadow] 查看更多细节。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- <h2>Example</h2>
|
|
|
+ <h2>示例</h2>
|
|
|
|
|
|
<iframe src='../examples/webgl_lights_spotlight.html'></iframe>
|
|
|
<p>
|
|
|
[example:webgl_lights_spotlight View in Examples ]
|
|
|
</p>
|
|
|
|
|
|
- <h2>Other Examples</h2>
|
|
|
+ <h2>其他例子</h2>
|
|
|
|
|
|
<p>
|
|
|
[example:webgl_interactive_cubes_gpu interactive / cubes / gpu ]<br />
|
|
@@ -45,7 +44,7 @@
|
|
|
[example:webgl_shadowmap_viewer shadowmap / viewer]
|
|
|
</p>
|
|
|
|
|
|
- <h2>Code Example</h2>
|
|
|
+ <h2>代码示例</h2>
|
|
|
<code>
|
|
|
// white spotlight shining from the side, casting a shadow
|
|
|
|
|
@@ -64,126 +63,117 @@
|
|
|
scene.add( spotLight );
|
|
|
</code>
|
|
|
|
|
|
- <h2>Constructor</h2>
|
|
|
+ <h2>构造器(Constructor)</h2>
|
|
|
|
|
|
|
|
|
<h3>[name]( [param:Integer color], [param:Float intensity], [param:Float distance], [param:Radians angle], [param:Float penumbra], [param:Float decay] )</h3>
|
|
|
<p>
|
|
|
- [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 /><br />
|
|
|
- [page:Float distance] - Maximum distance from origin where light will shine whose intensity
|
|
|
- is attenuated linearly based on distance from origin. <br />
|
|
|
- [page:Radians angle] - Maximum angle of light dispersion from its direction whose upper
|
|
|
- bound is Math.PI/2.<br />
|
|
|
- [page:Float penumbra] - Percent of the spotlight cone that is attenuated due to penumbra.
|
|
|
- Takes values between zero and 1. Default is zero.<br />
|
|
|
- [page:Float decay] - The amount the light dims along the distance of the light.<br /><br />
|
|
|
-
|
|
|
- Creates a new [name].
|
|
|
+ [page:Integer color] - (可选参数) 十六进制光照颜色。 缺省值 0xffffff (白色)。<br />
|
|
|
+ [page:Float intensity] - (可选参数) 光照强度。 缺省值 1。<br /><br />
|
|
|
+ [page:Float distance] - 从光源发出光的最大距离,其强度根据光源的距离线性衰减。 <br />
|
|
|
+ [page:Radians angle] - 光线散射角度,最大为Math.PI/2。<br />
|
|
|
+ [page:Float penumbra] - 聚光锥的半影衰减百分比。在0和1之间的值。默认为0。<br />
|
|
|
+ [page:Float decay] - 沿着光照距离的衰减量。<br /><br />
|
|
|
+
|
|
|
+ 创建一个新的聚光灯。
|
|
|
</p>
|
|
|
|
|
|
- <h2>Properties</h2>
|
|
|
+ <h2>属性(Properties)</h2>
|
|
|
|
|
|
- See the base [page:Light Light] class for common properties.
|
|
|
+ 公共属性请查看基类[page:Light Light]。
|
|
|
|
|
|
<h3>[property:Float angle]</h3>
|
|
|
<p>
|
|
|
- Maximum extent of the spotlight, in radians, from its direction. Should be no more than
|
|
|
- *Math.PI/2*. The default is *Math.PI/3*.
|
|
|
+ 从聚光灯的位置以弧度表示聚光灯的最大范围。应该不超过 *Math.PI/2*。默认值为 *Math.PI/3*。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
<h3>[property:Boolean castShadow]</h3>
|
|
|
<p>
|
|
|
- If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and
|
|
|
- requires tweaking to get shadows looking right. See the [page:SpotLightShadow] for details.
|
|
|
- The default is *false*.
|
|
|
+ 此属性设置为 *true* 聚光灯将投射阴影。警告: 这样做的代价比较高而且需要一直调整到阴影看起来正确。
|
|
|
+ 查看 [page:SpotLightShadow] 了解详细信息。
|
|
|
+ 默认值为 *false*
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Float decay]</h3>
|
|
|
<p>
|
|
|
- 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 />
|
|
|
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式下,decay 设置为等于2将实现现实世界的光衰减。<br/>
|
|
|
+ 缺省值为 *1*。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Float distance]</h3>
|
|
|
<p>
|
|
|
- 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*.
|
|
|
+ 如果非零,那么光强度将会从最大值当前灯光位置处按照距离线性衰减到0。
|
|
|
+ 缺省值为 *0.0*。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean isSpotLight]</h3>
|
|
|
<p>
|
|
|
- Used to check whether this or derived classes are spot lights. Default is *true*.<br /><br />
|
|
|
+ 用来校验这个类或者它的派生类是不是聚光灯光源。缺省值是 *true*。<br /><br />
|
|
|
|
|
|
- You should not change this, as it used internally for optimisation.
|
|
|
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Float penumbra]</h3>
|
|
|
<p>
|
|
|
- Percent of the spotlight cone that is attenuated due to penumbra. Takes values between
|
|
|
- zero and 1. The default is *0.0*.
|
|
|
+ 聚光锥的半影衰减百分比。在0和1之间的值。
|
|
|
+ 默认值 — 0.0。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Vector3 position]</h3>
|
|
|
<p>
|
|
|
- This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
|
|
|
+ 假如这个值设置等于 [page:Object3D.DefaultUp] (0, 1, 0),那么光线将会从上往下照射。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Float power]</h3>
|
|
|
<p>
|
|
|
- The light's power.<br />
|
|
|
- In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the luminous
|
|
|
- power of the light measured in lumens. Default is *4Math.PI*. <br /><br />
|
|
|
-
|
|
|
- This is directly related to the [page:.intensity intensity] in the ratio
|
|
|
- <code>
|
|
|
- power = intensity * π
|
|
|
+ 光功率<br />
|
|
|
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式中,
|
|
|
+ 表示以"流明(光通量单位)"为单位的光功率。 缺省值 - *4Math.PI*。 <br /><br />
|
|
|
+
|
|
|
+ 该值与 [page:.intensity intensity] 直接关联
|
|
|
+ <code>
|
|
|
+ power = intensity * 4π
|
|
|
</code>
|
|
|
- and changing this will also change the intensity.
|
|
|
+ 修改该值也会导致光强度的改变。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:SpotLightShadow shadow]</h3>
|
|
|
<p>
|
|
|
- A [page:SpotLightShadow] used to calculate shadows for this light.
|
|
|
+ [page:SpotLightShadow]用与计算此光照的阴影。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
<h3>[property:Object3D target]</h3>
|
|
|
<p>
|
|
|
- The Spotlight points from its [page:.position position] to target.position. The default
|
|
|
- position of the target is *(0, 0, 0)*.<br />
|
|
|
-
|
|
|
- *Note*: For the target's position to be changed to anything other than the default,
|
|
|
- it must be added to the [page:Scene scene] using
|
|
|
+ 平行光的方向是从它的位置到目标位置.默认的目标位置为原点 *(0,0,0)*。<br />
|
|
|
+ 注意: 对于目标的位置,要将其更改为除缺省值之外的任何位置,它必须被添加到 [page:Scene scene]
|
|
|
+ 场景中去。
|
|
|
<code>
|
|
|
scene.add( light.target );
|
|
|
</code>
|
|
|
|
|
|
- This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically
|
|
|
- updated each frame.<br /><br />
|
|
|
+ 这使得属性target中的 [page:Object3D.matrixWorld matrixWorld] 会每帧自动更新。<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:
|
|
|
+ 它也可以设置target为场景中的其他对象(任意拥有 [page:Object3D.position position] 属性的对象), 示例如下:
|
|
|
<code>
|
|
|
var targetObject = new THREE.Object3D();
|
|
|
scene.add(targetObject);
|
|
|
|
|
|
light.target = targetObject;
|
|
|
</code>
|
|
|
- The spotlight will now track the target object.
|
|
|
+ 完成上述操作后,聚光灯现在就可以追踪到目标对像了。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
- <h2>Methods</h2>
|
|
|
+ <h2>方法(Methods)</h2>
|
|
|
|
|
|
- See the base [page:Light Light] class for common methods.
|
|
|
+ 公共方法请查看基类 [page:Light Light]。
|
|
|
|
|
|
<h3>[method:SpotLight copy]( [param:SpotLight source] )</h3>
|
|
|
<p>
|
|
|
- Copies value of all the properties from the [page:SpotLight source] to this
|
|
|
- SpotLight.
|
|
|
+ 将所有属性的值从源 [page:SpotLight source] 复制到此聚光灯光源对象。
|
|
|
</p>
|
|
|
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|