savoiardi/light
Light construction and light-specific controls.
The module exposes a shared light type together with safe conversions to the more specific directional, point, spot, and hemisphere light variants.
Types
A directional light.
pub type DirectionalLight
A hemisphere light.
pub type HemisphereLight
A point light.
pub type PointLight
Values
pub fn ambient(
color color: Int,
intensity intensity: Float,
) -> Light
Creates an ambient light.
pub fn directional(
color color: Int,
intensity intensity: Float,
) -> Light
Creates a directional light.
pub fn directional_from_light(
light: Light,
) -> Result(DirectionalLight, Nil)
Safely downcasts a light to a directional light.
pub fn directional_get_target(
light: DirectionalLight,
) -> object.Object3D
Gets the target object used by a directional light.
pub fn directional_set_shadow_camera_bounds(
light: DirectionalLight,
left: Float,
right: Float,
top: Float,
bottom: Float,
) -> DirectionalLight
Sets orthographic shadow camera bounds for a directional light.
pub fn directional_set_shadow_camera_near_far(
light: DirectionalLight,
near: Float,
far: Float,
) -> DirectionalLight
Sets the shadow camera clipping planes for a directional light.
pub fn directional_set_target(
light: DirectionalLight,
target: object.Object3D,
) -> DirectionalLight
Sets the target object used by a directional light.
pub fn directional_to_light(light: DirectionalLight) -> Light
Widens a directional light into the shared light type.
pub fn directional_to_object3d(
light: DirectionalLight,
) -> object.Object3D
Views a directional light as an object.
pub fn from_object3d(
object: object.Object3D,
) -> Result(Light, Nil)
Safely downcasts an object to a light.
pub fn hemisphere(
sky_color sky_color: Int,
ground_color ground_color: Int,
intensity intensity: Float,
) -> Light
Creates a hemisphere light.
pub fn hemisphere_from_light(
light: Light,
) -> Result(HemisphereLight, Nil)
Safely downcasts a light to a hemisphere light.
pub fn hemisphere_set_ground_color(
light: HemisphereLight,
ground_color: Int,
) -> HemisphereLight
Sets the ground color of a hemisphere light.
pub fn hemisphere_to_light(light: HemisphereLight) -> Light
Widens a hemisphere light into the shared light type.
pub fn hemisphere_to_object3d(
light: HemisphereLight,
) -> object.Object3D
Views a hemisphere light as an object.
pub fn point(
color color: Int,
intensity intensity: Float,
distance distance: Float,
) -> Light
Creates a point light.
pub fn point_from_light(light: Light) -> Result(PointLight, Nil)
Safely downcasts a light to a point light.
pub fn point_set_decay(
light: PointLight,
decay: Float,
) -> PointLight
Sets the decay factor of a point light.
pub fn point_set_distance(
light: PointLight,
distance: Float,
) -> PointLight
Sets the attenuation distance of a point light.
pub fn point_set_power(
light: PointLight,
power: Float,
) -> PointLight
Sets the power of a point light.
pub fn point_set_shadow_camera_near_far(
light: PointLight,
near: Float,
far: Float,
) -> PointLight
Sets the shadow camera clipping planes for a point light.
pub fn point_to_light(light: PointLight) -> Light
Widens a point light into the shared light type.
pub fn point_to_object3d(light: PointLight) -> object.Object3D
Views a point light as an object.
pub fn set_cast_shadow(light: Light, cast_shadow: Bool) -> Light
Enables or disables shadow casting for a light.
pub fn set_shadow_auto_update(
light: Light,
auto_update: Bool,
) -> Light
Enables or disables automatic shadow map updates.
pub fn set_shadow_map_size(
light: Light,
width: Int,
height: Int,
) -> Light
Sets the size of the shadow map texture.
pub fn set_shadow_needs_update(
light: Light,
needs_update: Bool,
) -> Light
Marks the shadow map as needing an update.
pub fn set_shadow_normal_bias(
light: Light,
normal_bias: Float,
) -> Light
Sets the shadow normal bias for a light.
pub fn set_shadow_radius(light: Light, radius: Float) -> Light
Sets the shadow blur radius for a light.
pub fn spot(
color color: Int,
intensity intensity: Float,
distance distance: Float,
angle angle: Float,
penumbra penumbra: Float,
) -> Light
Creates a spot light.
pub fn spot_from_light(light: Light) -> Result(SpotLight, Nil)
Safely downcasts a light to a spot light.
pub fn spot_get_target(light: SpotLight) -> object.Object3D
Gets the target object used by a spot light.
pub fn spot_set_angle(
light: SpotLight,
angle: Float,
) -> SpotLight
Sets the cone angle of a spot light.
pub fn spot_set_decay(
light: SpotLight,
decay: Float,
) -> SpotLight
Sets the decay factor of a spot light.
pub fn spot_set_distance(
light: SpotLight,
distance: Float,
) -> SpotLight
Sets the attenuation distance of a spot light.
pub fn spot_set_penumbra(
light: SpotLight,
penumbra: Float,
) -> SpotLight
Sets the penumbra of a spot light.
pub fn spot_set_power(
light: SpotLight,
power: Float,
) -> SpotLight
Sets the power of a spot light.
pub fn spot_set_shadow_camera_near_far(
light: SpotLight,
near: Float,
far: Float,
) -> SpotLight
Sets the shadow camera clipping planes for a spot light.
pub fn spot_set_target(
light: SpotLight,
target: object.Object3D,
) -> SpotLight
Sets the target object used by a spot light.
pub fn spot_to_object3d(light: SpotLight) -> object.Object3D
Views a spot light as an object.