Verified Commit 206c697f authored by insert's avatar insert

Add additional options.

parent 44818ba7
use byol::render::mesh::{ MeshData, Render };
pub fn cuboid(width: f32, height: f32, length: f32) -> MeshData {
let x0 = - width / 2.0;
let y0 = - height / 2.0;
let z0 = - length / 2.0;
pub fn cuboid(width: f32, height: f32, length: f32, centered: bool) -> MeshData {
let x0 = if centered { - width / 2.0 } else { 0.0 };
let y0 = if centered { - height / 2.0 } else { 0.0 };
let z0 = if centered { - length / 2.0 } else { 0.0 };
let x1 = x0 + width;
let y1 = y0 + height;
......@@ -153,6 +153,6 @@ pub fn cuboid(width: f32, height: f32, length: f32) -> MeshData {
data
}
pub fn cube(s: f32) -> MeshData {
cuboid(s, s, s)
pub fn cube(size: f32, centered: bool) -> MeshData {
cuboid(size, size, size, centered)
}
use byol::render::mesh::{ MeshData, Render };
pub fn plane(width: f32, length: f32) -> MeshData {
let x0 = - width / 2.0;
let z0 = - length / 2.0;
pub fn plane(width: f32, length: f32, centered: bool) -> MeshData {
let x0 = if centered { - width / 2.0 } else { 0.0 };
let z0 = if centered { - length / 2.0 } else { 0.0 };
let x1 = x0 + width;
let z1 = z0 + length;
......
use byol::render::mesh::{ MeshData, Render };
pub fn rect(width: f32, height: f32) -> MeshData {
let x0 = - width / 2.0;
let y0 = - height / 2.0;
pub fn rect(width: f32, height: f32, centered: bool) -> MeshData {
let x0 = if centered { - width / 2.0 } else { 0.0 };
let y0 = if centered { - height / 2.0 } else { 0.0 };
let x1 = x0 + width;
let y1 = y0 + height;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment