mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Feat] (...): Implement scissor box in frontend and backend.
This commit is contained in:
@@ -293,6 +293,14 @@ namespace MobileGL {
|
||||
return m_renderState.GetCullFaceMode();
|
||||
}
|
||||
|
||||
void GLContext::SetScissorBox(IntVec4 box) {
|
||||
m_renderState.SetScissorBox(box);
|
||||
}
|
||||
|
||||
const IntVec4& GLContext::GetScissorBox() const {
|
||||
return m_renderState.GetScissorBox();
|
||||
}
|
||||
|
||||
// Framebuffer
|
||||
Vector<Uint> GLContext::GenFramebufferNames(Uint number) {
|
||||
return m_framebufferState.GenerateNames(number);
|
||||
|
||||
@@ -92,6 +92,8 @@ namespace MobileGL {
|
||||
Int GetPixelStoreParam(PixelStoreParam param) const;
|
||||
void SetCullFaceMode(CullFaceMode mode);
|
||||
CullFaceMode GetCullFaceMode() const;
|
||||
void SetScissorBox(IntVec4 box); // x, y, width, height
|
||||
const IntVec4& GetScissorBox() const; // x, y, width, height
|
||||
|
||||
// Framebuffer
|
||||
Vector<Uint> GenFramebufferNames(Uint number);
|
||||
|
||||
@@ -39,6 +39,9 @@ namespace MobileGL {
|
||||
case CapabilityInput::CullFace:
|
||||
m_cullFaceEnabled = enabled;
|
||||
break;
|
||||
case CapabilityInput::ScissorTest:
|
||||
m_scissorTestEnabled = enabled;
|
||||
break;
|
||||
default: // not supported currently
|
||||
break;
|
||||
}
|
||||
@@ -52,6 +55,8 @@ namespace MobileGL {
|
||||
return m_depthTestEnabled;
|
||||
case CapabilityInput::CullFace:
|
||||
return m_cullFaceEnabled;
|
||||
case CapabilityInput::ScissorTest:
|
||||
return m_scissorTestEnabled;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -134,6 +139,15 @@ namespace MobileGL {
|
||||
CullFaceMode RenderState::GetCullFaceMode() const {
|
||||
return m_cullFaceMode;
|
||||
}
|
||||
|
||||
// --------------------- Scissor ---------------------
|
||||
void RenderState::SetScissorBox(IntVec4 box) {
|
||||
m_scissorBox = box;
|
||||
}
|
||||
|
||||
const IntVec4& RenderState::GetScissorBox() const {
|
||||
return m_scissorBox;
|
||||
}
|
||||
} // namespace GLState
|
||||
} // namespace MG_State
|
||||
} // namespace MobileGL
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "MG_Util/Math/VectorTypes.h"
|
||||
#include "MG_Util/Types.h"
|
||||
#include <Includes.h>
|
||||
|
||||
namespace MobileGL {
|
||||
@@ -151,6 +152,10 @@ namespace MobileGL {
|
||||
void SetCullFaceMode(CullFaceMode mode);
|
||||
CullFaceMode GetCullFaceMode() const;
|
||||
|
||||
// Scissor
|
||||
void SetScissorBox(IntVec4 box); // x, y, width, height
|
||||
const IntVec4& GetScissorBox() const; // x, y, width, height
|
||||
|
||||
private:
|
||||
// Rasterization
|
||||
IntVec4 m_viewport = IntVec4(0, 0, 0, 0); // x, y, width, height
|
||||
@@ -180,6 +185,10 @@ namespace MobileGL {
|
||||
// Cull Face
|
||||
Bool m_cullFaceEnabled = false;
|
||||
CullFaceMode m_cullFaceMode = CullFaceMode::Back;
|
||||
|
||||
// Scissor
|
||||
Bool m_scissorTestEnabled = false;
|
||||
IntVec4 m_scissorBox = IntVec4(0, 0, 0, 0); // x, y, width, height
|
||||
};
|
||||
} // namespace GLState
|
||||
} // namespace MG_State
|
||||
|
||||
Reference in New Issue
Block a user