From ece65b18da650a5bf36430a56093a3c3d2166393 Mon Sep 17 00:00:00 2001 From: Isuru Samarathunga Date: Sat, 20 Sep 2025 10:03:52 +0530 Subject: [PATCH] Restructure --- .vscode/settings.json | 10 +- Src/IAESandbox/CMakeLists.txt | 2 +- Src/IAESandbox/imp/cpp/Game.cpp | 13 +- Src/IAEngine/CMakeLists.txt | 3 +- .../imp/cpp/Components/AtlasRenderer.cpp | 12 +- .../imp/cpp/Components/SpriteRenderer.cpp | 12 +- .../imp/cpp/Components/TextureRenderer.cpp | 12 +- Src/IAEngine/imp/cpp/IAEngine.cpp | 10 +- Src/IAEngine/imp/cpp/Physics/Physics.cpp | 8 +- Src/IAEngine/imp/cpp/Rendering/GPUBuffer.cpp | 1 + Src/IAEngine/imp/cpp/Rendering/GPUTexture.cpp | 2 + Src/IAEngine/imp/cpp/Rendering/Mesh/Quad.cpp | 51 ----- .../imp/cpp/Rendering/Pipeline/UnlitMesh.cpp | 5 +- Src/IAEngine/imp/cpp/Rendering/Renderer.cpp | 190 +++++++++++------- Src/IAEngine/imp/cpp/Texture.cpp | 12 +- Src/IAEngine/imp/cpp/UI.cpp | 113 +++++++++++ .../imp/glsl/UnlitMesh/UnlitMesh.frag | 10 +- Src/IAEngine/imp/hpp/EmbeddedShaders.hpp | 4 +- .../inc/IAEngine/Components/AtlasRenderer.hpp | 11 +- .../IAEngine/Components/SpriteRenderer.hpp | 41 +--- .../IAEngine/Components/TextureRenderer.hpp | 50 ++++- Src/IAEngine/inc/IAEngine/Nodes/Node.hpp | 12 +- Src/IAEngine/inc/IAEngine/Nodes/Transform.hpp | 57 ++++-- .../inc/IAEngine/Rendering/Renderer.hpp | 22 +- Src/IAEngine/inc/IAEngine/Rendering/Types.hpp | 4 +- Src/IAEngine/inc/IAEngine/Texture.hpp | 15 +- .../{Rendering/Mesh/Quad.hpp => UI.hpp} | 14 +- 27 files changed, 437 insertions(+), 259 deletions(-) delete mode 100644 Src/IAEngine/imp/cpp/Rendering/Mesh/Quad.cpp create mode 100644 Src/IAEngine/imp/cpp/UI.cpp rename Src/IAEngine/inc/IAEngine/{Rendering/Mesh/Quad.hpp => UI.hpp} (76%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6e995d6..e9df343 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,6 +19,14 @@ "initializer_list": "cpp", "random": "cpp", "span": "cpp", - "xstring": "cpp" + "xstring": "cpp", + "cstddef": "cpp", + "algorithm": "cpp", + "expected": "cpp", + "optional": "cpp", + "regex": "cpp", + "system_error": "cpp", + "xlocmon": "cpp", + "xiosbase": "cpp" } } \ No newline at end of file diff --git a/Src/IAESandbox/CMakeLists.txt b/Src/IAESandbox/CMakeLists.txt index e51430d..732c222 100644 --- a/Src/IAESandbox/CMakeLists.txt +++ b/Src/IAESandbox/CMakeLists.txt @@ -8,4 +8,4 @@ add_executable(IAESandbox ${IAESandbox_Sources}) target_include_directories(IAESandbox PRIVATE imp/hpp) -target_link_libraries(IAESandbox PRIVATE IAEngine) +target_link_libraries(IAESandbox PRIVATE IAEngine RmlUi::RmlUi) diff --git a/Src/IAESandbox/imp/cpp/Game.cpp b/Src/IAESandbox/imp/cpp/Game.cpp index c8936bd..3bc8a7d 100644 --- a/Src/IAESandbox/imp/cpp/Game.cpp +++ b/Src/IAESandbox/imp/cpp/Game.cpp @@ -6,6 +6,7 @@ #include + namespace ia::iae::game { RefPtr scene; @@ -25,14 +26,14 @@ namespace ia::iae::game .ShouldLoop = true, .Keys = { SpriteRendererComponent::AnimationKeyFrame { - .Scale = {0.1f, 0.1f, 0.1f}, .Texture = Engine::CreateTexture(File::ReadToVector("Graphics/green.png")), + .Scale = {0.1f, 0.1f}, } }, }); t->BakeAnimations(); } - g_player->SetLocalPosition({200, 200, 0}); + g_player->SetLocalPosition({200, 200}); const auto obstacle = MakeRefPtr(); { @@ -41,15 +42,15 @@ namespace ia::iae::game .ShouldLoop = true, .Keys = { SpriteRendererComponent::AnimationKeyFrame { - .Scale = {0.25f, 0.25f, 0.1f}, .Texture = Engine::CreateTexture(File::ReadToVector("Graphics/red.png")), + .Scale = {0.25f, 0.25f}, } }, }); t->BakeAnimations(); } - obstacle->SortOffset() = 20; - obstacle->SetLocalPosition({150, 100, 0}); + obstacle->SetLocalSortIndex(20); + obstacle->SetLocalPosition({150, 100}); scene->AddNode(g_player); scene->AddNode(obstacle); @@ -61,6 +62,6 @@ namespace ia::iae::game VOID Game::Update() { - g_player->SetLocalPosition(g_player->GetLocalPosition() + glm::vec3{Input::GetDirectionalInput(), 0.0f}); + g_player->SetLocalPosition(g_player->GetLocalPosition() + Input::GetDirectionalInput()); } } \ No newline at end of file diff --git a/Src/IAEngine/CMakeLists.txt b/Src/IAEngine/CMakeLists.txt index bf99e7e..9a159fa 100644 --- a/Src/IAEngine/CMakeLists.txt +++ b/Src/IAEngine/CMakeLists.txt @@ -7,14 +7,13 @@ set(IAEngine_Sources imp/cpp/Scene.cpp imp/cpp/Random.cpp imp/cpp/Texture.cpp + imp/cpp/UI.cpp imp/cpp/Rendering/Camera.cpp imp/cpp/Rendering/Renderer.cpp imp/cpp/Rendering/GPUBuffer.cpp imp/cpp/Rendering/GPUTexture.cpp - imp/cpp/Rendering/Mesh/Quad.cpp - imp/cpp/Rendering/Pipeline/Pipeline.cpp imp/cpp/Rendering/Pipeline/UnlitMesh.cpp diff --git a/Src/IAEngine/imp/cpp/Components/AtlasRenderer.cpp b/Src/IAEngine/imp/cpp/Components/AtlasRenderer.cpp index 580f5ec..7aca464 100644 --- a/Src/IAEngine/imp/cpp/Components/AtlasRenderer.cpp +++ b/Src/IAEngine/imp/cpp/Components/AtlasRenderer.cpp @@ -20,7 +20,7 @@ namespace ia::iae { - AtlasRendererComponent::AtlasRendererComponent(IN Node *node) : IComponent(node) + AtlasRendererComponent::AtlasRendererComponent(IN Node *node) : TextureRendererComponent(node) { } @@ -40,12 +40,12 @@ namespace ia::iae m_tileGrid.m_tileTextures.resize(m_tileGrid.TileCountX * m_tileGrid.TileCountY); } - VOID AtlasRendererComponent::SetGridTileTexture(IN INT32 index, IN Texture texture) + VOID AtlasRendererComponent::SetGridTileTexture(IN INT32 index, IN class Texture texture) { m_tileGrid.m_tileTextures[index] = texture; } - VOID AtlasRendererComponent::SetGridTileTexture(IN INT32 x, IN INT32 y, IN Texture texture) + VOID AtlasRendererComponent::SetGridTileTexture(IN INT32 x, IN INT32 y, IN class Texture texture) { m_tileGrid.m_tileTextures[x + (y * m_tileGrid.TileCountX)] = texture; } @@ -59,7 +59,8 @@ namespace ia::iae handles[i] = m_tileGrid.m_tileTextures[i].GetHandle(); m_bakedGPUTexture = GPUTexture::GridCombine(handles.data(), m_tileGrid.TileCountX, m_tileGrid.TileCountY, m_tileGrid.TileWidth, m_tileGrid.TileHeight); - m_bakedTexture = Texture(m_bakedGPUTexture->GetHandle(), w, h); + CurrentTexture() = Texture(m_bakedGPUTexture->GetHandle(), w, h); + PositionOffset() = m_tileGrid.Position; } VOID AtlasRendererComponent::Update() @@ -68,7 +69,6 @@ namespace ia::iae VOID AtlasRendererComponent::Draw() { - m_bakedTexture.Draw(m_node->SortOffset(), m_node->GetPosition() + m_tileGrid.Position, {1.0f, 1.0f, 1.0f}, 0.0f, - false, false, {1.0f, 1.0f, 1.0f, 1.0f}); + TextureRendererComponent::Draw(); } } // namespace ia::iae diff --git a/Src/IAEngine/imp/cpp/Components/SpriteRenderer.cpp b/Src/IAEngine/imp/cpp/Components/SpriteRenderer.cpp index 1f828b2..b13159f 100644 --- a/Src/IAEngine/imp/cpp/Components/SpriteRenderer.cpp +++ b/Src/IAEngine/imp/cpp/Components/SpriteRenderer.cpp @@ -29,7 +29,7 @@ namespace ia::iae return m_reverseAnimation ? m_activeAnimation.Keys[m_activeAnimation.Keys.size() - 1 - index] : m_activeAnimation.Keys[index]; } - SpriteRendererComponent::SpriteRendererComponent(IN Node *node) : IComponent(node) + SpriteRendererComponent::SpriteRendererComponent(IN Node *node) : TextureRendererComponent(node) { } @@ -69,11 +69,13 @@ namespace ia::iae VOID SpriteRendererComponent::Draw() { - Renderer::SetParallaxFactor(m_parallaxFactor); const auto &animFrame = m_currentAnimationState; - animFrame.Texture.Draw(m_node->SortOffset() + m_sortOffset, m_node->GetPosition() + animFrame.Position, - m_node->GetScale() * animFrame.Scale, m_node->GetRotation().z + animFrame.Rotation.z, - m_isFlippedH, m_isFlippedV, animFrame.ColorOverlay); + PositionOffset() = animFrame.Position; + ScaleOffset() = animFrame.Scale; + RotationOffset() = animFrame.Rotation; + ColorOverlay() = animFrame.ColorOverlay; + CurrentTexture() = animFrame.Texture; + TextureRendererComponent::Draw(); } VOID SpriteRendererComponent::UpdateAnimation() diff --git a/Src/IAEngine/imp/cpp/Components/TextureRenderer.cpp b/Src/IAEngine/imp/cpp/Components/TextureRenderer.cpp index 1059d00..94ab786 100644 --- a/Src/IAEngine/imp/cpp/Components/TextureRenderer.cpp +++ b/Src/IAEngine/imp/cpp/Components/TextureRenderer.cpp @@ -17,6 +17,7 @@ #include #include +#include namespace ia::iae { @@ -30,8 +31,13 @@ namespace ia::iae VOID TextureRendererComponent::Draw() { - m_texture.Draw(m_node->SortOffset(), m_node->GetPosition() + m_position, - m_node->GetScale(), m_node->GetRotation().z, - false, false, glm::vec4{1.0f, 1.0f, 1.0f, 1.0f}); + Renderer::SetState_FlippedH(m_isFlippedH); + Renderer::SetState_FlippedV(m_isFlippedV); + Renderer::SetState_CameraRelative(m_isCameraRelative); + Renderer::SetState_TextureOffset(m_textureOffset.x, m_textureOffset.y); + + Renderer::Draw(Renderer::GetMesh_Quad(), m_texture.GetHandle(), m_node->GetPosition() + m_positionOffset, + m_node->GetScale() * m_texture.GetExtent() * m_scaleOffset, m_node->GetRotation() + m_rotationOffset, m_node->LayerIndex(), + m_node->GetSortIndex(), m_colorOverlay); } } // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/imp/cpp/IAEngine.cpp b/Src/IAEngine/imp/cpp/IAEngine.cpp index 07a5a8b..2d73ffe 100644 --- a/Src/IAEngine/imp/cpp/IAEngine.cpp +++ b/Src/IAEngine/imp/cpp/IAEngine.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -71,6 +72,7 @@ namespace ia::iae Input::Initialize(); Audio::Initialize(); Physics::Initialize(); + UI::Initialize(config.WindowWidth, config.WindowHeight); return true; } @@ -82,9 +84,10 @@ namespace ia::iae for (auto &t : g_gpuTextureRefs) t.reset(); - Renderer::Terminate(); - Audio::Terminate(); + UI::Terminate(); Physics::Terminate(); + Audio::Terminate(); + Renderer::Terminate(); SDL_DestroyWindow(g_windowHandle); @@ -106,6 +109,7 @@ namespace ia::iae } Renderer::BeginFrame(); RenderGame(); + UI::Draw(); } VOID Engine::EndFrame() @@ -123,10 +127,12 @@ namespace ia::iae { ImGui_ImplSDL3_ProcessEvent(&g_event); Input::OnEvent(&g_event); + UI::OnEvent(&g_event); } VOID Engine::UpdateGame() { + UI::Update(); Physics::Update(); if B_LIKELY (g_activeScene) diff --git a/Src/IAEngine/imp/cpp/Physics/Physics.cpp b/Src/IAEngine/imp/cpp/Physics/Physics.cpp index 3f09540..81249bf 100644 --- a/Src/IAEngine/imp/cpp/Physics/Physics.cpp +++ b/Src/IAEngine/imp/cpp/Physics/Physics.cpp @@ -51,13 +51,13 @@ namespace ia::iae const auto nodeA = g_colliders[i]->GetNode(); if(IsIntersectingH(boxB, boxA.z) && (IsIntersectingV(boxB, boxA.y) || IsIntersectingV(boxB, boxA.w))) - nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec3(-boxA.z + boxB.x, 0, 0)); + nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec2(-boxA.z + boxB.x, 0)); else if(IsIntersectingH(boxB, boxA.x) && (IsIntersectingV(boxB, boxA.y) || IsIntersectingV(boxB, boxA.w))) - nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec3(-boxA.x + boxB.z, 0, 0)); + nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec2(-boxA.x + boxB.z, 0)); else if(IsIntersectingV(boxB, boxA.w) && (IsIntersectingH(boxB, boxA.x) || IsIntersectingH(boxB, boxA.z))) - nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec3(0, -boxA.w + boxB.y, 0)); + nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec2(0, -boxA.w + boxB.y)); else if(IsIntersectingV(boxB, boxA.y) && (IsIntersectingH(boxB, boxA.x) || IsIntersectingH(boxB, boxA.z))) - nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec3(0, -boxA.y + boxB.w, 0)); + nodeA->SetLocalPosition(nodeA->GetLocalPosition() + glm::vec2(0, -boxA.y + boxB.w)); } } } diff --git a/Src/IAEngine/imp/cpp/Rendering/GPUBuffer.cpp b/Src/IAEngine/imp/cpp/Rendering/GPUBuffer.cpp index 76ee653..228ca16 100644 --- a/Src/IAEngine/imp/cpp/Rendering/GPUBuffer.cpp +++ b/Src/IAEngine/imp/cpp/Rendering/GPUBuffer.cpp @@ -78,6 +78,7 @@ namespace ia::iae SDL_EndGPUCopyPass(copyPass); SDL_SubmitGPUCommandBuffer(cmdBuffer); + SDL_WaitForGPUIdle(g_gpuDevice); } res->m_handle = (Handle) handle; diff --git a/Src/IAEngine/imp/cpp/Rendering/GPUTexture.cpp b/Src/IAEngine/imp/cpp/Rendering/GPUTexture.cpp index 012b19b..a2b2028 100644 --- a/Src/IAEngine/imp/cpp/Rendering/GPUTexture.cpp +++ b/Src/IAEngine/imp/cpp/Rendering/GPUTexture.cpp @@ -83,6 +83,7 @@ namespace ia::iae SDL_UploadToGPUTexture(copyPass, &transferInfo, ®ion, false); SDL_EndGPUCopyPass(copyPass); SDL_SubmitGPUCommandBuffer(cmdBuffer); + SDL_WaitForGPUIdle(g_gpuDevice); SDL_ReleaseGPUTransferBuffer(g_gpuDevice, stagingBuffer); res->m_handle = (Handle) handle; @@ -125,6 +126,7 @@ namespace ia::iae SDL_EndGPUCopyPass(copyPass); SDL_SubmitGPUCommandBuffer(cmdBuffer); + SDL_WaitForGPUIdle(g_gpuDevice); res->m_handle = (Handle) handle; diff --git a/Src/IAEngine/imp/cpp/Rendering/Mesh/Quad.cpp b/Src/IAEngine/imp/cpp/Rendering/Mesh/Quad.cpp deleted file mode 100644 index 0f4289d..0000000 --- a/Src/IAEngine/imp/cpp/Rendering/Mesh/Quad.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// IAEngine: 2D Game Engine by IA -// Copyright (C) 2025 IAS (ias@iasoft.dev) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include -#include -#include -#include - -namespace ia::iae -{ - RefPtr g_quadMeshVertexBuffer{}; - - VOID QuadMesh::Initialize() - { - Vertex_Mesh vertices[6] = { - {glm::vec3{0, 1, 0}, glm::vec2{0, 1}}, - {glm::vec3{1, 1, 0}, glm::vec2{1, 1}}, - {glm::vec3{1, 0, 0}, glm::vec2{1, 0}}, - - {glm::vec3{1, 0, 0}, glm::vec2{1, 0}}, - {glm::vec3{0, 0, 0}, glm::vec2{0, 0}}, - {glm::vec3{0, 1, 0}, glm::vec2{0, 1}}, - }; - g_quadMeshVertexBuffer = GPUBuffer::Create(GPUBuffer::Usage::VERTEX, &vertices, sizeof(vertices)); - } - - VOID QuadMesh::Terminate() - { - if (g_quadMeshVertexBuffer) - g_quadMeshVertexBuffer.reset(); - } - - VOID QuadMesh::Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, - IN FLOAT32 rotation) - { - Renderer::Draw(sortOffset, position, scale, rotation, g_quadMeshVertexBuffer->GetHandle(), 6); - } -} // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/imp/cpp/Rendering/Pipeline/UnlitMesh.cpp b/Src/IAEngine/imp/cpp/Rendering/Pipeline/UnlitMesh.cpp index 0a4eaa0..18d7b18 100644 --- a/Src/IAEngine/imp/cpp/Rendering/Pipeline/UnlitMesh.cpp +++ b/Src/IAEngine/imp/cpp/Rendering/Pipeline/UnlitMesh.cpp @@ -45,7 +45,7 @@ namespace ia::iae }}; SDL_GPUVertexBufferDescription vertexBuffers[] = {{ .slot = 0, - .pitch = sizeof(Vertex_Mesh), + .pitch = sizeof(MeshVertex), .input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX, .instance_step_rate = 0, }}; @@ -54,7 +54,8 @@ namespace ia::iae {.location = 1, .buffer_slot = 0, .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2, - .offset = sizeof(glm::vec3)}}; + .offset = sizeof(glm::vec3)}, + }; SDL_GPUGraphicsPipelineCreateInfo createInfo = { .vertex_shader = (SDL_GPUShader *) vertexShader, .fragment_shader = (SDL_GPUShader *) pixelShader, diff --git a/Src/IAEngine/imp/cpp/Rendering/Renderer.cpp b/Src/IAEngine/imp/cpp/Rendering/Renderer.cpp index 503f07e..daba1b9 100644 --- a/Src/IAEngine/imp/cpp/Rendering/Renderer.cpp +++ b/Src/IAEngine/imp/cpp/Rendering/Renderer.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -27,6 +26,27 @@ #include #include +namespace ia::iae +{ + struct Mesh + { + INT32 IndexCount{}; + RefPtr IndexBuffer; + RefPtr VertexBuffer; + }; + + struct RenderState + { + BOOL FlippedH{false}; + BOOL FlippedV{false}; + BOOL CameraRelative{true}; + glm::vec2 TextureOffset{0.0f, 0.0f}; + }; + + Vector g_meshes{}; + RenderState g_renderState{}; +} // namespace ia::iae + namespace ia::iae { EXTERN SDL_Window *g_windowHandle; @@ -55,9 +75,9 @@ namespace ia::iae glm::mat4 matView{1.0f}; glm::mat4 matModel{1.0f}; - BOOL g_flipH{false}; - BOOL g_flipV{false}; - FLOAT32 g_parallaxFactor{0.0f}; + glm::mat4 matIdentity{1.0f}; + + Handle g_meshHandleQuad{}; BOOL Renderer::Initialize() { @@ -117,10 +137,17 @@ namespace ia::iae g_pipelineUnlitMesh = Pipeline_UnlitMesh::Create(); - QuadMesh::Initialize(); - matProjection = glm::orthoLH(0.0f, (FLOAT32) s_width, (FLOAT32) s_height, 0.0f, -1000.0f, 1000.0f); + g_meshHandleQuad = CreateMesh( + { + {glm::vec3{0, 1, 0}, glm::vec2{0, 1}}, + {glm::vec3{1, 1, 0}, glm::vec2{1, 1}}, + {glm::vec3{1, 0, 0}, glm::vec2{1, 0}}, + {glm::vec3{0, 0, 0}, glm::vec2{0, 0}}, + }, + {0, 1, 2, 2, 3, 0}); + return true; } @@ -128,9 +155,13 @@ namespace ia::iae { SDL_WaitForGPUIdle(g_gpuDevice); - g_pipelineUnlitMesh.reset(); + for (auto &mesh : g_meshes) + { + mesh.VertexBuffer.reset(); + mesh.IndexBuffer.reset(); + } - QuadMesh::Terminate(); + g_pipelineUnlitMesh.reset(); GPUTexture::Terminate(); @@ -221,85 +252,98 @@ namespace ia::iae SDL_SubmitGPUCommandBuffer(g_cmdBuffer); } - VOID Renderer::SetFlipH(IN BOOL value) + VOID Renderer::SetState_FlippedH(IN BOOL value) { - g_flipH = value; + g_renderState.FlippedH = value; } - VOID Renderer::SetFlipV(IN BOOL value) + VOID Renderer::SetState_FlippedV(IN BOOL value) { - g_flipV = value; + g_renderState.FlippedV = value; } - VOID Renderer::BindTexture(IN Handle handle, IN CONST glm::vec4 &colorOverlay) + VOID Renderer::SetState_CameraRelative(IN BOOL value) { - SDL_GPUTextureSamplerBinding binding{.texture = (SDL_GPUTexture *) handle, - .sampler = (SDL_GPUSampler *) GPUTexture::GetDefaultSampler()}; - SDL_BindGPUFragmentSamplers(g_renderPass, 0, &binding, 1); - SDL_PushGPUFragmentUniformData(g_cmdBuffer, 0, &colorOverlay, sizeof(colorOverlay)); + g_renderState.CameraRelative = value; } - VOID SetModelTransformMatrix(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, - IN FLOAT32 rotation) + VOID Renderer::SetState_TextureOffset(IN FLOAT32 u, IN FLOAT32 v) { - if (g_parallaxFactor <= 0.0f) - matView = g_camera.GetViewMatrix(); - else - matView = glm::mat4(1.0f); - SDL_PushGPUVertexUniformData(g_cmdBuffer, 1, &matView, sizeof(matView)); - FLOAT32 shaderParallaxFactor = g_parallaxFactor * g_camera.Position().x / 640.0f; - SDL_PushGPUFragmentUniformData(g_cmdBuffer, 1, &shaderParallaxFactor, sizeof(shaderParallaxFactor)); - - matModel = glm::mat4(1.0f); - - glm::vec3 poff = {0.0f, 0.0f, 0.0f}; - - const auto f = 1.0f; - if(g_flipH) - { - poff.x = scale.x * f; - } - - // [IATODO]: IMPL Flip V - - const auto depthTestOffset = sortOffset + (Engine::GetActiveScene()->YSortingEnabled() ? position.y : 0); - matModel = - glm::translate(matModel, {position.x + poff.x, position.y, - position.z + depthTestOffset + (g_parallaxFactor < 0.0f ? 0.0f : -100.0f)}); - matModel = glm::rotate(matModel, rotation, glm::vec3(0.0f, 0.0f, 1.0f)); - matModel = glm::scale(matModel, scale * (g_flipH ? glm::vec3{-1.0f, 1.0f, 1.0f} : glm::vec3{1.0f, 1.0f, 1.0f})); - - SDL_PushGPUVertexUniformData(g_cmdBuffer, 2, &matModel, sizeof(matModel)); - } - - VOID Renderer::Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, - IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN INT32 vertexCount) - { - SetModelTransformMatrix(sortOffset, position, scale, rotation); - SDL_GPUBufferBinding bindings[] = {{.buffer = (SDL_GPUBuffer *) vertexBufferHandle, .offset = 0}}; - SDL_BindGPUVertexBuffers(g_renderPass, 0, bindings, 1); - SDL_DrawGPUPrimitives(g_renderPass, vertexCount, 1, 0, 0); - } - - VOID Renderer::Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, - IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN Handle indexBufferHandle, - IN INT32 indexCount) - { - SetModelTransformMatrix(sortOffset, position, scale, rotation); - SDL_GPUBufferBinding bindings[] = {{.buffer = (SDL_GPUBuffer *) vertexBufferHandle, .offset = 0}, - {.buffer = (SDL_GPUBuffer *) indexBufferHandle, .offset = 0}}; - SDL_BindGPUVertexBuffers(g_renderPass, 0, bindings, 1); - SDL_BindGPUIndexBuffer(g_renderPass, &bindings[1], SDL_GPU_INDEXELEMENTSIZE_32BIT); - SDL_DrawGPUIndexedPrimitives(g_renderPass, indexCount, 1, 0, 0, 0); + g_renderState.TextureOffset = {u, v}; } Camera2D *Renderer::GetCamera() { return &g_camera; } - - VOID Renderer::SetParallaxFactor(IN FLOAT32 value) - { - g_parallaxFactor = value; - } } // namespace ia::iae + +namespace ia::iae +{ + Handle Renderer::GetMesh_Quad() + { + return g_meshHandleQuad; + } + + Handle Renderer::CreateMesh(IN CONST Vector &vertices, IN CONST Vector &indices) + { + Mesh mesh{}; + mesh.VertexBuffer = GPUBuffer::Create(GPUBuffer::Usage::VERTEX, vertices.data(), + static_cast(vertices.size() * sizeof(vertices[0]))); + mesh.IndexBuffer = GPUBuffer::Create(GPUBuffer::Usage::INDEX, indices.data(), + static_cast(indices.size() * sizeof(indices[0]))); + mesh.IndexCount = static_cast(indices.size()); + g_meshes.pushBack(mesh); + return static_cast(g_meshes.size() - 1); + } + + VOID Renderer::Draw(IN Handle meshHandle, IN Handle textureHandle, IN CONST glm::vec2 &position, + IN CONST glm::vec2 &scale, IN FLOAT32 rotation, IN UINT8 layerIndex, IN INT16 sortIndex, + IN CONST glm::vec4 &colorOverlay) + { + IA_ASSERT(sortIndex <= 0x1FFF); + +#pragma pack(push, 1) + + STATIC struct + { + INT32 FlippedH{false}; + INT32 FlippedV{false}; + glm::vec2 TextureOffset{0.0f, 0.0f}; + glm::vec4 ColorOverlay{1.0f, 1.0f, 1.0f, 1.0f}; + } s_fragmentUniform{}; + +#pragma pack(pop) + + if (g_renderState.CameraRelative) + SDL_PushGPUVertexUniformData(g_cmdBuffer, 1, &matView, sizeof(matView)); + else + SDL_PushGPUVertexUniformData(g_cmdBuffer, 1, &matIdentity, sizeof(matIdentity)); + if(Engine::GetActiveScene()->YSortingEnabled()) + sortIndex += static_cast(position.y); + matModel = + glm::translate(glm::mat4(1.0f), glm::vec3{position.x, position.y, + static_cast((layerIndex << 13) | (sortIndex & 0x1FFF))}); + matModel = glm::rotate(matModel, rotation, glm::vec3(0.0f, 0.0f, 1.0f)); + matModel = glm::scale(matModel, glm::vec3{scale.x, scale.y, 1.0f}); + SDL_PushGPUVertexUniformData(g_cmdBuffer, 2, &matModel, sizeof(matModel)); + + s_fragmentUniform.ColorOverlay = colorOverlay; + s_fragmentUniform.FlippedH = g_renderState.FlippedH; + s_fragmentUniform.FlippedV = g_renderState.FlippedV; + s_fragmentUniform.TextureOffset = g_renderState.TextureOffset; + SDL_PushGPUFragmentUniformData(g_cmdBuffer, 0, &s_fragmentUniform, sizeof(s_fragmentUniform)); + + SDL_GPUTextureSamplerBinding textureBinding{.texture = (SDL_GPUTexture *) textureHandle, + .sampler = (SDL_GPUSampler *) GPUTexture::GetDefaultSampler()}; + SDL_BindGPUFragmentSamplers(g_renderPass, 0, &textureBinding, 1); + + const auto &mesh = g_meshes[meshHandle]; + SDL_GPUBufferBinding bufferBindings[] = { + {.buffer = (SDL_GPUBuffer *) mesh.VertexBuffer->GetHandle(), .offset = 0}, + {.buffer = (SDL_GPUBuffer *) mesh.IndexBuffer->GetHandle(), .offset = 0}}; + SDL_BindGPUVertexBuffers(g_renderPass, 0, bufferBindings, 1); + SDL_BindGPUIndexBuffer(g_renderPass, &bufferBindings[1], SDL_GPU_INDEXELEMENTSIZE_32BIT); + SDL_DrawGPUIndexedPrimitives(g_renderPass, mesh.IndexCount, 1, 0, 0, 0); + } +} // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/imp/cpp/Texture.cpp b/Src/IAEngine/imp/cpp/Texture.cpp index d005050..153d1b8 100644 --- a/Src/IAEngine/imp/cpp/Texture.cpp +++ b/Src/IAEngine/imp/cpp/Texture.cpp @@ -17,7 +17,6 @@ #include #include -#include #include namespace ia::iae @@ -27,20 +26,11 @@ namespace ia::iae } Texture::Texture(IN Handle handle, IN INT32 width, IN INT32 height) - : m_handle(handle), m_size({(FLOAT32) width, (FLOAT32) height, 1.0f}) + : m_handle(handle), m_extent({(FLOAT32) width, (FLOAT32) height}) { } Texture::~Texture() { } - - VOID Texture::Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, IN FLOAT32 rotation, IN BOOL flipH, - IN BOOL flipV, IN CONST glm::vec4 &colorOverlay) CONST - { - Renderer::SetFlipH(flipH); - Renderer::SetFlipV(flipV); - Renderer::BindTexture(m_handle, colorOverlay); - QuadMesh::Draw(sortOffset, position, m_size * scale, rotation); - } } // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/imp/cpp/UI.cpp b/Src/IAEngine/imp/cpp/UI.cpp new file mode 100644 index 0000000..2efe31d --- /dev/null +++ b/Src/IAEngine/imp/cpp/UI.cpp @@ -0,0 +1,113 @@ +// IAEngine: 2D Game Engine by IA +// Copyright (C) 2025 IAS (ias@iasoft.dev) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include + +namespace ia::iae +{ + class RmlUIRenderInterface : public Rml::RenderInterface + { + public: + Rml::CompiledGeometryHandle CompileGeometry(Rml::Span vertices, + Rml::Span indices); + void RenderGeometry(Rml::CompiledGeometryHandle geometry, Rml::Vector2f translation, + Rml::TextureHandle texture); + void ReleaseGeometry(Rml::CompiledGeometryHandle geometry); + Rml::TextureHandle LoadTexture(Rml::Vector2i &texture_dimensions, const Rml::String &source); + Rml::TextureHandle GenerateTexture(Rml::Span source, Rml::Vector2i source_dimensions); + void ReleaseTexture(Rml::TextureHandle texture); + void EnableScissorRegion(bool enable); + void SetScissorRegion(Rml::Rectanglei region); + }; + + //RmlUIRenderInterface g_rmlUIRenderInterface{}; +} // namespace ia::iae + +namespace ia::iae +{ + //Rml::Context* g_context{}; + + VOID UI::Initialize(IN INT32 width, IN INT32 height) + { + //Rml::SetRenderInterface(&g_rmlUIRenderInterface); + //Rml::Initialise(); + //g_context = Rml::CreateContext("main", Rml::Vector2i(width, height)); + } + + VOID UI::Terminate() + { + //Rml::Shutdown(); + } + + VOID UI::Update() + { + //g_context->Update(); + } + + VOID UI::Draw() + { + //g_context->Render(); + } + + VOID UI::OnEvent(IN PVOID event) + { + + } + + VOID UI::OnResize(IN INT32 width, IN INT32 height) + { + } +} // namespace ia::iae + +namespace ia::iae +{ + /*Rml::CompiledGeometryHandle RmlUIRenderInterface::CompileGeometry(Rml::Span vertices, + Rml::Span indices) + { + } + + void RmlUIRenderInterface::RenderGeometry(Rml::CompiledGeometryHandle geometry, Rml::Vector2f translation, + Rml::TextureHandle texture) + { + } + + void RmlUIRenderInterface::ReleaseGeometry(Rml::CompiledGeometryHandle geometry) + { + } + + Rml::TextureHandle RmlUIRenderInterface::LoadTexture(Rml::Vector2i &texture_dimensions, const Rml::String &source) + { + } + + Rml::TextureHandle RmlUIRenderInterface::GenerateTexture(Rml::Span source, + Rml::Vector2i source_dimensions) + { + } + + void RmlUIRenderInterface::ReleaseTexture(Rml::TextureHandle texture) + { + } + + void RmlUIRenderInterface::EnableScissorRegion(bool enable) + { + } + + void RmlUIRenderInterface::SetScissorRegion(Rml::Rectanglei region) + { + }*/ +} // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/imp/glsl/UnlitMesh/UnlitMesh.frag b/Src/IAEngine/imp/glsl/UnlitMesh/UnlitMesh.frag index 59d3c5b..d1a5302 100644 --- a/Src/IAEngine/imp/glsl/UnlitMesh/UnlitMesh.frag +++ b/Src/IAEngine/imp/glsl/UnlitMesh/UnlitMesh.frag @@ -7,16 +7,18 @@ layout(location = 0) out vec4 outColor; layout(set = 2, binding = 0) uniform sampler2D texSampler; layout(set = 3, binding = 0) uniform UniformBufferObject { + bool flippedH; + bool flippedV; + vec2 uvOffset; vec4 colorOverlay; } ubo; -layout(set = 3, binding = 1) uniform UniformBufferObject2 { - float parallaxFactor; -} ubo2; void main() { vec2 uv = inTexCoord; - uv.x += ubo2.parallaxFactor; + uv += ubo.uvOffset; + if(ubo.flippedH) uv.x = 1.0 - uv.x; + if(ubo.flippedV) uv.y = 1.0 - uv.y; outColor = texture(texSampler, uv) * ubo.colorOverlay; if(outColor.w < 0.1) discard; diff --git a/Src/IAEngine/imp/hpp/EmbeddedShaders.hpp b/Src/IAEngine/imp/hpp/EmbeddedShaders.hpp index 7a50085..206de4f 100644 --- a/Src/IAEngine/imp/hpp/EmbeddedShaders.hpp +++ b/Src/IAEngine/imp/hpp/EmbeddedShaders.hpp @@ -27,7 +27,7 @@ namespace ia::iae CONSTEXPR UINT8 SHADER_SOURCE_UNLITMESH_VERT[1964] = { 0x3,0x2,0x23,0x7,0x0,0x0,0x1,0x0,0xb,0x0,0xd,0x0,0x35,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11,0x0,0x2,0x0,0x1,0x0,0x0,0x0,0xb,0x0,0x6,0x0,0x1,0x0,0x0,0x0,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30,0x0,0x0,0x0,0x0,0xe,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xf,0x0,0x9,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x6d,0x61,0x69,0x6e,0x0,0x0,0x0,0x0,0xd,0x0,0x0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x47,0x4c,0x5f,0x41,0x52,0x42,0x5f,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x65,0x5f,0x73,0x68,0x61,0x64,0x65,0x72,0x5f,0x6f,0x62,0x6a,0x65,0x63,0x74,0x73,0x0,0x0,0x4,0x0,0xa,0x0,0x47,0x4c,0x5f,0x47,0x4f,0x4f,0x47,0x4c,0x45,0x5f,0x63,0x70,0x70,0x5f,0x73,0x74,0x79,0x6c,0x65,0x5f,0x6c,0x69,0x6e,0x65,0x5f,0x64,0x69,0x72,0x65,0x63,0x74,0x69,0x76,0x65,0x0,0x0,0x4,0x0,0x8,0x0,0x47,0x4c,0x5f,0x47,0x4f,0x4f,0x47,0x4c,0x45,0x5f,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x5f,0x64,0x69,0x72,0x65,0x63,0x74,0x69,0x76,0x65,0x0,0x5,0x0,0x4,0x0,0x4,0x0,0x0,0x0,0x6d,0x61,0x69,0x6e,0x0,0x0,0x0,0x0,0x5,0x0,0x3,0x0,0x9,0x0,0x0,0x0,0x75,0x76,0x0,0x0,0x5,0x0,0x5,0x0,0xb,0x0,0x0,0x0,0x69,0x6e,0x54,0x65,0x78,0x43,0x6f,0x6f,0x72,0x64,0x0,0x0,0x5,0x0,0x8,0x0,0xd,0x0,0x0,0x0,0x55,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x42,0x75,0x66,0x66,0x65,0x72,0x4f,0x62,0x6a,0x65,0x63,0x74,0x32,0x0,0x0,0x0,0x0,0x6,0x0,0x7,0x0,0xd,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x70,0x61,0x72,0x61,0x6c,0x6c,0x61,0x78,0x46,0x61,0x63,0x74,0x6f,0x72,0x0,0x0,0x5,0x0,0x4,0x0,0xf,0x0,0x0,0x0,0x75,0x62,0x6f,0x32,0x0,0x0,0x0,0x0,0x5,0x0,0x5,0x0,0x1e,0x0,0x0,0x0,0x6f,0x75,0x74,0x43,0x6f,0x6c,0x6f,0x72,0x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0,0x3f,0x0,0x0,0x0,0x3e,0x0,0x0,0x0,0x85,0x0,0x5,0x0,0xe,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x3b,0x0,0x0,0x0,0x3f,0x0,0x0,0x0,0x3e,0x0,0x3,0x0,0x34,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x41,0x0,0x5,0x0,0x42,0x0,0x0,0x0,0x43,0x0,0x0,0x0,0x34,0x0,0x0,0x0,0x41,0x0,0x0,0x0,0x3d,0x0,0x4,0x0,0x6,0x0,0x0,0x0,0x44,0x0,0x0,0x0,0x43,0x0,0x0,0x0,0xb8,0x0,0x5,0x0,0x1d,0x0,0x0,0x0,0x46,0x0,0x0,0x0,0x44,0x0,0x0,0x0,0x45,0x0,0x0,0x0,0xf7,0x0,0x3,0x0,0x48,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfa,0x0,0x4,0x0,0x46,0x0,0x0,0x0,0x47,0x0,0x0,0x0,0x48,0x0,0x0,0x0,0xf8,0x0,0x2,0x0,0x47,0x0,0x0,0x0,0xfc,0x0,0x1,0x0,0xf8,0x0,0x2,0x0,0x48,0x0,0x0,0x0,0xfd,0x0,0x1,0x0,0x38,0x0,0x1,0x0,}; } // namespace ia::iae diff --git a/Src/IAEngine/inc/IAEngine/Components/AtlasRenderer.hpp b/Src/IAEngine/inc/IAEngine/Components/AtlasRenderer.hpp index f143a28..42b9ffc 100644 --- a/Src/IAEngine/inc/IAEngine/Components/AtlasRenderer.hpp +++ b/Src/IAEngine/inc/IAEngine/Components/AtlasRenderer.hpp @@ -16,13 +16,13 @@ #pragma once -#include +#include #include #include namespace ia::iae { - class AtlasRendererComponent : public IComponent + class AtlasRendererComponent : public TextureRendererComponent { public: struct TileGrid @@ -35,7 +35,7 @@ namespace ia::iae INT32 TileCountY{}; private: - Vector m_tileTextures{}; + Vector m_tileTextures{}; friend class AtlasRendererComponent; }; @@ -46,8 +46,8 @@ namespace ia::iae public: VOID SetGrid(IN INT32 tileWidth, IN INT32 tileHeight, IN INT32 tileCountX, IN INT32 tileCountY); - VOID SetGridTileTexture(IN INT32 index, IN Texture texture); - VOID SetGridTileTexture(IN INT32 x, IN INT32 y, IN Texture texture); + VOID SetGridTileTexture(IN INT32 index, IN class Texture texture); + VOID SetGridTileTexture(IN INT32 x, IN INT32 y, IN class Texture texture); VOID BakeGrid(); public: @@ -56,7 +56,6 @@ namespace ia::iae private: TileGrid m_tileGrid{}; - Texture m_bakedTexture{}; RefPtr m_bakedGPUTexture{}; }; } // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/inc/IAEngine/Components/SpriteRenderer.hpp b/Src/IAEngine/inc/IAEngine/Components/SpriteRenderer.hpp index 68228ca..21cd731 100644 --- a/Src/IAEngine/inc/IAEngine/Components/SpriteRenderer.hpp +++ b/Src/IAEngine/inc/IAEngine/Components/SpriteRenderer.hpp @@ -16,23 +16,24 @@ #pragma once -#include +#include #include namespace ia::iae { - class SpriteRendererComponent : public IComponent + class SpriteRendererComponent : public TextureRendererComponent { public: struct AnimationKeyFrame { - INT32 Duration{100}; - glm::vec3 Position{}; - glm::vec3 Rotation{}; - glm::vec3 Scale{1.0f, 1.0f, 1.0f}; - glm::vec4 ColorOverlay{1.0f, 1.0f, 1.0f, 1.0f}; - BOOL ShouldInterpolate{}; Texture Texture; + INT32 Duration{100}; + BOOL ShouldInterpolate{}; + + FLOAT32 Rotation{}; + glm::vec2 Position{}; + glm::vec2 Scale{1.0f, 1.0f}; + glm::vec4 ColorOverlay{1.0f, 1.0f, 1.0f, 1.0f}; }; struct Animation @@ -61,26 +62,6 @@ namespace ia::iae return m_animations; } - BOOL &IsFlippedV() - { - return m_isFlippedV; - } - - BOOL &IsFlippedH() - { - return m_isFlippedH; - } - - FLOAT32 &SortOffset() - { - return m_sortOffset; - } - - FLOAT32 &ParallaxFactor() - { - return m_parallaxFactor; - } - BOOL &ReverseAnimation() { return m_reverseAnimation; @@ -97,10 +78,6 @@ namespace ia::iae private: BOOL m_reverseAnimation{}; - FLOAT32 m_parallaxFactor{0.0f}; - FLOAT32 m_sortOffset{}; - BOOL m_isFlippedV{false}; - BOOL m_isFlippedH{false}; FLOAT32 m_timelinePosition{}; Animation m_activeAnimation{}; Handle m_activeAnimationHandle{INVALID_HANDLE}; diff --git a/Src/IAEngine/inc/IAEngine/Components/TextureRenderer.hpp b/Src/IAEngine/inc/IAEngine/Components/TextureRenderer.hpp index caab9c3..aad52a8 100644 --- a/Src/IAEngine/inc/IAEngine/Components/TextureRenderer.hpp +++ b/Src/IAEngine/inc/IAEngine/Components/TextureRenderer.hpp @@ -26,14 +26,49 @@ namespace ia::iae public: TextureRendererComponent(IN Node *node); - Texture &Texture() + Texture &CurrentTexture() { return m_texture; } - glm::vec3 &Position() + glm::vec2 &PositionOffset() { - return m_position; + return m_positionOffset; + } + + glm::vec2 &ScaleOffset() + { + return m_scaleOffset; + } + + FLOAT32& RotationOffset() + { + return m_rotationOffset; + } + + glm::vec2 &TextureOffset() + { + return m_textureOffset; + } + + glm::vec4 &ColorOverlay() + { + return m_colorOverlay; + } + + BOOL &IsFlippedH() + { + return m_isFlippedH; + } + + BOOL &IsFlippedV() + { + return m_isFlippedV; + } + + BOOL &IsCameraRelative() + { + return m_isCameraRelative; } public: @@ -41,7 +76,14 @@ namespace ia::iae VOID Update(); private: + BOOL m_isFlippedH{}; + BOOL m_isFlippedV{}; + BOOL m_isCameraRelative{}; + glm::vec2 m_positionOffset{}; + glm::vec2 m_scaleOffset{}; + FLOAT32 m_rotationOffset{}; + glm::vec2 m_textureOffset{}; + glm::vec4 m_colorOverlay{1.0f, 1.0f, 1.0f, 1.0f}; class Texture m_texture; - glm::vec3 m_position; }; } // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/inc/IAEngine/Nodes/Node.hpp b/Src/IAEngine/inc/IAEngine/Nodes/Node.hpp index d8ccc91..04a34d6 100644 --- a/Src/IAEngine/inc/IAEngine/Nodes/Node.hpp +++ b/Src/IAEngine/inc/IAEngine/Nodes/Node.hpp @@ -49,15 +49,19 @@ namespace ia::iae return m_components; } - public: - FLOAT32 &SortOffset() + UINT8 GetLayerIndex() CONST { - return m_sortOffset; + return m_layerIndex; + } + + UINT8 &LayerIndex() + { + return m_layerIndex; } protected: Scene *m_scene{}; - FLOAT32 m_sortOffset{}; + UINT8 m_layerIndex{}; BOOL m_isEnabled{true}; protected: diff --git a/Src/IAEngine/inc/IAEngine/Nodes/Transform.hpp b/Src/IAEngine/inc/IAEngine/Nodes/Transform.hpp index 36e84d5..ce4e295 100644 --- a/Src/IAEngine/inc/IAEngine/Nodes/Transform.hpp +++ b/Src/IAEngine/inc/IAEngine/Nodes/Transform.hpp @@ -20,55 +20,70 @@ namespace ia::iae { - template - class Transform + template class Transform { public: - VOID SetLocalPosition(IN CONST glm::vec3 &v) + VOID SetLocalSortIndex(IN INT16 index) + { + m_local.SortIndex = index; + RecalculateSortIndex(); + } + + VOID SetLocalPosition(IN CONST glm::vec2 &v) { m_local.Position = v; RecalculatePosition(); } - VOID SetLocalScale(IN CONST glm::vec3 &v) + VOID SetLocalScale(IN CONST glm::vec2 &v) { m_local.Scale = v; RecalculateScale(); } - VOID SetLocalRotation(IN CONST glm::vec3 &v) + VOID SetLocalRotation(IN CONST glm::vec2 &v) { m_local.Rotation = v; RecalculateRotation(); } public: - CONST glm::vec3 &GetPosition() CONST + INT16 GetSortIndex() CONST + { + return m_global.SortIndex; + } + + CONST glm::vec2 &GetPosition() CONST { return m_global.Position; } - CONST glm::vec3 &GetScale() CONST + CONST glm::vec2 &GetScale() CONST { return m_global.Scale; } - CONST glm::vec3 &GetRotation() CONST + CONST FLOAT32 &GetRotation() CONST { return m_global.Rotation; } - CONST glm::vec3 &GetLocalPosition() CONST + INT16 GetLocalSortIndex() CONST + { + return m_local.SortIndex; + } + + CONST glm::vec2 &GetLocalPosition() CONST { return m_local.Position; } - CONST glm::vec3 &GetLocalScale() CONST + CONST glm::vec2 &GetLocalScale() CONST { return m_local.Scale; } - CONST glm::vec3 &GetLocalRotation() CONST + CONST FLOAT32 &GetLocalRotation() CONST { return m_local.Rotation; } @@ -78,23 +93,30 @@ namespace ia::iae Vector> m_children{}; protected: + VOID RecalculateSortIndex() + { + m_global.SortIndex = (m_parent ? m_parent->GetSortIndex() : 0) + m_local.SortIndex; + for (auto &c : m_children) + c->RecalculateSortIndex(); + } + VOID RecalculatePosition() { - m_global.Position = (m_parent ? m_parent->GetPosition() : glm::vec3{}) + m_local.Position; + m_global.Position = (m_parent ? m_parent->GetPosition() : glm::vec2{}) + m_local.Position; for (auto &c : m_children) c->RecalculatePosition(); } VOID RecalculateRotation() { - m_global.Rotation = (m_parent ? m_parent->GetRotation() : glm::vec3{}) + m_local.Rotation; + m_global.Rotation = (m_parent ? m_parent->GetRotation() : 0) + m_local.Rotation; for (auto &c : m_children) c->RecalculateRotation(); } VOID RecalculateScale() { - m_global.Scale = (m_parent ? m_parent->GetScale() : glm::vec3{}) + m_local.Scale; + m_global.Scale = (m_parent ? m_parent->GetScale() : glm::vec2{}) + m_local.Scale; for (auto &c : m_children) c->RecalculateScale(); } @@ -102,9 +124,10 @@ namespace ia::iae private: struct { - glm::vec3 Position{0.0f, 0.0f, 0.0f}; - glm::vec3 Rotation{0.0f, 0.0f, 0.0f}; - glm::vec3 Scale{1.0f, 1.0f, 1.0f}; + INT16 SortIndex{}; + FLOAT32 Rotation{0.0f}; + glm::vec2 Position{0.0f, 0.0f}; + glm::vec2 Scale{1.0f, 1.0f}; } m_local{}, m_global{}; }; } // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/inc/IAEngine/Rendering/Renderer.hpp b/Src/IAEngine/inc/IAEngine/Rendering/Renderer.hpp index 8d0a164..1670e57 100644 --- a/Src/IAEngine/inc/IAEngine/Rendering/Renderer.hpp +++ b/Src/IAEngine/inc/IAEngine/Rendering/Renderer.hpp @@ -16,7 +16,7 @@ #pragma once -#include +#include namespace ia::iae { @@ -44,16 +44,22 @@ namespace ia::iae STATIC VOID BeginFrame(); STATIC VOID EndFrame(); - STATIC VOID BindTexture(IN Handle handle, IN CONST glm::vec4& colorOverlay); + STATIC VOID SetState_FlippedH(IN BOOL value); + STATIC VOID SetState_FlippedV(IN BOOL value); + STATIC VOID SetState_CameraRelative(IN BOOL value); + STATIC VOID SetState_TextureOffset(IN FLOAT32 u, IN FLOAT32 v); - STATIC VOID Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN INT32 vertexCount); - STATIC VOID Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN Handle indexBufferHandle, IN INT32 indexCount); + public: + STATIC Handle GetMesh_Quad(); - STATIC Camera2D* GetCamera(); + STATIC Handle CreateMesh(IN CONST Vector &vertices, IN CONST Vector &indices); - STATIC VOID SetFlipH(IN BOOL value); - STATIC VOID SetFlipV(IN BOOL value); - STATIC VOID SetParallaxFactor(IN FLOAT32 value); + STATIC VOID Draw(IN Handle meshHandle, IN Handle textureHandle, IN CONST glm::vec2 &position, + IN CONST glm::vec2 &scale, IN FLOAT32 rotation = 0, IN UINT8 layerIndex = 0, + IN INT16 sortIndex = 0, IN CONST glm::vec4 &colorOverlay = {1.0f, 1.0f, 1.0f, 1.0f}); + + public: + STATIC Camera2D *GetCamera(); public: STATIC INT32 Width() diff --git a/Src/IAEngine/inc/IAEngine/Rendering/Types.hpp b/Src/IAEngine/inc/IAEngine/Rendering/Types.hpp index f72c43c..e420b8a 100644 --- a/Src/IAEngine/inc/IAEngine/Rendering/Types.hpp +++ b/Src/IAEngine/inc/IAEngine/Rendering/Types.hpp @@ -20,11 +20,9 @@ namespace ia::iae { - struct Vertex_Mesh + struct MeshVertex { glm::vec3 Position{}; glm::vec2 UV{}; }; - - } \ No newline at end of file diff --git a/Src/IAEngine/inc/IAEngine/Texture.hpp b/Src/IAEngine/inc/IAEngine/Texture.hpp index 2d02b44..b55759b 100644 --- a/Src/IAEngine/inc/IAEngine/Texture.hpp +++ b/Src/IAEngine/inc/IAEngine/Texture.hpp @@ -27,10 +27,6 @@ namespace ia::iae Texture(); ~Texture(); - public: - VOID Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, IN FLOAT32 rotation, - IN BOOL flipH, IN BOOL flipV, IN CONST glm::vec4 &colorOverlay) CONST; - public: Handle GetHandle() CONST { @@ -39,16 +35,21 @@ namespace ia::iae INT32 GetWidth() CONST { - return (INT32) m_size.x; + return (INT32) m_extent.x; } INT32 GetHeight() CONST { - return (INT32) m_size.y; + return (INT32) m_extent.y; + } + + CONST glm::vec2 &GetExtent() CONST + { + return m_extent; } private: Handle m_handle{INVALID_HANDLE}; - glm::vec3 m_size{}; + glm::vec2 m_extent{}; }; } // namespace ia::iae \ No newline at end of file diff --git a/Src/IAEngine/inc/IAEngine/Rendering/Mesh/Quad.hpp b/Src/IAEngine/inc/IAEngine/UI.hpp similarity index 76% rename from Src/IAEngine/inc/IAEngine/Rendering/Mesh/Quad.hpp rename to Src/IAEngine/inc/IAEngine/UI.hpp index f225eb4..2e22554 100644 --- a/Src/IAEngine/inc/IAEngine/Rendering/Mesh/Quad.hpp +++ b/Src/IAEngine/inc/IAEngine/UI.hpp @@ -20,12 +20,16 @@ namespace ia::iae { - class QuadMesh + class UI { - public: - STATIC VOID Initialize(); + public: + STATIC VOID Initialize(IN INT32 width, IN INT32 height); STATIC VOID Terminate(); - STATIC VOID Draw(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale, IN FLOAT32 rotation); + STATIC VOID Draw(); + STATIC VOID Update(); + + STATIC VOID OnEvent(IN PVOID event); + STATIC VOID OnResize(IN INT32 width, IN INT32 height); }; -} // namespace ia::iae \ No newline at end of file +} \ No newline at end of file