Created
April 9, 2018 05:01
-
-
Save seanjensengrey/c85582b6b2802eb5db00ccb28224c095 to your computer and use it in GitHub Desktop.
kiss3d rotating cubes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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