From ab09d78e42ccef97d78fe9fcbf09d2772042d153 Mon Sep 17 00:00:00 2001 From: Brandon Mak Date: Fri, 14 Oct 2022 00:08:14 +0800 Subject: [PATCH] removed routines for graphics from application (remember to add back after ingui update routine is added). Scene graph and physics system had some extra couts input system bug fix (this change is now in main) Mouse pick system wip --- .../src/Application/SBApplication.cpp | 6 +- SHADE_Application/src/Scenes/SBTestScene.cpp | 22 +++---- .../Graphics/Commands/SHVkCommandBuffer.cpp | 5 ++ .../src/Graphics/Commands/SHVkCommandBuffer.h | 3 +- .../MiddleEnd/Interface/SHGraphicsSystem.cpp | 12 +++- .../MiddleEnd/Interface/SHGraphicsSystem.h | 6 +- .../MiddleEnd/Interface/SHMousePickSystem.cpp | 59 +++++++++++++++++++ .../MiddleEnd/Interface/SHMousePickSystem.h | 38 ++++++++++++ .../Graphics/RenderGraph/SHRenderGraph.cpp | 9 +++ .../src/Graphics/RenderGraph/SHRenderGraph.h | 3 +- .../RenderGraph/SHRenderGraphResource.cpp | 52 ++++++++++++++++ .../RenderGraph/SHRenderGraphResource.h | 12 ++++ SHADE_Engine/src/Graphics/SHVkUtil.cpp | 13 ++++ SHADE_Engine/src/Graphics/SHVkUtil.h | 10 ++-- SHADE_Engine/src/Input/SHInputManager.cpp | 6 +- SHADE_Engine/src/Physics/SHPhysicsSystem.cpp | 14 ++--- SHADE_Engine/src/Scene/SHSceneGraph.cpp | 6 +- 17 files changed, 241 insertions(+), 35 deletions(-) create mode 100644 SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.cpp create mode 100644 SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.h diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index c6da6f1f..861a92d6 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -81,9 +81,9 @@ namespace Sandbox SHADE::SHSystemManager::RegisterRoutine(); SHADE::SHSystemManager::RegisterRoutine(); - SHADE::SHSystemManager::RegisterRoutine(); - SHADE::SHSystemManager::RegisterRoutine(); - SHADE::SHSystemManager::RegisterRoutine(); + //SHADE::SHSystemManager::RegisterRoutine(); + //SHADE::SHSystemManager::RegisterRoutine(); + //SHADE::SHSystemManager::RegisterRoutine(); SHADE::SHComponentManager::CreateComponentSparseSet(); SHADE::SHComponentManager::CreateComponentSparseSet(); diff --git a/SHADE_Application/src/Scenes/SBTestScene.cpp b/SHADE_Application/src/Scenes/SBTestScene.cpp index 3b277e6c..96be39f0 100644 --- a/SHADE_Application/src/Scenes/SBTestScene.cpp +++ b/SHADE_Application/src/Scenes/SBTestScene.cpp @@ -86,10 +86,10 @@ namespace Sandbox for (int y = 0; y < NUM_ROWS; ++y) for (int x = 0; x < NUM_COLS; ++x) { - auto entity = SHEntityManager::CreateEntity(); + auto entity = SHEntityManager::CreateEntity(); auto& renderable = *SHComponentManager::GetComponent_s(entity); auto& transform = *SHComponentManager::GetComponent_s(entity); - auto& collider = *SHComponentManager::GetComponent_s(entity); + //auto& collider = *SHComponentManager::GetComponent_s(entity); //renderable.Mesh = handles.front(); renderable.Mesh = CUBE_MESH; @@ -99,13 +99,13 @@ namespace Sandbox renderable.GetModifiableMaterial()->SetProperty("data.color", SHVec4(1.0f, 0.0f, 0.0f, 1.0f)); //Set initial positions - transform.SetWorldPosition(TEST_OBJ_START_POS + SHVec3{ x * TEST_OBJ_SPACING.x, y * TEST_OBJ_SPACING.y, SHMath::GenerateRandomNumber(-3.5f, -5.0f)}); + transform.SetWorldPosition(TEST_OBJ_START_POS + SHVec3{ x * TEST_OBJ_SPACING.x, y * TEST_OBJ_SPACING.y, SHMath::GenerateRandomNumber(-300.5f, 500.0f)}); //transform.SetWorldPosition({-1.0f, -1.0f, -1.0f}); transform.SetWorldRotation(SHMath::GenerateRandomNumber(), SHMath::GenerateRandomNumber(), SHMath::GenerateRandomNumber()); transform.SetWorldScale(TEST_OBJ_SCALE); - auto* box = collider.AddBoundingBox(); - box->SetHalfExtents(transform.GetWorldScale() * 0.5f); + //auto* box = collider.AddBoundingBox(); + //box->SetHalfExtents(transform.GetWorldScale() * 0.5f); stressTestObjects.emplace_back(entity); } @@ -123,11 +123,11 @@ namespace Sandbox transform.SetWorldPosition({ -3.0f, -1.0f, -1.0f }); transform.SetLocalScale({ 5.0f, 5.0f, 5.0f }); - auto floor = SHEntityManager::CreateEntity(); + auto floor = SHEntityManager::CreateEntity(); auto& floorRenderable = *SHComponentManager::GetComponent_s(floor); auto& floorTransform = *SHComponentManager::GetComponent_s(floor); - auto& floorRigidBody = *SHComponentManager::GetComponent_s(floor); - auto& floorCollider = *SHComponentManager::GetComponent_s(floor); + //auto& floorRigidBody = *SHComponentManager::GetComponent_s(floor); + //auto& floorCollider = *SHComponentManager::GetComponent_s(floor); floorRenderable.Mesh = CUBE_MESH; floorRenderable.SetMaterial(customMat); @@ -136,10 +136,10 @@ namespace Sandbox floorTransform.SetWorldScale({7.5f, 0.5f, 7.5}); floorTransform.SetWorldPosition({0.0f, -3.0f, -5.0f}); - floorRigidBody.SetType(SHRigidBodyComponent::Type::STATIC); + //floorRigidBody.SetType(SHRigidBodyComponent::Type::STATIC); - auto* floorBox = floorCollider.AddBoundingBox(); - floorBox->SetHalfExtents(floorTransform.GetWorldScale() * 0.5f); + //auto* floorBox = floorCollider.AddBoundingBox(); + //floorBox->SetHalfExtents(floorTransform.GetWorldScale() * 0.5f); // Create blank entity with a script //testObj = SHADE::SHEntityManager::CreateEntity(); diff --git a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp index 9ebbd227..4501ba7b 100644 --- a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp +++ b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp @@ -461,6 +461,11 @@ namespace SHADE ); } + void SHVkCommandBuffer::CopyImageToBuffer(const vk::Image& src, const vk::Buffer& dst, const std::vector& copyInfo) + { + vkCommandBuffer.copyImageToBuffer (src, vk::ImageLayout::eTransferSrcOptimal, dst, copyInfo); + } + void SHVkCommandBuffer::PipelineBarrier( vk::PipelineStageFlags srcStage, vk::PipelineStageFlags dstStage, diff --git a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.h b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.h index c18527b3..9416a1aa 100644 --- a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.h +++ b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.h @@ -120,7 +120,8 @@ namespace SHADE void DrawMultiIndirect (Handle indirectDrawData, uint32_t drawCount); // Buffer Copy - void CopyBufferToImage (const vk::Buffer& src, const vk::Image& dst, const std::vector& copyInfo); + void CopyBufferToImage (const vk::Buffer& src, const vk::Image& dst, const std::vector& copyInfo); + void CopyImageToBuffer (const vk::Image& src, const vk::Buffer& dst, const std::vector& copyInfo); // memory barriers void PipelineBarrier ( diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index 09579f02..636aa27a 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -32,6 +32,7 @@ of DigiPen Institute of Technology is prohibited. #include "Graphics/Buffers/SHVkBuffer.h" #include "Graphics/Images/SHVkSampler.h" #include "Assets/Asset Types/SHTextureAsset.h" +#include "Graphics/MiddleEnd/Interface/SHMousePickSystem.h" namespace SHADE { @@ -197,6 +198,15 @@ namespace SHADE cubeFS->Reflect(); defaultMaterial = AddMaterial(cubeVS, cubeFS, gBufferWriteSubpass); + + mousePickSystem = resourceManager.Create(); + + std::vector> cmdPools; + cmdPools.reserve(swapchain->GetNumImages()); + for (uint32_t i = 0; i < swapchain->GetNumImages(); ++i) + cmdPools.push_back(renderContext.GetFrameData(i).cmdPoolHdls[0]); + + mousePickSystem->Init(device, cmdPools, worldRenderGraph->GetRenderGraphResource("Entity ID")); } /***************************************************************************/ @@ -396,10 +406,10 @@ namespace SHADE } - const uint32_t CURR_FRAME_IDX = renderContext.GetCurrentFrame(); auto& currFrameData = renderContext.GetCurrentFrameData(); + mousePickSystem->Run(graphicsQueue, CURR_FRAME_IDX); // #BackEndTest: queues an image for presentation if (auto result = graphicsQueue->Present(swapchain, { currFrameData.semRenderFinishHdl }, CURR_FRAME_IDX); result != vk::Result::eSuccess) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h index c89e6ebc..981600f3 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h @@ -52,6 +52,7 @@ namespace SHADE class SHVkShaderModule; class SHMaterial; class SHMaterialInstance; + class SHMousePickSystem; /*---------------------------------------------------------------------------------*/ /* Type Definitions */ @@ -294,7 +295,7 @@ namespace SHADE SHWindow* window = nullptr; // Middle End Resources - ResourceManager resourceManager; + ResourceManager resourceManager; SHMeshLibrary meshLibrary; SHTextureLibrary texLibrary; SHSamplerCache samplerCache; @@ -322,5 +323,8 @@ namespace SHADE Handle defaultMaterial; Handle worldRenderGraph; + + // Sub systems + Handle mousePickSystem; }; } \ No newline at end of file diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.cpp new file mode 100644 index 00000000..ec7a5491 --- /dev/null +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.cpp @@ -0,0 +1,59 @@ +#include "SHpch.h" +#include "SHMousePickSystem.h" +#include "Input/SHInputManager.h" +#include "Graphics/Commands/SHVkCommandPool.h" +#include "Graphics/Devices/SHVkLogicalDevice.h" +#include "Graphics/Synchronization/SHVkFence.h" +#include "Graphics/Buffers/SHVkBuffer.h" +#include "Graphics/SHVkUtil.h" + +namespace SHADE +{ + void SHMousePickSystem::Init(Handle logicalDevice, std::span> cmdPools, Handle eidAttachment) noexcept + { + // Create command buffers + for (auto& pool : cmdPools) + { + commandBuffers.push_back(pool->RequestCommandBuffer (SH_CMD_BUFFER_TYPE::PRIMARY)); + } + + // assign the attachment + entityIDAttachment = eidAttachment; + + // Create the fence + afterCopyFence = logicalDevice->CreateFence(); + + uint32_t bufferSize = entityIDAttachment->GetWidth() * eidAttachment->GetHeight() * SHVkUtil::GetBytesPerPixelFromFormat(entityIDAttachment->GetResourceFormat()); + + // Create the buffer + imageDataDstBuffer = logicalDevice->CreateBuffer(bufferSize, nullptr, bufferSize, vk::BufferUsageFlagBits::eTransferDst, VMA_MEMORY_USAGE_AUTO, VMA_ALLOCATION_CREATE_MAPPED_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT); + } + + void SHMousePickSystem::Run(Handle queue, uint32_t frameIndex) noexcept + { + // if input detected + if (/*SHInputManager::GetKey(SHInputManager::SH_KEYCODE::LEFT_CTRL) && */SHInputManager::GetKeyUp(SHInputManager::SH_KEYCODE::LMB)) + { + std::cout << "Input registered... " << std::endl; + + //// begin command buffer for recording + //commandBuffers[frameIndex]->BeginRecording(); + + //// transition the image for optimized copying + //entityIDAttachment->TransitionImage (vk::ImageLayout::eColorAttachmentOptimal, vk::ImageLayout::eTransferSrcOptimal, commandBuffers[frameIndex], vk::PipelineStageFlagBits::eColorAttachmentOutput, vk::PipelineStageFlagBits::eTransfer, 0); + + //// copy the image here. Last argument is 0 because the attachment isn't a swapchain image. + //entityIDAttachment->CopyToBuffer(imageDataDstBuffer, commandBuffers[frameIndex], 0); + + //// end command buffer for recording + //commandBuffers[frameIndex]->EndRecording(); + + //// submit the command buffer to copy image to buffer + //queue->SubmitCommandBuffer({ commandBuffers[frameIndex] }, {}, {}, vk::PipelineStageFlagBits::eColorAttachmentOutput, afterCopyFence); + + //// wait for the copy to be done + //afterCopyFence->Wait(true, std::numeric_limits::max()); + } + } + +} diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.h new file mode 100644 index 00000000..815eb938 --- /dev/null +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMousePickSystem.h @@ -0,0 +1,38 @@ +#pragma once + +#include "Graphics/RenderGraph/SHRenderGraphResource.h" +#include "ECS_Base/SHECSMacros.h" +#include "Math/Vector/SHVec2.h" +#include + +namespace SHADE +{ + class SHVkLogicalDevice; + class SHVkCommandPool; + class SHVkCommandBuffer; + class SHVkFence; + class SHVkQueue; + class SHVkBuffer; + + class SHMousePickSystem + { + private: + //! Handle to the render graph resource that will contain the entity IDs + Handle entityIDAttachment; + + //! Command buffers meant for copying image to buffer + std::vector> commandBuffers; + + //! After the attachment has copied its data to a buffer, we want to signal this fence + Handle afterCopyFence; + + //! buffer to contain the attachment data after copying + Handle imageDataDstBuffer; + + public: + void Init(Handle logicalDevice, std::span> cmdPools, Handle eidAttachment) noexcept; + + void Run (Handle queue, uint32_t frameIndex) noexcept; + + }; +} \ No newline at end of file diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp index cad6a78e..78bd1ca6 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp @@ -498,4 +498,13 @@ namespace SHADE } + Handle SHRenderGraph::GetRenderGraphResource(std::string const& resourceName) const noexcept + { + if (graphResources.contains(resourceName)) + { + return graphResources.at(resourceName); + } + return {}; + } + } \ No newline at end of file diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h index a3140a4f..2e9a3310 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.h @@ -85,7 +85,8 @@ namespace SHADE /*-----------------------------------------------------------------------*/ /* SETTERS AND GETTERS */ /*-----------------------------------------------------------------------*/ - Handle GetNode (std::string const& nodeName) const noexcept; + Handle GetNode (std::string const& nodeName) const noexcept; + Handle GetRenderGraphResource (std::string const& resourceName) const noexcept; }; } diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.cpp index 6da6593e..e8c9863f 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.cpp @@ -3,6 +3,8 @@ #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Swapchain/SHVkSwapchain.h" #include "Graphics/Images/SHVkImageView.h" +#include "Graphics/Buffers/SHVkBuffer.h" +#include "Graphics/SHVkUtil.h" namespace SHADE { @@ -242,9 +244,59 @@ namespace SHADE } } + void SHRenderGraphResource::TransitionImage(vk::ImageLayout oldLayout, vk::ImageLayout newLayout, Handle commandBuffer, vk::PipelineStageFlagBits srcStage, vk::PipelineStageFlagBits dstStage, uint32_t frameIndex) noexcept + { + vk::ImageMemoryBarrier barrier; + barrier.oldLayout = oldLayout; + barrier.newLayout = newLayout; + barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.image = images[frameIndex]->GetVkImage(), + barrier.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor; // TODO: Need to change this to base it off image format. + barrier.subresourceRange.baseMipLevel = 0; + barrier.subresourceRange.levelCount = mipLevels; + barrier.subresourceRange.baseArrayLayer = 0; + barrier.subresourceRange.layerCount = 1; // always 1 since we wont have array of images for attachments + + commandBuffer->PipelineBarrier(srcStage, dstStage, {}, {}, {}, {barrier}); + } + + void SHRenderGraphResource::CopyToBuffer(Handle dstBuffer, Handle commandBuffer, uint32_t frameIndex) const noexcept + { + vk::ImageSubresourceLayers subResource + { + .aspectMask = SHVkUtil::IsDepthOnlyFormat(resourceFormat) ? vk::ImageAspectFlagBits::eDepth : vk::ImageAspectFlagBits::eColor, + .mipLevel = 0, + .baseArrayLayer = 0, + .layerCount = 1 + }; + + vk::BufferImageCopy region + { + .bufferOffset = 0, + .bufferRowLength = 0, + .bufferImageHeight = 0, + .imageSubresource = subResource, + .imageOffset = vk::Offset3D {0,0,0}, + .imageExtent = vk::Extent3D {width, height, 1} + }; + + commandBuffer->CopyImageToBuffer(images[frameIndex]->GetVkImage(), dstBuffer->GetVkBuffer(), {region}); + } + vk::Format SHRenderGraphResource::GetResourceFormat(void) const noexcept { return resourceFormat; } + uint32_t SHRenderGraphResource::GetWidth(void) const noexcept + { + return width; + } + + uint32_t SHRenderGraphResource::GetHeight(void) const noexcept + { + return height; + } + } \ No newline at end of file diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.h b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.h index d4782226..a490ab95 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.h +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraphResource.h @@ -13,6 +13,8 @@ namespace SHADE class SHVkImageView; class SHVkLogicalDevice; class SHVkSwapchain; + class SHVkCommandBuffer; + class SHVkBuffer; class SH_API SHRenderGraphResource { @@ -70,9 +72,19 @@ namespace SHADE SHRenderGraphResource& operator=(SHRenderGraphResource&& rhs) noexcept; ~SHRenderGraphResource(void) noexcept; + /*-----------------------------------------------------------------------*/ + /* PUBLIC MEMBER FUNCTIONS */ + /*-----------------------------------------------------------------------*/ void HandleResize (uint32_t newWidth, uint32_t newHeight) noexcept; + void TransitionImage(vk::ImageLayout oldLayout, vk::ImageLayout newLayout, Handle commandBuffer, vk::PipelineStageFlagBits srcStage, vk::PipelineStageFlagBits dstStage, uint32_t frameIndex) noexcept; + void CopyToBuffer (Handle dstBuffer, Handle commandBuffer, uint32_t frameIndex = 0) const noexcept; + /*-----------------------------------------------------------------------*/ + /* SETTERS AND GETTERS */ + /*-----------------------------------------------------------------------*/ vk::Format GetResourceFormat (void) const noexcept; + uint32_t GetWidth (void) const noexcept; + uint32_t GetHeight (void) const noexcept; friend class SHRenderGraphNode; friend class SHRenderGraph; diff --git a/SHADE_Engine/src/Graphics/SHVkUtil.cpp b/SHADE_Engine/src/Graphics/SHVkUtil.cpp index 2d0e7cf2..c8c563a1 100644 --- a/SHADE_Engine/src/Graphics/SHVkUtil.cpp +++ b/SHADE_Engine/src/Graphics/SHVkUtil.cpp @@ -42,6 +42,19 @@ namespace SHADE return false; } + uint32_t SHVkUtil::GetBytesPerPixelFromFormat(vk::Format format) noexcept + { + // TODO: Update with all formats + switch (format) + { + case vk::Format::eR32Sint: + case vk::Format::eR32Uint: + case vk::Format::eR32Sfloat: + return 4; + } + return 0; + } + void SHVkUtil::EnsureBufferAndCopyData(Handle device, Handle cmdBuffer, Handle& bufferHandle, void* src, uint32_t size, vk::BufferUsageFlagBits usage) { if (bufferHandle) diff --git a/SHADE_Engine/src/Graphics/SHVkUtil.h b/SHADE_Engine/src/Graphics/SHVkUtil.h index d8625607..ca3b6f83 100644 --- a/SHADE_Engine/src/Graphics/SHVkUtil.h +++ b/SHADE_Engine/src/Graphics/SHVkUtil.h @@ -19,10 +19,12 @@ namespace SHADE /*---------------------------------------------------------------------------------*/ class SHVkUtil { - public: - static bool IsDepthOnlyFormat (vk::Format format) noexcept; - static bool IsDepthStencilAttachment(vk::Format format) noexcept; - static bool IsBlendCompatible (vk::Format format) noexcept; + public: + static bool IsDepthOnlyFormat (vk::Format format) noexcept; + static bool IsDepthStencilAttachment (vk::Format format) noexcept; + static bool IsBlendCompatible (vk::Format format) noexcept; + static uint32_t GetBytesPerPixelFromFormat (vk::Format format) noexcept; + /***********************************************************************************/ /*! diff --git a/SHADE_Engine/src/Input/SHInputManager.cpp b/SHADE_Engine/src/Input/SHInputManager.cpp index 04f2b02e..a6090062 100644 --- a/SHADE_Engine/src/Input/SHInputManager.cpp +++ b/SHADE_Engine/src/Input/SHInputManager.cpp @@ -44,6 +44,9 @@ namespace SHADE void SHInputManager::UpdateInput(double dt) noexcept { //Keyboard and Mouse Buttons//////////////////////////////////////////////// + //Write to lastKeys + memcpy(keysLast, keys, sizeof(keys)); + //Poll unsigned char keyboardState[MAX_KEYS]; //if (GetKeyboardState(keyboardState) == false) return; @@ -96,9 +99,6 @@ namespace SHADE } } - //Write to lastKeys - memcpy(keysLast, keys, sizeof(keys)); - //Mouse Positioning///////////////////////////////////// //https://stackoverflow.com/a/6423739 diff --git a/SHADE_Engine/src/Physics/SHPhysicsSystem.cpp b/SHADE_Engine/src/Physics/SHPhysicsSystem.cpp index f3a4c276..7d2e257b 100644 --- a/SHADE_Engine/src/Physics/SHPhysicsSystem.cpp +++ b/SHADE_Engine/src/Physics/SHPhysicsSystem.cpp @@ -203,9 +203,9 @@ namespace SHADE void SHPhysicsSystem::AddRigidBody(EntityID entityID) noexcept { - #ifdef _DEBUG - SHLOG_INFO("Adding a Rigidbody to the Physics World.") - #endif + //#ifdef _DEBUG + // SHLOG_INFO("Adding a Rigidbody to the Physics World.") + //#endif // Check if entity is already a physics object auto* physicsObject = GetPhysicsObject(entityID); @@ -274,9 +274,9 @@ namespace SHADE void SHPhysicsSystem::AddCollider(EntityID entityID) noexcept { - #ifdef _DEBUG - SHLOG_INFO("Adding a Collider to the Physics World.") - #endif + //#ifdef _DEBUG + // SHLOG_INFO("Adding a Collider to the Physics World.") + //#endif // Check if entity is already a physics object auto* physicsObject = GetPhysicsObject(entityID); @@ -488,7 +488,7 @@ namespace SHADE const auto it = map.find(entityID); if (it == map.end()) { - SHLOG_ERROR("Entity {} is not in the physics system!", entityID) + //SHLOG_ERROR("Entity {} is not in the physics system!", entityID) return nullptr; } diff --git a/SHADE_Engine/src/Scene/SHSceneGraph.cpp b/SHADE_Engine/src/Scene/SHSceneGraph.cpp index 3fe85809..bbbdb7e4 100644 --- a/SHADE_Engine/src/Scene/SHSceneGraph.cpp +++ b/SHADE_Engine/src/Scene/SHSceneGraph.cpp @@ -571,9 +571,9 @@ namespace SHADE { SHSceneNode* newNode = new SHSceneNode{entityID}; - #ifdef _DEBUG - SHLOG_INFO("Allocated a new Scene Node for Entity {}!", entityID) - #endif + //#ifdef _DEBUG + // SHLOG_INFO("Allocated a new Scene Node for Entity {}!", entityID) + //#endif entityNodeMap.emplace(entityID, newNode); return newNode;