Fixed inverted spatialized audio direction in play mode

This commit is contained in:
antopilo
2024-10-28 20:14:49 -04:00
parent f1be4f7cef
commit 03d785f016
5 changed files with 24 additions and 14 deletions

View File

@@ -28,7 +28,7 @@ namespace Nuake {
// TODO: Sample rate, back end, buffer size, flags.
#ifdef NK_WIN
m_Soloud->init();
m_Soloud->init(SoLoud::Soloud::LEFT_HANDED_3D);
#else
m_Soloud->init(SoLoud::Soloud::CLIP_ROUNDOFF, SoLoud::Soloud::ALSA);
#endif
@@ -55,6 +55,7 @@ namespace Nuake {
m_ListenerUp.x, m_ListenerUp.y, m_ListenerUp.z
);
m_Soloud->update3dAudio();
}
}

View File

@@ -275640,9 +275640,10 @@ namespace Nuake {
0x69, 0x66, 0x28, 0x61, 0x20, 0x3D, 0x3D, 0x20, 0x31, 0x2E, 0x66, 0x29,
0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x20,
0x0D, 0x0A, 0x09, 0x09, 0x09, 0x66, 0x69, 0x6E, 0x61, 0x6C, 0x43, 0x6F,
0x6C, 0x6F, 0x72, 0x20, 0x3D, 0x20, 0x6D, 0x69, 0x78, 0x28, 0x75, 0x5F,
0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x2C,
0x20, 0x66, 0x69, 0x6E, 0x61, 0x6C, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x2C,
0x6C, 0x6F, 0x72, 0x2E, 0x72, 0x67, 0x62, 0x20, 0x3D, 0x20, 0x6D, 0x69,
0x78, 0x28, 0x75, 0x5F, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6F,
0x6C, 0x6F, 0x72, 0x2E, 0x72, 0x67, 0x62, 0x2C, 0x20, 0x66, 0x69, 0x6E,
0x61, 0x6C, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x2E, 0x72, 0x67, 0x62, 0x2C,
0x20, 0x62, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6C, 0x70, 0x68, 0x61,
0x29, 0x3B, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x63, 0x6F, 0x6F, 0x72, 0x64,
@@ -275696,11 +275697,9 @@ namespace Nuake {
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
0x74, 0x75, 0x72, 0x6E, 0x3B, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x7D, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0D,
0x0A, 0x20, 0x20, 0x20, 0x20, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x66,
0x69, 0x6E, 0x61, 0x6C, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x2E, 0x61, 0x20,
0x3D, 0x20, 0x61, 0x3B, 0x0D, 0x0A, 0x09, 0x46, 0x72, 0x61, 0x67, 0x43,
0x6F, 0x6C, 0x6F, 0x72, 0x20, 0x3D, 0x20, 0x66, 0x69, 0x6E, 0x61, 0x6C,
0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x3B, 0x20, 0x0D, 0x0A, 0x7D,
0x0A, 0x20, 0x20, 0x20, 0x20, 0x0D, 0x0A, 0x09, 0x46, 0x72, 0x61, 0x67,
0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x20, 0x3D, 0x20, 0x66, 0x69, 0x6E, 0x61,
0x6C, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x3B, 0x20, 0x0D, 0x0A, 0x7D,
};
unsigned int Resources_Shaders_ui_panel_shader_len = sizeof(Resources_Shaders_ui_panel_shader);

View File

@@ -31,12 +31,14 @@ namespace Nuake
auto currentCamera = m_Scene->GetCurrentCamera();
Vector3 direction = currentCamera->GetDirection();
if (Engine::IsPlayMode())
Vector3 position = currentCamera->GetTranslation();
if (!Engine::IsPlayMode())
{
direction *= -1.0f;
direction.x *= -1.0f;
direction.z *= -1.0f;
}
audioManager.SetListenerPosition(currentCamera->GetTranslation(), std::move(direction), currentCamera->GetUp());
audioManager.SetListenerPosition(position, std::move(direction), currentCamera->GetUp());
auto view = m_Scene->m_Registry.view<TransformComponent, AudioEmitterComponent>();
for (auto& e : view)

View File

@@ -582,6 +582,15 @@ namespace NuakeUI
SetLengthBorderNoAuto(Padding, Right);
SetLengthBorderNoAuto(Padding, Bottom);
if (ComputedStyle.Visibility == VisibilityType::Hidden)
{
YGNodeStyleSetDisplay(mNode, YGDisplayNone);
}
else
{
YGNodeStyleSetDisplay(mNode, YGDisplayFlex);
}
if (ComputedStyle.FlexGrow > 0.f)
YGNodeStyleSetFlexGrow(mNode, ComputedStyle.FlexGrow);
if (ComputedStyle.FlexShrink > 0.f)

View File

@@ -86,7 +86,7 @@ void main() {
if(a == 1.f)
{
finalColor = mix(u_BorderColor, finalColor, borderAlpha);
finalColor.rgb = mix(u_BorderColor.rgb, finalColor.rgb, borderAlpha);
if(coords.x < u_Border || coords.x > u_Size.x - u_Border ||
coords.y < u_Border || coords.y > u_Size.y - u_Border)
{
@@ -111,6 +111,5 @@ void main() {
}
}
finalColor.a = a;
FragColor = finalColor;
}