Restructure
This commit is contained in:
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@ -19,6 +19,14 @@
|
|||||||
"initializer_list": "cpp",
|
"initializer_list": "cpp",
|
||||||
"random": "cpp",
|
"random": "cpp",
|
||||||
"span": "cpp",
|
"span": "cpp",
|
||||||
"xstring": "cpp"
|
"xstring": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"expected": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"xlocmon": "cpp",
|
||||||
|
"xiosbase": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,4 +8,4 @@ add_executable(IAESandbox ${IAESandbox_Sources})
|
|||||||
|
|
||||||
target_include_directories(IAESandbox PRIVATE imp/hpp)
|
target_include_directories(IAESandbox PRIVATE imp/hpp)
|
||||||
|
|
||||||
target_link_libraries(IAESandbox PRIVATE IAEngine)
|
target_link_libraries(IAESandbox PRIVATE IAEngine RmlUi::RmlUi)
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <IACore/File.hpp>
|
#include <IACore/File.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace ia::iae::game
|
namespace ia::iae::game
|
||||||
{
|
{
|
||||||
RefPtr<Scene> scene;
|
RefPtr<Scene> scene;
|
||||||
@ -25,14 +26,14 @@ namespace ia::iae::game
|
|||||||
.ShouldLoop = true,
|
.ShouldLoop = true,
|
||||||
.Keys = {
|
.Keys = {
|
||||||
SpriteRendererComponent::AnimationKeyFrame {
|
SpriteRendererComponent::AnimationKeyFrame {
|
||||||
.Scale = {0.1f, 0.1f, 0.1f},
|
|
||||||
.Texture = Engine::CreateTexture(File::ReadToVector("Graphics/green.png")),
|
.Texture = Engine::CreateTexture(File::ReadToVector("Graphics/green.png")),
|
||||||
|
.Scale = {0.1f, 0.1f},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
t->BakeAnimations();
|
t->BakeAnimations();
|
||||||
}
|
}
|
||||||
g_player->SetLocalPosition({200, 200, 0});
|
g_player->SetLocalPosition({200, 200});
|
||||||
|
|
||||||
const auto obstacle = MakeRefPtr<Node>();
|
const auto obstacle = MakeRefPtr<Node>();
|
||||||
{
|
{
|
||||||
@ -41,15 +42,15 @@ namespace ia::iae::game
|
|||||||
.ShouldLoop = true,
|
.ShouldLoop = true,
|
||||||
.Keys = {
|
.Keys = {
|
||||||
SpriteRendererComponent::AnimationKeyFrame {
|
SpriteRendererComponent::AnimationKeyFrame {
|
||||||
.Scale = {0.25f, 0.25f, 0.1f},
|
|
||||||
.Texture = Engine::CreateTexture(File::ReadToVector("Graphics/red.png")),
|
.Texture = Engine::CreateTexture(File::ReadToVector("Graphics/red.png")),
|
||||||
|
.Scale = {0.25f, 0.25f},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
t->BakeAnimations();
|
t->BakeAnimations();
|
||||||
}
|
}
|
||||||
obstacle->SortOffset() = 20;
|
obstacle->SetLocalSortIndex(20);
|
||||||
obstacle->SetLocalPosition({150, 100, 0});
|
obstacle->SetLocalPosition({150, 100});
|
||||||
|
|
||||||
scene->AddNode(g_player);
|
scene->AddNode(g_player);
|
||||||
scene->AddNode(obstacle);
|
scene->AddNode(obstacle);
|
||||||
@ -61,6 +62,6 @@ namespace ia::iae::game
|
|||||||
|
|
||||||
VOID Game::Update()
|
VOID Game::Update()
|
||||||
{
|
{
|
||||||
g_player->SetLocalPosition(g_player->GetLocalPosition() + glm::vec3{Input::GetDirectionalInput(), 0.0f});
|
g_player->SetLocalPosition(g_player->GetLocalPosition() + Input::GetDirectionalInput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,14 +7,13 @@ set(IAEngine_Sources
|
|||||||
imp/cpp/Scene.cpp
|
imp/cpp/Scene.cpp
|
||||||
imp/cpp/Random.cpp
|
imp/cpp/Random.cpp
|
||||||
imp/cpp/Texture.cpp
|
imp/cpp/Texture.cpp
|
||||||
|
imp/cpp/UI.cpp
|
||||||
|
|
||||||
imp/cpp/Rendering/Camera.cpp
|
imp/cpp/Rendering/Camera.cpp
|
||||||
imp/cpp/Rendering/Renderer.cpp
|
imp/cpp/Rendering/Renderer.cpp
|
||||||
imp/cpp/Rendering/GPUBuffer.cpp
|
imp/cpp/Rendering/GPUBuffer.cpp
|
||||||
imp/cpp/Rendering/GPUTexture.cpp
|
imp/cpp/Rendering/GPUTexture.cpp
|
||||||
|
|
||||||
imp/cpp/Rendering/Mesh/Quad.cpp
|
|
||||||
|
|
||||||
imp/cpp/Rendering/Pipeline/Pipeline.cpp
|
imp/cpp/Rendering/Pipeline/Pipeline.cpp
|
||||||
imp/cpp/Rendering/Pipeline/UnlitMesh.cpp
|
imp/cpp/Rendering/Pipeline/UnlitMesh.cpp
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace ia::iae
|
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);
|
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;
|
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;
|
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();
|
handles[i] = m_tileGrid.m_tileTextures[i].GetHandle();
|
||||||
m_bakedGPUTexture = GPUTexture::GridCombine(handles.data(), m_tileGrid.TileCountX, m_tileGrid.TileCountY,
|
m_bakedGPUTexture = GPUTexture::GridCombine(handles.data(), m_tileGrid.TileCountX, m_tileGrid.TileCountY,
|
||||||
m_tileGrid.TileWidth, m_tileGrid.TileHeight);
|
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()
|
VOID AtlasRendererComponent::Update()
|
||||||
@ -68,7 +69,6 @@ namespace ia::iae
|
|||||||
|
|
||||||
VOID AtlasRendererComponent::Draw()
|
VOID AtlasRendererComponent::Draw()
|
||||||
{
|
{
|
||||||
m_bakedTexture.Draw(m_node->SortOffset(), m_node->GetPosition() + m_tileGrid.Position, {1.0f, 1.0f, 1.0f}, 0.0f,
|
TextureRendererComponent::Draw();
|
||||||
false, false, {1.0f, 1.0f, 1.0f, 1.0f});
|
|
||||||
}
|
}
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
|
|||||||
@ -29,7 +29,7 @@ namespace ia::iae
|
|||||||
return m_reverseAnimation ? m_activeAnimation.Keys[m_activeAnimation.Keys.size() - 1 - index] : m_activeAnimation.Keys[index];
|
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()
|
VOID SpriteRendererComponent::Draw()
|
||||||
{
|
{
|
||||||
Renderer::SetParallaxFactor(m_parallaxFactor);
|
|
||||||
const auto &animFrame = m_currentAnimationState;
|
const auto &animFrame = m_currentAnimationState;
|
||||||
animFrame.Texture.Draw(m_node->SortOffset() + m_sortOffset, m_node->GetPosition() + animFrame.Position,
|
PositionOffset() = animFrame.Position;
|
||||||
m_node->GetScale() * animFrame.Scale, m_node->GetRotation().z + animFrame.Rotation.z,
|
ScaleOffset() = animFrame.Scale;
|
||||||
m_isFlippedH, m_isFlippedV, animFrame.ColorOverlay);
|
RotationOffset() = animFrame.Rotation;
|
||||||
|
ColorOverlay() = animFrame.ColorOverlay;
|
||||||
|
CurrentTexture() = animFrame.Texture;
|
||||||
|
TextureRendererComponent::Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SpriteRendererComponent::UpdateAnimation()
|
VOID SpriteRendererComponent::UpdateAnimation()
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
#include <IAEngine/Components/TextureRenderer.hpp>
|
#include <IAEngine/Components/TextureRenderer.hpp>
|
||||||
|
|
||||||
#include <IAEngine/Nodes/Node.hpp>
|
#include <IAEngine/Nodes/Node.hpp>
|
||||||
|
#include <IAEngine/Rendering/Renderer.hpp>
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
@ -30,8 +31,13 @@ namespace ia::iae
|
|||||||
|
|
||||||
VOID TextureRendererComponent::Draw()
|
VOID TextureRendererComponent::Draw()
|
||||||
{
|
{
|
||||||
m_texture.Draw(m_node->SortOffset(), m_node->GetPosition() + m_position,
|
Renderer::SetState_FlippedH(m_isFlippedH);
|
||||||
m_node->GetScale(), m_node->GetRotation().z,
|
Renderer::SetState_FlippedV(m_isFlippedV);
|
||||||
false, false, glm::vec4{1.0f, 1.0f, 1.0f, 1.0f});
|
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
|
} // namespace ia::iae
|
||||||
@ -22,6 +22,7 @@
|
|||||||
#include <IAEngine/Physics/Physics.hpp>
|
#include <IAEngine/Physics/Physics.hpp>
|
||||||
#include <IAEngine/Random.hpp>
|
#include <IAEngine/Random.hpp>
|
||||||
#include <IAEngine/Time.hpp>
|
#include <IAEngine/Time.hpp>
|
||||||
|
#include <IAEngine/UI.hpp>
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ namespace ia::iae
|
|||||||
Input::Initialize();
|
Input::Initialize();
|
||||||
Audio::Initialize();
|
Audio::Initialize();
|
||||||
Physics::Initialize();
|
Physics::Initialize();
|
||||||
|
UI::Initialize(config.WindowWidth, config.WindowHeight);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -82,9 +84,10 @@ namespace ia::iae
|
|||||||
for (auto &t : g_gpuTextureRefs)
|
for (auto &t : g_gpuTextureRefs)
|
||||||
t.reset();
|
t.reset();
|
||||||
|
|
||||||
Renderer::Terminate();
|
UI::Terminate();
|
||||||
Audio::Terminate();
|
|
||||||
Physics::Terminate();
|
Physics::Terminate();
|
||||||
|
Audio::Terminate();
|
||||||
|
Renderer::Terminate();
|
||||||
|
|
||||||
SDL_DestroyWindow(g_windowHandle);
|
SDL_DestroyWindow(g_windowHandle);
|
||||||
|
|
||||||
@ -106,6 +109,7 @@ namespace ia::iae
|
|||||||
}
|
}
|
||||||
Renderer::BeginFrame();
|
Renderer::BeginFrame();
|
||||||
RenderGame();
|
RenderGame();
|
||||||
|
UI::Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID Engine::EndFrame()
|
VOID Engine::EndFrame()
|
||||||
@ -123,10 +127,12 @@ namespace ia::iae
|
|||||||
{
|
{
|
||||||
ImGui_ImplSDL3_ProcessEvent(&g_event);
|
ImGui_ImplSDL3_ProcessEvent(&g_event);
|
||||||
Input::OnEvent(&g_event);
|
Input::OnEvent(&g_event);
|
||||||
|
UI::OnEvent(&g_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID Engine::UpdateGame()
|
VOID Engine::UpdateGame()
|
||||||
{
|
{
|
||||||
|
UI::Update();
|
||||||
Physics::Update();
|
Physics::Update();
|
||||||
|
|
||||||
if B_LIKELY (g_activeScene)
|
if B_LIKELY (g_activeScene)
|
||||||
|
|||||||
@ -51,13 +51,13 @@ namespace ia::iae
|
|||||||
const auto nodeA = g_colliders[i]->GetNode();
|
const auto nodeA = g_colliders[i]->GetNode();
|
||||||
|
|
||||||
if(IsIntersectingH(boxB, boxA.z) && (IsIntersectingV(boxB, boxA.y) || IsIntersectingV(boxB, boxA.w)))
|
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)))
|
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)))
|
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)))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,6 +78,7 @@ namespace ia::iae
|
|||||||
|
|
||||||
SDL_EndGPUCopyPass(copyPass);
|
SDL_EndGPUCopyPass(copyPass);
|
||||||
SDL_SubmitGPUCommandBuffer(cmdBuffer);
|
SDL_SubmitGPUCommandBuffer(cmdBuffer);
|
||||||
|
SDL_WaitForGPUIdle(g_gpuDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
res->m_handle = (Handle) handle;
|
res->m_handle = (Handle) handle;
|
||||||
|
|||||||
@ -83,6 +83,7 @@ namespace ia::iae
|
|||||||
SDL_UploadToGPUTexture(copyPass, &transferInfo, ®ion, false);
|
SDL_UploadToGPUTexture(copyPass, &transferInfo, ®ion, false);
|
||||||
SDL_EndGPUCopyPass(copyPass);
|
SDL_EndGPUCopyPass(copyPass);
|
||||||
SDL_SubmitGPUCommandBuffer(cmdBuffer);
|
SDL_SubmitGPUCommandBuffer(cmdBuffer);
|
||||||
|
SDL_WaitForGPUIdle(g_gpuDevice);
|
||||||
SDL_ReleaseGPUTransferBuffer(g_gpuDevice, stagingBuffer);
|
SDL_ReleaseGPUTransferBuffer(g_gpuDevice, stagingBuffer);
|
||||||
|
|
||||||
res->m_handle = (Handle) handle;
|
res->m_handle = (Handle) handle;
|
||||||
@ -125,6 +126,7 @@ namespace ia::iae
|
|||||||
|
|
||||||
SDL_EndGPUCopyPass(copyPass);
|
SDL_EndGPUCopyPass(copyPass);
|
||||||
SDL_SubmitGPUCommandBuffer(cmdBuffer);
|
SDL_SubmitGPUCommandBuffer(cmdBuffer);
|
||||||
|
SDL_WaitForGPUIdle(g_gpuDevice);
|
||||||
|
|
||||||
res->m_handle = (Handle) handle;
|
res->m_handle = (Handle) handle;
|
||||||
|
|
||||||
|
|||||||
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include <IAEngine/Rendering/GPUBuffer.hpp>
|
|
||||||
#include <IAEngine/Rendering/Mesh/Quad.hpp>
|
|
||||||
#include <IAEngine/Rendering/Renderer.hpp>
|
|
||||||
#include <IAEngine/Rendering/Types.hpp>
|
|
||||||
|
|
||||||
namespace ia::iae
|
|
||||||
{
|
|
||||||
RefPtr<GPUBuffer> 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
|
|
||||||
@ -45,7 +45,7 @@ namespace ia::iae
|
|||||||
}};
|
}};
|
||||||
SDL_GPUVertexBufferDescription vertexBuffers[] = {{
|
SDL_GPUVertexBufferDescription vertexBuffers[] = {{
|
||||||
.slot = 0,
|
.slot = 0,
|
||||||
.pitch = sizeof(Vertex_Mesh),
|
.pitch = sizeof(MeshVertex),
|
||||||
.input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX,
|
.input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX,
|
||||||
.instance_step_rate = 0,
|
.instance_step_rate = 0,
|
||||||
}};
|
}};
|
||||||
@ -54,7 +54,8 @@ namespace ia::iae
|
|||||||
{.location = 1,
|
{.location = 1,
|
||||||
.buffer_slot = 0,
|
.buffer_slot = 0,
|
||||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
||||||
.offset = sizeof(glm::vec3)}};
|
.offset = sizeof(glm::vec3)},
|
||||||
|
};
|
||||||
SDL_GPUGraphicsPipelineCreateInfo createInfo = {
|
SDL_GPUGraphicsPipelineCreateInfo createInfo = {
|
||||||
.vertex_shader = (SDL_GPUShader *) vertexShader,
|
.vertex_shader = (SDL_GPUShader *) vertexShader,
|
||||||
.fragment_shader = (SDL_GPUShader *) pixelShader,
|
.fragment_shader = (SDL_GPUShader *) pixelShader,
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
#include <IAEngine/Rendering/Camera.hpp>
|
#include <IAEngine/Rendering/Camera.hpp>
|
||||||
#include <IAEngine/Rendering/GPUBuffer.hpp>
|
#include <IAEngine/Rendering/GPUBuffer.hpp>
|
||||||
#include <IAEngine/Rendering/GPUTexture.hpp>
|
#include <IAEngine/Rendering/GPUTexture.hpp>
|
||||||
#include <IAEngine/Rendering/Mesh/Quad.hpp>
|
|
||||||
#include <IAEngine/Rendering/Pipeline/UnlitMesh.hpp>
|
#include <IAEngine/Rendering/Pipeline/UnlitMesh.hpp>
|
||||||
#include <IAEngine/Rendering/Renderer.hpp>
|
#include <IAEngine/Rendering/Renderer.hpp>
|
||||||
|
|
||||||
@ -27,6 +26,27 @@
|
|||||||
#include <backends/imgui_impl_sdl3.h>
|
#include <backends/imgui_impl_sdl3.h>
|
||||||
#include <backends/imgui_impl_sdlgpu3.h>
|
#include <backends/imgui_impl_sdlgpu3.h>
|
||||||
|
|
||||||
|
namespace ia::iae
|
||||||
|
{
|
||||||
|
struct Mesh
|
||||||
|
{
|
||||||
|
INT32 IndexCount{};
|
||||||
|
RefPtr<GPUBuffer> IndexBuffer;
|
||||||
|
RefPtr<GPUBuffer> VertexBuffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RenderState
|
||||||
|
{
|
||||||
|
BOOL FlippedH{false};
|
||||||
|
BOOL FlippedV{false};
|
||||||
|
BOOL CameraRelative{true};
|
||||||
|
glm::vec2 TextureOffset{0.0f, 0.0f};
|
||||||
|
};
|
||||||
|
|
||||||
|
Vector<Mesh> g_meshes{};
|
||||||
|
RenderState g_renderState{};
|
||||||
|
} // namespace ia::iae
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
EXTERN SDL_Window *g_windowHandle;
|
EXTERN SDL_Window *g_windowHandle;
|
||||||
@ -55,9 +75,9 @@ namespace ia::iae
|
|||||||
glm::mat4 matView{1.0f};
|
glm::mat4 matView{1.0f};
|
||||||
glm::mat4 matModel{1.0f};
|
glm::mat4 matModel{1.0f};
|
||||||
|
|
||||||
BOOL g_flipH{false};
|
glm::mat4 matIdentity{1.0f};
|
||||||
BOOL g_flipV{false};
|
|
||||||
FLOAT32 g_parallaxFactor{0.0f};
|
Handle g_meshHandleQuad{};
|
||||||
|
|
||||||
BOOL Renderer::Initialize()
|
BOOL Renderer::Initialize()
|
||||||
{
|
{
|
||||||
@ -117,10 +137,17 @@ namespace ia::iae
|
|||||||
|
|
||||||
g_pipelineUnlitMesh = Pipeline_UnlitMesh::Create();
|
g_pipelineUnlitMesh = Pipeline_UnlitMesh::Create();
|
||||||
|
|
||||||
QuadMesh::Initialize();
|
|
||||||
|
|
||||||
matProjection = glm::orthoLH(0.0f, (FLOAT32) s_width, (FLOAT32) s_height, 0.0f, -1000.0f, 1000.0f);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,9 +155,13 @@ namespace ia::iae
|
|||||||
{
|
{
|
||||||
SDL_WaitForGPUIdle(g_gpuDevice);
|
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();
|
GPUTexture::Terminate();
|
||||||
|
|
||||||
@ -221,85 +252,98 @@ namespace ia::iae
|
|||||||
SDL_SubmitGPUCommandBuffer(g_cmdBuffer);
|
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,
|
g_renderState.CameraRelative = value;
|
||||||
.sampler = (SDL_GPUSampler *) GPUTexture::GetDefaultSampler()};
|
|
||||||
SDL_BindGPUFragmentSamplers(g_renderPass, 0, &binding, 1);
|
|
||||||
SDL_PushGPUFragmentUniformData(g_cmdBuffer, 0, &colorOverlay, sizeof(colorOverlay));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetModelTransformMatrix(IN FLOAT32 sortOffset, IN CONST glm::vec3 &position, IN CONST glm::vec3 &scale,
|
VOID Renderer::SetState_TextureOffset(IN FLOAT32 u, IN FLOAT32 v)
|
||||||
IN FLOAT32 rotation)
|
|
||||||
{
|
{
|
||||||
if (g_parallaxFactor <= 0.0f)
|
g_renderState.TextureOffset = {u, v};
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera2D *Renderer::GetCamera()
|
Camera2D *Renderer::GetCamera()
|
||||||
{
|
{
|
||||||
return &g_camera;
|
return &g_camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID Renderer::SetParallaxFactor(IN FLOAT32 value)
|
|
||||||
{
|
|
||||||
g_parallaxFactor = value;
|
|
||||||
}
|
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
|
|
||||||
|
namespace ia::iae
|
||||||
|
{
|
||||||
|
Handle Renderer::GetMesh_Quad()
|
||||||
|
{
|
||||||
|
return g_meshHandleQuad;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle Renderer::CreateMesh(IN CONST Vector<MeshVertex> &vertices, IN CONST Vector<INT32> &indices)
|
||||||
|
{
|
||||||
|
Mesh mesh{};
|
||||||
|
mesh.VertexBuffer = GPUBuffer::Create(GPUBuffer::Usage::VERTEX, vertices.data(),
|
||||||
|
static_cast<UINT32>(vertices.size() * sizeof(vertices[0])));
|
||||||
|
mesh.IndexBuffer = GPUBuffer::Create(GPUBuffer::Usage::INDEX, indices.data(),
|
||||||
|
static_cast<UINT32>(indices.size() * sizeof(indices[0])));
|
||||||
|
mesh.IndexCount = static_cast<UINT32>(indices.size());
|
||||||
|
g_meshes.pushBack(mesh);
|
||||||
|
return static_cast<Handle>(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<INT16>(position.y);
|
||||||
|
matModel =
|
||||||
|
glm::translate(glm::mat4(1.0f), glm::vec3{position.x, position.y,
|
||||||
|
static_cast<FLOAT32>((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
|
||||||
@ -17,7 +17,6 @@
|
|||||||
#include <IAEngine/IAEngine.hpp>
|
#include <IAEngine/IAEngine.hpp>
|
||||||
#include <IAEngine/Texture.hpp>
|
#include <IAEngine/Texture.hpp>
|
||||||
|
|
||||||
#include <IAEngine/Rendering/Mesh/Quad.hpp>
|
|
||||||
#include <IAEngine/Rendering/Renderer.hpp>
|
#include <IAEngine/Rendering/Renderer.hpp>
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
@ -27,20 +26,11 @@ namespace ia::iae
|
|||||||
}
|
}
|
||||||
|
|
||||||
Texture::Texture(IN Handle handle, IN INT32 width, IN INT32 height)
|
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()
|
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
|
} // namespace ia::iae
|
||||||
113
Src/IAEngine/imp/cpp/UI.cpp
Normal file
113
Src/IAEngine/imp/cpp/UI.cpp
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <IAEngine/UI.hpp>
|
||||||
|
|
||||||
|
#include <RmlUi/Core.h>
|
||||||
|
|
||||||
|
namespace ia::iae
|
||||||
|
{
|
||||||
|
class RmlUIRenderInterface : public Rml::RenderInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Rml::CompiledGeometryHandle CompileGeometry(Rml::Span<const Rml::Vertex> vertices,
|
||||||
|
Rml::Span<const int> 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<const Rml::byte> 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<const Rml::Vertex> vertices,
|
||||||
|
Rml::Span<const int> 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<const Rml::byte> 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
|
||||||
@ -7,16 +7,18 @@ layout(location = 0) out vec4 outColor;
|
|||||||
|
|
||||||
layout(set = 2, binding = 0) uniform sampler2D texSampler;
|
layout(set = 2, binding = 0) uniform sampler2D texSampler;
|
||||||
layout(set = 3, binding = 0) uniform UniformBufferObject {
|
layout(set = 3, binding = 0) uniform UniformBufferObject {
|
||||||
|
bool flippedH;
|
||||||
|
bool flippedV;
|
||||||
|
vec2 uvOffset;
|
||||||
vec4 colorOverlay;
|
vec4 colorOverlay;
|
||||||
} ubo;
|
} ubo;
|
||||||
layout(set = 3, binding = 1) uniform UniformBufferObject2 {
|
|
||||||
float parallaxFactor;
|
|
||||||
} ubo2;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 uv = inTexCoord;
|
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;
|
outColor = texture(texSampler, uv) * ubo.colorOverlay;
|
||||||
if(outColor.w < 0.1)
|
if(outColor.w < 0.1)
|
||||||
discard;
|
discard;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <IAEngine/Components/Component.hpp>
|
#include <IAEngine/Components/TextureRenderer.hpp>
|
||||||
#include <IAEngine/Rendering/GPUTexture.hpp>
|
#include <IAEngine/Rendering/GPUTexture.hpp>
|
||||||
#include <IAEngine/Texture.hpp>
|
#include <IAEngine/Texture.hpp>
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
class AtlasRendererComponent : public IComponent
|
class AtlasRendererComponent : public TextureRendererComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct TileGrid
|
struct TileGrid
|
||||||
@ -35,7 +35,7 @@ namespace ia::iae
|
|||||||
INT32 TileCountY{};
|
INT32 TileCountY{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<Texture> m_tileTextures{};
|
Vector<class Texture> m_tileTextures{};
|
||||||
|
|
||||||
friend class AtlasRendererComponent;
|
friend class AtlasRendererComponent;
|
||||||
};
|
};
|
||||||
@ -46,8 +46,8 @@ namespace ia::iae
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
VOID SetGrid(IN INT32 tileWidth, IN INT32 tileHeight, IN INT32 tileCountX, IN INT32 tileCountY);
|
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 index, IN class Texture texture);
|
||||||
VOID SetGridTileTexture(IN INT32 x, IN INT32 y, IN Texture texture);
|
VOID SetGridTileTexture(IN INT32 x, IN INT32 y, IN class Texture texture);
|
||||||
VOID BakeGrid();
|
VOID BakeGrid();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -56,7 +56,6 @@ namespace ia::iae
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TileGrid m_tileGrid{};
|
TileGrid m_tileGrid{};
|
||||||
Texture m_bakedTexture{};
|
|
||||||
RefPtr<GPUTexture> m_bakedGPUTexture{};
|
RefPtr<GPUTexture> m_bakedGPUTexture{};
|
||||||
};
|
};
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
@ -16,23 +16,24 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <IAEngine/Components/Component.hpp>
|
#include <IAEngine/Components/TextureRenderer.hpp>
|
||||||
#include <IAEngine/Texture.hpp>
|
#include <IAEngine/Texture.hpp>
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
class SpriteRendererComponent : public IComponent
|
class SpriteRendererComponent : public TextureRendererComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct AnimationKeyFrame
|
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;
|
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
|
struct Animation
|
||||||
@ -61,26 +62,6 @@ namespace ia::iae
|
|||||||
return m_animations;
|
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()
|
BOOL &ReverseAnimation()
|
||||||
{
|
{
|
||||||
return m_reverseAnimation;
|
return m_reverseAnimation;
|
||||||
@ -97,10 +78,6 @@ namespace ia::iae
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BOOL m_reverseAnimation{};
|
BOOL m_reverseAnimation{};
|
||||||
FLOAT32 m_parallaxFactor{0.0f};
|
|
||||||
FLOAT32 m_sortOffset{};
|
|
||||||
BOOL m_isFlippedV{false};
|
|
||||||
BOOL m_isFlippedH{false};
|
|
||||||
FLOAT32 m_timelinePosition{};
|
FLOAT32 m_timelinePosition{};
|
||||||
Animation m_activeAnimation{};
|
Animation m_activeAnimation{};
|
||||||
Handle m_activeAnimationHandle{INVALID_HANDLE};
|
Handle m_activeAnimationHandle{INVALID_HANDLE};
|
||||||
|
|||||||
@ -26,14 +26,49 @@ namespace ia::iae
|
|||||||
public:
|
public:
|
||||||
TextureRendererComponent(IN Node *node);
|
TextureRendererComponent(IN Node *node);
|
||||||
|
|
||||||
Texture &Texture()
|
Texture &CurrentTexture()
|
||||||
{
|
{
|
||||||
return m_texture;
|
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:
|
public:
|
||||||
@ -41,7 +76,14 @@ namespace ia::iae
|
|||||||
VOID Update();
|
VOID Update();
|
||||||
|
|
||||||
private:
|
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;
|
class Texture m_texture;
|
||||||
glm::vec3 m_position;
|
|
||||||
};
|
};
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
@ -49,15 +49,19 @@ namespace ia::iae
|
|||||||
return m_components;
|
return m_components;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
UINT8 GetLayerIndex() CONST
|
||||||
FLOAT32 &SortOffset()
|
|
||||||
{
|
{
|
||||||
return m_sortOffset;
|
return m_layerIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT8 &LayerIndex()
|
||||||
|
{
|
||||||
|
return m_layerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Scene *m_scene{};
|
Scene *m_scene{};
|
||||||
FLOAT32 m_sortOffset{};
|
UINT8 m_layerIndex{};
|
||||||
BOOL m_isEnabled{true};
|
BOOL m_isEnabled{true};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -20,55 +20,70 @@
|
|||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
template<typename _node_type>
|
template<typename _node_type> class Transform
|
||||||
class Transform
|
|
||||||
{
|
{
|
||||||
public:
|
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;
|
m_local.Position = v;
|
||||||
RecalculatePosition();
|
RecalculatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetLocalScale(IN CONST glm::vec3 &v)
|
VOID SetLocalScale(IN CONST glm::vec2 &v)
|
||||||
{
|
{
|
||||||
m_local.Scale = v;
|
m_local.Scale = v;
|
||||||
RecalculateScale();
|
RecalculateScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetLocalRotation(IN CONST glm::vec3 &v)
|
VOID SetLocalRotation(IN CONST glm::vec2 &v)
|
||||||
{
|
{
|
||||||
m_local.Rotation = v;
|
m_local.Rotation = v;
|
||||||
RecalculateRotation();
|
RecalculateRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CONST glm::vec3 &GetPosition() CONST
|
INT16 GetSortIndex() CONST
|
||||||
|
{
|
||||||
|
return m_global.SortIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONST glm::vec2 &GetPosition() CONST
|
||||||
{
|
{
|
||||||
return m_global.Position;
|
return m_global.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONST glm::vec3 &GetScale() CONST
|
CONST glm::vec2 &GetScale() CONST
|
||||||
{
|
{
|
||||||
return m_global.Scale;
|
return m_global.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONST glm::vec3 &GetRotation() CONST
|
CONST FLOAT32 &GetRotation() CONST
|
||||||
{
|
{
|
||||||
return m_global.Rotation;
|
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;
|
return m_local.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONST glm::vec3 &GetLocalScale() CONST
|
CONST glm::vec2 &GetLocalScale() CONST
|
||||||
{
|
{
|
||||||
return m_local.Scale;
|
return m_local.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONST glm::vec3 &GetLocalRotation() CONST
|
CONST FLOAT32 &GetLocalRotation() CONST
|
||||||
{
|
{
|
||||||
return m_local.Rotation;
|
return m_local.Rotation;
|
||||||
}
|
}
|
||||||
@ -78,23 +93,30 @@ namespace ia::iae
|
|||||||
Vector<RefPtr<_node_type>> m_children{};
|
Vector<RefPtr<_node_type>> m_children{};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
VOID RecalculateSortIndex()
|
||||||
|
{
|
||||||
|
m_global.SortIndex = (m_parent ? m_parent->GetSortIndex() : 0) + m_local.SortIndex;
|
||||||
|
for (auto &c : m_children)
|
||||||
|
c->RecalculateSortIndex();
|
||||||
|
}
|
||||||
|
|
||||||
VOID RecalculatePosition()
|
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)
|
for (auto &c : m_children)
|
||||||
c->RecalculatePosition();
|
c->RecalculatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID RecalculateRotation()
|
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)
|
for (auto &c : m_children)
|
||||||
c->RecalculateRotation();
|
c->RecalculateRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID RecalculateScale()
|
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)
|
for (auto &c : m_children)
|
||||||
c->RecalculateScale();
|
c->RecalculateScale();
|
||||||
}
|
}
|
||||||
@ -102,9 +124,10 @@ namespace ia::iae
|
|||||||
private:
|
private:
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
glm::vec3 Position{0.0f, 0.0f, 0.0f};
|
INT16 SortIndex{};
|
||||||
glm::vec3 Rotation{0.0f, 0.0f, 0.0f};
|
FLOAT32 Rotation{0.0f};
|
||||||
glm::vec3 Scale{1.0f, 1.0f, 1.0f};
|
glm::vec2 Position{0.0f, 0.0f};
|
||||||
|
glm::vec2 Scale{1.0f, 1.0f};
|
||||||
} m_local{}, m_global{};
|
} m_local{}, m_global{};
|
||||||
};
|
};
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <IAEngine/Base.hpp>
|
#include <IAEngine/Rendering/Types.hpp>
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
@ -44,16 +44,22 @@ namespace ia::iae
|
|||||||
STATIC VOID BeginFrame();
|
STATIC VOID BeginFrame();
|
||||||
STATIC VOID EndFrame();
|
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);
|
public:
|
||||||
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);
|
STATIC Handle GetMesh_Quad();
|
||||||
|
|
||||||
STATIC Camera2D* GetCamera();
|
STATIC Handle CreateMesh(IN CONST Vector<MeshVertex> &vertices, IN CONST Vector<INT32> &indices);
|
||||||
|
|
||||||
STATIC VOID SetFlipH(IN BOOL value);
|
STATIC VOID Draw(IN Handle meshHandle, IN Handle textureHandle, IN CONST glm::vec2 &position,
|
||||||
STATIC VOID SetFlipV(IN BOOL value);
|
IN CONST glm::vec2 &scale, IN FLOAT32 rotation = 0, IN UINT8 layerIndex = 0,
|
||||||
STATIC VOID SetParallaxFactor(IN FLOAT32 value);
|
IN INT16 sortIndex = 0, IN CONST glm::vec4 &colorOverlay = {1.0f, 1.0f, 1.0f, 1.0f});
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATIC Camera2D *GetCamera();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC INT32 Width()
|
STATIC INT32 Width()
|
||||||
|
|||||||
@ -20,11 +20,9 @@
|
|||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
struct Vertex_Mesh
|
struct MeshVertex
|
||||||
{
|
{
|
||||||
glm::vec3 Position{};
|
glm::vec3 Position{};
|
||||||
glm::vec2 UV{};
|
glm::vec2 UV{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -27,10 +27,6 @@ namespace ia::iae
|
|||||||
Texture();
|
Texture();
|
||||||
~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:
|
public:
|
||||||
Handle GetHandle() CONST
|
Handle GetHandle() CONST
|
||||||
{
|
{
|
||||||
@ -39,16 +35,21 @@ namespace ia::iae
|
|||||||
|
|
||||||
INT32 GetWidth() CONST
|
INT32 GetWidth() CONST
|
||||||
{
|
{
|
||||||
return (INT32) m_size.x;
|
return (INT32) m_extent.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 GetHeight() CONST
|
INT32 GetHeight() CONST
|
||||||
{
|
{
|
||||||
return (INT32) m_size.y;
|
return (INT32) m_extent.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONST glm::vec2 &GetExtent() CONST
|
||||||
|
{
|
||||||
|
return m_extent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Handle m_handle{INVALID_HANDLE};
|
Handle m_handle{INVALID_HANDLE};
|
||||||
glm::vec3 m_size{};
|
glm::vec2 m_extent{};
|
||||||
};
|
};
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
@ -20,12 +20,16 @@
|
|||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
class QuadMesh
|
class UI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
STATIC VOID Initialize();
|
STATIC VOID Initialize(IN INT32 width, IN INT32 height);
|
||||||
STATIC VOID Terminate();
|
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
|
}
|
||||||
Reference in New Issue
Block a user