diff options
author | chai <chaifix@163.com> | 2020-10-19 09:13:58 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-19 09:13:58 +0800 |
commit | f0807fc44dde14531759306317611bab87c8fccf (patch) | |
tree | 6e78fed61c16a70cda5fa732635f89f9faac9720 /Runtime/Graphics/Device.h | |
parent | 639b34294ffc20721c66db46e59e07d9100ac4b8 (diff) |
+gamelab proj
Diffstat (limited to 'Runtime/Graphics/Device.h')
-rw-r--r-- | Runtime/Graphics/Device.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Runtime/Graphics/Device.h b/Runtime/Graphics/Device.h new file mode 100644 index 0000000..4e02b72 --- /dev/null +++ b/Runtime/Graphics/Device.h @@ -0,0 +1,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
\ No newline at end of file |