[core] move GL enum conversions to separate file
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
"src/mbgl/gl/debugging.cpp",
|
||||
"src/mbgl/gl/debugging_extension.cpp",
|
||||
"src/mbgl/gl/depth_mode.cpp",
|
||||
"src/mbgl/gl/enum.cpp",
|
||||
"src/mbgl/gl/object.cpp",
|
||||
"src/mbgl/gl/stencil_mode.cpp",
|
||||
"src/mbgl/gl/uniform.cpp",
|
||||
@@ -510,6 +511,7 @@
|
||||
"mbgl/gl/debugging_extension.hpp": "src/mbgl/gl/debugging_extension.hpp",
|
||||
"mbgl/gl/defines.hpp": "src/mbgl/gl/defines.hpp",
|
||||
"mbgl/gl/depth_mode.hpp": "src/mbgl/gl/depth_mode.hpp",
|
||||
"mbgl/gl/enum.hpp": "src/mbgl/gl/enum.hpp",
|
||||
"mbgl/gl/extension.hpp": "src/mbgl/gl/extension.hpp",
|
||||
"mbgl/gl/features.hpp": "src/mbgl/gl/features.hpp",
|
||||
"mbgl/gl/framebuffer.hpp": "src/mbgl/gl/framebuffer.hpp",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/gfx/types.hpp>
|
||||
#include <mbgl/util/variant.hpp>
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
@@ -8,53 +9,29 @@ namespace gfx {
|
||||
|
||||
class ColorMode {
|
||||
public:
|
||||
enum class BlendEquation {
|
||||
Add,
|
||||
Subtract,
|
||||
ReverseSubtract
|
||||
};
|
||||
|
||||
enum class BlendFactor {
|
||||
Zero,
|
||||
One,
|
||||
SrcColor,
|
||||
OneMinusSrcColor,
|
||||
SrcAlpha,
|
||||
OneMinusSrcAlpha,
|
||||
DstAlpha,
|
||||
OneMinusDstAlpha,
|
||||
DstColor,
|
||||
OneMinusDstColor,
|
||||
SrcAlphaSaturate,
|
||||
ConstantColor,
|
||||
OneMinusConstantColor,
|
||||
ConstantAlpha,
|
||||
OneMinusConstantAlpha
|
||||
};
|
||||
|
||||
template <BlendEquation E>
|
||||
template <ColorBlendEquationType E>
|
||||
struct ConstantBlend {
|
||||
static constexpr BlendEquation equation = E;
|
||||
static constexpr BlendFactor srcFactor = BlendFactor::One;
|
||||
static constexpr BlendFactor dstFactor = BlendFactor::One;
|
||||
static constexpr ColorBlendEquationType equation = E;
|
||||
static constexpr ColorBlendFactorType srcFactor = ColorBlendFactorType::One;
|
||||
static constexpr ColorBlendFactorType dstFactor = ColorBlendFactorType::One;
|
||||
};
|
||||
|
||||
template <BlendEquation E>
|
||||
template <ColorBlendEquationType E>
|
||||
struct LinearBlend {
|
||||
static constexpr BlendEquation equation = E;
|
||||
BlendFactor srcFactor;
|
||||
BlendFactor dstFactor;
|
||||
static constexpr ColorBlendEquationType equation = E;
|
||||
ColorBlendFactorType srcFactor;
|
||||
ColorBlendFactorType dstFactor;
|
||||
};
|
||||
|
||||
struct Replace {
|
||||
static constexpr BlendEquation equation = BlendEquation::Add;
|
||||
static constexpr BlendFactor srcFactor = BlendFactor::One;
|
||||
static constexpr BlendFactor dstFactor = BlendFactor::Zero;
|
||||
static constexpr ColorBlendEquationType equation = ColorBlendEquationType::Add;
|
||||
static constexpr ColorBlendFactorType srcFactor = ColorBlendFactorType::One;
|
||||
static constexpr ColorBlendFactorType dstFactor = ColorBlendFactorType::Zero;
|
||||
};
|
||||
|
||||
using Add = LinearBlend<BlendEquation::Add>;
|
||||
using Subtract = LinearBlend<BlendEquation::Subtract>;
|
||||
using ReverseSubtract = LinearBlend<BlendEquation::ReverseSubtract>;
|
||||
using Add = LinearBlend<ColorBlendEquationType::Add>;
|
||||
using Subtract = LinearBlend<ColorBlendEquationType::Subtract>;
|
||||
using ReverseSubtract = LinearBlend<ColorBlendEquationType::ReverseSubtract>;
|
||||
|
||||
using BlendFunction = variant<
|
||||
Replace,
|
||||
@@ -83,11 +60,11 @@ public:
|
||||
}
|
||||
|
||||
static ColorMode alphaBlended() {
|
||||
return { Add{ BlendFactor::One, BlendFactor::OneMinusSrcAlpha }, {}, { true, true, true, true } };
|
||||
return { Add{ ColorBlendFactorType::One, ColorBlendFactorType::OneMinusSrcAlpha }, {}, { true, true, true, true } };
|
||||
}
|
||||
|
||||
static ColorMode additive() {
|
||||
return { Add{ BlendFactor::One, BlendFactor::One }, {}, { true, true, true, true } };
|
||||
return { Add{ ColorBlendFactorType::One, ColorBlendFactorType::One }, {}, { true, true, true, true } };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,5 +15,29 @@ enum class PrimitiveType : uint8_t {
|
||||
TriangleFan
|
||||
};
|
||||
|
||||
enum class ColorBlendEquationType : uint8_t {
|
||||
Add,
|
||||
Subtract,
|
||||
ReverseSubtract
|
||||
};
|
||||
|
||||
enum class ColorBlendFactorType : uint8_t {
|
||||
Zero,
|
||||
One,
|
||||
SrcColor,
|
||||
OneMinusSrcColor,
|
||||
SrcAlpha,
|
||||
OneMinusSrcAlpha,
|
||||
DstAlpha,
|
||||
OneMinusDstAlpha,
|
||||
DstColor,
|
||||
OneMinusDstColor,
|
||||
SrcAlphaSaturate,
|
||||
ConstantColor,
|
||||
OneMinusConstantColor,
|
||||
ConstantAlpha,
|
||||
OneMinusConstantAlpha
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/gl/enum.hpp>
|
||||
#include <mbgl/gl/debugging_extension.hpp>
|
||||
#include <mbgl/gl/vertex_array_extension.hpp>
|
||||
#include <mbgl/gl/program_binary_extension.hpp>
|
||||
@@ -735,7 +736,7 @@ void Context::setColorMode(const gfx::ColorMode& color) {
|
||||
blend = true;
|
||||
blendColor = color.blendColor;
|
||||
apply_visitor([&] (const auto& blendFunction) {
|
||||
blendEquation = gfx::ColorMode::BlendEquation(blendFunction.equation);
|
||||
blendEquation = gfx::ColorBlendEquationType(blendFunction.equation);
|
||||
blendFunc = { blendFunction.srcFactor, blendFunction.dstFactor };
|
||||
}, color.blendFunction);
|
||||
}
|
||||
@@ -743,24 +744,11 @@ void Context::setColorMode(const gfx::ColorMode& color) {
|
||||
colorMask = color.mask;
|
||||
}
|
||||
|
||||
GLenum toGLenum(const gfx::PrimitiveType primitiveType) {
|
||||
switch (primitiveType) {
|
||||
case gfx::PrimitiveType::Points: return GL_POINTS;
|
||||
case gfx::PrimitiveType::Lines: return GL_LINES;
|
||||
case gfx::PrimitiveType::LineLoop: return GL_LINE_LOOP;
|
||||
case gfx::PrimitiveType::LineStrip: return GL_LINE_STRIP;
|
||||
case gfx::PrimitiveType::Triangles: return GL_TRIANGLES;
|
||||
case gfx::PrimitiveType::TriangleStrip: return GL_TRIANGLE_STRIP;
|
||||
case gfx::PrimitiveType::TriangleFan: return GL_TRIANGLE_FAN;
|
||||
}
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
void Context::draw(gfx::PrimitiveType primitiveType,
|
||||
std::size_t indexOffset,
|
||||
std::size_t indexLength) {
|
||||
MBGL_CHECK_ERROR(glDrawElements(
|
||||
toGLenum(primitiveType),
|
||||
Enum<gfx::PrimitiveType>::to(primitiveType),
|
||||
static_cast<GLsizei>(indexLength),
|
||||
GL_UNSIGNED_SHORT,
|
||||
reinterpret_cast<GLvoid*>(sizeof(uint16_t) * indexOffset)));
|
||||
|
||||
97
src/mbgl/gl/enum.cpp
Normal file
97
src/mbgl/gl/enum.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
#include <mbgl/gl/enum.hpp>
|
||||
#include <mbgl/gfx/types.hpp>
|
||||
#include <mbgl/gl/defines.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
|
||||
// template <>
|
||||
// gfx::PrimitiveType Enum::from(const platform::GLint value) {
|
||||
|
||||
// }
|
||||
|
||||
// template <>
|
||||
// platform::GLenum Enum::to(const gfx::PrimitiveType value) {
|
||||
|
||||
// }
|
||||
|
||||
template <>
|
||||
platform::GLenum Enum<gfx::PrimitiveType>::to(const gfx::PrimitiveType value) {
|
||||
switch (value) {
|
||||
case gfx::PrimitiveType::Points: return GL_POINTS;
|
||||
case gfx::PrimitiveType::Lines: return GL_LINES;
|
||||
case gfx::PrimitiveType::LineLoop: return GL_LINE_LOOP;
|
||||
case gfx::PrimitiveType::LineStrip: return GL_LINE_STRIP;
|
||||
case gfx::PrimitiveType::Triangles: return GL_TRIANGLES;
|
||||
case gfx::PrimitiveType::TriangleStrip: return GL_TRIANGLE_STRIP;
|
||||
case gfx::PrimitiveType::TriangleFan: return GL_TRIANGLE_FAN;
|
||||
}
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
template <>
|
||||
gfx::ColorBlendEquationType Enum<gfx::ColorBlendEquationType>::from(const platform::GLint value) {
|
||||
switch (value) {
|
||||
case GL_FUNC_ADD: return gfx::ColorBlendEquationType::Add;
|
||||
case GL_FUNC_SUBTRACT: return gfx::ColorBlendEquationType::Subtract;
|
||||
case GL_FUNC_REVERSE_SUBTRACT: return gfx::ColorBlendEquationType::ReverseSubtract;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template <>
|
||||
platform::GLenum Enum<gfx::ColorBlendEquationType>::to(const gfx::ColorBlendEquationType value) {
|
||||
switch (value) {
|
||||
case gfx::ColorBlendEquationType::Add: return GL_FUNC_ADD;
|
||||
case gfx::ColorBlendEquationType::Subtract: return GL_FUNC_SUBTRACT;
|
||||
case gfx::ColorBlendEquationType::ReverseSubtract: return GL_FUNC_REVERSE_SUBTRACT;
|
||||
}
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
template <>
|
||||
gfx::ColorBlendFactorType Enum<gfx::ColorBlendFactorType>::from(const platform::GLint blendFactor) {
|
||||
switch (blendFactor) {
|
||||
case GL_ZERO: return gfx::ColorBlendFactorType::Zero;
|
||||
case GL_ONE: return gfx::ColorBlendFactorType::One;
|
||||
case GL_SRC_COLOR: return gfx::ColorBlendFactorType::SrcColor;
|
||||
case GL_ONE_MINUS_SRC_COLOR: return gfx::ColorBlendFactorType::OneMinusSrcColor;
|
||||
case GL_DST_COLOR: return gfx::ColorBlendFactorType::DstColor;
|
||||
case GL_ONE_MINUS_DST_COLOR: return gfx::ColorBlendFactorType::OneMinusDstColor;
|
||||
case GL_SRC_ALPHA: return gfx::ColorBlendFactorType::SrcAlpha;
|
||||
case GL_ONE_MINUS_SRC_ALPHA: return gfx::ColorBlendFactorType::OneMinusSrcAlpha;
|
||||
case GL_DST_ALPHA: return gfx::ColorBlendFactorType::DstAlpha;
|
||||
case GL_ONE_MINUS_DST_ALPHA: return gfx::ColorBlendFactorType::OneMinusDstAlpha;
|
||||
case GL_CONSTANT_COLOR: return gfx::ColorBlendFactorType::ConstantColor;
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR: return gfx::ColorBlendFactorType::OneMinusConstantColor;
|
||||
case GL_CONSTANT_ALPHA: return gfx::ColorBlendFactorType::ConstantAlpha;
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA: return gfx::ColorBlendFactorType::OneMinusConstantAlpha;
|
||||
case GL_SRC_ALPHA_SATURATE: return gfx::ColorBlendFactorType::SrcAlphaSaturate;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template <>
|
||||
platform::GLenum Enum<gfx::ColorBlendFactorType>::to(const gfx::ColorBlendFactorType value) {
|
||||
switch (value) {
|
||||
case gfx::ColorBlendFactorType::Zero: return GL_ZERO;
|
||||
case gfx::ColorBlendFactorType::One: return GL_ONE;
|
||||
case gfx::ColorBlendFactorType::SrcColor: return GL_SRC_COLOR;
|
||||
case gfx::ColorBlendFactorType::OneMinusSrcColor: return GL_ONE_MINUS_SRC_COLOR;
|
||||
case gfx::ColorBlendFactorType::DstColor: return GL_DST_COLOR;
|
||||
case gfx::ColorBlendFactorType::OneMinusDstColor: return GL_ONE_MINUS_DST_COLOR;
|
||||
case gfx::ColorBlendFactorType::SrcAlpha: return GL_SRC_ALPHA;
|
||||
case gfx::ColorBlendFactorType::OneMinusSrcAlpha: return GL_ONE_MINUS_SRC_ALPHA;
|
||||
case gfx::ColorBlendFactorType::DstAlpha: return GL_DST_ALPHA;
|
||||
case gfx::ColorBlendFactorType::OneMinusDstAlpha: return GL_ONE_MINUS_DST_ALPHA;
|
||||
case gfx::ColorBlendFactorType::ConstantColor: return GL_CONSTANT_COLOR;
|
||||
case gfx::ColorBlendFactorType::OneMinusConstantColor: return GL_ONE_MINUS_CONSTANT_COLOR;
|
||||
case gfx::ColorBlendFactorType::ConstantAlpha: return GL_CONSTANT_ALPHA;
|
||||
case gfx::ColorBlendFactorType::OneMinusConstantAlpha: return GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||
case gfx::ColorBlendFactorType::SrcAlphaSaturate: return GL_SRC_ALPHA_SATURATE;
|
||||
}
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mbgl
|
||||
16
src/mbgl/gl/enum.hpp
Normal file
16
src/mbgl/gl/enum.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/platform/gl_functions.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
|
||||
template <typename T>
|
||||
class Enum {
|
||||
public:
|
||||
static T from(const platform::GLint);
|
||||
static platform::GLenum to(T);
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mbgl
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <mbgl/gl/value.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
#include <mbgl/gl/vertex_array_extension.hpp>
|
||||
#include <mbgl/gl/enum.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
@@ -8,9 +9,6 @@ namespace value {
|
||||
|
||||
using namespace platform;
|
||||
|
||||
template <class T>
|
||||
T fromGLenum(const GLint);
|
||||
|
||||
const constexpr ClearDepth::Type ClearDepth::Default;
|
||||
|
||||
void ClearDepth::Set(const Type& value) {
|
||||
@@ -177,91 +175,29 @@ Blend::Type Blend::Get() {
|
||||
|
||||
const constexpr BlendEquation::Type BlendEquation::Default;
|
||||
|
||||
GLenum toGLenum(const gfx::ColorMode::BlendEquation blendEquation) {
|
||||
switch (blendEquation) {
|
||||
case gfx::ColorMode::BlendEquation::Add: return GL_FUNC_ADD;
|
||||
case gfx::ColorMode::BlendEquation::Subtract: return GL_FUNC_SUBTRACT;
|
||||
case gfx::ColorMode::BlendEquation::ReverseSubtract: return GL_FUNC_REVERSE_SUBTRACT;
|
||||
}
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
void BlendEquation::Set(const Type& value) {
|
||||
MBGL_CHECK_ERROR(glBlendEquation(toGLenum(value)));
|
||||
}
|
||||
|
||||
template <>
|
||||
gfx::ColorMode::BlendEquation fromGLenum<gfx::ColorMode::BlendEquation>(const GLint blendEquation) {
|
||||
switch (blendEquation) {
|
||||
case GL_FUNC_ADD: return gfx::ColorMode::BlendEquation::Add;
|
||||
case GL_FUNC_SUBTRACT: return gfx::ColorMode::BlendEquation::Subtract;
|
||||
case GL_FUNC_REVERSE_SUBTRACT: return gfx::ColorMode::BlendEquation::ReverseSubtract;
|
||||
}
|
||||
return {};
|
||||
MBGL_CHECK_ERROR(glBlendEquation(Enum<gfx::ColorBlendEquationType>::to(value)));
|
||||
}
|
||||
|
||||
BlendEquation::Type BlendEquation::Get() {
|
||||
GLint blend;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_EQUATION_RGB, &blend));
|
||||
return fromGLenum<gfx::ColorMode::BlendEquation>(blend);
|
||||
return Enum<gfx::ColorBlendEquationType>::from(blend);
|
||||
}
|
||||
|
||||
const constexpr BlendFunc::Type BlendFunc::Default;
|
||||
|
||||
GLenum toGLenum(const gfx::ColorMode::BlendFactor blendFactor) {
|
||||
switch (blendFactor) {
|
||||
case gfx::ColorMode::BlendFactor::Zero: return GL_ZERO;
|
||||
case gfx::ColorMode::BlendFactor::One: return GL_ONE;
|
||||
case gfx::ColorMode::BlendFactor::SrcColor: return GL_SRC_COLOR;
|
||||
case gfx::ColorMode::BlendFactor::OneMinusSrcColor: return GL_ONE_MINUS_SRC_COLOR;
|
||||
case gfx::ColorMode::BlendFactor::DstColor: return GL_DST_COLOR;
|
||||
case gfx::ColorMode::BlendFactor::OneMinusDstColor: return GL_ONE_MINUS_DST_COLOR;
|
||||
case gfx::ColorMode::BlendFactor::SrcAlpha: return GL_SRC_ALPHA;
|
||||
case gfx::ColorMode::BlendFactor::OneMinusSrcAlpha: return GL_ONE_MINUS_SRC_ALPHA;
|
||||
case gfx::ColorMode::BlendFactor::DstAlpha: return GL_DST_ALPHA;
|
||||
case gfx::ColorMode::BlendFactor::OneMinusDstAlpha: return GL_ONE_MINUS_DST_ALPHA;
|
||||
case gfx::ColorMode::BlendFactor::ConstantColor: return GL_CONSTANT_COLOR;
|
||||
case gfx::ColorMode::BlendFactor::OneMinusConstantColor: return GL_ONE_MINUS_CONSTANT_COLOR;
|
||||
case gfx::ColorMode::BlendFactor::ConstantAlpha: return GL_CONSTANT_ALPHA;
|
||||
case gfx::ColorMode::BlendFactor::OneMinusConstantAlpha: return GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||
case gfx::ColorMode::BlendFactor::SrcAlphaSaturate: return GL_SRC_ALPHA_SATURATE;
|
||||
}
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
void BlendFunc::Set(const Type& value) {
|
||||
MBGL_CHECK_ERROR(
|
||||
glBlendFunc(toGLenum(value.sfactor), toGLenum(value.dfactor)));
|
||||
}
|
||||
|
||||
template <>
|
||||
gfx::ColorMode::BlendFactor fromGLenum<gfx::ColorMode::BlendFactor>(const GLint blendFactor) {
|
||||
switch (blendFactor) {
|
||||
case GL_ZERO: return gfx::ColorMode::BlendFactor::Zero;
|
||||
case GL_ONE: return gfx::ColorMode::BlendFactor::One;
|
||||
case GL_SRC_COLOR: return gfx::ColorMode::BlendFactor::SrcColor;
|
||||
case GL_ONE_MINUS_SRC_COLOR: return gfx::ColorMode::BlendFactor::OneMinusSrcColor;
|
||||
case GL_DST_COLOR: return gfx::ColorMode::BlendFactor::DstColor;
|
||||
case GL_ONE_MINUS_DST_COLOR: return gfx::ColorMode::BlendFactor::OneMinusDstColor;
|
||||
case GL_SRC_ALPHA: return gfx::ColorMode::BlendFactor::SrcAlpha;
|
||||
case GL_ONE_MINUS_SRC_ALPHA: return gfx::ColorMode::BlendFactor::OneMinusSrcAlpha;
|
||||
case GL_DST_ALPHA: return gfx::ColorMode::BlendFactor::DstAlpha;
|
||||
case GL_ONE_MINUS_DST_ALPHA: return gfx::ColorMode::BlendFactor::OneMinusDstAlpha;
|
||||
case GL_CONSTANT_COLOR: return gfx::ColorMode::BlendFactor::ConstantColor;
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR: return gfx::ColorMode::BlendFactor::OneMinusConstantColor;
|
||||
case GL_CONSTANT_ALPHA: return gfx::ColorMode::BlendFactor::ConstantAlpha;
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA: return gfx::ColorMode::BlendFactor::OneMinusConstantAlpha;
|
||||
case GL_SRC_ALPHA_SATURATE: return gfx::ColorMode::BlendFactor::SrcAlphaSaturate;
|
||||
}
|
||||
return {};
|
||||
MBGL_CHECK_ERROR(glBlendFunc(Enum<gfx::ColorBlendFactorType>::to(value.sfactor),
|
||||
Enum<gfx::ColorBlendFactorType>::to(value.dfactor)));
|
||||
}
|
||||
|
||||
BlendFunc::Type BlendFunc::Get() {
|
||||
GLint sfactor, dfactor;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_SRC_ALPHA, &sfactor));
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_DST_ALPHA, &dfactor));
|
||||
return { fromGLenum<gfx::ColorMode::BlendFactor>(sfactor),
|
||||
fromGLenum<gfx::ColorMode::BlendFactor>(dfactor) };
|
||||
return { Enum<gfx::ColorBlendFactorType>::from(sfactor),
|
||||
Enum<gfx::ColorBlendFactorType>::from(dfactor) };
|
||||
}
|
||||
|
||||
const BlendColor::Type BlendColor::Default { 0, 0, 0, 0 };
|
||||
|
||||
@@ -126,18 +126,18 @@ struct Blend {
|
||||
};
|
||||
|
||||
struct BlendEquation {
|
||||
using Type = gfx::ColorMode::BlendEquation;
|
||||
static const constexpr Type Default = gfx::ColorMode::BlendEquation::Add;
|
||||
using Type = gfx::ColorBlendEquationType;
|
||||
static const constexpr Type Default = gfx::ColorBlendEquationType::Add;
|
||||
static void Set(const Type&);
|
||||
static Type Get();
|
||||
};
|
||||
|
||||
struct BlendFunc {
|
||||
struct Type {
|
||||
gfx::ColorMode::BlendFactor sfactor;
|
||||
gfx::ColorMode::BlendFactor dfactor;
|
||||
gfx::ColorBlendFactorType sfactor;
|
||||
gfx::ColorBlendFactorType dfactor;
|
||||
};
|
||||
static const constexpr Type Default = { gfx::ColorMode::BlendFactor::One, gfx::ColorMode::BlendFactor::Zero };
|
||||
static const constexpr Type Default = { gfx::ColorBlendFactorType::One, gfx::ColorBlendFactorType::Zero };
|
||||
static void Set(const Type&);
|
||||
static Type Get();
|
||||
};
|
||||
|
||||
@@ -84,8 +84,8 @@ gfx::ColorMode PaintParameters::colorModeForRenderPass() const {
|
||||
const float overdraw = 1.0f / 8.0f;
|
||||
return gfx::ColorMode {
|
||||
gfx::ColorMode::Add {
|
||||
gfx::ColorMode::BlendFactor::ConstantColor,
|
||||
gfx::ColorMode::BlendFactor::One
|
||||
gfx::ColorBlendFactorType::ConstantColor,
|
||||
gfx::ColorBlendFactorType::One
|
||||
},
|
||||
Color { overdraw, overdraw, overdraw, 0.0f },
|
||||
gfx::ColorMode::Mask { true, true, true, true }
|
||||
|
||||
Reference in New Issue
Block a user