From c9904e7d2060b3d23debd2d7f1bf6d726f348a59 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 8 Apr 2018 18:50:42 +0200 Subject: [PATCH 1/2] Audio/Sound: Fix copy constructor not copying looping state --- ChangeLog.md | 1 + src/Nazara/Audio/Sound.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 2dc442e04..6914fc0ad 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -82,6 +82,7 @@ Nazara Engine: - Fix copy and move semantic on HandledObject and ObjectHandle - Add support for emissive and normal maps in .mtl loader using custom keywords ([map_]emissive and [map_]normal) - Music, Sound and SoundEmitter are now movable +- Fixed Sound copy which was not copying looping state Nazara Development Kit: - Added ImageWidget (#139) diff --git a/src/Nazara/Audio/Sound.cpp b/src/Nazara/Audio/Sound.cpp index c06ca5526..6937e1ec2 100644 --- a/src/Nazara/Audio/Sound.cpp +++ b/src/Nazara/Audio/Sound.cpp @@ -37,6 +37,7 @@ namespace Nz SoundEmitter(sound) { SetBuffer(sound.m_buffer); + EnableLooping(sound.IsLooping()); } /*! From 42a263ed6a82bcf7b57bbd9014081c9ae7f0103b Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 9 Apr 2018 20:33:40 +0200 Subject: [PATCH 2/2] Graphics/Billboard: Fix bounding volume --- ChangeLog.md | 1 + src/Nazara/Graphics/Billboard.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index cca98be26..32e5a9225 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -83,6 +83,7 @@ Nazara Engine: - Add support for emissive and normal maps in .mtl loader using custom keywords ([map_]emissive and [map_]normal) - Music, Sound and SoundEmitter are now movable - Fixed Sound copy which was not copying looping state +- Fixed Billboard bounding volume Nazara Development Kit: - Added ImageWidget (#139) diff --git a/src/Nazara/Graphics/Billboard.cpp b/src/Nazara/Graphics/Billboard.cpp index e228a2a59..3896cce49 100644 --- a/src/Nazara/Graphics/Billboard.cpp +++ b/src/Nazara/Graphics/Billboard.cpp @@ -33,9 +33,12 @@ namespace Nz void Billboard::MakeBoundingVolume() const { - constexpr float sqrt2 = float(M_SQRT2); + // As billboard always face the screen, we must take its maximum size in account on every axis + float maxSize = float(M_SQRT2) * std::max(m_size.x, m_size.y); - m_boundingVolume.Set(Vector3f(0.f), sqrt2 * m_size.x * Vector3f::Right() + sqrt2 * m_size.y * Vector3f::Down()); + Nz::Vector3f halfSize = (maxSize * Vector3f::Right() + maxSize * Vector3f::Down() + maxSize * Vector3f::Forward()) / 2.f; + + m_boundingVolume.Set(-halfSize, halfSize); } BillboardLibrary::LibraryMap Billboard::s_library;