Struct three::template::LightTemplate
source · 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
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
sourceimpl LightTemplate
impl LightTemplate
sourcepub fn ambient(object: usize, color: Color, intensity: f32) -> LightTemplate
pub fn ambient(object: usize, color: Color, intensity: f32) -> LightTemplate
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);
sourcepub fn directional(object: usize, color: Color, intensity: f32) -> LightTemplate
pub fn directional(object: usize, color: Color, intensity: f32) -> LightTemplate
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);
sourcepub fn point(object: usize, color: Color, intensity: f32) -> LightTemplate
pub fn point(object: usize, color: Color, intensity: f32) -> LightTemplate
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);
sourcepub fn hemisphere(
object: usize,
sky_color: Color,
ground_color: Color,
intensity: f32
) -> LightTemplate
pub fn hemisphere(
object: usize,
sky_color: Color,
ground_color: Color,
intensity: f32
) -> LightTemplate
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
sourceimpl Clone for LightTemplate
impl Clone for LightTemplate
sourcefn clone(&self) -> LightTemplate
fn clone(&self) -> LightTemplate
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for LightTemplate
impl Debug for LightTemplate
impl Copy for LightTemplate
Auto Trait Implementations
impl RefUnwindSafe for LightTemplate
impl Send for LightTemplate
impl Sync for LightTemplate
impl Unpin for LightTemplate
impl UnwindSafe for LightTemplate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
Sets
value
as a parameter of self
.