Drawable Renderer (#1570), Move layer update to where more state is available.

Evaluate properties and use actual style color.
Fix problems with attribute bindings and depth modes.
This commit is contained in:
Tim Sylvester
2023-04-27 14:25:43 -07:00
committed by Bart Louwers
parent 3122f81328
commit b8c0b1a97c
18 changed files with 224 additions and 102 deletions

View File

@@ -15,6 +15,8 @@ class PaintParameters;
namespace gfx {
enum class DepthMaskType : bool;
class DrawableTweaker;
class ShaderProgramBase;
using ShaderProgramBasePtr = std::shared_ptr<ShaderProgramBase>;
@@ -47,6 +49,9 @@ public:
mat4 getMatrix() const { return matrix; }
void setMatrix(mat4 value) { matrix = value; }
DepthMaskType getDepthType() const { return depthType; }
void setDepthType(DepthMaskType value) { depthType = value; }
/// Get the number of vertexes
std::size_t getVertexCount() const { return getVertexAttributes().getMaxCount(); }
@@ -72,6 +77,7 @@ protected:
mat4 matrix; //= matrix::identity4();
std::optional<OverscaledTileID> tileID;
DrawPriority drawPriority = 0;
DepthMaskType depthType;// = DepthMaskType::ReadOnly;
std::vector<DrawableTweakerPtr> tweakers;
};

View File

@@ -1,6 +1,7 @@
#pragma once
#include <mbgl/gfx/drawable.hpp>
#include <mbgl/gfx/types.hpp>
#include <mbgl/gfx/vertex_attribute.hpp>
#include <memory>
@@ -59,6 +60,9 @@ public:
const Color& getColor() const;
void setColor(const Color& value);
DepthMaskType getDepthType() const { return depthType; }
void setDepthType(DepthMaskType value) { depthType = value; }
/// Which shader to use when rendering emitted drawables
const gfx::ShaderProgramBasePtr& getShader() const { return shader; }
void setShader(gfx::ShaderProgramBasePtr value) { shader = std::move(value); }
@@ -88,14 +92,11 @@ protected:
protected:
DrawPriority drawPriority = 0;
DepthMaskType depthType = DepthMaskType::ReadOnly;
gfx::ShaderProgramBasePtr shader;
mat4 matrix;
DrawablePtr currentDrawable;
std::vector<DrawablePtr> drawables;
std::vector<DrawableTweakerPtr> tweakers;
struct Impl;