[core] add constant DDS values as uniforms
This commit is contained in:
committed by
John Firebaugh
parent
cf85873f36
commit
a64828218a
@@ -62,7 +62,7 @@ public:
|
||||
std::move(stencilMode),
|
||||
std::move(colorMode),
|
||||
uniformValues
|
||||
.concat(paintPropertyBinders.uniformValues(currentZoom)),
|
||||
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)),
|
||||
LayoutAttributes::allVariableBindings(layoutVertexBuffer)
|
||||
.concat(paintPropertyBinders.attributeBindings(currentProperties)),
|
||||
indexBuffer,
|
||||
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
std::move(colorMode),
|
||||
uniformValues
|
||||
.concat(symbolSizeBinder.uniformValues(currentZoom))
|
||||
.concat(paintPropertyBinders.uniformValues(currentZoom)),
|
||||
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)),
|
||||
LayoutAttributes::allVariableBindings(layoutVertexBuffer)
|
||||
.concat(symbolSizeBinder.attributeBindings(currentSizeValue))
|
||||
.concat(paintPropertyBinders.attributeBindings(currentProperties)),
|
||||
|
||||
@@ -88,6 +88,7 @@ public:
|
||||
virtual void upload(gl::Context& context) = 0;
|
||||
virtual AttributeBinding attributeBinding(const PossiblyEvaluatedPropertyValue<T>& currentValue) const = 0;
|
||||
virtual float interpolationFactor(float currentZoom) const = 0;
|
||||
virtual T uniformValue(const PossiblyEvaluatedPropertyValue<T>& currentValue) const = 0;
|
||||
|
||||
static std::unique_ptr<PaintPropertyBinder> create(const PossiblyEvaluatedPropertyValue<T>& value, float zoom, T defaultValue);
|
||||
|
||||
@@ -118,6 +119,10 @@ public:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
T uniformValue(const PossiblyEvaluatedPropertyValue<T>& currentValue) const override {
|
||||
return currentValue.constantOr(constant);
|
||||
}
|
||||
|
||||
private:
|
||||
T constant;
|
||||
};
|
||||
@@ -165,6 +170,11 @@ public:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
T uniformValue(const PossiblyEvaluatedPropertyValue<T>&) const override {
|
||||
// Uniform values for vertex attribute arrays are unused.
|
||||
return {};
|
||||
}
|
||||
|
||||
private:
|
||||
style::SourceFunction<T> function;
|
||||
T defaultValue;
|
||||
@@ -220,6 +230,11 @@ public:
|
||||
return util::interpolationFactor(1.0f, std::get<0>(coveringRanges), currentZoom);
|
||||
}
|
||||
|
||||
T uniformValue(const PossiblyEvaluatedPropertyValue<T>&) const override {
|
||||
// Uniform values for vertex attribute arrays are unused.
|
||||
return {};
|
||||
}
|
||||
|
||||
private:
|
||||
using InnerStops = typename style::CompositeFunction<T>::InnerStops;
|
||||
style::CompositeFunction<T> function;
|
||||
@@ -306,14 +321,18 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
using Uniforms = gl::Uniforms<InterpolationUniform<typename Ps::Attribute>...>;
|
||||
using Uniforms = gl::Uniforms<InterpolationUniform<typename Ps::Attribute>..., typename Ps::Uniform...>;
|
||||
using UniformValues = typename Uniforms::Values;
|
||||
|
||||
UniformValues uniformValues(float currentZoom) const {
|
||||
template <class EvaluatedProperties>
|
||||
UniformValues uniformValues(float currentZoom, const EvaluatedProperties& currentProperties) const {
|
||||
(void)currentZoom; // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56958
|
||||
return UniformValues {
|
||||
typename InterpolationUniform<typename Ps::Attribute>::Value {
|
||||
binders.template get<Ps>()->interpolationFactor(currentZoom)
|
||||
}...,
|
||||
typename Ps::Uniform::Value {
|
||||
binders.template get<Ps>()->uniformValue(currentProperties.template get<Ps>())
|
||||
}...
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user