Skip to main content

Module scene

Module scene 

Source
Expand description

Raytraced braille scenes.

Provides vector math, an orbit camera, and a rasterizer. Deterministic CPU ray tracing packed into braille terminal cells.

[PathTracer] combines analytic [Primitive] geometry, an owning [Bvh], principled [Material]s, analytic lights, and bounded indirect transport. It traces shadows, GGX reflections, dielectric refraction, emissive surfaces, and environment illumination without per-ray allocation. Implement [Trace] directly when a procedural scene needs custom shading or animation; [rasterize] accepts either form.

§Example

use omp_tui::scene::{self, Light, Material, Object, PathTracer, Sphere, Vec3, World, vec3};

let world = World::new(vec![Object::new(
	Sphere::new(Vec3::ZERO, 1.0),
	Material::diffuse(Vec3::rgb(56, 189, 248)),
)])
.with_light(Light::directional(vec3(-1.0, -1.0, -1.0), Vec3::ONE, 2.0))
.with_environment(Vec3::rgb(5, 7, 12));
let tracer = PathTracer::new(world);
let mut lit = 0;
scene::rasterize(&tracer, &Default::default(), 20, 8, |_, _, _, _| lit += 1);
assert!(lit > 0);

Structs§

Aabb
An axis-aligned bounding box represented by inclusive minimum and maximum corners.
Bvh
An owning bounding-volume hierarchy over scene objects.
Camera
An orbit camera: a position on a sphere around target, looking at it.
Disk
A circular disk in an arbitrarily oriented plane.
GeometryHit
Geometry-local intersection data before a material and face orientation are applied.
Hit
A fully oriented scene intersection borrowing its object’s material.
Integrator
Path-transport limits and deterministic sampling configuration.
Material
Compact physically based surface parameters in linear color space.
Object
A scene primitive paired with its surface material.
PathTracer
Deterministic CPU path tracer over an owned World.
Quad
A finite parallelogram spanned from one corner by two edge vectors.
Ray
One camera ray: origin + dir * t, with dir unit length.
Sphere
An analytic sphere.
Vec3
A 3-component f32 vector used for points, directions, and linear colors.
World
Geometry, analytic lights, and the linear radiance seen by rays that miss.

Enums§

Light
An analytic light evaluated without sampling noise.
Primitive
Common geometry stored inline, with a boxed fallback for user-defined shapes.

Traits§

Geometry
A bounded, thread-safe ray-intersectable shape.
Trace
A raytraced scene: per-frame state plus a shader for every ray.

Functions§

rasterize
Traces scene through camera into a cols × rows grid of braille cells with 2× supersampling.
vec3
Shorthand Vec3 constructor.