blob: 4e02b727ceb82fd043523d0d1d94667a433f9c42 (
plain)
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
|
#ifndef DEVICE_H
#define DEVICE_H
#include "../Utilities/NonCopyable.h"
#include "../Utilities/Type.h"
#include "../Utilities/Assert.h"
#include "Texture.h"
#include "Color.h"
#include "DeviceDefine.h"
#include "VertexBuffer.h"
struct DeviceSetting
{
TextureFilter texFilter;
TextureWrap texWrap;
};
class Device : public NonCopyable
{
public:
Device();
~Device();
void Initialize(DeviceSetting& setting);
void Enable(DeviceEnable enabled);
void Disable(DeviceEnable enabled);
void IsEnable(uint flag);
void SetDepthTest(DepthTest testing);
void SetCullFace(CullFace face);
void SetStencilMask(byte stencilMask);
void SetStencilOp(StencilOp op);
void SetAntiAliasing(int level = 0);
void Clear(int clearFlag);
void BeginFrame();
void EndFrame();
void PresentFrame();
GET(SharedVertexBuffer*, SharedVBO, m_SharedVBO);
GET_SET(Color, ClearColor, m_ClearColor);
GET_SET(TextureFilter, TextureFilter, m_TexFilter);
GET_SET(TextureWrap, TextureWrap, m_TexWrap);
inline bool IsInsideFrame();
private:
uint m_EnableFlag;
// Global texture setting
TextureFilter m_TexFilter;
TextureWrap m_TexWrap;
Color m_ClearColor;
DepthTest m_DepthTest;
StencilTest m_StencilTest;
StencilOp m_StencilOp;
byte m_StencilMask;
SharedVertexBuffer m_SharedVBO;
bool m_IsInsideFrame;
};
extern Device g_Device;
#define g_SharedVBO (*g_Device.GetSharedVBO())
inline bool Device::IsInsideFrame()
{
return m_IsInsideFrame;
}
#endif
|