1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Prefabricated shapes for the Glium OpenGL library.
//!
//! # Building a shape
//!
//! Each shape is constructed using a builder object. The builder objects allow us
//! to customise the resultant shape.
//!
//! In the following example, we use a `CuboidBuilder` to construct a 2x3x4 `Cuboid`
//! with its base at the origin:
//!
//! ```ignore
//! let cuboid = glium_shapes::cuboid::CuboidBuilder::new()
//!              .translate(0.0, 0.5, 0.0)
//!              .scale(2.0, 3.0, 4.0)
//!              .build(display)
//!              .expect("Failed to build cuboid shape");
//! ```
//!
//! # Drawing a shape
//!
//! All of the shapes provided in this library are a source of both vertices and
//! indices, such that you can pass them directly to the `glium::Surface::draw` method
//! like so:
//!
//! ```ignore
//! frame.draw(/*vertices=*/&cuboid, /*indices=*/&cuboid, program, uniforms, params);
//! ```
//!
//! The shader program, uniform buffers, and draw parameters are not provided by this library.

#[macro_use]
extern crate approx;

#[macro_use]
extern crate glium;

pub mod axes;
pub mod cuboid;
pub mod errors;
pub mod quad;
pub mod sphere;
pub mod vertex;