savoiardi/scene
Scene creation and scene-level rendering configuration.
This module wraps Three.js scenes together with typed helpers for backgrounds, environment maps, and fog settings.
Types
Scene background sources supported by Savoiardi.
pub type Background {
ColorBackground(Int)
TextureBackground(texture.Texture)
CubeTextureBackground(texture.CubeTexture)
}
Constructors
-
ColorBackground(Int) -
TextureBackground(texture.Texture) -
CubeTextureBackground(texture.CubeTexture)
Scene environment map sources supported by Savoiardi.
pub type Environment {
EnvironmentTexture(texture.Texture)
EnvironmentCubeTexture(texture.CubeTexture)
}
Constructors
-
EnvironmentTexture(texture.Texture) -
EnvironmentCubeTexture(texture.CubeTexture)
Fog settings for a scene.
pub type Fog {
LinearFog(color: Int, near: Float, far: Float)
ExponentialFog(color: Int, density: Float)
}
Constructors
-
LinearFog(color: Int, near: Float, far: Float) -
ExponentialFog(color: Int, density: Float)
Values
pub fn background_color(value: Int) -> Background
Builds a solid-color background value.
pub fn background_cube_texture(
cube_texture: texture.CubeTexture,
) -> Background
Builds a cube texture background value.
pub fn background_texture(texture: texture.Texture) -> Background
Builds a 2D texture background value.
pub fn environment_cube_texture(
cube_texture: texture.CubeTexture,
) -> Environment
Builds an environment map from a cube texture.
pub fn environment_texture(
texture: texture.Texture,
) -> Environment
Builds an environment map from a 2D texture.
pub fn fog(
color color: Int,
near near: Float,
far far: Float,
) -> Fog
Builds linear fog settings.
pub fn fog_exp2(color color: Int, density density: Float) -> Fog
Builds exponential fog settings.
pub fn set_background(
scene: Scene,
background: Background,
) -> Scene
Applies a background to a scene.
pub fn set_background_blurriness(
scene: Scene,
blurriness: Float,
) -> Scene
Sets the blur amount used for texture-based backgrounds.
pub fn set_background_intensity(
scene: Scene,
intensity: Float,
) -> Scene
Sets the intensity used for texture-based backgrounds.
pub fn set_environment(
scene: Scene,
environment: Environment,
) -> Scene
Applies an environment map to a scene.
pub fn set_environment_intensity(
scene: Scene,
intensity: Float,
) -> Scene
Sets the environment lighting intensity.
pub fn to_object3d(scene: Scene) -> object.Object3D
Views a scene as an object so it can be used with object APIs.