forked from turanszkij/WickedEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRenderPath2D.h
79 lines (65 loc) · 1.81 KB
/
RenderPath2D.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include "RenderPath.h"
#include "wiGUI.h"
#include <string>
class wiSprite;
class wiSpriteFont;
struct RenderItem2D
{
enum TYPE
{
SPRITE,
FONT,
} type;
wiSprite* sprite = nullptr;
wiSpriteFont* font = nullptr;
int order = 0;
};
struct RenderLayer2D
{
std::vector<RenderItem2D> items;
std::string name;
int order = 0;
};
class RenderPath2D :
public RenderPath
{
private:
wiGraphics::Texture rtStenciled;
wiGraphics::Texture rtStenciled_resolved;
wiGraphics::Texture rtFinal;
wiGraphics::RenderPass renderpass_stenciled;
wiGraphics::RenderPass renderpass_final;
wiGUI GUI;
protected:
void ResizeBuffers() override;
public:
void Initialize() override;
void Load() override;
void Unload() override;
void Start() override;
void Update(float dt) override;
void FixedUpdate() override;
void Render() const override;
void Compose(wiGraphics::CommandList cmd) const override;
const wiGraphics::Texture& GetRenderResult() const { return rtFinal; }
virtual const wiGraphics::Texture* GetDepthStencil() const { return nullptr; }
virtual const wiGraphics::Texture* GetGUIBlurredBackground() const { return nullptr; }
void AddSprite(wiSprite* sprite, const std::string& layer = "");
void RemoveSprite(wiSprite* sprite);
void ClearSprites();
int GetSpriteOrder(wiSprite* sprite);
void AddFont(wiSpriteFont* font, const std::string& layer = "");
void RemoveFont(wiSpriteFont* font);
void ClearFonts();
int GetFontOrder(wiSpriteFont* font);
std::vector<RenderLayer2D> layers{ 1 };
void AddLayer(const std::string& name);
void SetLayerOrder(const std::string& name, int order);
void SetSpriteOrder(wiSprite* sprite, int order);
void SetFontOrder(wiSpriteFont* font, int order);
void SortLayers();
void CleanLayers();
const wiGUI& GetGUI() const { return GUI; }
wiGUI& GetGUI() { return GUI; }
};