目录

Light

Class Info

public class Light extends Component

灯光组件。

Public Method Summary

Qualifier and Type

Method Name and Description

static Component.Descriptor<Light>

descriptor()

获取灯光组件描述符。

Vector3

getColor()

获取灯光颜色。

float

getIntensity()

获取光照强度。

Light.Type

getType()

获取灯光类型。

boolean

isShadowCaster()

获取灯光是否投射阴影。

Light

setCastShadow(boolean enable)

设置是否投射阴影。

Light

setColor(Vector3 color)

设置灯光颜色。

Light

setInnerAndOuterCone(float inner, float outer)

设置聚光灯内外圈角度。

Light

setIntensity(float intensity)

设置光照强度。

Light

setType(Light.Type type)

设置灯光类型。

Public Methods

[h2]descriptor

Method

public static Component.Descriptor<Light> descriptor()

获取灯光组件描述符。

Returns

Type

Description

Component.Descriptor<Light>

灯光组件描述符。

[h2]getColor

Method

public Vector3 getColor()

获取灯光颜色。

Returns

Type

Description

Vector3

灯光的RGB颜色值。

[h2]getIntensity

Method

public float getIntensity()

获取光照强度。

Returns

Type

Description

float

光照强度。

[h2]getType

Method

public Light.Type getType()

获取灯光类型。

Returns

Type

Description

Light.Type

灯光类型。

[h2]isShadowCaster

Method

public boolean isShadowCaster()

获取灯光是否投射阴影。

Returns

Type

Description

boolean

是否投射阴影。

  • true:灯光投射阴影。
  • false:灯光不投射阴影。

[h2]setCastShadow

Method

public Light setCastShadow(boolean enable)

设置是否投射阴影。

Parameters

Name

Description

enable

是否投射阴影。

  • true:开启投射阴影。
  • false:不开启投射阴影。

Returns

Type

Description

Light

自身实例。

[h2]setColor

Method

public Light setColor(Vector3 color)

设置颜色。

Parameters

Name

Description

color

灯光的RGB颜色向量,R 、G、B的取值范围为[0, 1]。

Returns

Type

Description

Light

自身实例。

[h2]setInnerAndOuterCone

Method

public Light setInnerAndOuterCone(float inner, float outer)

设置灯光内圈外圈角度。

Parameters

Name

Description

inner

内圈角度,取值范围[0, outer]。

outer

外圈角度,取值范围[inner, 180]。

Returns

Type

Description

Light

自身实例。

[h2]setIntensity

Method

public Light setIntensity(float intensity)

设置光照强度。

Parameters

Name

Description

intensity

光照强度,取值范围大于0。

Returns

Type

Description

Light

自身实例。

[h2]setType

Method

public Light setType(Light.Type type)

设置灯光类型。

Parameters

Name

Description

type

灯光类型,当前支持点光源、方向光与聚光灯。

Returns

Type

Description

Light

自身实例。