#[repr(C)]
pub struct Light {
Show 13 fields pub ty: LightType, pub diffuse: ColorValue, pub specular: ColorValue, pub ambient: ColorValue, pub position: Vector, pub direction: Vector, pub range: f32, pub falloff: f32, pub attenuation0: f32, pub attenuation1: f32, pub attenuation2: f32, pub theta: f32, pub phi: f32,
}
Expand description

Fields

ty: LightType

Type of the light source.

diffuse: ColorValue

Diffuse color emitted by the light.

specular: ColorValue

Specular color emitted by the light.

ambient: ColorValue

Ambient color emitted by the light.

position: Vector

Position of the light in world space. This member has no meaning for Directional lights, and is ignored in that case.

direction: Vector

Direction that the light is pointing in world space. This member has meaning only for Directional and Spotlights. This vector need not be normalized, but it should have a nonzero length.

range: f32

Distance beyond which the light has no effect. The maximum allowable value for this member is the square root of f32::MAX. This member does not affect Directional lights.

falloff: f32

Decrease in illumination between a spotlight’s inner cone (the angle specified by theta) and the outer edge of the outer cone (the angle specified by phi).

The effect of falloff on the lighting is subtle. Furthermore, a small performance penalty is incurred by shaping the falloff curve. For these reasons, most developers set this value to 1.0.

attenuation0: f32

Value specifying how the light intensity changes over distance. Attenuation values are ignored for Directional lights. This member represents an attenuation constant. For information about attenuation, see Light Properties (Direct3D 9). Valid values for this member range from 0.0 to infinity. For non-directional lights, all three attenuation values should not be set to 0.0 at the same time.

attenuation1: f32

Value specifying how the light intensity changes over distance. Attenuation values are ignored for Directional lights. This member represents an attenuation constant. For information about attenuation, see Light Properties (Direct3D 9). Valid values for this member range from 0.0 to infinity. For non-Directional lights, all three attenuation values should not be set to 0.0 at the same time.

attenuation2: f32

Value specifying how the light intensity changes over distance. Attenuation values are ignored for Directional lights. This member represents an attenuation constant. For information about attenuation, see Light Properties (Direct3D 9). Valid values for this member range from 0.0 to infinity. For non-Directional lights, all three attenuation values should not be set to 0.0 at the same time.

theta: f32

Angle, in radians, of a spotlight’s inner cone - that is, the fully illuminated spotlight cone. This value must be in the range from 0 through the value specified by phi.

phi: f32

Angle, in radians, defining the outer edge of the spotlight’s outer cone. Points outside this cone are not lit by the spotlight. This value must be between 0 and std::f32::consts::PI.

Implementations

Light is a point source. The light has a position in space and radiates light in all directions.

Light is a spotlight source. This light is like a point light, except that the illumination is limited to a cone. This light type has a direction and several other parameters that determine the shape of the cone it produces. For information about these parameters, see the Light structure.

Light is a directional light source. This is equivalent to using a point light source at an infinite distance.

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Dereferences the value.

The resulting type after dereferencing.

Mutably dereferences the value.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.