slice removal
This commit is contained in:
parent
4cfa230985
commit
650ccf6ab4
1 changed files with 18 additions and 4 deletions
22
src/main.rs
22
src/main.rs
|
@ -58,7 +58,10 @@ fn main() {
|
|||
let mut yrot: f32 = 0.0;
|
||||
let mut zrot: f32 = 0.0;
|
||||
|
||||
let mut draw_gl = || {
|
||||
|
||||
let mut slices: [f32; 7] = [-1.0;7];
|
||||
|
||||
let mut draw_gl = |slices: &mut [f32; 7]| {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glLoadIdentity();
|
||||
|
||||
|
@ -71,13 +74,21 @@ fn main() {
|
|||
|
||||
glTranslatef(0.0, 0.0, -1.0);
|
||||
|
||||
for i in 0..=6 {
|
||||
for i in 0..7 {
|
||||
glPushMatrix();
|
||||
glTranslatef(0., -1.0, 1.0);
|
||||
glRotatef(2970. * i as f32, 0.0, 1.0, 0.0);
|
||||
glTranslatef(0., 1.0, -1.0);
|
||||
if slices[i] != -1. {
|
||||
slices[i] += 0.01;
|
||||
slices[i] *= 1.4;
|
||||
glTranslatef(slices[i], 0.-slices[i]/2.0, 0.);
|
||||
}
|
||||
glScalef(1., 0.4, 1.);
|
||||
slice(tex_exterior, tex_top, tex_interior, false);
|
||||
let edges = slices[i] != -1.
|
||||
|| slices[(i+1)%7] != -1.
|
||||
|| slices[(i+6)%7] != -1.;
|
||||
slice(tex_exterior, tex_top, tex_interior, edges);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -94,6 +105,9 @@ fn main() {
|
|||
println!("Start pressed! Quitting...");
|
||||
done = true;
|
||||
}
|
||||
if ((*state).buttons & maple::controller::CONT_A) != 0 {
|
||||
slices[0] = 0.0;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -101,7 +115,7 @@ fn main() {
|
|||
break;
|
||||
}
|
||||
|
||||
draw_gl();
|
||||
draw_gl(&mut slices);
|
||||
|
||||
glKosSwapBuffers();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue