天空盒
创建一个带有时间控制、阴影控制的天空盒
示例
类型
js
function useSkyBox(
scene: Scene,
options?: UseSkyBoxOptions
): UseSkyBoxReturnValue说明
第一个参数是Three.js的scene。第二个参数可选,它是传入函数的配置项。
参数
UseSkyBoxOptions
| 参数名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| defaultValue | 默认值 | number | 0 |
| size | 天空盒大小 | number | 4000 |
| position | 天空盒位置 | [number, number, number] | [0, 0, 0] |
| sunLightName | 阳光(平行光对象)的名称 | string | '_sky_.sunLight' |
| showSunLight | 显示阳光 | boolean | true |
| castShadowList | 需要创建阴影的名称列表,要开启阴影投射必须要将showSunLight设置为true | Array<string> | [] |
| castShadowNumber | 投射阴影查找上层递归次数 | number | 2 |
| durationMultiple | 过渡时间倍率,为0时表示不使用过渡。值越大,过渡越慢 | number | 3 |
| updateCallback | 更新天空后的回调 | Function | undefined | undefined |
UseSkyBoxReturnValue
| 参数名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| value | 天空盒当前时间 | Ref<number> | - |
| control | 控制器 | Ref<UseSkyBoxControl> | - |
UseSkyBoxControl
| 参数名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| rayleigh | 福瑞散射 主要影响天空颜色 | number | - |
| turbidity | 浊度 | number | - |
| mieCoefficient | 米氏散射 主要影响光晕 | number | - |
| mieDirectionalG | 米氏散射方向 | number | - |
| elevation | 太阳高度 | number | - |
| azimuth | 方位角度 | number | - |
ThreeUse