struct Eagle::LightData

Overview

A light as the renderer sees it. The light nodes produce these each frame.

Defined in:

eagle/graphics3d/renderer3d.cr

Constructors

Instance Method Summary

Constructor Detail

def self.directional(direction : Vec3, color : Color = Color::WHITE, intensity : Number = 1, shadows : Bool = true) : LightData #

A directional light.


def self.new(kind : Eagle::LightData::Kind, position : Eagle::Vec3, direction : Eagle::Vec3, color : Eagle::Color, intensity : Float32, range : Float32 = 10_f32, spot_inner : Float32 = 0.5_f32, spot_outer : Float32 = 0.6_f32, shadows : Bool = false) #

Creates light data. Prefer .directional, .point or .spot.


def self.point(position : Vec3, color : Color = Color::WHITE, intensity : Number = 1, range : Number = 10) : LightData #

A point light.


def self.spot(position : Vec3, direction : Vec3, color : Color = Color::WHITE, intensity : Number = 1, range : Number = 10, angle : Number = 0.6, softness : Number = 0.1) : LightData #

A spot light.


Instance Method Detail

def color : Color #

Light color.


def direction : Vec3 #

Direction, for directional and spot lights.


def intensity : Float32 #

Brightness multiplier.


def kind : Kind #

The kind of light.


def position : Vec3 #

World position, for point and spot lights.


def range : Float32 #

Distance at which point and spot lights fade out.


def shadows? : Bool #

Whether the light casts shadows.


def spot_inner : Float32 #

Cosine of the angle where a spot light starts to fade.


def spot_outer : Float32 #

Cosine of the angle where a spot light is fully dark.