pub struct LightTemplate {
    pub object: usize,
    pub color: Color,
    pub intensity: f32,
    pub sub_light: SubLightTemplate,
}
Expand description

Common information for instantiating the various types of lights.

See the module documentation for information on how templates are setup and how objects are added to the template.

Fields

object: usize

The object data for the light, given as an index into the objects array of the parent Template.

color: Color

The base color of the light.

intensity: f32

The intensity of the light.

sub_light: SubLightTemplate

The specific type of light represented by the template.

Implementations

Creates a new template for an ambient light, analogous to Factory::ambient_light.

Examples
use three::template::{LightTemplate, ObjectTemplate, Template};

let mut template = Template::new();
template.objects.push(ObjectTemplate::new());
let light = LightTemplate::ambient(
    template.objects.len() - 1,
    three::color::RED,
    0.5,
);
template.lights.push(light);

Creates a new template for a directional light, analogous to Factory::directional_light.

Examples
use three::template::{LightTemplate, ObjectTemplate, Template};

let mut template = Template::new();
template.objects.push(ObjectTemplate::new());
let light = LightTemplate::directional(
    template.objects.len() - 1,
    three::color::RED,
    0.5,
);
template.lights.push(light);

Creates a new template for a point light, analogous to Factory::point_light.

Examples
use three::template::{LightTemplate, ObjectTemplate, Template};

let mut template = Template::new();
template.objects.push(ObjectTemplate::new());
let light = LightTemplate::point(
    template.objects.len() - 1,
    three::color::RED,
    0.5,
);
template.lights.push(light);

Creates a new template for a hemisphere light, analogous to Factory::hemisphere_light.

Examples
use three::template::{LightTemplate, ObjectTemplate, Template};

let mut template = Template::new();
template.objects.push(ObjectTemplate::new());
let light = LightTemplate::hemisphere(
    template.objects.len() - 1,
    three::color::RED,
    three::color::BLUE,
    0.5,
);
template.lights.push(light);

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

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 alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Sets value as a parameter of self.
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.