[][src]Trait libraymarcher::SceneObject

pub trait SceneObject<C> {
    fn distance_to(&self, point: Vec3, t: f64) -> f64;
fn get_color(&self, t: f64) -> C; fn normal(&self, p: Vec3, t: f64) -> Vec3 { ... } }

Represents something that has a distance field (through SceneObject::distance_to)

Required methods

fn distance_to(&self, point: Vec3, t: f64) -> f64

The distance from point to the nearest surface of the object.

Also allows input of t, the varied animation parameter

fn get_color(&self, t: f64) -> C

The color of this object. May be useful if there are multiple objects in the scene with different colors.

Loading content...

Provided methods

fn normal(&self, p: Vec3, t: f64) -> Vec3

Calculates the normal by finding the gradient of the distance field. This may be overridden if a more efficient implementation is available for a specific SceneObject.

Loading content...

Implementors

impl<C: Color> SceneObject<C> for Julia<C>[src]

impl<C: Color> SceneObject<C> for Sphere<C>[src]

fn distance_to(&self, point: Vec3, _: f64) -> f64[src]

TODO: This is messed up, fix for modular raymarching...

Loading content...