Optimized Renderer
This commit is contained in:
@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user