fix(audio): set distance model, reduce max distance, fix sound pos

- Set OpenAL distance model to AL_INVERSE_DISTANCE_CLAMPED in engine.
- Reduced AL_MAX_DISTANCE from 100 to 48 for better falloff.
- Fixed block sound position to use world coordinates instead of local block coordinates.
This commit is contained in:
2026-07-07 14:52:55 +08:00
parent 5264755a7e
commit 7eebed40e0
3 changed files with 17 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
#include "Cubed/audio/audio_engine.hpp"
#include "Cubed/audio/audio_error.hpp"
#include "Cubed/config.hpp"
#include "Cubed/tools/cubed_assert.hpp"
#include "Cubed/tools/log.hpp"
@@ -34,6 +35,9 @@ void AudioEngine::init() {
}
alcMakeContextCurrent(context);
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
check_al_error();
auto& config = Config::get();
m_music_volume = static_cast<float>(config.get<double>("volume.music"));