Usable Engine

This commit is contained in:
Isuru Samarathunga
2025-10-07 17:11:20 +05:30
parent 0ef29f4e5f
commit 57c4309cf2
68 changed files with 1007 additions and 127 deletions

View File

@ -24,6 +24,9 @@ namespace ia::iae
class Renderer
{
public:
STATIC CONSTEXPR FLOAT32 MIN_DEPTH = -2097152.0f;
STATIC CONSTEXPR FLOAT32 MAX_DEPTH = 2097152.0f;
struct Geometry
{
INT32 IndexCount{};
@ -41,16 +44,16 @@ namespace ia::iae
Vec2 TextureOffset{0.0f, 0.0f};
SDL_Rect Scissor{0, 0, 0, 0};
SDL_GPUTexture* ActiveTexture{nullptr};
SDL_GPUViewport ActiveViewport{};
Mat4 ModelMatrix{1.0f};
Mat4 ProjectionMatrix{1.0f};
SDL_GPURenderPass* ActiveRenderPass{};
SDL_GPUCommandBuffer* ActiveCommandBuffer{};
SDL_GPUColorTargetInfo ColorTargetInfo{};
SDL_GPUDepthStencilTargetInfo DepthStencilTargetInfo{};
class ICameraComponent *ActiveCamera{};
class CameraComponent *ActiveCamera{};
};
public:

View File

@ -46,6 +46,8 @@ namespace ia::iae
IN INT32 unitCountX, IN INT32 unitCountY);
private:
STATIC Vector<Handle> s_images;
STATIC Vector<Handle> s_sounds;
STATIC Map<Handle, UINT64> s_imageExtents;
};
} // namespace ia::iae

View File

@ -0,0 +1,48 @@
// IAEngine: 2D Game Engine by IA
// Copyright (C) 2025 IASoft (PVT) LTD (oss@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/>.
#pragma once
#include <IAEngine/Nodes/INode.hpp>
#include <SDL3/SDL.h>
namespace ia::iae
{
class Scene
{
public:
STATIC Scene *Create();
STATIC Scene *Create(IN CONST String &sceneXML);
STATIC VOID Destroy(IN Scene *scene);
public:
VOID Draw();
VOID DebugDraw();
VOID FixedUpdate();
VOID Update();
public:
VOID AddNode(IN RefPtr<INode> node);
INode *GetNode(IN CONST String &name);
VOID RemoveNode(IN CONST String &name);
private:
Map<String, RefPtr<INode>> m_nodes;
};
} // namespace ia::iae

View File

@ -17,6 +17,7 @@
#pragma once
#include <IAEngine/Base.hpp>
#include <Scene.hpp>
#include <SDL3/SDL.h>
@ -24,7 +25,7 @@ namespace ia::iae
{
class WorldManager
{
public:
public:
STATIC VOID Initialize();
STATIC VOID Terminate();
@ -32,5 +33,15 @@ namespace ia::iae
STATIC VOID DebugDraw();
STATIC VOID Update();
STATIC VOID FixedUpdate();
public:
STATIC VOID ChangeActiveScene(IN Scene* scene);
STATIC VOID AddNodeToActiveScene(IN RefPtr<INode> node);
STATIC INode *GetNodeFromActiveScene(IN CONST String &name);
STATIC VOID RemoveNodeFromActiveScene(IN CONST String &name);
private:
STATIC Scene *m_activeScene;
};
}
} // namespace ia::iae