Skip to main content

MeshSurface

Struct MeshSurface 

Source
pub struct MeshSurface {
    pub mesh: Arc<Mesh>,
    pub transform: Mat4,
    pub material: Material,
    pub casts_shadow: bool,
    pub solid: bool,
}
Expand description

A composable’s content drawn on a mesh placed in a scene.

Fields§

§mesh: Arc<Mesh>

The mesh the content is drawn on.

§transform: Mat4

Places the mesh in the scene.

§material: Material

How the content meets the scene’s light and what lies behind it.

§casts_shadow: bool

Whether the surface casts a shadow from the scene’s light. Every lit and unlit surface takes the shadows that fall on it.

§solid: bool

Whether an eye that walks into the surface (see EyeWorld::walk) stops there. A doorway in the surface’s content lets it through.

Implementations§

Source§

impl MeshSurface

Source

pub fn cast(&self, ray: Ray, size: Size) -> Option<SurfaceHit>

The content of a composable of size on the mesh: the content point where the ray meets the mesh, the triangle it meets, and how far along the ray.

Source

pub fn cast_plane(&self, ray: Ray, triangle: u32, size: Size) -> Option<Point>

The content point of a composable of size where the ray meets the plane of triangle: a drag that leaves the mesh’s edge goes on along it.

Source

pub fn content_transform( &self, camera: &Camera, viewport: Size, size: Size, ) -> Option<ProjectiveTransform>

The projective map that carries the content of a composable of size from the mesh to the bounds of viewport that camera shows. It is exact for a flat mesh; for a curved one it follows the plane that touches the mesh at the content’s middle. It sends the part nearer than the camera’s near plane to w below NEAR_PLANE, which ProjectiveTransform::front_polygon cuts away. None for content of no size, or for a mesh with no texture plane.

Source

pub fn content_to_scene(&self, size: Size) -> Option<Mat4>

The map from the content space of a composable of size on the mesh into the scene: x and y in the content’s pixels from its top left, z into the surface, away from the side it shows its content to, a unit as long as a content pixel. A mesh surface inside this content is placed in that space. It is exact for a flat mesh; for a curved one it follows the plane that touches the mesh at the content’s middle. None for content of no size, or for a mesh with no texture plane.

Source

pub fn placed_by(&self, to_scene: &Mat4) -> MeshSurface

This surface with its transform followed by to_scene: a surface inside another’s content, placed in the scene through the other’s content_to_scene. Glass keeps its thickness in the units of the space it is placed from.

Source

pub fn point_at(&self, point: Point, size: Size) -> Option<Vec3>

Where the content point point of a composable of size lies in the scene.

Trait Implementations§

Source§

impl Clone for MeshSurface

Source§

fn clone(&self) -> MeshSurface

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MeshSurface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for MeshSurface

Source§

fn eq(&self, other: &MeshSurface) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MeshSurface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> LayoutData for T
where T: Any + Debug + PartialEq,

Source§

fn same_as(&self, other: &(dyn LayoutData + 'static)) -> bool

Whether other holds the same data, so a parent can keep its last measure.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

The data as Any, to read it by its type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.