class Prism::Attenuation

Overview

Defines the gradual diminishing in strength of something In other words, how quickly something fades off. This is particularly useful for point lights.

The attenuation equation is

1 / (constant + linear * x + exponent * x ^ 2)

The easiest way to understand how to configure attenuation will be to graph it with something like https://www.desmos.com/calculator

This just a wrapper around a vector so we can document the different attenuation components.

Defined in:

prism/stdlib/attenuation.cr

Constructors

Instance Method Summary

Instance methods inherited from class Prism::Maths::Vector3f

*(r : Vector3f) : Vector3f
*(r : Float32) : Vector3f
*
, +(r : Vector3f) : Vector3f
+(r : Float32) : Vector3f
+
, -(r : Vector3f) : Vector3f
-(r : Float32) : Vector3f
-
, /(r : Vector3f) : Vector3f
/(r : Float32) : Vector3f
/
, ==(r : Vector3f) : Bool ==, abs : Vector3f abs, clone clone, cross(other : Vector3f) : Vector3f cross, dot(r : Vector3f) : Float32 dot, length : Float32 length, lerp(dest : Vector3f, lerp_factor : Float32) : Vector3f lerp, max max, normalize! normalize!, reflect(q : Quaternion) reflect, rotate(axis : Vector3f, angle : Float32) : Vector3f
rotate(rotation : Quaternion) : Vector3f
rotate
, set(x : Float32, y : Float32, z : Float32)
set(r : Vector3f)
set
, to_normalized to_normalized, to_s to_s, x : Float32 x, x=(x : Float32) x=, xy : Vector2f xy, xz : Vector2f xz, y : Float32 y, y=(y : Float32) y=, yx : Vector2f yx, yz : Vector2f yz, z : Float32 z, z=(z : Float32) z=, zx : Vector2f zx, zy : Vector2f zy

Constructor methods inherited from class Prism::Maths::Vector3f

new(x : Float32, y : Float32, z : Float32)
new(vector : Vector3f)
new

Constructor Detail

def self.new(constant : Float32, linear : Float32, exponent : Float32) #

[View source]

Instance Method Detail

def constant : Float32 #

Controls the maximum intensity of light. A large value greatly reduces the intensity. A value of 1 or below produces the maximum intensity


[View source]
def exponent : Float32 #

Controls how far the light reaches. A very large value causes the light to have a short reach.


[View source]
def linear : Float32 #

Controls how quickly the intensity at the center of the light dissipates. A large value causes the light to dissipate very quickly.


[View source]