shadows.py

lunaengine/graphics/shadows.py

Simple shadow system: data management + CPU‑based projected shadows.

class LightType

Description

No documentation

Attributes
POINT: Any = 'point'
DIRECTIONAL: Any = 'directional'
Methods

No methods defined.

class LightShape

Description

No documentation

Attributes
CIRCLE: Any = 'circle'
RECTANGLE: Any = 'rectangle'
CONE: Any = 'cone'
Methods

No methods defined.

class ShadowType

Description

No documentation

Attributes
TRANSLUCENT: Any = 'translucent'
OPAQUE: Any = 'opaque'
BLUR: Any = 'blur'
Methods

No methods defined.

class ShadowShape

Description

No documentation

Attributes
CIRCLE: Any = 'circle'
RECTANGLE: Any = 'rectangle'
CONE: Any = 'cone'
POLYGON: Any = 'polygon'
Methods

No methods defined.

class Light

Description

Light source that can cast shadows.

Methods
def __init__(self: Any, light_type: LightType, position: Tuple[float, float], color: Tuple[float, float, float] = (1.0, 1.0, 1.0), intensity: float = 1.0, range: float = 10.0, cast_shadows: bool = True) -> Any
No documentation

class ShadowCaster

Description

An object that can cast shadows.

Methods
def __init__(self: Any, vertices: List[Tuple[float, float]], position: Tuple[float, float] = (0, 0), visible: bool = True) -> Any
No documentation

class ShadowSystem

Description

Manages lights and casters, and renders simple projected shadows.

Methods
def __init__(self: Any) -> Any
No documentation
def add_light(self: Any, light: Light) -> Any
No documentation
def remove_light(self: Any, light: Light) -> Any
No documentation
def clear_lights(self: Any) -> Any
No documentation
def add_caster(self: Any, caster: ShadowCaster) -> Any
No documentation
def remove_caster(self: Any, caster: ShadowCaster) -> Any
No documentation
def clear_casters(self: Any) -> Any
No documentation
def add_rectangle_caster(self: Any, x: float, y: float, width: float, height: float) -> ShadowCaster
Create a rectangular caster (centered at x,y).
def add_circle_caster(self: Any, x: float, y: float, radius: float, segments: int = 16) -> ShadowCaster
Create a circular caster approximated by a polygon.
def add_point_light(self: Any, x: float, y: float, color: Any = (1, 1, 1), intensity: Any = 1.0, range: Any = 100.0) -> Light
Helper to create a point light.
def add_directional_light(self: Any, color: Any = (1, 1, 1), intensity: Any = 1.0, range: Any = 500.0, *args: tuple, **kwargs: dict) -> Light
Helper to create a directional light (simulated with a distant point).
def render_shadows_simple(self: Any, renderer: Any, camera: Any) -> Any
Draw simple projected shadows for all lights and casters.

Args:
   renderer: The OpenGLRenderer instance.
   camera: The camera (to convert world to screen).
def apply_lighting(self: Any, renderer: Any, camera: Any, ambient: float = 0.2, light_power: float = 1.0, saturation: float = 0.5) -> Any
Darken areas outside any light's range and brighten areas inside lights.

Args:
   renderer: The OpenGLRenderer instance.
   camera: The camera (to convert world to screen).
   ambient: Base brightness of unlit areas (0.0 = pitch black, 1.0 = fully bright).
   light_power: Overall brightness multiplier for lights (higher = brighter).
   saturation: How much the light's color affects the scene (0.0 = white light only,
               1.0 = full color). Values between 0 and 1 mix the light color with white.
def get_stats(self: Any) -> Any
Return simple statistics.
Back to Graphics Module