2 Commits
test ... master

Author SHA1 Message Date
f80310632a Merge pull request 'Task3' (#4) from test into master
Reviewed-on: #4
2025-10-02 13:38:13 +02:00
ede8c6c411 Merge pull request 'Assignment 2' (#2) from ov3 into master
Reviewed-on: #2
2025-10-02 12:41:42 +02:00
2 changed files with 1 additions and 14 deletions

View File

@@ -10,13 +10,11 @@ void main() {
// ambient component
float ambientStrength = 0.1;
vec3 ambient = ambientStrength * vColor.rgb;
// terrain bump mapping with multioctave noise based on world position
float bumpStrength = 0.1;
float bumpStrength = 0.4;
float n1 = fract(sin(dot(vPosition.xz, vec2(12.9898, 78.233))) * 43758.5453);
float n2 = fract(sin(dot(vPosition.xz * 0.5, vec2(93.9898, 67.345))) * 24634.6345);
float noiseVal = mix(n1, n2, 0.5);
vec3 bumpNormal = normalize(vNormal + bumpStrength * (noiseVal - 0.5) * vec3(1.0));
// diffuse component (Lambert) with bump
float lambert = max(0.0, dot(normalize(bumpNormal), -lightDirection));

View File

@@ -376,7 +376,6 @@ fn main() {
// The main rendering loop
let first_frame_time = std::time::Instant::now();
let mut previous_frame_time = first_frame_time;
let mut door_slide = 0.0f32;
loop {
// Compute time passed since the previous frame and since the start of the program
let now = std::time::Instant::now();
@@ -429,7 +428,6 @@ fn main() {
// clamp pitch to avoid flipping
let pitch_limit = std::f32::consts::FRAC_PI_2 - 0.01;
cam_pitch = cam_pitch.clamp(-pitch_limit, pitch_limit);
door_slide = if keys.contains(&O) { 2.0 } else { 0.0 };
}
// Handle mouse movement. delta contains the x and y movement of the mouse since last frame in pixels
if let Ok(mut delta) = mouse_delta.lock() {
@@ -476,15 +474,6 @@ fn main() {
(&mut (*node.children[3]).rotation).x = elapsed * 10.0;
}
}
// Animate door sliding
{
let mut pin = root.as_mut();
let node = unsafe { pin.get_unchecked_mut() };
unsafe {
let door_node = &mut *node.children[1];
door_node.position.z = door_slide;
}
}
}
// Draw scene via scene graph