added basic slider for modifying speed
parent
82bdbdd758
commit
f2bb21e569
24
src/main.rs
24
src/main.rs
|
@ -33,20 +33,6 @@ mod model;
|
||||||
mod camera;
|
mod camera;
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
//let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
|
|
||||||
|
|
||||||
// glfw.window_hint(glfw::WindowHint::ContextVersion(3, 3));
|
|
||||||
// glfw.window_hint(glfw::WindowHint::OpenGlProfile(glfw::OpenGlProfileHint::Core));
|
|
||||||
// glfw.window_hint(glfw::WindowHint::OpenGlForwardCompat(true));
|
|
||||||
// glfw.window_hint(glfw::WindowHint::Resizable(false));
|
|
||||||
// glfw.window_hint(glfw::WindowHint::TransparentFramebuffer(false));
|
|
||||||
// glfw.window_hint(glfw::WindowHint::Decorated(true));
|
|
||||||
|
|
||||||
// let (mut window, events) = glfw.create_window(SCR_WIDTH, SCR_HEIGHT, TITLE, glfw::WindowMode::Windowed).unwrap();
|
|
||||||
|
|
||||||
//let (screen_width, screen_height) = window.get_framebuffer_size();
|
|
||||||
|
|
||||||
|
|
||||||
let (gl, shader_version, window, mut events_loop, _context) = {
|
let (gl, shader_version, window, mut events_loop, _context) = {
|
||||||
let sdl = match sdl2::init()
|
let sdl = match sdl2::init()
|
||||||
{
|
{
|
||||||
|
@ -128,7 +114,8 @@ fn main() {
|
||||||
|
|
||||||
|
|
||||||
let time = std::time::Instant::now();
|
let time = std::time::Instant::now();
|
||||||
|
let mut spinSpeed = 1.0;
|
||||||
|
let mut current_rad = 1.0;
|
||||||
let projection: Matrix4<f32> = perspective(Deg(45.0), SCR_WIDTH as f32/ SCR_HEIGHT as f32, 0.1, 100.0);
|
let projection: Matrix4<f32> = perspective(Deg(45.0), SCR_WIDTH as f32/ SCR_HEIGHT as f32, 0.1, 100.0);
|
||||||
println!("entering main loop");
|
println!("entering main loop");
|
||||||
// NOTE main loop here
|
// NOTE main loop here
|
||||||
|
@ -136,7 +123,7 @@ fn main() {
|
||||||
let currentFrame = time.elapsed().as_secs_f32();
|
let currentFrame = time.elapsed().as_secs_f32();
|
||||||
deltaTime = currentFrame - lastFrame;
|
deltaTime = currentFrame - lastFrame;
|
||||||
lastFrame = currentFrame;
|
lastFrame = currentFrame;
|
||||||
|
current_rad += spinSpeed/15.0;
|
||||||
|
|
||||||
unsafe{
|
unsafe{
|
||||||
gl.enable(glow::DEPTH_TEST);
|
gl.enable(glow::DEPTH_TEST);
|
||||||
|
@ -150,8 +137,9 @@ fn main() {
|
||||||
ourshader.setMat4("view", &view);
|
ourshader.setMat4("view", &view);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let mut model: Matrix4<f32> = Matrix4::from_axis_angle(vec3(0.0, -1.0, 0.0).normalize(),
|
let mut model: Matrix4<f32> = Matrix4::from_axis_angle(vec3(0.0, -1.0, 0.0).normalize(),
|
||||||
cgmath::Rad(time.elapsed().as_secs_f32()));
|
cgmath::Rad(current_rad));
|
||||||
model = model * Matrix4::from_scale(0.2);
|
model = model * Matrix4::from_scale(0.2);
|
||||||
ourshader.setMat4("model", &model);
|
ourshader.setMat4("model", &model);
|
||||||
|
|
||||||
|
@ -169,7 +157,7 @@ fn main() {
|
||||||
.build(|| {
|
.build(|| {
|
||||||
ui.text("you serve no purpose in life");
|
ui.text("you serve no purpose in life");
|
||||||
ui.text("Your Purpose in life is to suck my dick");
|
ui.text("Your Purpose in life is to suck my dick");
|
||||||
|
ui.slider("The Spin Speed", 0.1, 10.0, &mut spinSpeed);
|
||||||
});
|
});
|
||||||
|
|
||||||
let draw_data = imgui.render();
|
let draw_data = imgui.render();
|
||||||
|
|
Loading…
Reference in New Issue