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 render_pass. The only requirement is that the geometry provides all the per vertex information (normals, uv coordinates, etc.) that the material requires.
Fields
geometry: GThe geometry
material: MThe material applied to the geometry
Implementations
sourceimpl Gm<Mesh, M>
impl Gm<Mesh, M>
sourcepub fn new(context: &Context, cpu_mesh: &CpuMesh) -> ThreeDResult<Self>
pub fn new(context: &Context, cpu_mesh: &CpuMesh) -> ThreeDResult<Self>
Creates a new 3D model with a Mesh as geometry and a default ColorMaterial.
sourceimpl<M: Material> Gm<Mesh, M>
impl<M: Material> Gm<Mesh, M>
sourcepub fn new_with_material(
context: &Context,
cpu_mesh: &CpuMesh,
material: M
) -> ThreeDResult<Self>
pub fn new_with_material(
context: &Context,
cpu_mesh: &CpuMesh,
material: M
) -> ThreeDResult<Self>
Creates a new 3D model with a Mesh as geometry and the given material.
sourceimpl Gm<InstancedMesh, M>
impl Gm<InstancedMesh, M>
sourcepub fn new(
context: &Context,
instances: &[Instance],
cpu_mesh: &CpuMesh
) -> ThreeDResult<Self>
pub fn new(
context: &Context,
instances: &[Instance],
cpu_mesh: &CpuMesh
) -> ThreeDResult<Self>
Creates a new instanced 3D model with a triangle mesh as geometry and a default ColorMaterial. The model is rendered in as many instances as there are Instance structs given as input. The transformation and texture transform in Instance are applied to each model instance before they are rendered.
sourceimpl<M: Material> Gm<InstancedMesh, M>
impl<M: Material> Gm<InstancedMesh, M>
sourcepub fn new_with_material(
context: &Context,
instances: &[Instance],
cpu_mesh: &CpuMesh,
material: M
) -> ThreeDResult<Self>
pub fn new_with_material(
context: &Context,
instances: &[Instance],
cpu_mesh: &CpuMesh,
material: M
) -> ThreeDResult<Self>
Trait Implementations
sourceimpl<G: Geometry, M: Material> Geometry for Gm<G, M>
impl<G: Geometry, M: Material> Geometry for Gm<G, M>
sourcefn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
Returns the AxisAlignedBoundingBox for this geometry in the global coordinate system. Read more
sourcefn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
) -> ThreeDResult<()>
fn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
) -> ThreeDResult<()>
Render the geometry with the given material.
Must be called in a render target render function,
for example in the callback function of Screen::write.
You can use an empty array for the lights argument, if you know the object does not require lights to be rendered. Read more
sourceimpl<G: Geometry, M: Material> Object for Gm<G, M>
impl<G: Geometry, M: Material> Object for Gm<G, M>
sourcefn render(&self, camera: &Camera, lights: &[&dyn Light]) -> ThreeDResult<()>
fn render(&self, camera: &Camera, lights: &[&dyn Light]) -> ThreeDResult<()>
Render the object.
Must be called in a render target render function,
for example in the callback function of Screen::write.
You can use an empty array for the lights argument, if you know the object does not require lights to be rendered. Read more
sourcefn is_transparent(&self) -> bool
fn is_transparent(&self) -> bool
Returns whether or not this object should be considered transparent. Read more
Auto Trait Implementations
impl<G, M> RefUnwindSafe for Gm<G, M> where
G: RefUnwindSafe,
M: RefUnwindSafe,
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more