pub struct PointLight {
pub intensity: f32,
pub color: Srgba,
pub position: Vec3,
pub attenuation: Attenuation,
}Expand description
A light which shines from the given position in all directions.
Fields§
§intensity: f32The intensity of the light. This allows for higher intensity than 1 which can be used to simulate high intensity light sources like the sun.
color: SrgbaThe base color of the light.
position: Vec3The position of the light.
attenuation: AttenuationThe Attenuation of the light.
Implementations§
Source§impl PointLight
impl PointLight
Sourcepub fn new(
_context: &Context,
intensity: f32,
color: Srgba,
position: Vec3,
attenuation: Attenuation,
) -> PointLight
pub fn new( _context: &Context, intensity: f32, color: Srgba, position: Vec3, attenuation: Attenuation, ) -> PointLight
Constructs a new point light.
Trait Implementations§
Source§impl Light for PointLight
impl Light for PointLight
Source§fn shader_source(&self, i: u32) -> String
fn shader_source(&self, i: u32) -> String
The fragment shader source for calculating this lights contribution to the color in a fragment.
It should contain a function with this signature
vec3 calculate_lighting{}(vec3 surface_color, vec3 position, vec3 normal, vec3 view_direction, float metallic, float roughness, float occlusion)
Where {} is replaced with the number i given as input.
This function should return the color contribution for this light on the surface with the given surface parameters.Source§fn use_uniforms(&self, program: &Program, i: u32)
fn use_uniforms(&self, program: &Program, i: u32)
Should bind the uniforms that is needed for calculating this lights contribution to the color in Light::shader_source.
Auto Trait Implementations§
impl Freeze for PointLight
impl RefUnwindSafe for PointLight
impl Send for PointLight
impl Sync for PointLight
impl Unpin for PointLight
impl UnsafeUnpin for PointLight
impl UnwindSafe for PointLight
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more