DirectionalLight
类:方向光对象
Constructor
new Glodon.Bimface.Light.DirectionalLight(directionalLightConfig)
构造方向光对象
Parameters:
| Name | Type | Description |
|---|---|---|
| directionalLightConfig | Glodon.Bimface.Light.DirectionalLightConfig | 方向光配置项 |
Methods
enableLight(isEnabled)
开启/关闭平行光
Parameters:
| Name | Type | Description |
|---|---|---|
| isEnabled | Boolean | 开启/关闭平行光 |
enableShadow(isEnabled)
是否开启阴影
Parameters:
| Name | Type | Description |
|---|---|---|
| isEnabled | Boolean | 是否开启阴影,默认为false |
getColor()
获取方向光的颜色
Returns:
| Type | Description |
|---|---|
| Glodon.Web.Graphics.Color | 方向光的颜色 |
getDirection()
获取方向光的投影方向
Returns:
| Type | Description |
|---|---|
| Object | 方向光的投影方向 |
getId()
获取光源ID
Returns:
| Type | Description |
|---|---|
| String | 光源ID |
getIntensity()
获取光照强度
Returns:
| Type | Description |
|---|---|
| Number | 平行光光线强度 |
isEnabled()
获取平行光的开启状态
Returns:
| Type | Description |
|---|---|
| Boolean | 平行光的开启状态 |
isShadowEnabled()
是否开启阴影
Returns:
| Type | Description |
|---|---|
| Boolean | 是否开启阴影 |
setColor(color)
设置方向光的颜色
Parameters:
| Name | Type | Description |
|---|---|---|
| color | Glodon.Web.Graphics.Color | 方向光的颜色 |
setDirection(direction)
设置方向光的投影方向
Parameters:
| Name | Type | Description |
|---|---|---|
| direction | Object | 方向光的投影方向,用向量对象表示,例如:{ x: 0.64, y: -0.48, z: -0.6 } |
setDirectionByCondition(latLon, date)
根据经纬度及时间设置方向光的投影方向
Parameters:
| Name | Type | Description |
|---|---|---|
| latLon | Object | 表示经纬度的对象,例如:{ lat: 31.0, lon: 120.0 } |
| date | Date | 时间对象,例如:new Date('2020-05-16 16:00:00 GMT+8') |
setIntensity(intensity)
设置光照强度
Parameters:
| Name | Type | Description |
|---|---|---|
| intensity | Number | 平行光光线强度 |
update()
更新方向光对象