struct
Scene
pub struct Scene {
pub camera: Camera,
pub light: Light,
pub point_lights: Vec<PointLight>,
pub spot_lights: Vec<SpotLight>,
pub objects: Vec<Object3D>,
pub particles: Vec<ParticleField>,
pub background: Color,
pub fog: f32,
pub backdrop: Option<String>,
pub backdrop_colors: Vec<Color>,
pub backdrop_intensity: f32,
pub backdrop_speed: f32,
}A 3D scene: its camera, lights, objects and backdrop.
Fields
Methods
has_shadows
pub fn has_shadows(&self) -> boolWhether any light casts shadows onto anything: some light has shadows on, and some object casts them.
is_animated
pub fn is_animated(&self) -> boolWhether rendering changes over time (so the host must animate it).
project
pub fn project(&self, point: Vec3, width: f32, height: f32) -> Option<(f32, f32)>Project a world-space point to viewport pixels (None if behind the camera).
screen_bounds
pub fn screen_bounds(&self, index: usize, width: f32, height: f32) -> Option<Rect>Screen-space bounding box of object index.
screen_bounds_at
pub fn screen_bounds_at(&self, index: usize, width: f32, height: f32, t: f32) -> Option<Rect>[Scene::screen_bounds] as drawn at t seconds (spin, float, motion tweens).
hit_test_at
pub fn hit_test_at(&self, x: f32, y: f32, width: f32, height: f32, t: f32) -> Option<usize>The nearest object under the pixel, as drawn at t seconds.
hit_test
pub fn hit_test(&self, x: f32, y: f32, width: f32, height: f32) -> Option<usize>The nearest object whose screen bounds contain the pixel.