Struct three_d::renderer::object::Gm

source ·
pub struct Gm<G: Geometry, M: Material> {
    pub geometry: G,
    pub material: M,
}
Expand description

A combination of a Geometry and a Material which implements Object. Use this to combine any geometry and material into an object that can be used in a render function for example RenderTarget::render. The only requirement is that the geometry provides all the per vertex information (normals, uv coordinates, etc.) that the material requires.

Fields§

§geometry: G

The geometry

§material: M

The material applied to the geometry

Implementations§

source§

impl<G: Geometry, M: Material> Gm<G, M>

source

pub fn new(geometry: G, material: M) -> Self

Creates a new Gm from a geometry and material.

Trait Implementations§

source§

impl<G: Geometry + Clone, M: Material + Clone> Clone for Gm<G, M>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<G: Geometry, M: Material> Deref for Gm<G, M>

§

type Target = G

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<G: Geometry, M: Material> DerefMut for Gm<G, M>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<G: Geometry, M: Material> Geometry for Gm<G, M>

source§

fn draw( &self, camera: &Camera, program: &Program, render_states: RenderStates, attributes: FragmentAttributes )

Draw this geometry.
source§

fn vertex_shader_source( &self, required_attributes: FragmentAttributes ) -> String

Returns the vertex shader source for this geometry given that the fragment shader needs the given vertex attributes.
source§

fn id(&self, required_attributes: FragmentAttributes) -> u16

Returns a unique ID for each variation of the shader source returned from Geometry::vertex_shader_source. Read more
source§

fn render_with_material( &self, material: &dyn Material, camera: &Camera, lights: &[&dyn Light] )

Render the geometry with the given Material. Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method. Use an empty array for the lights argument, if the material does not require lights to be rendered.
source§

fn render_with_effect( &self, material: &dyn Effect, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> )

Render the geometry with the given Effect. Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method. Use an empty array for the lights argument, if the material does not require lights to be rendered.
source§

fn aabb(&self) -> AxisAlignedBoundingBox

Returns the AxisAlignedBoundingBox for this geometry in the global coordinate system.
source§

fn animate(&mut self, time: f32)

For updating the animation of this geometry if it is animated, if not, this method does nothing. The time parameter should be some continious time, for example the time since start.
source§

impl<'a, G: Geometry, M: Material> IntoIterator for &'a Gm<G, M>

§

type Item = &'a dyn Object

The type of the elements being iterated over.
§

type IntoIter = Once<&'a dyn Object>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<G: Geometry, M: Material> Object for Gm<G, M>

source§

fn render(&self, camera: &Camera, lights: &[&dyn Light])

Render the object. Use an empty array for the lights argument, if the objects does not require lights to be rendered. Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method.
source§

fn material_type(&self) -> MaterialType

Returns the type of material applied to this object.

Auto Trait Implementations§

§

impl<G, M> RefUnwindSafe for Gm<G, M>

§

impl<G, M> Send for Gm<G, M>
where G: Send, M: Send,

§

impl<G, M> Sync for Gm<G, M>
where G: Sync, M: Sync,

§

impl<G, M> Unpin for Gm<G, M>
where G: Unpin, M: Unpin,

§

impl<G, M> UnwindSafe for Gm<G, M>
where G: UnwindSafe, M: UnwindSafe,

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> 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> 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> ToOwned for T
where T: Clone,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,