This commit is contained in:
2026-07-11 00:14:41 +02:00
parent 87dd8e1190
commit c9e463bb9a
15 changed files with 183 additions and 51 deletions
+2
View File
@@ -21,6 +21,7 @@ impl Mat4 {
[0.0, 0.0, 0.0, 1.0],
]);
#[allow(clippy::needless_range_loop)] // Zeilen-/Spalten-Index ist bei 4×4-Mathematik klarer als Iteratoren
pub fn mul(&self, rhs: &Mat4) -> Mat4 {
let mut out = [[0.0f32; 4]; 4];
for c in 0..4 {
@@ -34,6 +35,7 @@ impl Mat4 {
/// Punkt-Transformation auf der CPU — bisher nur von den Tests
/// gebraucht; der Renderer transformiert auf der GPU.
#[cfg(test)]
#[allow(clippy::needless_range_loop)] // Zeilen-Index ist bei der Matrix-Vektor-Mathematik klarer
pub fn transform(&self, v: [f32; 4]) -> [f32; 4] {
let mut out = [0.0f32; 4];
for r in 0..4 {
+7 -7
View File
@@ -42,8 +42,9 @@ use gpu::Gpu;
use math::Mat4;
use scene::Mesh;
/// Radiant pro Maus-Pixel.
const MOUSE_SENS: f32 = 0.0025;
/// Radiant pro Maus-Pixel für die Flycam — dieselbe Empfindlichkeit wie die
/// First-Person-Sicht, damit sich der Wechsel nahtlos anfühlt.
const MOUSE_SENS: f32 = crate::session::LOOK_SENS;
/// Welt-Einheiten pro Sekunde.
const MOVE_SPEED: f32 = 4.0;
/// Zeitkonstante (s) des Eye-Height-Smoothings am Boden: die Kamera gleitet
@@ -252,11 +253,10 @@ impl ApplicationHandler for App {
/// Rohe Maus-Bewegung (unabhängig von Cursor-Position) — nur sinnvoll,
/// solange der Cursor gefangen ist.
fn device_event(&mut self, _el: &ActiveEventLoop, _id: DeviceId, event: DeviceEvent) {
if let DeviceEvent::MouseMotion { delta } = event {
if self.input.grabbed {
self.input.mouse_dx += delta.0 as f32;
self.input.mouse_dy += delta.1 as f32;
}
if let DeviceEvent::MouseMotion { delta } = event
&& self.input.grabbed {
self.input.mouse_dx += delta.0 as f32;
self.input.mouse_dy += delta.1 as f32;
}
}
+1 -1
View File
@@ -251,7 +251,7 @@ fn upload_texture(
/// verfälschen. Mittelung im (gamma-kodierten) Speicherraum — für den
/// stilisierten Look unkritisch.
fn downsample(src: &[u8], w: u32, h: u32) -> (Vec<u8>, u32, u32) {
let (nw, nh) = ((w + 1) / 2, (h + 1) / 2);
let (nw, nh) = (w.div_ceil(2), h.div_ceil(2));
let mut dst = vec![0u8; (nw * nh * 4) as usize];
for y in 0..nh {
for x in 0..nw {