mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
sound changes
This commit is contained in:
@@ -339,7 +339,7 @@ void TGauge::play( sound *Sound )
|
||||
auto pos = glm::vec3(glm::vec4(model_pos, 1.0f) * glm::inverse((glm::mat4)World.train()->Dynamic()->mMatrix));
|
||||
pos += (glm::vec3)World.train()->Dynamic()->GetPosition();
|
||||
|
||||
Sound->set_mode(sound::anchored).dist(1.5f).position(pos);
|
||||
Sound->set_mode(sound::anchored).dist(3.0f).position(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
World.cpp
19
World.cpp
@@ -1055,15 +1055,6 @@ bool TWorld::Update()
|
||||
Ground.Update_Hidden();
|
||||
Ground.Update_Lights();
|
||||
|
||||
{
|
||||
glm::dmat4 cam_matrix;
|
||||
Camera.SetMatrix(cam_matrix);
|
||||
|
||||
glm::vec3 pos(Camera.Pos.x, Camera.Pos.y, Camera.Pos.z);
|
||||
sound_man->set_listener(pos, glm::mat3(cam_matrix));
|
||||
sound_man->update(dt);
|
||||
}
|
||||
|
||||
// render time routines follow:
|
||||
|
||||
dt = Timer::GetDeltaRenderTime(); // nie uwzględnia pauzowania ani mnożenia czasu
|
||||
@@ -1094,6 +1085,16 @@ bool TWorld::Update()
|
||||
|
||||
Update_Camera( dt );
|
||||
|
||||
{
|
||||
glm::dmat4 cam_matrix;
|
||||
Camera.SetMatrix(cam_matrix);
|
||||
|
||||
glm::vec3 pos(Camera.Pos.x, Camera.Pos.y, Camera.Pos.z);
|
||||
sound_man->set_listener(pos, glm::mat3(cam_matrix));
|
||||
sound_man->update(Global::iPause ? 0.0f : dt);
|
||||
}
|
||||
|
||||
|
||||
GfxRenderer.Update( dt );
|
||||
ResourceSweep();
|
||||
|
||||
|
||||
@@ -348,9 +348,11 @@ sound& sound::position(Math3D::vector3 const &pos)
|
||||
|
||||
sound& sound::dist(float dist)
|
||||
{
|
||||
alSourcef(id, AL_MAX_DISTANCE, dist);
|
||||
alSourcef(id, AL_REFERENCE_DISTANCE, dist / 3.82f);
|
||||
max_dist = dist * 1.5f;
|
||||
max_dist = dist * 2.0f;
|
||||
float half_dist = dist / 3.82f;
|
||||
alSourcef(id, AL_REFERENCE_DISTANCE, half_dist / 1.32f);
|
||||
alSourcef(id, AL_ROLLOFF_FACTOR, 3.0f);
|
||||
alSourcef(id, AL_MAX_DISTANCE, max_dist);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user