class Eagle::Environment

Overview

Scene-wide 3D settings: sky, ambient light, fog and shadows. The active one is Scene3D.environment.

env = Scene3D.environment
env.fog(15, 60, Color.gray(0.7))                # fade to gray between 15 and 60 units
env.sky = false
env.background = Color::BLACK                   # space
env.shadow_distance = 25                        # sharper shadows over a smaller area

Defined in:

eagle/graphics3d/renderer3d.cr

Instance Method Summary

Instance Method Detail

def ambient : Color #

Light that reaches everything, even in shadow. Raise it if shadows look too black.


def ambient=(ambient : Color) #

Light that reaches everything, even in shadow. Raise it if shadows look too black.


def background : Color #

Flat background color when the sky is off.


def background=(background : Color) #

Flat background color when the sky is off.


def fog(start : Number, finish : Number, color : Color | Nil = nil) : self #

Turns on fog between start and finish, optionally changing its color. Returns self.


def fog_color : Color #

Color distant things fade toward.


def fog_color=(fog_color : Color) #

Color distant things fade toward.


def fog_end : Float32 #

Distance where fog is total. Fog is off when this is not greater than #fog_start.


def fog_end=(fog_end : Float32) #

Distance where fog is total. Fog is off when this is not greater than #fog_start.


def fog_start : Float32 #

Distance where fog begins.


def fog_start=(fog_start : Float32) #

Distance where fog begins.


def shadow_bias : Float32 #

Offset that stops surfaces from shadowing themselves ("shadow acne"). Raise it slightly if you see stripes, and lower it if shadows detach from objects.


def shadow_bias=(shadow_bias : Float32) #

Offset that stops surfaces from shadowing themselves ("shadow acne"). Raise it slightly if you see stripes, and lower it if shadows detach from objects.


def shadow_distance : Float32 #

How far from the camera shadows are drawn. Smaller values give sharper shadows.


def shadow_distance=(shadow_distance : Float32) #

How far from the camera shadows are drawn. Smaller values give sharper shadows.


def shadow_size : Int32 #

Shadow map resolution in pixels. Higher is sharper and slower.


def shadow_size=(shadow_size : Int32) #

Shadow map resolution in pixels. Higher is sharper and slower.


def shadows=(shadows : Bool) #

Master switch for shadows.


def shadows? : Bool #

Master switch for shadows.


def sky=(sky : Bool) #

Draw the gradient sky. When off, #background is used.


def sky? : Bool #

Draw the gradient sky. When off, #background is used.


def sky_bottom : Color #

Color below the horizon.


def sky_bottom=(sky_bottom : Color) #

Color below the horizon.


def sky_colors(top : Color, horizon : Color, bottom : Color) : self #

Sets the three sky colors at once. Returns self.


def sky_horizon : Color #

Sky color at the horizon.


def sky_horizon=(sky_horizon : Color) #

Sky color at the horizon.


def sky_top : Color #

Sky color overhead.


def sky_top=(sky_top : Color) #

Sky color overhead.