Silence some warnings

This commit is contained in:
Georg Hagen
2024-07-02 21:29:15 +02:00
parent c008c98311
commit fa51f868b7
10 changed files with 36 additions and 13 deletions

View File

@@ -16,7 +16,7 @@ namespace OpenVulkano
ArCameraController::ArCameraController(Scene::Camera* camera, const std::shared_ptr<AR::ArSession>& session, const Math::Matrix4f& registration) ArCameraController::ArCameraController(Scene::Camera* camera, const std::shared_ptr<AR::ArSession>& session, const Math::Matrix4f& registration)
: CameraController(camera), m_arSession(session), m_registration(registration), m_updated(false) : CameraController(camera), m_arSession(session), m_registration(registration), m_updated(false)
{ {
Init(); CommonInit();
} }
ArCameraController::~ArCameraController() ArCameraController::~ArCameraController()
@@ -24,7 +24,7 @@ namespace OpenVulkano
if (m_arSession) Close(); if (m_arSession) Close();
} }
void ArCameraController::Init() void ArCameraController::CommonInit()
{ {
//m_registration = Math::Utils::translate(Math::Vector3f_SIMD(0.0f, 0.0f, -2.5f)) * Math::Utils::rotate(Math::Matrix4f(1), M_PI_2f, {0,1,0}); //m_registration = Math::Utils::translate(Math::Vector3f_SIMD(0.0f, 0.0f, -2.5f)) * Math::Utils::rotate(Math::Matrix4f(1), M_PI_2f, {0,1,0});
if (m_arSession) if (m_arSession)
@@ -70,7 +70,7 @@ namespace OpenVulkano
CameraController::Init(camera); CameraController::Init(camera);
m_arSession = session; m_arSession = session;
m_registration = registration; m_registration = registration;
Init(); CommonInit();
} }
void ArCameraController::Tick() void ArCameraController::Tick()

View File

@@ -34,7 +34,10 @@ namespace OpenVulkano
~ArCameraController() override; ~ArCameraController() override;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
void Init(Scene::Camera* camera, const std::shared_ptr<AR::ArSession>& session = nullptr, const Math::Matrix4f& registration = Math::Matrix4f (1)); void Init(Scene::Camera* camera, const std::shared_ptr<AR::ArSession>& session = nullptr, const Math::Matrix4f& registration = Math::Matrix4f (1));
#pragma clang diagnostic pop
void Tick() override; void Tick() override;
@@ -45,7 +48,7 @@ namespace OpenVulkano
[[nodiscard]] std::shared_ptr<AR::ArSession> GetArSession() const { return m_arSession; } [[nodiscard]] std::shared_ptr<AR::ArSession> GetArSession() const { return m_arSession; }
private: private:
void Init(); void CommonInit();
void UpdateCameraViewMatrix(const Math::Matrix4f& transform); void UpdateCameraViewMatrix(const Math::Matrix4f& transform);
}; };

View File

