3D isometric renderer: chunked meshes with noise-displaced walls, lit shader with flickering torches, billboard sprites, rotatable/tiltable ortho camera, ray picking
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
91bb91b6ee
commit
220d9543cc
6 files changed
+180
-589
No files matched your search
+3
-5
@@ -3,7 +3,6 @@
|
||||
// Ohne registrierten Klang bleibt ein Ereignis stumm.
|
||||
|
||||
use crate::game::{Sfx, SfxEvent, SFX_ALL};
|
||||
use crate::render::View;
|
||||
use macroquad::audio::{load_sound_from_bytes, play_sound, PlaySoundParams, Sound};
|
||||
use macroquad::prelude::*;
|
||||
|
||||
@@ -47,7 +46,8 @@ impl SoundBank {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn play(&mut self, ev: SfxEvent, view: &View, now: f64) {
|
||||
// listener: camera target on the ground; hear: audible radius in tiles
|
||||
pub fn play(&mut self, ev: SfxEvent, listener: Vec2, hear: f32, now: f64) {
|
||||
if self.muted || self.volume <= 0.0 {
|
||||
return;
|
||||
}
|
||||
@@ -59,9 +59,7 @@ impl SoundBank {
|
||||
// Lautstärke nach Entfernung zur Bildschirmmitte
|
||||
let mut vol = self.volume;
|
||||
if let Some((wx, wy)) = ev.pos {
|
||||
let (cx, cy) = view.world(screen_width() * 0.5, screen_height() * 0.5);
|
||||
let d = ((wx - cx).powi(2) + (wy - cy).powi(2)).sqrt();
|
||||
let hear = screen_width().max(screen_height()) / view.zoom * 0.6;
|
||||
let d = ((wx - listener.x).powi(2) + (wy - listener.y).powi(2)).sqrt();
|
||||
let f = 1.0 - ((d - hear * 0.5) / hear).clamp(0.0, 1.0);
|
||||
if f <= 0.05 {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user