[core] move ColorMode to gfx namespace
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
"src/mbgl/geometry/feature_index.cpp",
|
||||
"src/mbgl/geometry/line_atlas.cpp",
|
||||
"src/mbgl/gl/attribute.cpp",
|
||||
"src/mbgl/gl/color_mode.cpp",
|
||||
"src/mbgl/gl/context.cpp",
|
||||
"src/mbgl/gl/cull_face_mode.cpp",
|
||||
"src/mbgl/gl/debugging.cpp",
|
||||
@@ -499,12 +498,12 @@
|
||||
"mbgl/geometry/feature_index.hpp": "src/mbgl/geometry/feature_index.hpp",
|
||||
"mbgl/geometry/line_atlas.hpp": "src/mbgl/geometry/line_atlas.hpp",
|
||||
"mbgl/gfx/attribute.hpp": "src/mbgl/gfx/attribute.hpp",
|
||||
"mbgl/gfx/color_mode.hpp": "src/mbgl/gfx/color_mode.hpp",
|
||||
"mbgl/gfx/draw_mode.hpp": "src/mbgl/gfx/draw_mode.hpp",
|
||||
"mbgl/gfx/primitives.hpp": "src/mbgl/gfx/primitives.hpp",
|
||||
"mbgl/gfx/types.hpp": "src/mbgl/gfx/types.hpp",
|
||||
"mbgl/gfx/uniform.hpp": "src/mbgl/gfx/uniform.hpp",
|
||||
"mbgl/gl/attribute.hpp": "src/mbgl/gl/attribute.hpp",
|
||||
"mbgl/gl/color_mode.hpp": "src/mbgl/gl/color_mode.hpp",
|
||||
"mbgl/gl/context.hpp": "src/mbgl/gl/context.hpp",
|
||||
"mbgl/gl/cull_face_mode.hpp": "src/mbgl/gl/cull_face_mode.hpp",
|
||||
"mbgl/gl/debugging.hpp": "src/mbgl/gl/debugging.hpp",
|
||||
|
||||
@@ -4,39 +4,39 @@
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
namespace gfx {
|
||||
|
||||
class ColorMode {
|
||||
public:
|
||||
enum class BlendEquation {
|
||||
Add = 0x8006,
|
||||
Subtract = 0x800A,
|
||||
ReverseSubtract = 0x800B
|
||||
Add,
|
||||
Subtract,
|
||||
ReverseSubtract
|
||||
};
|
||||
|
||||
enum BlendFactor {
|
||||
Zero = 0x0000,
|
||||
One = 0x0001,
|
||||
SrcColor = 0x0300,
|
||||
OneMinusSrcColor = 0x0301,
|
||||
SrcAlpha = 0x0302,
|
||||
OneMinusSrcAlpha = 0x0303,
|
||||
DstAlpha = 0x0304,
|
||||
OneMinusDstAlpha = 0x0305,
|
||||
DstColor = 0x0306,
|
||||
OneMinusDstColor = 0x0307,
|
||||
SrcAlphaSaturate = 0x0308,
|
||||
ConstantColor = 0x8001,
|
||||
OneMinusConstantColor = 0x8002,
|
||||
ConstantAlpha = 0x8003,
|
||||
OneMinusConstantAlpha = 0x8004
|
||||
enum class BlendFactor {
|
||||
Zero,
|
||||
One,
|
||||
SrcColor,
|
||||
OneMinusSrcColor,
|
||||
SrcAlpha,
|
||||
OneMinusSrcAlpha,
|
||||
DstAlpha,
|
||||
OneMinusDstAlpha,
|
||||
DstColor,
|
||||
OneMinusDstColor,
|
||||
SrcAlphaSaturate,
|
||||
ConstantColor,
|
||||
OneMinusConstantColor,
|
||||
ConstantAlpha,
|
||||
OneMinusConstantAlpha
|
||||
};
|
||||
|
||||
template <BlendEquation E>
|
||||
struct ConstantBlend {
|
||||
static constexpr BlendEquation equation = E;
|
||||
static constexpr BlendFactor srcFactor = One;
|
||||
static constexpr BlendFactor dstFactor = One;
|
||||
static constexpr BlendFactor srcFactor = BlendFactor::One;
|
||||
static constexpr BlendFactor dstFactor = BlendFactor::One;
|
||||
};
|
||||
|
||||
template <BlendEquation E>
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
|
||||
struct Replace {
|
||||
static constexpr BlendEquation equation = BlendEquation::Add;
|
||||
static constexpr BlendFactor srcFactor = One;
|
||||
static constexpr BlendFactor dstFactor = Zero;
|
||||
static constexpr BlendFactor srcFactor = BlendFactor::One;
|
||||
static constexpr BlendFactor dstFactor = BlendFactor::Zero;
|
||||
};
|
||||
|
||||
using Add = LinearBlend<BlendEquation::Add>;
|
||||
@@ -75,19 +75,19 @@ public:
|
||||
Mask mask;
|
||||
|
||||
static ColorMode disabled() {
|
||||
return ColorMode { Replace(), {}, { false, false, false, false } };
|
||||
return { Replace{}, {}, { false, false, false, false } };
|
||||
}
|
||||
|
||||
static ColorMode unblended() {
|
||||
return ColorMode { Replace(), {}, { true, true, true, true } };
|
||||
return { Replace{}, {}, { true, true, true, true } };
|
||||
}
|
||||
|
||||
static ColorMode alphaBlended() {
|
||||
return ColorMode { Add { One, OneMinusSrcAlpha }, {}, { true, true, true, true } };
|
||||
return { Add{ BlendFactor::One, BlendFactor::OneMinusSrcAlpha }, {}, { true, true, true, true } };
|
||||
}
|
||||
|
||||
static ColorMode additive() {
|
||||
return ColorMode { Add { One, One }, {}, { true, true, true, true } };
|
||||
return { Add{ BlendFactor::One, BlendFactor::One }, {}, { true, true, true, true } };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,5 +95,5 @@ constexpr bool operator!=(const ColorMode::Mask& a, const ColorMode::Mask& b) {
|
||||
return a.r != b.r || a.g != b.g || a.b != b.b || a.a != b.a;
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
@@ -1,44 +0,0 @@
|
||||
#include <mbgl/gl/color_mode.hpp>
|
||||
#include <mbgl/gl/defines.hpp>
|
||||
#include <mbgl/util/traits.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
|
||||
static_assert(underlying_type(ColorMode::BlendEquation::Add) == GL_FUNC_ADD, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::BlendEquation::Subtract) == GL_FUNC_SUBTRACT, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::BlendEquation::ReverseSubtract) == GL_FUNC_REVERSE_SUBTRACT, "OpenGL enum mismatch");
|
||||
|
||||
static_assert(underlying_type(ColorMode::Zero) == GL_ZERO, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::One) == GL_ONE, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::SrcColor) == GL_SRC_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusSrcColor) == GL_ONE_MINUS_SRC_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::DstColor) == GL_DST_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusDstColor) == GL_ONE_MINUS_DST_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::SrcAlpha) == GL_SRC_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusSrcAlpha) == GL_ONE_MINUS_SRC_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::DstAlpha) == GL_DST_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusDstAlpha) == GL_ONE_MINUS_DST_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::ConstantColor) == GL_CONSTANT_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusConstantColor) == GL_ONE_MINUS_CONSTANT_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::ConstantAlpha) == GL_CONSTANT_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusConstantAlpha) == GL_ONE_MINUS_CONSTANT_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::SrcAlphaSaturate) == GL_SRC_ALPHA_SATURATE, "OpenGL enum mismatch");
|
||||
|
||||
static_assert(underlying_type(ColorMode::Zero) == GL_ZERO, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::One) == GL_ONE, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::SrcColor) == GL_SRC_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusSrcColor) == GL_ONE_MINUS_SRC_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::DstColor) == GL_DST_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusDstColor) == GL_ONE_MINUS_DST_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::SrcAlpha) == GL_SRC_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusSrcAlpha) == GL_ONE_MINUS_SRC_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::DstAlpha) == GL_DST_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusDstAlpha) == GL_ONE_MINUS_DST_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::ConstantColor) == GL_CONSTANT_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusConstantColor) == GL_ONE_MINUS_CONSTANT_COLOR, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::ConstantAlpha) == GL_CONSTANT_ALPHA, "OpenGL enum mismatch");
|
||||
static_assert(underlying_type(ColorMode::OneMinusConstantAlpha) == GL_ONE_MINUS_CONSTANT_ALPHA, "OpenGL enum mismatch");
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mbgl
|
||||
@@ -728,14 +728,14 @@ void Context::setStencilMode(const StencilMode& stencil) {
|
||||
}
|
||||
}
|
||||
|
||||
void Context::setColorMode(const ColorMode& color) {
|
||||
if (color.blendFunction.is<ColorMode::Replace>()) {
|
||||
void Context::setColorMode(const gfx::ColorMode& color) {
|
||||
if (color.blendFunction.is<gfx::ColorMode::Replace>()) {
|
||||
blend = false;
|
||||
} else {
|
||||
blend = true;
|
||||
blendColor = color.blendColor;
|
||||
apply_visitor([&] (const auto& blendFunction) {
|
||||
blendEquation = ColorMode::BlendEquation(blendFunction.equation);
|
||||
blendEquation = gfx::ColorMode::BlendEquation(blendFunction.equation);
|
||||
blendFunc = { blendFunction.srcFactor, blendFunction.dstFactor };
|
||||
}, color.blendFunction);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <mbgl/gfx/draw_mode.hpp>
|
||||
#include <mbgl/gl/depth_mode.hpp>
|
||||
#include <mbgl/gl/stencil_mode.hpp>
|
||||
#include <mbgl/gl/color_mode.hpp>
|
||||
#include <mbgl/gfx/color_mode.hpp>
|
||||
#include <mbgl/platform/gl_functions.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
void setDepthMode(const DepthMode&);
|
||||
void setStencilMode(const StencilMode&);
|
||||
void setColorMode(const ColorMode&);
|
||||
void setColorMode(const gfx::ColorMode&);
|
||||
void setCullFaceMode(const CullFaceMode&);
|
||||
|
||||
void draw(gfx::PrimitiveType,
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
DrawMode drawMode,
|
||||
DepthMode depthMode,
|
||||
StencilMode stencilMode,
|
||||
ColorMode colorMode,
|
||||
gfx::ColorMode colorMode,
|
||||
CullFaceMode cullFaceMode,
|
||||
const UniformValues& uniformValues,
|
||||
VertexArray& vertexArray,
|
||||
|
||||
@@ -8,6 +8,9 @@ namespace value {
|
||||
|
||||
using namespace platform;
|
||||
|
||||
template <class T>
|
||||
T fromGLenum(const GLint);
|
||||
|
||||
const constexpr ClearDepth::Type ClearDepth::Default;
|
||||
|
||||
void ClearDepth::Set(const Type& value) {
|
||||
@@ -174,29 +177,91 @@ 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(static_cast<GLenum>(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 {};
|
||||
}
|
||||
|
||||
BlendEquation::Type BlendEquation::Get() {
|
||||
GLint blend;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_EQUATION_RGB, &blend));
|
||||
return static_cast<Type>(blend);
|
||||
return fromGLenum<gfx::ColorMode::BlendEquation>(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(static_cast<GLenum>(value.sfactor), static_cast<GLenum>(value.dfactor)));
|
||||
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 {};
|
||||
}
|
||||
|
||||
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 { static_cast<ColorMode::BlendFactor>(sfactor),
|
||||
static_cast<ColorMode::BlendFactor>(dfactor) };
|
||||
return { fromGLenum<gfx::ColorMode::BlendFactor>(sfactor),
|
||||
fromGLenum<gfx::ColorMode::BlendFactor>(dfactor) };
|
||||
}
|
||||
|
||||
const BlendColor::Type BlendColor::Default { 0, 0, 0, 0 };
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <mbgl/gl/types.hpp>
|
||||
#include <mbgl/gl/depth_mode.hpp>
|
||||
#include <mbgl/gl/stencil_mode.hpp>
|
||||
#include <mbgl/gl/color_mode.hpp>
|
||||
#include <mbgl/gfx/color_mode.hpp>
|
||||
#include <mbgl/gl/cull_face_mode.hpp>
|
||||
#include <mbgl/gl/attribute.hpp>
|
||||
#include <mbgl/platform/gl_functions.hpp>
|
||||
@@ -54,7 +54,7 @@ struct DepthMask {
|
||||
};
|
||||
|
||||
struct ColorMask {
|
||||
using Type = ColorMode::Mask;
|
||||
using Type = gfx::ColorMode::Mask;
|
||||
static const constexpr Type Default = { true, true, true, true };
|
||||
static void Set(const Type&);
|
||||
static Type Get();
|
||||
@@ -126,18 +126,18 @@ struct Blend {
|
||||
};
|
||||
|
||||
struct BlendEquation {
|
||||
using Type = ColorMode::BlendEquation;
|
||||
static const constexpr Type Default = ColorMode::BlendEquation::Add;
|
||||
using Type = gfx::ColorMode::BlendEquation;
|
||||
static const constexpr Type Default = gfx::ColorMode::BlendEquation::Add;
|
||||
static void Set(const Type&);
|
||||
static Type Get();
|
||||
};
|
||||
|
||||
struct BlendFunc {
|
||||
struct Type {
|
||||
ColorMode::BlendFactor sfactor;
|
||||
ColorMode::BlendFactor dfactor;
|
||||
gfx::ColorMode::BlendFactor sfactor;
|
||||
gfx::ColorMode::BlendFactor dfactor;
|
||||
};
|
||||
static const constexpr Type Default = { ColorMode::One, ColorMode::Zero };
|
||||
static const constexpr Type Default = { gfx::ColorMode::BlendFactor::One, gfx::ColorMode::BlendFactor::Zero };
|
||||
static void Set(const Type&);
|
||||
static Type Get();
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
DrawMode drawMode,
|
||||
gl::DepthMode depthMode,
|
||||
gl::StencilMode stencilMode,
|
||||
gl::ColorMode colorMode,
|
||||
gfx::ColorMode colorMode,
|
||||
gl::CullFaceMode cullFaceMode,
|
||||
const UniformValues& uniformValues,
|
||||
const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer,
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
DrawMode drawMode,
|
||||
gl::DepthMode depthMode,
|
||||
gl::StencilMode stencilMode,
|
||||
gl::ColorMode colorMode,
|
||||
gfx::ColorMode colorMode,
|
||||
gl::CullFaceMode cullFaceMode,
|
||||
const UniformValues& uniformValues,
|
||||
const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer,
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
DrawMode drawMode,
|
||||
gl::DepthMode depthMode,
|
||||
gl::StencilMode stencilMode,
|
||||
gl::ColorMode colorMode,
|
||||
gfx::ColorMode colorMode,
|
||||
gl::CullFaceMode cullFaceMode,
|
||||
const gl::IndexBuffer<DrawMode>& indexBuffer,
|
||||
const SegmentVector<Attributes>& segments,
|
||||
|
||||
@@ -308,7 +308,7 @@ public:
|
||||
DrawMode drawMode,
|
||||
gl::DepthMode depthMode,
|
||||
gl::StencilMode stencilMode,
|
||||
gl::ColorMode colorMode,
|
||||
gfx::ColorMode colorMode,
|
||||
gl::CullFaceMode cullFaceMode,
|
||||
const gl::IndexBuffer<DrawMode>& indexBuffer,
|
||||
const SegmentVector<Attributes>& segments,
|
||||
|
||||
@@ -122,7 +122,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
gfx::Triangles(),
|
||||
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
|
||||
stencilMode,
|
||||
gl::ColorMode::additive(),
|
||||
gfx::ColorMode::additive(),
|
||||
gl::CullFaceMode::disabled(),
|
||||
*bucket.indexBuffer,
|
||||
bucket.segments,
|
||||
|
||||
@@ -79,21 +79,21 @@ gl::StencilMode PaintParameters::stencilModeForClipping(const ClipID& id) const
|
||||
};
|
||||
}
|
||||
|
||||
gl::ColorMode PaintParameters::colorModeForRenderPass() const {
|
||||
gfx::ColorMode PaintParameters::colorModeForRenderPass() const {
|
||||
if (debugOptions & MapDebugOptions::Overdraw) {
|
||||
const float overdraw = 1.0f / 8.0f;
|
||||
return gl::ColorMode {
|
||||
gl::ColorMode::Add {
|
||||
gl::ColorMode::ConstantColor,
|
||||
gl::ColorMode::One
|
||||
return gfx::ColorMode {
|
||||
gfx::ColorMode::Add {
|
||||
gfx::ColorMode::BlendFactor::ConstantColor,
|
||||
gfx::ColorMode::BlendFactor::One
|
||||
},
|
||||
Color { overdraw, overdraw, overdraw, 0.0f },
|
||||
gl::ColorMode::Mask { true, true, true, true }
|
||||
gfx::ColorMode::Mask { true, true, true, true }
|
||||
};
|
||||
} else if (pass == RenderPass::Translucent) {
|
||||
return gl::ColorMode::alphaBlended();
|
||||
return gfx::ColorMode::alphaBlended();
|
||||
} else {
|
||||
return gl::ColorMode::unblended();
|
||||
return gfx::ColorMode::unblended();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <mbgl/map/mode.hpp>
|
||||
#include <mbgl/gl/depth_mode.hpp>
|
||||
#include <mbgl/gl/stencil_mode.hpp>
|
||||
#include <mbgl/gl/color_mode.hpp>
|
||||
#include <mbgl/gfx/color_mode.hpp>
|
||||
#include <mbgl/util/mat4.hpp>
|
||||
#include <mbgl/algorithm/generate_clip_ids.hpp>
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
gl::DepthMode depthModeForSublayer(uint8_t n, gl::DepthMode::Mask) const;
|
||||
gl::DepthMode depthModeFor3D(gl::DepthMode::Mask) const;
|
||||
gl::StencilMode stencilModeForClipping(const ClipID&) const;
|
||||
gl::ColorMode colorModeForRenderPass() const;
|
||||
gfx::ColorMode colorModeForRenderPass() const;
|
||||
|
||||
mat4 matrixForTile(const UnwrappedTileID&, bool aligned = false) const;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
|
||||
gfx::Lines { 4.0f * parameters.pixelRatio },
|
||||
gl::DepthMode::disabled(),
|
||||
parameters.stencilModeForClipping(clip),
|
||||
gl::ColorMode::unblended(),
|
||||
gfx::ColorMode::unblended(),
|
||||
gl::CullFaceMode::disabled(),
|
||||
*tile.debugBucket->indexBuffer,
|
||||
tile.debugBucket->segments,
|
||||
@@ -120,7 +120,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
|
||||
gfx::Lines { 2.0f * parameters.pixelRatio },
|
||||
gl::DepthMode::disabled(),
|
||||
parameters.stencilModeForClipping(clip),
|
||||
gl::ColorMode::unblended(),
|
||||
gfx::ColorMode::unblended(),
|
||||
gl::CullFaceMode::disabled(),
|
||||
*tile.debugBucket->indexBuffer,
|
||||
tile.debugBucket->segments,
|
||||
@@ -144,7 +144,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
|
||||
gfx::LineStrip { 4.0f * parameters.pixelRatio },
|
||||
gl::DepthMode::disabled(),
|
||||
parameters.stencilModeForClipping(clip),
|
||||
gl::ColorMode::unblended(),
|
||||
gfx::ColorMode::unblended(),
|
||||
gl::CullFaceMode::disabled(),
|
||||
parameters.staticData.tileBorderIndexBuffer,
|
||||
parameters.staticData.tileBorderSegments,
|
||||
|
||||
@@ -452,7 +452,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
gl::StencilMode::Keep,
|
||||
gl::StencilMode::Replace
|
||||
},
|
||||
gl::ColorMode::disabled(),
|
||||
gfx::ColorMode::disabled(),
|
||||
gl::CullFaceMode::disabled(),
|
||||
parameters.staticData.quadTriangleIndexBuffer,
|
||||
parameters.staticData.tileTriangleSegments,
|
||||
@@ -479,7 +479,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
if (parameters.debugOptions & MapDebugOptions::StencilClip) {
|
||||
parameters.context.setStencilMode(gl::StencilMode::disabled());
|
||||
parameters.context.setDepthMode(gl::DepthMode::disabled());
|
||||
parameters.context.setColorMode(gl::ColorMode::unblended());
|
||||
parameters.context.setColorMode(gfx::ColorMode::unblended());
|
||||
parameters.context.program = 0;
|
||||
|
||||
// Reset the value in case someone else changed it, or it's dirty.
|
||||
@@ -562,7 +562,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
if (parameters.debugOptions & MapDebugOptions::DepthBuffer) {
|
||||
parameters.context.setStencilMode(gl::StencilMode::disabled());
|
||||
parameters.context.setDepthMode(gl::DepthMode::disabled());
|
||||
parameters.context.setColorMode(gl::ColorMode::unblended());
|
||||
parameters.context.setColorMode(gfx::ColorMode::unblended());
|
||||
parameters.context.program = 0;
|
||||
|
||||
// Scales the values in the depth buffer so that they cover the entire grayscale range. This
|
||||
|
||||
@@ -66,7 +66,7 @@ void RenderImageSource::finishRender(PaintParameters& parameters) {
|
||||
gfx::LineStrip { 4.0f * parameters.pixelRatio },
|
||||
gl::DepthMode::disabled(),
|
||||
gl::StencilMode::disabled(),
|
||||
gl::ColorMode::unblended(),
|
||||
gfx::ColorMode::unblended(),
|
||||
gl::CullFaceMode::disabled(),
|
||||
parameters.staticData.tileBorderIndexBuffer,
|
||||
parameters.staticData.tileBorderSegments,
|
||||
|
||||
Reference in New Issue
Block a user