Compare commits
No commits in common. "c31e7cb1ec52e9a2b1c70f117e3eddd55343a59b" and "a40ba662093b87c606eeda2ae20ac98854937c6b" have entirely different histories.
c31e7cb1ec
...
a40ba66209
|
|
@ -30,11 +30,11 @@ impl<S: Copy> DragCtl<S> {
|
||||||
pub fn on_button(&mut self, pos: Vec2, state: ElementState) {
|
pub fn on_button(&mut self, pos: Vec2, state: ElementState) {
|
||||||
match state {
|
match state {
|
||||||
ElementState::Pressed => {
|
ElementState::Pressed => {
|
||||||
if self.ctl.is_none() {
|
assert!(self.ctl.is_none());
|
||||||
self.ctl = Some((pos, self.state));
|
self.ctl = Some((pos, self.state));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ElementState::Released => {
|
ElementState::Released => {
|
||||||
|
assert!(self.ctl.is_some());
|
||||||
self.ctl = None;
|
self.ctl = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,35 +60,23 @@ fn main() {
|
||||||
let indices = glium::index::NoIndices(glium::index::PrimitiveType::LineLoop);
|
let indices = glium::index::NoIndices(glium::index::PrimitiveType::LineLoop);
|
||||||
let shape = vec![
|
let shape = vec![
|
||||||
Vertex {
|
Vertex {
|
||||||
position: [0., 0., 0.],
|
position: [-1., 0., 4.],
|
||||||
},
|
},
|
||||||
Vertex {
|
Vertex {
|
||||||
position: [1., 0., 0.],
|
position: [0., -1., 4.],
|
||||||
},
|
},
|
||||||
Vertex {
|
Vertex {
|
||||||
position: [0., 0., 0.],
|
position: [1., 0., 4.],
|
||||||
},
|
},
|
||||||
Vertex {
|
Vertex {
|
||||||
position: [0., 1., 0.],
|
position: [0., 1., 4.],
|
||||||
},
|
|
||||||
Vertex {
|
|
||||||
position: [0., 0., 0.],
|
|
||||||
},
|
|
||||||
Vertex {
|
|
||||||
position: [0., 0., 1.],
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let vertex_buffer = VertexBuffer::new(&display, &shape).unwrap();
|
let vertex_buffer = VertexBuffer::new(&display, &shape).unwrap();
|
||||||
|
|
||||||
let rot = Quat::from_euler(
|
|
||||||
glam::EulerRot::YXZ,
|
|
||||||
std::f32::consts::FRAC_PI_4,
|
|
||||||
std::f32::consts::FRAC_PI_6,
|
|
||||||
0.,
|
|
||||||
);
|
|
||||||
let mut cur_pos = vec2(0., 0.);
|
let mut cur_pos = vec2(0., 0.);
|
||||||
let mut cam_pos = DragCtl::new(rot * vec3(0., 0., 4.));
|
let mut cam_pos = DragCtl::new(Vec3::ZERO);
|
||||||
let mut cam_rot = DragCtl::new(rot.inverse());
|
let mut cam_rot = DragCtl::new(Quat::IDENTITY);
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
event_loop
|
event_loop
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,6 @@ in vec3 position;
|
||||||
out vec3 vertex_color;
|
out vec3 vertex_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vertex_color = position;
|
vertex_color = color;
|
||||||
gl_Position = mvp * vec4(position, 1.0);
|
gl_Position = mvp * vec4(position, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user