Struct gfx_draping::DrapingRenderer [] [src]

pub struct DrapingRenderer<R: Resources> { /* fields omitted */ }

Drives graphics operations.

This struct contains the shaders and stencil operations necessary to render draped polygons onto a terrain.

Methods

impl<R: Resources> DrapingRenderer<R>
[src]

[src]

Set up the pipeline state objects needed for rendering draped polygons.

[src]

Render polygons in buffer using indices to choose the polygons.

The depth buffer in depth_stencil_target should contain the depth values of your terrain -- in other words, draw your terrain just before you call this function, and make sure you don't clear the buffer until after rendering all the polygons you wish to draw.

In addition, the stencil buffer should be cleared to zero before calling this function. The stencil buffer is guaranteed to remain zero after each call, so there is no need to clear the stencil buffer between calls to this function.

mvp should be a model-view-projection matrix. You probably want to use a different mvp than what you're normally using. The polygons will only render onto terrain with z-values between 0 and 1; you should apply a transformation to alter these z-bounds. For example, if your terrain is bounded in height between z_min and z_max, your mvp use you from this library might be constructed as:

This code doesn't compile so be extra careful!
// With the relevant imports, this is working code when using the `cgmath` crate.

let translate_z = Matrix4::from_translation([0.0, 0.0, min_z].into());
let stretch_z = Matrix4::from_nonuniform_scale(1.0, 1.0, max_z - min_z);
let draping_mvp = usual_mvp * translate_z * stretch_z;

Trait Implementations

impl<R: Clone + Resources> Clone for DrapingRenderer<R>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<R: Debug + Resources> Debug for DrapingRenderer<R>
[src]

[src]

Formats the value using the given formatter.