Move background tile shader selection back to the render layer (#1200)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
committed by
Bart Louwers
parent
90aea725e5
commit
dc5f6c4d69
@@ -104,6 +104,10 @@ public:
|
||||
/// @param location A sampler location in the shader being used with this drawable.
|
||||
void setTexture(std::shared_ptr<gfx::Texture2D> texture, int32_t location);
|
||||
|
||||
/// Whether the drawble should be drawn
|
||||
bool getEnabled() const { return enabled; }
|
||||
void setEnabled(bool value) { enabled = value; }
|
||||
|
||||
/// not used for anything yet
|
||||
DrawPriority getDrawPriority() const { return drawPriority; }
|
||||
void setDrawPriority(DrawPriority value) { drawPriority = value; }
|
||||
@@ -150,6 +154,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool enabled = true;
|
||||
std::string name;
|
||||
util::SimpleIdentity uniqueID;
|
||||
gfx::ShaderProgramBasePtr shader;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
|
||||
class Context;
|
||||
|
||||
class UniformBuffer {
|
||||
// Can only be created by platform specific implementations
|
||||
protected:
|
||||
@@ -49,24 +51,25 @@ public:
|
||||
|
||||
/// Get an uniform buffer element.
|
||||
/// Returns a pointer to the element on success, or null if the uniform buffer doesn't exists.
|
||||
const std::shared_ptr<UniformBuffer>& get(const std::string& name) const;
|
||||
const std::shared_ptr<UniformBuffer>& get(std::string_view name) const;
|
||||
|
||||
/// Add a new uniform buffer element or replace the existing one.
|
||||
const std::shared_ptr<UniformBuffer>& addOrReplace(std::string name, std::shared_ptr<UniformBuffer> uniformBuffer);
|
||||
const std::shared_ptr<UniformBuffer>& addOrReplace(std::string_view name,
|
||||
std::shared_ptr<UniformBuffer> uniformBuffer);
|
||||
|
||||
/// Create and add a new buffer or update an existing one
|
||||
void createOrUpdate(std::string_view name, const std::vector<uint8_t>& data, gfx::Context&);
|
||||
void createOrUpdate(std::string_view name, const void* data, std::size_t size, gfx::Context&);
|
||||
template <typename T>
|
||||
void createOrUpdate(std::string_view name, const T* data, gfx::Context& context) {
|
||||
createOrUpdate(name, data, sizeof(T), context);
|
||||
}
|
||||
|
||||
UniformBufferArray& operator=(UniformBufferArray&&);
|
||||
UniformBufferArray& operator=(const UniformBufferArray&);
|
||||
|
||||
protected:
|
||||
const std::shared_ptr<UniformBuffer>& add(std::string name, std::shared_ptr<UniformBuffer>&& uniformBuffer) {
|
||||
const auto result = uniformBufferMap.insert(std::make_pair(std::move(name), std::shared_ptr<UniformBuffer>()));
|
||||
if (result.second) {
|
||||
result.first->second = std::move(uniformBuffer);
|
||||
return result.first->second;
|
||||
} else {
|
||||
return nullref;
|
||||
}
|
||||
}
|
||||
const std::shared_ptr<UniformBuffer>& add(const std::string_view name, std::shared_ptr<UniformBuffer>&&);
|
||||
|
||||
virtual std::unique_ptr<UniformBuffer> copy(const UniformBuffer& uniformBuffer) = 0;
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ public:
|
||||
LayerGroup(const LayerGroup&) = delete;
|
||||
LayerGroup& operator=(const LayerGroup&) = delete;
|
||||
|
||||
/// Whether the drawables should be drawn
|
||||
bool getEnabled() const { return enabled; }
|
||||
void setEnabled(bool value) { enabled = value; }
|
||||
|
||||
int32_t getLayerIndex() const { return layerIndex; }
|
||||
|
||||
/// Called before starting each frame
|
||||
@@ -64,6 +68,7 @@ public:
|
||||
const LayerTweakerPtr& getLayerTweaker() const { return layerTweaker; }
|
||||
|
||||
protected:
|
||||
bool enabled = true;
|
||||
int32_t layerIndex;
|
||||
LayerTweakerPtr layerTweaker;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user