fix: remove sine-cosine transformations from model matrix calculation

This commit is contained in:
2025-10-02 00:54:30 +02:00
parent ebaf03237e
commit 20c7dc975c

View File

@@ -359,24 +359,6 @@ fn main() {
// == // Issue the necessary gl:: commands to draw your scene here
simple_shader.activate();
// build Model matrix (start from identity)
let mut model: glm::Mat4 = glm::identity();
// cycle through each transform parameter (a,b,c,d,e,f) over time
let cycle_duration = 2.0;
let idx = ((elapsed / cycle_duration).floor() as usize) % 6;
let v = elapsed.sin();
match idx {
0 => model[(0,0)] = v, // a
1 => model[(0,1)] = v, // b
2 => model[(0,3)] = v, // c
3 => model[(1,0)] = v, // d
4 => model[(1,1)] = v, // e
5 => model[(1,3)] = v, // f
_ => {}
}
// model translation to initial view distance
let translation_model: glm::Mat4 = glm::translation(&glm::vec3(0.0, 0.0, -5.0));
let model = translation_model * model;
// build View matrix: translate and rotate world relative to camera
let view_translation: glm::Mat4 = glm::translation(&(-cam_pos));
let view_rot_y: glm::Mat4 = glm::rotation(-cam_yaw, &glm::vec3(0.0, 1.0, 0.0));
@@ -385,9 +367,6 @@ fn main() {
// build Projection matrix
let projection: glm::Mat4 =
glm::perspective(window_aspect_ratio, std::f32::consts::PI / 4.0, 1.0, 1000.0);
// final transform: Projection * View * Model
let transform: glm::Mat4 = projection * view * model;
gl::UniformMatrix4fv(transform_loc, 1, gl::FALSE, transform.as_ptr());
// Draw the lunar terrain
let model_terrain: glm::Mat4 = glm::identity();