Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
73 lines
1.7 KiB
C++
73 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <mbgl/gfx/drawable.hpp>
|
|
#include <mbgl/gfx/draw_mode.hpp>
|
|
#include <mbgl/gl/vertex_array.hpp>
|
|
#include <mbgl/gl/vertex_attribute_gl.hpp>
|
|
#include <mbgl/programs/segment.hpp>
|
|
|
|
#include <memory>
|
|
|
|
namespace mbgl {
|
|
|
|
template <class AttributeList>
|
|
class Segment;
|
|
|
|
namespace gfx {
|
|
|
|
class Context;
|
|
class IndexBuffer;
|
|
class UploadPass;
|
|
class VertexBufferResource;
|
|
|
|
using UniqueVertexBufferResource = std::unique_ptr<gfx::VertexBufferResource>;
|
|
|
|
} // namespace gfx
|
|
|
|
namespace gl {
|
|
|
|
class Texture2D;
|
|
class VertexArray;
|
|
|
|
class DrawableGL : public gfx::Drawable {
|
|
public:
|
|
DrawableGL(std::string name);
|
|
~DrawableGL() override;
|
|
|
|
void draw(const PaintParameters&) const override;
|
|
|
|
struct DrawSegmentGL;
|
|
void setIndexData(std::vector<std::uint16_t> indexes, std::vector<UniqueDrawSegment> segments);
|
|
|
|
const gfx::VertexAttributeArray& getVertexAttributes() const override;
|
|
void setVertexAttributes(const gfx::VertexAttributeArray& value) override;
|
|
void setVertexAttributes(gfx::VertexAttributeArray&& value) override;
|
|
|
|
gfx::VertexAttributeArray& mutableVertexAttributes();
|
|
|
|
const gfx::UniformBufferArray& getUniformBuffers() const override;
|
|
gfx::UniformBufferArray& mutableUniformBuffers() override;
|
|
|
|
/// Reset a single color attribute for all vertexes
|
|
void resetColor(const Color&) override;
|
|
|
|
void upload(gfx::Context&, gfx::UploadPass&);
|
|
|
|
protected:
|
|
class Impl;
|
|
const std::unique_ptr<Impl> impl;
|
|
|
|
// For testing only.
|
|
DrawableGL(std::unique_ptr<Impl>);
|
|
|
|
private:
|
|
void bindUniformBuffers() const;
|
|
void unbindUniformBuffers() const;
|
|
|
|
void bindTextures() const;
|
|
void unbindTextures() const;
|
|
};
|
|
|
|
} // namespace gl
|
|
} // namespace mbgl
|