Struct three_d::renderer::object::Model[][src]

pub struct Model<M: ForwardMaterial> {
    pub cull: Cull,
    pub material: M,
    // some fields omitted
}
Expand description

A 3D model consisting of a triangle mesh and any material that implements the ForwardMaterial trait.

Fields

cull: Cull
👎 Deprecated:

set in render states on material instead

material: M

The material applied to the model

Implementations

Creates a new 3D model with a triangle mesh as geometry and a default ColorMaterial.

Creates a new 3D model with a triangle mesh as geometry and the given material.

👎 Deprecated:

Use ‘render_forward’ instead

Render the mesh with a color per triangle vertex. The colors are defined when constructing the mesh and are assumed to be in gamma color space (sRGBA). Must be called in a render target render function, for example in the callback function of Screen::write. Will render the model transparent if the colors contain alpha values below 255, you only need to render the model after all solid models.

Errors

Will return an error if the mesh has no colors.

👎 Deprecated:

Use ‘render_forward’ instead

Render the mesh with the given color. The color is assumed to be in gamma color space (sRGBA). Must be called in a render target render function, for example in the callback function of Screen::write. Will render the model transparent if the color contains an alpha value below 255, you only need to render the model after all solid models.

👎 Deprecated:

Use ‘render_forward’ instead

Render the uv coordinates of the mesh in red (u) and green (v) for debug purposes. Must be called in a render target render function, for example in the callback function of Screen::write.

Errors

Will return an error if the mesh has no uv coordinates.

👎 Deprecated:

Use ‘render_forward’ instead

Render the normals of the mesh for debug purposes. Must be called in a render target render function, for example in the callback function of Screen::write.

Errors

Will return an error if the mesh has no normals.

👎 Deprecated:

Use ‘render_forward’ instead

Render the mesh with the given texture which is assumed to be in sRGB color space with or without an alpha channel. Must be called in a render target render function, for example in the callback function of Screen::write. Will render the model transparent if the texture contain an alpha channel (ie. the format is Format::RGBA), you only need to render the model after all solid models.

Errors

Will return an error if the mesh has no uv coordinates.

👎 Deprecated:

Use ‘render_forward’ instead

Render the depth (scaled such that a value of 1 corresponds to max_depth) into the red channel of the current color render target which for example is used for picking. Must be called in a render target render function, for example in the callback function of Screen::write.

👎 Deprecated:

Use ‘render_forward’ instead

Render only the depth into the current depth render target which is useful for shadow maps or depth pre-pass. Must be called in a render target render function, for example in the callback function of Screen::write.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the AxisAlignedBoundingBox for this geometry. Read more

Returns the local to world transformation applied to this geometry. Read more

Set the local to world transformation applied to this geometry. Read more

Render the object. Must be called in a render target render function, for example in the callback function of Screen::write. You can use Lights::default() if you know the object does not require lights to be rendered. Read more

Returns whether or not this object should be considered transparent. Read more

Render the object 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 Lights::default() if you know the material does not require lights. Read more

Render the geometry and surface material parameters of the object. Should usually not be called directly but used in DeferredPipeline::geometry_pass. Read more

👎 Deprecated:

Use ‘render_forward’ instead

Render the object shaded with the given lights using physically based rendering (PBR). Must be called in a render target render function, for example in the callback function of Screen::write. Will render transparent if the material contain an albedo color with alpha value below 255 or if the albedo texture contain an alpha channel (ie. the format is Format::RGBA), you only need to render the model after all solid models. Read more

👎 Deprecated:

Use ‘render_deferred’ instead

Render the geometry and surface material parameters of the object. Should not be called directly but used in a deferred render pass. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more