Optimized Renderer
This commit is contained in:
@ -41,7 +41,10 @@ namespace ia::iae
|
||||
STATIC VOID SwitchModeToText();
|
||||
STATIC VOID SwitchModeToAction();
|
||||
|
||||
STATIC BOOL IsPointerDown();
|
||||
STATIC Vec2 GetPointerPosition();
|
||||
STATIC BOOL IsPointerDown(IN CONST Vec2& start, IN CONST Vec2& end);
|
||||
STATIC BOOL DidPointerClick(IN CONST Vec2& start, IN CONST Vec2& end);
|
||||
|
||||
STATIC BOOL IsKeyDown(IN InputKey key);
|
||||
STATIC BOOL WasKeyPressed(IN InputKey key);
|
||||
@ -74,6 +77,8 @@ namespace ia::iae
|
||||
STATIC INT16 s_horizontalAxis;
|
||||
STATIC BOOL s_keys[256];
|
||||
STATIC BOOL s_prevKeys[256];
|
||||
STATIC BOOL s_pointerState;
|
||||
STATIC BOOL s_pointerPrevState;
|
||||
STATIC Vec2 s_pointerPosition;
|
||||
STATIC BOOL s_onScreenGamePadEnabled;
|
||||
STATIC BOOL s_keyboardGamePadEnabled;
|
||||
|
||||
@ -16,17 +16,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Renderer/Pipeline.hpp>
|
||||
#include <Renderer/GPUResourceManager.hpp>
|
||||
#include <Renderer/Pipeline.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
class Renderer
|
||||
{
|
||||
public:
|
||||
STATIC CONSTEXPR FLOAT32 MIN_DEPTH = -2097152.0f;
|
||||
STATIC CONSTEXPR FLOAT32 MAX_DEPTH = 2097152.0f;
|
||||
|
||||
struct Geometry
|
||||
{
|
||||
INT32 IndexCount{};
|
||||
@ -39,12 +36,16 @@ namespace ia::iae
|
||||
BOOL FlippedH{false};
|
||||
BOOL FlippedV{false};
|
||||
BOOL CameraRelative{true};
|
||||
BOOL YSortingEnabled{false};
|
||||
Color ColorOverlay{};
|
||||
Vec2 TextureOffset{0.0f, 0.0f};
|
||||
SDL_GPUTexture* ActiveTexture{nullptr};
|
||||
Mat4 ModelMatrix{1.0f};
|
||||
FLOAT32 PositionY{};
|
||||
|
||||
Vec2 Position{};
|
||||
Vec2 Scale{};
|
||||
FLOAT32 Rotation;
|
||||
|
||||
SDL_Rect Scissor{};
|
||||
|
||||
SDL_GPUTexture *ActiveTexture{nullptr};
|
||||
};
|
||||
|
||||
struct DrawEntry
|
||||
@ -52,7 +53,7 @@ namespace ia::iae
|
||||
UINT8 Layer{};
|
||||
UINT16 SortIndex{};
|
||||
State DrawState{};
|
||||
Geometry* GeometryHandle{};
|
||||
Geometry *GeometryHandle{};
|
||||
};
|
||||
|
||||
public:
|
||||
@ -67,11 +68,13 @@ namespace ia::iae
|
||||
STATIC VOID OnScreenResize(IN INT32 newWidth, IN INT32 newHeight);
|
||||
|
||||
public:
|
||||
STATIC Geometry* CreateGeometry(IN CONST Vector<GeometryVertex> &vertices, IN CONST Vector<INT32> &indices);
|
||||
STATIC VOID DestroyGeometry(IN Geometry* handle);
|
||||
STATIC Geometry *CreateGeometry(IN CONST Vector<GeometryVertex> &vertices, IN CONST Vector<INT32> &indices);
|
||||
STATIC VOID DestroyGeometry(IN Geometry *handle);
|
||||
|
||||
STATIC VOID DrawGeometry(IN Geometry* handle, IN UINT8 layer, IN UINT16 sortIndex);
|
||||
STATIC VOID DrawText(IN CONST String& text, IN Vec2 position, IN FLOAT32 scale, IN FLOAT32 rotation, IN UINT8 layer, IN UINT16 sortIndex);
|
||||
STATIC VOID DrawGeometry(IN Geometry *handle, IN SDL_GPUTexture* texture, IN Vec2 position, IN Vec2 scale, IN FLOAT32 rotation,
|
||||
IN UINT8 layer, IN UINT16 sortIndex);
|
||||
STATIC VOID DrawText(IN CONST String &text, IN Vec2 position, IN FLOAT32 scale, IN FLOAT32 rotation,
|
||||
IN UINT8 layer, IN UINT16 sortIndex);
|
||||
|
||||
STATIC SDL_GPUTextureFormat GetRenderTargetFormat();
|
||||
|
||||
@ -80,25 +83,25 @@ namespace ia::iae
|
||||
return s_gpuDevice;
|
||||
}
|
||||
|
||||
private:
|
||||
STATIC VOID Draw(IN CONST DrawEntry &entity);
|
||||
|
||||
private:
|
||||
STATIC State s_state;
|
||||
STATIC INT32 s_screenWidth;
|
||||
STATIC INT32 s_screenHeight;
|
||||
STATIC SDL_GPUDevice *s_gpuDevice;
|
||||
STATIC SDL_GPUTexture *s_renderTargetSceneColor;
|
||||
STATIC SDL_GPUTexture *s_renderTargetDebugDrawColor;
|
||||
STATIC Pipeline* s_geometryPipeline;
|
||||
STATIC Pipeline* s_postprocessPipeline;
|
||||
STATIC Geometry* s_quadGeometry;
|
||||
STATIC Geometry* s_circleGeometry;
|
||||
STATIC Pipeline *s_geometryPipeline;
|
||||
STATIC Geometry *s_quadGeometry;
|
||||
STATIC Geometry *s_circleGeometry;
|
||||
STATIC Vector<DrawEntry> s_drawEntries;
|
||||
STATIC SDL_GPURenderPass* s_activeRenderPass;
|
||||
STATIC SDL_GPUCommandBuffer* s_activeCommandBuffer;
|
||||
STATIC SDL_GPURenderPass *s_activeRenderPass;
|
||||
STATIC SDL_GPUCommandBuffer *s_activeCommandBuffer;
|
||||
STATIC SDL_GPUColorTargetInfo s_colorTargetInfo;
|
||||
STATIC class CameraComponent *s_activeCamera;
|
||||
STATIC SDL_Rect s_scissor;
|
||||
STATIC SDL_GPUViewport s_activeViewport;
|
||||
STATIC Vec2 s_sceneScaleFactor;
|
||||
STATIC BOOL s_ySortingEnabled;
|
||||
STATIC SDL_Rect s_defaultScissor;
|
||||
STATIC SDL_GPUViewport s_defaultViewport;
|
||||
|
||||
friend class Engine;
|
||||
};
|
||||
|
||||
@ -53,7 +53,7 @@ namespace ia::iae
|
||||
STATIC IVec2 GetImageExtent(IN Handle image);
|
||||
STATIC IVec2 GetImageOriginalExtent(IN Handle image);
|
||||
STATIC VOID RescaleAllImages(IN Vec2 factor);
|
||||
STATIC Handle RescaleImage(IN Handle image, IN Vec2 factor);
|
||||
STATIC Handle RescaleImage(IN Handle image, IN Vec2 factor, IN BOOL makeOriginal = false);
|
||||
STATIC Handle CombineImages(IN CONST Vector<Handle> &images, IN INT32 unitWidth, IN INT32 unitHeight,
|
||||
IN INT32 unitCountX, IN INT32 unitCountY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user