Scene / Skybox
Skybox Class
Sky Box
Usage example: control the sky box real-time effect of the editor as follows Create a script called 'SkyboxExample', place it in the object bar, open the script, enter the following code, run the game, and you will be able to control the brightness of the SkyboxExample using the '+' and '-' keys, and switch presets using the '*' key.
@Component
export default class SkyboxExample extends mw.Script {
// When the script is instantiated, this function will be called before the first frame update
protected async onStart(): Promise<void> {
if(Util.SystemUtil.isClient())
{
mw.InputUtil.onKeyDown(Type.Keys.Add,()=>{
// Keypad+Build, increase the brightness of the Sky Box by 1 unit in sequence
Skybox.skyDomeIntensity = Skybox.skyDomeIntensity + 0.2;
Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
});
mw.InputUtil.onKeyDown(Type.Keys.Subtract,()=>{
// Keypad - Build, decrease the brightness of the Sky Box by one unit in sequence
Skybox.skyDomeIntensity = Skybox.skyDomeIntensity - 0.2;
Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
});
mw.InputUtil.onKeyDown(Type.Keys.Multiply,()=>{
// Keypad * build, switch sky box presets
Skybox.preset =7 % (Skybox.preset + 1);
});
}
}
}
@Component
export default class SkyboxExample extends mw.Script {
// When the script is instantiated, this function will be called before the first frame update
protected async onStart(): Promise<void> {
if(Util.SystemUtil.isClient())
{
mw.InputUtil.onKeyDown(Type.Keys.Add,()=>{
// Keypad+Build, increase the brightness of the Sky Box by 1 unit in sequence
Skybox.skyDomeIntensity = Skybox.skyDomeIntensity + 0.2;
Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
});
mw.InputUtil.onKeyDown(Type.Keys.Subtract,()=>{
// Keypad - Build, decrease the brightness of the Sky Box by one unit in sequence
Skybox.skyDomeIntensity = Skybox.skyDomeIntensity - 0.2;
Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
});
mw.InputUtil.onKeyDown(Type.Keys.Multiply,()=>{
// Keypad * build, switch sky box presets
Skybox.preset =7 % (Skybox.preset + 1);
});
}
}
}
Table of contents
Accessors
affectedByFog(): boolean other |
---|
Set whether it is affected by environmental fog |
cloudColor(): LinearColor other |
Obtain cloud color |
cloudDensity(): number other |
Obtain cloud density |
cloudOpacity(): number other |
Obtain the transparency of the cloud |
cloudSpeed(): number other |
Obtain cloud speed |
cloudTextureID(): string other |
Get Cloud texture ID |
cloudVisible(): boolean other |
Get whether cloud is enabled or not |
disturbanceDensity(): number other |
Obtain disturbance density |
disturbanceEnabled(): boolean other |
Obtain disturbance switch |
disturbanceIntensity(): number other |
Obtain disturbance intensity |
layerDisturbanceEnabled(): boolean other |
Set whether to enable layered perturbation |
moonColor(): LinearColor other |
Obtain the color of the moon |
moonIntensity(): number other |
Get the brightness of the moon |
moonSize(): number other |
Obtain the size of the moon |
moonTextureID(): string other |
Get the moon texture ID |
moonVisible(): boolean other |
Determine whether to activate the moon |
pitchAngle(): number other |
Get Sky Box texture pitch rotation (degrees) |
preset(): SkyPreset other |
Get preset settings |
rollAngle(): number other |
Get Sky Box texture roll rotation (degrees) |
skyDomeBaseColor(): LinearColor other |
Get Sky Box color |
skyDomeBottomColor(): LinearColor other |
Color of the lower layer of the sky |
skyDomeGradientEnabled(): boolean other |
Get whether to enable gradient effect |
skyDomeHorizontalFallOff(): number other |
Get the horizon fade out value |
skyDomeIntensity(): number other |
Get Sky Box Brightness |
skyDomeMiddleColor(): LinearColor other |
Middle sky color |
skyDomeTextureID(): string other |
Get Sky Box texture Asset ID |
skyDomeTopColor(): LinearColor other |
Get the top color of the sky |
skyboxRotation(): Rotation other |
Get Sky Ball Rotation |
starDensity(): number other |
Get star density |
starIntensity(): number other |
Obtain star brightness |
starTextureID(): string other |
Get star texture ID |
starVisible(): boolean other |
Get whether to activate stars |
sunColor(): LinearColor other |
Obtain the color of the sun |
sunIntensity(): number other |
Get brightness of sunlight |
sunSize(): number other |
Obtain the size of the sun |
sunTextureID(): string other |
Get sun texture ID |
sunVisible(): boolean other |
Get whether to turn on the sun |
yawAngle(): number other |
Get Sky Box texture yaw Rotation (degrees) |
Methods
refresh(): void other |
---|
Sky Box Refresh |
reset(): void other |
Reset to default parameters |
Accessors
affectedByFog
• | • | ||||
---|---|---|---|---|---|
Set whether it is affected by environmental fog Returns
| Set whether it is affected by environmental fog Parameters
|
cloudColor
• | • | ||||
---|---|---|---|---|---|
Obtain cloud color Returns
| Set cloud color Parameters
|
cloudDensity
• | • | ||||
---|---|---|---|---|---|
Obtain cloud density Returns
| Set cloud density Parameters
|
cloudOpacity
• | • | ||||
---|---|---|---|---|---|
Obtain the transparency of the cloud Returns
| Set the transparency of the cloud Parameters
|
cloudSpeed
• | • | ||||
---|---|---|---|---|---|
Obtain cloud speed Returns
| Set cloud speed Parameters
|
cloudTextureID
• | • | ||||
---|---|---|---|---|---|
Get Cloud texture ID Returns
| Set cloud texture resource ID Parameters
|
cloudVisible
• | • | ||||
---|---|---|---|---|---|
Get whether cloud is enabled or not Returns
| Set whether to enable cloud Parameters
|
disturbanceDensity
• | • | ||||
---|---|---|---|---|---|
Obtain disturbance density Returns
| Set disturbance density Parameters
|
disturbanceEnabled
• | • | ||||
---|---|---|---|---|---|
Obtain disturbance switch Returns
| Set disturbance switch Parameters
|
disturbanceIntensity
• | • | ||||
---|---|---|---|---|---|
Obtain disturbance intensity Returns
| Set disturbance intensity Parameters
|
layerDisturbanceEnabled
• | • | ||||
---|---|---|---|---|---|
Set whether to enable layered perturbation Returns
| Set whether to enable layered perturbation Parameters
|
moonColor
• | • | ||||
---|---|---|---|---|---|
Obtain the color of the moon Returns
| Set Moon Color Parameters
|
moonIntensity
• | • | ||||
---|---|---|---|---|---|
Get the brightness of the moon Returns
| Set the brightness of the moon Parameters
|
moonSize
• | • | ||||
---|---|---|---|---|---|
Obtain the size of the moon Returns
| Set the size of the moon Parameters
|
moonTextureID
• | • | ||||
---|---|---|---|---|---|
Get the moon texture ID Returns
| Set Moon texture Asset ID Parameters
|
moonVisible
• | • | ||||
---|---|---|---|---|---|
Determine whether to activate the moon Returns
| Set whether to turn on the moon Parameters
|
pitchAngle
• | • | ||||
---|---|---|---|---|---|
Get Sky Box texture pitch rotation (degrees) Returns
| Set Sky Box texture pitch rotation (degrees) Parameters
|
preset
• | • | ||||
---|---|---|---|---|---|
Get preset settings Returns
| Set presets Parameters
|
rollAngle
• | • | ||||
---|---|---|---|---|---|
Get Sky Box texture roll rotation (degrees) Returns
| Set Sky Box texture roll rotation (degrees) Parameters
|
skyDomeBaseColor
• | • | ||||
---|---|---|---|---|---|
Get Sky Box color Returns
| Set Sky Box Color Parameters
|
skyDomeBottomColor
• | • | ||||
---|---|---|---|---|---|
Color of the lower layer of the sky Returns
| Set the color of the lower layer of the sky Parameters
|
skyDomeGradientEnabled
• | • | ||||
---|---|---|---|---|---|
Get whether to enable gradient effect Returns
| Set whether to enable gradient effect Parameters
|
skyDomeHorizontalFallOff
• | • | ||||
---|---|---|---|---|---|
Get the horizon fade out value Returns
| Set the horizon gradient value Parameters
|
skyDomeIntensity
• | • | ||||
---|---|---|---|---|---|
Get Sky Box Brightness Returns
| Set Sky Box brightness Parameters
|
skyDomeMiddleColor
• | • | ||||
---|---|---|---|---|---|
Middle sky color Returns
| Set the color of the middle layer of the sky Parameters
|
skyDomeTextureID
• | • | ||||
---|---|---|---|---|---|
Get Sky Box texture Asset ID Returns
| Set Sky Box texture Asset ID Parameters
|
skyDomeTopColor
• | • | ||||
---|---|---|---|---|---|
Get the top color of the sky Returns
| Set the top color of the sky Parameters
|
skyboxRotation
• | • | ||||
---|---|---|---|---|---|
Get Sky Ball Rotation Returns
| Set sky ball rotation Parameters
|
starDensity
• | • | ||||
---|---|---|---|---|---|
Get star density Returns
| Set star density Parameters
|
starIntensity
• | • | ||||
---|---|---|---|---|---|
Obtain star brightness Returns
| Set star brightness Parameters
|
starTextureID
• | • | ||||
---|---|---|---|---|---|
Get star texture ID Returns
| Set Star texture Asset ID Parameters
|
starVisible
• | • | ||||
---|---|---|---|---|---|
Get whether to activate stars Returns
| Set whether to enable stars Parameters
|
sunColor
• | • | ||||
---|---|---|---|---|---|
Obtain the color of the sun Returns
| Set the color of the sun Parameters
|
sunIntensity
• | • | ||||
---|---|---|---|---|---|
Get brightness of sunlight Returns
| Set the brightness of sunlight Parameters
|
sunSize
• | • | ||||
---|---|---|---|---|---|
Obtain the size of the sun Returns
| Set the size of the sun Parameters
|
sunTextureID
• | • | ||||
---|---|---|---|---|---|
Get sun texture ID Returns
| Set sun texture Asset ID Parameters
|
sunVisible
• | • | ||||
---|---|---|---|---|---|
Get whether to turn on the sun Returns
| Set whether to turn on the sun Parameters
|
yawAngle
• | • | ||||
---|---|---|---|---|---|
Get Sky Box texture yaw Rotation (degrees) Returns
| Set Sky Box texture yaw rotation (degrees) Parameters
|
Methods
refresh
• Static
refresh(): void
other
Sky Box Refresh
reset
• Static
reset(): void
other
Reset to default parameters