@@ -20,6 +20,8 @@ namespace OpenVulkano
namespace LibArchiveHelper namespace LibArchiveHelper
{ {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch"
constexpr mode_t GetFileType(std::filesystem::file_type type) constexpr mode_t GetFileType(std::filesystem::file_type type)
{ {
switch (type) switch (type)
@@ -49,6 +51,7 @@ namespace OpenVulkano
} }
return std::filesystem::file_type::unknown; return std::filesystem::file_type::unknown;
} }
#pragma clang diagnostic pop
template<bool BLOCK_WRITE = false> template<bool BLOCK_WRITE = false>
inline ssize_t CopyArchiveData(struct archive* archiveReader, struct archive* archiveWriter) inline ssize_t CopyArchiveData(struct archive* archiveReader, struct archive* archiveWriter)
@@ -93,7 +96,7 @@ namespace OpenVulkano
struct archive* m_archive; struct archive* m_archive;
char* m_buffer; char* m_buffer;
size_t m_currentBlockSize; size_t m_currentBlockSize;
int64_t offset, r; int64_t offset;
bool ReadNextBlock() bool ReadNextBlock()
{ {

View File

@@ -15,8 +15,9 @@ namespace OpenVulkano::Scene
{ {
}; };
struct Material class Material
{ {
public:
MaterialProperties properties; MaterialProperties properties;
Texture* texture = nullptr; Texture* texture = nullptr;
}; };

View File

@@ -26,7 +26,10 @@ namespace OpenVulkano::Scene
public: public:
MorphableCameraController(MorphableCamera* camera = nullptr); MorphableCameraController(MorphableCamera* camera = nullptr);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
void Init(MorphableCamera* camera); void Init(MorphableCamera* camera);
#pragma clang diagnostic pop
void Tick() override; void Tick() override;
void SetDuration(double duration) { m_animationDuration = duration; } void SetDuration(double duration) { m_animationDuration = duration; }

View File

@@ -12,7 +12,7 @@
namespace OpenVulkano::Scene namespace OpenVulkano::Scene
{ {
Node::Node() Node::Node()
: localMat(1), worldMat(1) : localMat(1), worldMat(1), enabled(true)
{} {}
Node::~Node() noexcept Node::~Node() noexcept
@@ -57,6 +57,11 @@ namespace OpenVulkano::Scene
node->UpdateWorldMatrix(worldMat); node->UpdateWorldMatrix(worldMat);
} }
void Node::AddChildIfParentless(Node* node)
{
if (!node->parent) AddChild(node);
}
void Node::RemoveChild(Node* node) void Node::RemoveChild(Node* node)
{ {
if (node->parent == this) if (node->parent == this)

View File

@@ -39,7 +39,7 @@ namespace OpenVulkano::Scene
public: public:
Node(); Node();
~Node() override; ~Node() noexcept override;
void Init(); void Init();
@@ -47,6 +47,8 @@ namespace OpenVulkano::Scene
void AddChild(Node* node); void AddChild(Node* node);
void AddChildIfParentless(Node* node);
inline void AddChild(Drawable* drawable) { AddDrawable(drawable); } inline void AddChild(Drawable* drawable) { AddDrawable(drawable); }
void RemoveChild(Node* node); void RemoveChild(Node* node);

View File

@@ -11,7 +11,7 @@
namespace OpenVulkano::Scene namespace OpenVulkano::Scene
{ {
class Geometry; class Geometry;
struct Material; class Material;
class SimpleDrawable final : public Drawable class SimpleDrawable final : public Drawable
{ {

View File

@@ -13,8 +13,9 @@
namespace OpenVulkano::Vulkan namespace OpenVulkano::Vulkan
{ {
struct VulkanNode : IRecordable, ICloseable class VulkanNode : public IRecordable, public ICloseable
{ {
public:
Scene::Node* node = nullptr; Scene::Node* node = nullptr;
UniformBuffer* buffer = nullptr; UniformBuffer* buffer = nullptr;

View File

@@ -10,6 +10,7 @@
#include "Image.hpp" #include "Image.hpp"
#include "FrameBuffer.hpp" #include "FrameBuffer.hpp"
#include "Base/UI/IWindow.hpp" #include "Base/UI/IWindow.hpp"
#include "Base/Logger.hpp"
#include <vulkan/vulkan.hpp> #include <vulkan/vulkan.hpp>
namespace OpenVulkano namespace OpenVulkano
@@ -90,15 +91,19 @@ namespace OpenVulkano
void Present(vk::Queue& queue ,std::vector<vk::Semaphore>& semaphores) const void Present(vk::Queue& queue ,std::vector<vk::Semaphore>& semaphores) const
{ {
queue.presentKHR(vk::PresentInfoKHR(semaphores.size(), semaphores.data(), const vk::Result result = queue.presentKHR(vk::PresentInfoKHR(semaphores.size(), semaphores.data(),
1, &swapChain, &currentFrameBufferId)); 1, &swapChain, &currentFrameBufferId));
if (result != vk::Result::eSuccess) [[unlikely]]
{
Logger::RENDER->error("Failed to preset swap chain image: {}", to_string(result));
}
} }
[[nodiscard]] bool UseVsync() const { return useVsync; } [[nodiscard]] bool UseVsync() const { return useVsync; }
void SetVsync(bool useVsync) void SetVsync(bool vsync)
{ //TODO change swap chain { //TODO change swap chain
this->useVsync = useVsync; this->useVsync = vsync;
} }
[[nodiscard]] uint32_t GetImageCount() const [[nodiscard]] uint32_t GetImageCount() const