Skip to content

Instantly share code, notes, and snippets.

@seanjensengrey
Created April 9, 2018 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanjensengrey/c85582b6b2802eb5db00ccb28224c095 to your computer and use it in GitHub Desktop.
Save seanjensengrey/c85582b6b2802eb5db00ccb28224c095 to your computer and use it in GitHub Desktop.
kiss3d rotating cubes
extern crate kiss3d;
extern crate nalgebra as na;
use na::{Vector3, UnitQuaternion};
use kiss3d::window::Window;
use kiss3d::light::Light;
fn main() {
let mut window = Window::new("Kiss3d: cube");
let mut c = window.add_cube(1.0, 1.0, 1.0);
let mut d = window.add_cube(1.0, 2.0, 0.5);
c.set_color(1.0, 0.3, 0.0);
d.set_color(0.0, 0.1, 1.0);
window.set_light(Light::StickToCamera);
let rot = UnitQuaternion::from_axis_angle(&Vector3::y_axis(), 0.014);
let rot2 = UnitQuaternion::from_axis_angle(&Vector3::x_axis(), 0.025);
while window.render() {
c.prepend_to_local_rotation(&rot);
d.prepend_to_local_rotation( &rot2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment