mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Feat] (MG_State/RenderState): Implement RenderState.
This commit is contained in:
@@ -80,6 +80,7 @@ set(SOURCE_FILES
|
|||||||
MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp
|
MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp
|
||||||
MobileGL/MG_State/GLState/ProgramState/ShaderObject.cpp
|
MobileGL/MG_State/GLState/ProgramState/ShaderObject.cpp
|
||||||
MobileGL/MG_State/GLState/ProgramState/ProgramState.cpp
|
MobileGL/MG_State/GLState/ProgramState/ProgramState.cpp
|
||||||
|
MobileGL/MG_State/GLState/RenderState/RenderState.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(${CMAKE_PROJECT_NAME} SHARED
|
add_library(${CMAKE_PROJECT_NAME} SHARED
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ namespace MobileGL {
|
|||||||
SharedPtr<VertexArrayObject> GLContext::GetBoundVertexArray() {
|
SharedPtr<VertexArrayObject> GLContext::GetBoundVertexArray() {
|
||||||
return m_vertexArrayState.GetBoundVertexArray();
|
return m_vertexArrayState.GetBoundVertexArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
Vector<Uint> GLContext::GenTextureNames(Uint number) {
|
Vector<Uint> GLContext::GenTextureNames(Uint number) {
|
||||||
return m_textureState.GenerateNames(number);
|
return m_textureState.GenerateNames(number);
|
||||||
@@ -156,6 +157,7 @@ namespace MobileGL {
|
|||||||
m_textureState.SetActiveTextureUnit(unit);
|
m_textureState.SetActiveTextureUnit(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Program
|
||||||
Uint GLContext::CreateProgram() {
|
Uint GLContext::CreateProgram() {
|
||||||
return m_programState.CreateProgram();
|
return m_programState.CreateProgram();
|
||||||
}
|
}
|
||||||
@@ -195,6 +197,98 @@ namespace MobileGL {
|
|||||||
SharedPtr<ProgramObject> GLContext::GetCurrentProgram() {
|
SharedPtr<ProgramObject> GLContext::GetCurrentProgram() {
|
||||||
return m_programState.GetCurrentProgram();
|
return m_programState.GetCurrentProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RenderState
|
||||||
|
void GLContext::SetViewport(IntVec4 viewport) {
|
||||||
|
m_renderState.SetViewport(viewport);
|
||||||
|
}
|
||||||
|
|
||||||
|
const IntVec4& GLContext::GetViewport() const {
|
||||||
|
return m_renderState.GetViewport();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetCapability(CapabilityInput cap, Bool enabled) {
|
||||||
|
m_renderState.SetCapability(cap, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool GLContext::IsCapabilityEnabled(CapabilityInput cap) const {
|
||||||
|
return m_renderState.IsCapabilityEnabled(cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetBlendFunc(BlendFactor srcRGB, BlendFactor dstRGB, BlendFactor srcAlpha,
|
||||||
|
BlendFactor dstAlpha) {
|
||||||
|
m_renderState.SetBlendFunc(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::GetBlendFunc(BlendFactor& srcRGB, BlendFactor& dstRGB, BlendFactor& srcAlpha,
|
||||||
|
BlendFactor& dstAlpha) const {
|
||||||
|
m_renderState.GetBlendFunc(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetDepthFunc(DepthFunc func) {
|
||||||
|
m_renderState.SetDepthFunc(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
DepthFunc GLContext::GetDepthFunc() const {
|
||||||
|
return m_renderState.GetDepthFunc();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetDepthMask(Bool flag) {
|
||||||
|
m_renderState.SetDepthMask(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool GLContext::GetDepthMask() const {
|
||||||
|
return m_renderState.GetDepthMask();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetColorMask(BoolVec4 mask) {
|
||||||
|
m_renderState.SetColorMask(mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
const BoolVec4 GLContext::GetColorMask() const {
|
||||||
|
return m_renderState.GetColorMask();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetClearColor(FloatVec4 color) {
|
||||||
|
m_renderState.SetClearColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
const FloatVec4& GLContext::GetClearColor() const {
|
||||||
|
return m_renderState.GetClearColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetClearDepth(Float depth) {
|
||||||
|
m_renderState.SetClearDepth(depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float GLContext::GetClearDepth() const {
|
||||||
|
return m_renderState.GetClearDepth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetPixelStoreParam(PixelStoreParam param, Int value) {
|
||||||
|
m_renderState.SetPixelStoreParam(param, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Int GLContext::GetPixelStoreParam(PixelStoreParam param) const {
|
||||||
|
return m_renderState.GetPixelStoreParam(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetCullFaceMode(CullFaceMode mode) {
|
||||||
|
m_renderState.SetCullFaceMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
CullFaceMode GLContext::GetCullFaceMode() const {
|
||||||
|
return m_renderState.GetCullFaceMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLContext::SetCullFaceEnabled(Bool enabled) {
|
||||||
|
m_renderState.SetCullFaceEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool GLContext::IsCullFaceEnabled() const {
|
||||||
|
return m_renderState.IsCullFaceEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace GLState
|
} // namespace GLState
|
||||||
|
|
||||||
GLState::GLContext* pGLContext;
|
GLState::GLContext* pGLContext;
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Includes.h>
|
#include <Includes.h>
|
||||||
#include "BufferState/BufferState.h"
|
|
||||||
#include "MG_Util/Types.h"
|
#include "MG_Util/Types.h"
|
||||||
#include "VertexArrayState/VertexArrayState.h"
|
|
||||||
#include "ErrorState/Error.h"
|
#include "ErrorState/Error.h"
|
||||||
|
#include "BufferState/BufferState.h"
|
||||||
#include "ProgramState/ProgramState.h"
|
#include "ProgramState/ProgramState.h"
|
||||||
#include "TextureState/TextureState.h"
|
#include "TextureState/TextureState.h"
|
||||||
|
#include "VertexArrayState/VertexArrayState.h"
|
||||||
|
#include "MG_State/GLState/RenderState/RenderState.h"
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
namespace MG_State {
|
namespace MG_State {
|
||||||
@@ -65,6 +66,32 @@ namespace MobileGL {
|
|||||||
SharedPtr<ShaderObject> GetShaderObject(Uint index);
|
SharedPtr<ShaderObject> GetShaderObject(Uint index);
|
||||||
void UseProgram(Uint program);
|
void UseProgram(Uint program);
|
||||||
SharedPtr<ProgramObject> GetCurrentProgram();
|
SharedPtr<ProgramObject> GetCurrentProgram();
|
||||||
|
|
||||||
|
// RenderState
|
||||||
|
void SetViewport(IntVec4 viewport); // x, y, width, height
|
||||||
|
const IntVec4& GetViewport() const; // x, y, width, height
|
||||||
|
void SetCapability(CapabilityInput cap, Bool enabled);
|
||||||
|
Bool IsCapabilityEnabled(CapabilityInput cap) const;
|
||||||
|
void SetBlendFunc(BlendFactor srcRGB, BlendFactor dstRGB, BlendFactor srcAlpha, BlendFactor dstAlpha);
|
||||||
|
void GetBlendFunc(BlendFactor& srcRGB, BlendFactor& dstRGB, BlendFactor& srcAlpha,
|
||||||
|
BlendFactor& dstAlpha) const;
|
||||||
|
void SetDepthFunc(DepthFunc func);
|
||||||
|
DepthFunc GetDepthFunc() const;
|
||||||
|
void SetDepthMask(Bool flag);
|
||||||
|
Bool GetDepthMask() const;
|
||||||
|
void SetColorMask(BoolVec4 mask);
|
||||||
|
const BoolVec4 GetColorMask() const;
|
||||||
|
void SetClearColor(FloatVec4 color);
|
||||||
|
const FloatVec4& GetClearColor() const;
|
||||||
|
void SetClearDepth(Float depth);
|
||||||
|
Float GetClearDepth() const;
|
||||||
|
void SetPixelStoreParam(PixelStoreParam param, Int value);
|
||||||
|
Int GetPixelStoreParam(PixelStoreParam param) const;
|
||||||
|
void SetCullFaceMode(CullFaceMode mode);
|
||||||
|
CullFaceMode GetCullFaceMode() const;
|
||||||
|
void SetCullFaceEnabled(Bool enabled);
|
||||||
|
Bool IsCullFaceEnabled() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Error
|
// Error
|
||||||
ErrorState m_errorState;
|
ErrorState m_errorState;
|
||||||
@@ -80,6 +107,9 @@ namespace MobileGL {
|
|||||||
|
|
||||||
// Program
|
// Program
|
||||||
ProgramState m_programState;
|
ProgramState m_programState;
|
||||||
|
|
||||||
|
// RenderState
|
||||||
|
RenderState m_renderState;
|
||||||
};
|
};
|
||||||
} // namespace GLState
|
} // namespace GLState
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
#include "RenderState.h"
|
||||||
|
|
||||||
|
namespace MobileGL {
|
||||||
|
namespace MG_State {
|
||||||
|
namespace GLState {
|
||||||
|
RenderState::RenderState() {
|
||||||
|
for (int i = 0; i < static_cast<int>(PixelStoreParam::PixelStoreParamCount); ++i) {
|
||||||
|
switch (static_cast<PixelStoreParam>(i)) {
|
||||||
|
case PixelStoreParam::PackAlignment:
|
||||||
|
case PixelStoreParam::UnpackAlignment:
|
||||||
|
m_pixelStoreParams[i] = 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
m_pixelStoreParams[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Rasterization --------------------
|
||||||
|
void RenderState::SetViewport(IntVec4 viewport) {
|
||||||
|
m_viewport = viewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
const IntVec4& RenderState::GetViewport() const {
|
||||||
|
return m_viewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Capabilities --------------------
|
||||||
|
void RenderState::SetCapability(CapabilityInput cap, Bool enabled) {
|
||||||
|
switch (cap) {
|
||||||
|
case CapabilityInput::Blend:
|
||||||
|
m_blendEnabled = enabled;
|
||||||
|
break;
|
||||||
|
case CapabilityInput::DepthTest:
|
||||||
|
m_depthTestEnabled = enabled;
|
||||||
|
break;
|
||||||
|
case CapabilityInput::CullFace:
|
||||||
|
m_cullFaceEnabled = enabled;
|
||||||
|
break;
|
||||||
|
default: // not supported currently
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool RenderState::IsCapabilityEnabled(CapabilityInput cap) const {
|
||||||
|
switch (cap) {
|
||||||
|
case CapabilityInput::Blend:
|
||||||
|
return m_blendEnabled;
|
||||||
|
case CapabilityInput::DepthTest:
|
||||||
|
return m_depthTestEnabled;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Blending --------------------
|
||||||
|
void RenderState::SetBlendFunc(BlendFactor srcRGB, BlendFactor dstRGB, BlendFactor srcAlpha,
|
||||||
|
BlendFactor dstAlpha) {
|
||||||
|
m_srcFactorRGB = srcRGB;
|
||||||
|
m_dstFactorRGB = dstRGB;
|
||||||
|
m_srcFactorAlpha = srcAlpha;
|
||||||
|
m_dstFactorAlpha = dstAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderState::GetBlendFunc(BlendFactor& srcRGB, BlendFactor& dstRGB, BlendFactor& srcAlpha,
|
||||||
|
BlendFactor& dstAlpha) const {
|
||||||
|
srcRGB = m_srcFactorRGB;
|
||||||
|
dstRGB = m_dstFactorRGB;
|
||||||
|
srcAlpha = m_srcFactorAlpha;
|
||||||
|
dstAlpha = m_dstFactorAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Depth --------------------
|
||||||
|
void RenderState::SetDepthFunc(DepthFunc func) {
|
||||||
|
m_depthFunc = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
DepthFunc RenderState::GetDepthFunc() const {
|
||||||
|
return m_depthFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderState::SetDepthMask(Bool flag) {
|
||||||
|
m_depthMask = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool RenderState::GetDepthMask() const {
|
||||||
|
return m_depthMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Color Mask --------------------
|
||||||
|
void RenderState::SetColorMask(BoolVec4 mask) {
|
||||||
|
m_colorMask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
const BoolVec4 RenderState::GetColorMask() const {
|
||||||
|
return m_colorMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Clear State --------------------
|
||||||
|
void RenderState::SetClearColor(FloatVec4 color) {
|
||||||
|
m_clearColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FloatVec4& RenderState::GetClearColor() const {
|
||||||
|
return m_clearColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderState::SetClearDepth(Float depth) {
|
||||||
|
m_clearDepth = depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
Float RenderState::GetClearDepth() const {
|
||||||
|
return m_clearDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Pixel Store --------------------
|
||||||
|
void RenderState::SetPixelStoreParam(PixelStoreParam param, Int value) {
|
||||||
|
m_pixelStoreParams[static_cast<SizeT>(param)] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int RenderState::GetPixelStoreParam(PixelStoreParam param) const {
|
||||||
|
return m_pixelStoreParams[static_cast<SizeT>(param)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------- Cull Face --------------------
|
||||||
|
void RenderState::SetCullFaceMode(CullFaceMode mode) {
|
||||||
|
m_cullFaceMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
CullFaceMode RenderState::GetCullFaceMode() const {
|
||||||
|
return m_cullFaceMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderState::SetCullFaceEnabled(Bool enabled) {
|
||||||
|
m_cullFaceEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool RenderState::IsCullFaceEnabled() const {
|
||||||
|
return m_cullFaceEnabled;
|
||||||
|
}
|
||||||
|
} // namespace GLState
|
||||||
|
} // namespace MG_State
|
||||||
|
} // namespace MobileGL
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "MG_Util/Math/VectorTypes.h"
|
||||||
|
#include <Includes.h>
|
||||||
|
|
||||||
|
namespace MobileGL {
|
||||||
|
namespace MG_State {
|
||||||
|
namespace GLState {
|
||||||
|
enum class BlendFactor {
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
SrcColor,
|
||||||
|
OneMinusSrcColor,
|
||||||
|
DstColor,
|
||||||
|
OneMinusDstColor,
|
||||||
|
SrcAlpha,
|
||||||
|
OneMinusSrcAlpha,
|
||||||
|
DstAlpha,
|
||||||
|
OneMinusDstAlpha,
|
||||||
|
ConstantColor,
|
||||||
|
OneMinusConstantColor,
|
||||||
|
ConstantAlpha,
|
||||||
|
OneMinusConstantAlpha,
|
||||||
|
BlendFactorCount,
|
||||||
|
Unknown = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DepthFunc {
|
||||||
|
Never,
|
||||||
|
Less,
|
||||||
|
Equal,
|
||||||
|
LessEqual,
|
||||||
|
Greater,
|
||||||
|
NotEqual,
|
||||||
|
GreaterEqual,
|
||||||
|
Always,
|
||||||
|
DepthFuncCount,
|
||||||
|
Unknown = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class PixelStoreParam {
|
||||||
|
// Pack Parameters
|
||||||
|
PackAlignment,
|
||||||
|
PackRowLength,
|
||||||
|
PackImageHeight,
|
||||||
|
PackSkipRows,
|
||||||
|
PackSkipPixels,
|
||||||
|
PackSkipImages,
|
||||||
|
PackSwapBytes,
|
||||||
|
PackLsbFirst,
|
||||||
|
|
||||||
|
// Unpack Parameters
|
||||||
|
UnpackAlignment,
|
||||||
|
UnpackRowLength,
|
||||||
|
UnpackImageHeight,
|
||||||
|
UnpackSkipRows,
|
||||||
|
UnpackSkipPixels,
|
||||||
|
UnpackSkipImages,
|
||||||
|
UnpackSwapBytes,
|
||||||
|
UnpackLsbFirst,
|
||||||
|
|
||||||
|
PixelStoreParamCount,
|
||||||
|
Unknown = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CullFaceMode {
|
||||||
|
Front,
|
||||||
|
Back,
|
||||||
|
FrontAndBack,
|
||||||
|
CullFaceModeCount,
|
||||||
|
Unknown = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CapabilityInput {
|
||||||
|
Blend,
|
||||||
|
ClipDistance0,
|
||||||
|
ClipDistance1,
|
||||||
|
ClipDistance2,
|
||||||
|
ClipDistance3,
|
||||||
|
ClipDistance4,
|
||||||
|
ClipDistance5,
|
||||||
|
ClipDistance6,
|
||||||
|
ClipDistance7,
|
||||||
|
ColorLogicOp,
|
||||||
|
CullFace,
|
||||||
|
DebugOutput,
|
||||||
|
DebugOutputSynchronous,
|
||||||
|
DepthClamp,
|
||||||
|
DepthTest,
|
||||||
|
Dither,
|
||||||
|
FramebufferSrgb,
|
||||||
|
LineSmooth,
|
||||||
|
Multisample,
|
||||||
|
PolygonOffsetFill,
|
||||||
|
PolygonOffsetLine,
|
||||||
|
PolygonOffsetPoint,
|
||||||
|
PolygonSmooth,
|
||||||
|
PrimitiveRestart,
|
||||||
|
PrimitiveRestartFixedIndex,
|
||||||
|
RasterizerDiscard,
|
||||||
|
SampleAlphaToCoverage,
|
||||||
|
SampleAlphaToOne,
|
||||||
|
SampleCoverage,
|
||||||
|
SampleShading,
|
||||||
|
SampleMask,
|
||||||
|
ScissorTest,
|
||||||
|
StencilTest,
|
||||||
|
TextureCubeMapSeamless,
|
||||||
|
ProgramPointSize,
|
||||||
|
CapabilityInputCount,
|
||||||
|
Unknown = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
class RenderState {
|
||||||
|
public:
|
||||||
|
RenderState();
|
||||||
|
|
||||||
|
// Rasterization
|
||||||
|
void SetViewport(IntVec4 viewport); // x, y, width, height
|
||||||
|
const IntVec4& GetViewport() const; // x, y, width, height
|
||||||
|
|
||||||
|
// Capabilities
|
||||||
|
void SetCapability(CapabilityInput cap, Bool enabled);
|
||||||
|
Bool IsCapabilityEnabled(CapabilityInput cap) const;
|
||||||
|
|
||||||
|
// Blending
|
||||||
|
void SetBlendFunc(BlendFactor srcRGB, BlendFactor dstRGB, BlendFactor srcAlpha, BlendFactor dstAlpha);
|
||||||
|
void GetBlendFunc(BlendFactor& srcRGB, BlendFactor& dstRGB, BlendFactor& srcAlpha,
|
||||||
|
BlendFactor& dstAlpha) const;
|
||||||
|
|
||||||
|
// Depth
|
||||||
|
void SetDepthFunc(DepthFunc func);
|
||||||
|
DepthFunc GetDepthFunc() const;
|
||||||
|
void SetDepthMask(Bool flag);
|
||||||
|
Bool GetDepthMask() const;
|
||||||
|
|
||||||
|
// Color Mask
|
||||||
|
void SetColorMask(BoolVec4 mask);
|
||||||
|
const BoolVec4 GetColorMask() const;
|
||||||
|
|
||||||
|
// Clear State
|
||||||
|
void SetClearColor(FloatVec4 color);
|
||||||
|
const FloatVec4& GetClearColor() const;
|
||||||
|
void SetClearDepth(Float depth);
|
||||||
|
Float GetClearDepth() const;
|
||||||
|
|
||||||
|
// Pixel Store
|
||||||
|
void SetPixelStoreParam(PixelStoreParam param, Int value);
|
||||||
|
Int GetPixelStoreParam(PixelStoreParam param) const;
|
||||||
|
|
||||||
|
// Cull Face
|
||||||
|
void SetCullFaceMode(CullFaceMode mode);
|
||||||
|
CullFaceMode GetCullFaceMode() const;
|
||||||
|
void SetCullFaceEnabled(Bool enabled);
|
||||||
|
Bool IsCullFaceEnabled() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Rasterization
|
||||||
|
IntVec4 m_viewport = IntVec4(0, 0, 0, 0); // x, y, width, height
|
||||||
|
|
||||||
|
// Blending
|
||||||
|
Bool m_blendEnabled = false;
|
||||||
|
BlendFactor m_srcFactorRGB = BlendFactor::One;
|
||||||
|
BlendFactor m_dstFactorRGB = BlendFactor::Zero;
|
||||||
|
BlendFactor m_srcFactorAlpha = BlendFactor::One;
|
||||||
|
BlendFactor m_dstFactorAlpha = BlendFactor::Zero;
|
||||||
|
|
||||||
|
// Depth
|
||||||
|
Bool m_depthTestEnabled = false;
|
||||||
|
DepthFunc m_depthFunc = DepthFunc::Less;
|
||||||
|
Bool m_depthMask = true;
|
||||||
|
|
||||||
|
// Color Mask
|
||||||
|
BoolVec4 m_colorMask = BoolVec4(true, true, true, true);
|
||||||
|
|
||||||
|
// Clear State
|
||||||
|
FloatVec4 m_clearColor = FloatVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
Float m_clearDepth = 1.0f;
|
||||||
|
|
||||||
|
// Pixel Store
|
||||||
|
Array<Int, static_cast<SizeT>(PixelStoreParam::PixelStoreParamCount)> m_pixelStoreParams;
|
||||||
|
|
||||||
|
// Cull Face
|
||||||
|
Bool m_cullFaceEnabled = false;
|
||||||
|
CullFaceMode m_cullFaceMode = CullFaceMode::Back;
|
||||||
|
};
|
||||||
|
} // namespace GLState
|
||||||
|
} // namespace MG_State
|
||||||
|
} // namespace MobileGL
|
||||||
Reference in New Issue
Block a user