-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
107 lines (89 loc) · 1.78 KB
/
main.cpp
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <stdio.h>
#include <iostream>
#include <String.hpp>
#include <Singleton.hpp>
#include <ObjectFactory.hpp>
class A : public Singleton< A >
{
public:
A() = default;
virtual ~A() = default;
int i;
};
class RenderTask : public std::enable_shared_from_this<RenderTask>
{
public:
RenderTask() = default;
virtual ~RenderTask() = default;
virtual void Execute() = 0;
};
class BeginRenderTask : public RenderTask
{
public:
BeginRenderTask() = default;
virtual ~BeginRenderTask() = default;
virtual void Execute()
{
std::cout << "Begin Render" << std::endl;
}
};
class ClearRenderTargetTask : public RenderTask
{
public:
struct SClearRTParams
{
float color[3];
bool clearDepht;
float depth;
bool clearStencil;
float stencil;
};
public:
ClearRenderTargetTask() = default;
virtual ~ClearRenderTargetTask() = default;
void Init(const SClearRTParams&)
{
// Init...
}
virtual void Execute()
{
// Apply the config of the rendering params
}
};
class EndRenderTask : public RenderTask
{
public:
EndRenderTask() = default;
virtual ~EndRenderTask() = default;
virtual void Execute()
{
}
};
class RenderTaskFactory : public ObjectFactory< RenderTask >, public Singleton< RenderTaskFactory >
{
public:
RenderTaskFactory()
{
registerCreator<BeginRenderTask>();
registerCreator<EndRenderTask>();
registerCreator<ClearRenderTargetTask>();
}
virtual ~RenderTaskFactory() = default;
};
#include <Logger.hpp>
#include <string>
int main()
{
Logger::BindOutputFunction
(
[](Logger::Severity _e, const std::string& _msg)
{
if (_e == Logger::Severity::eError)
std::cerr << _msg << std::endl;
else
std::cout << _msg << std::endl;
}
);
Log_Error("error!!!!!");
return 0;
}