Struct nannou::draw::Draw [−][src]
A simple API for drawing 2D and 3D graphics.
Draw provides a simple way to compose together geometric primitives and text (TODO) with custom colours and textures and draw them to the screen.
You can also ask Draw for the sequence of vertices or triangles (with or without colours/textures) that make up the entire scene that you have created.
Internally Draw uses a geom::Graph for placing geometry and text in 3D space.
Draw has 2 groups of methods:

Creation: These methods compose new geometry and text with colours and textures.

Rendering: These methods provide ways of rendering the graphics either directly to the frame for the current display or to a list of vertices or triangles for lowerlevel, more flexible access.
See the simple_draw.rs example for a demonstration of how to use the App's custom Draw type.
Methods
impl<S> Draw<S> where
S: BaseFloat,
[src]
impl<S> Draw<S> where
S: BaseFloat,
pub fn new() > Self
[src]
pub fn new() > Self
Create a new Draw instance.
This is the same as calling Draw::default.
pub fn reset(&self)
[src]
pub fn reset(&self)
Resets all state within the Draw
instance.
pub fn background(&self) > Background<S>
[src]
pub fn background(&self) > Background<S>
Specify a color with which the background should be cleared.
pub fn a<T>(&self, primitive: T) > Drawing<T, S> where
T: IntoDrawn<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
[src]
pub fn a<T>(&self, primitive: T) > Drawing<T, S> where
T: IntoDrawn<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
Add the given type to be drawn.
pub fn ellipse(&self) > Drawing<Ellipse<S>, S>
[src]
pub fn ellipse(&self) > Drawing<Ellipse<S>, S>
Begin drawing an Ellipse.
pub fn line(&self) > Drawing<Line<S>, S>
[src]
pub fn line(&self) > Drawing<Line<S>, S>
Begin drawing a Line.
pub fn quad(&self) > Drawing<Quad<S>, S>
[src]
pub fn quad(&self) > Drawing<Quad<S>, S>
Begin drawing a Quad.
pub fn rect(&self) > Drawing<Rect<S>, S>
[src]
pub fn rect(&self) > Drawing<Rect<S>, S>
Begin drawing a Rect.
pub fn tri(&self) > Drawing<Tri<S>, S>
[src]
pub fn tri(&self) > Drawing<Tri<S>, S>
Begin drawing a Triangle.
pub fn polygon(&self) > Drawing<Pointless, S>
[src]
pub fn polygon(&self) > Drawing<Pointless, S>
Begin drawing a Polygon.
pub fn mesh(&self) > Drawing<Vertexless, S>
[src]
pub fn mesh(&self) > Drawing<Vertexless, S>
Begin drawing a Mesh.
pub fn polyline(&self) > Drawing<Vertexless, S>
[src]
pub fn polyline(&self) > Drawing<Vertexless, S>
Begin drawing a Polyline.
pub fn node_vertices(&self, n: Index) > Option<NodeVertices<S>>
[src]
pub fn node_vertices(&self, n: Index) > Option<NodeVertices<S>>
Produce the transformed mesh vertices for the node at the given index.
Returns None if there is no node for the given index.
pub fn node_triangles(&self, n: Index) > Option<NodeTriangles<S>>
[src]
pub fn node_triangles(&self, n: Index) > Option<NodeTriangles<S>>
Produce the transformed triangles for the node at the given index.
Note: If the node's Drawing was still in progress, it will first be finished and inserted into the mesh and geometry graph before producing the triangles iterator.
ⓘImportant traits for RawVertices<'a, S>pub fn raw_vertices(&self) > RawVertices<S>
[src]
pub fn raw_vertices(&self) > RawVertices<S>
Produce an iterator yielding all vertices from the inner mesh transformed via the inner geometry graph.
This method ignores the mesh indices buffer and instead produces the vertices "raw".
Note: If there are any Drawings in progress, these will first be drained and completed before any vertices are yielded.
ⓘImportant traits for Vertices<'a, S>pub fn vertices(&self) > Vertices<S>
[src]
pub fn vertices(&self) > Vertices<S>
Produce an iterator yielding all indexed vertices from the inner mesh transformed via the inner geometry graph.
Vertices are yielded in depthfirstorder of the geometry graph nodes from which they are produced.
Note: If there are any Drawings in progress, these will first be drained and completed before any vertices are yielded.
pub fn triangles(&self) > Triangles<S>
[src]
pub fn triangles(&self) > Triangles<S>
Produce an iterator yielding all triangles from the inner mesh transformed via the inner geometry graph.
Triangles are yielded in depthfirstorder of the geometry graph nodes from which they are produced.
Note: If there are any Drawings in progress, these will first be drained and completed before any vertices are yielded.
pub fn inner_mesh(&self) > Ref<Mesh<S>>
[src]
pub fn inner_mesh(&self) > Ref<Mesh<S>>
Borrow the Draw's inner Mesh.
pub fn untransformed_dimension_of<F>(
&self,
n: &Index,
point_axis: &F
) > Option<S> where
F: Fn(&Point<S>) > S,
[src]
pub fn untransformed_dimension_of<F>(
&self,
n: &Index,
point_axis: &F
) > Option<S> where
F: Fn(&Point<S>) > S,
The length of the untransformed node at the given index along the axis returned by the
given point_axis
function.
pub fn untransformed_x_dimension_of(&self, n: &Index) > Option<S>
[src]
pub fn untransformed_x_dimension_of(&self, n: &Index) > Option<S>
The length of the untransformed node at the given index along the x axis.
pub fn untransformed_y_dimension_of(&self, n: &Index) > Option<S>
[src]
pub fn untransformed_y_dimension_of(&self, n: &Index) > Option<S>
The length of the untransformed node at the given index along the y axis.
pub fn untransformed_z_dimension_of(&self, n: &Index) > Option<S>
[src]
pub fn untransformed_z_dimension_of(&self, n: &Index) > Option<S>
The length of the untransformed node at the given index along the y axis.
pub fn untransformed_dimensions_of(&self, n: &Index) > Option<Vector3<S>>
[src]
pub fn untransformed_dimensions_of(&self, n: &Index) > Option<Vector3<S>>
Determine the raw, untransformed dimensions of the node at the given index.
Returns None
if their is no node within the geom::Graph for the given index or if
the node has not yet been Drawn.
pub fn dimension_of<F>(&self, n: &Index, point_axis: &F) > Option<S> where
F: Fn(&Point<S>) > S,
[src]
pub fn dimension_of<F>(&self, n: &Index, point_axis: &F) > Option<S> where
F: Fn(&Point<S>) > S,
The length of the transformed node at the given index along the axis returned by the given
point_axis
function.
pub fn x_dimension_of(&self, n: &Index) > Option<S>
[src]
pub fn x_dimension_of(&self, n: &Index) > Option<S>
The length of the transformed node at the given index along the x axis.
pub fn y_dimension_of(&self, n: &Index) > Option<S>
[src]
pub fn y_dimension_of(&self, n: &Index) > Option<S>
The length of the transformed node at the given index along the y axis.
pub fn z_dimension_of(&self, n: &Index) > Option<S>
[src]
pub fn z_dimension_of(&self, n: &Index) > Option<S>
The length of the transformed node at the given index along the z axis.
pub fn finish_remaining_drawings(&self) > Result<(), WouldCycle<S>>
[src]
pub fn finish_remaining_drawings(&self) > Result<(), WouldCycle<S>>
Drain any remaining drawing
s, convert them to their Drawn state and insert them into
the inner mesh and geometry graph.
Trait Implementations
impl<S: Clone> Clone for Draw<S> where
S: BaseFloat,
[src]
impl<S: Clone> Clone for Draw<S> where
S: BaseFloat,
fn clone(&self) > Draw<S>
[src]
fn clone(&self) > Draw<S>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copyassignment from source
. Read more
impl<S: Debug> Debug for Draw<S> where
S: BaseFloat,
[src]
impl<S: Debug> Debug for Draw<S> where
S: BaseFloat,
fn fmt(&self, f: &mut Formatter) > Result
[src]
fn fmt(&self, f: &mut Formatter) > Result
Formats the value using the given formatter. Read more
impl<S> Default for Draw<S> where
S: BaseFloat,
[src]
impl<S> Default for Draw<S> where
S: BaseFloat,