Files
MapLibreParticleLab/src/mbgl/renderer/render_light.hpp
John Firebaugh d5f4d0f05f [core] Move render-related sources out of style directory/namespace
Moves the following to the renderer directory and out of the style namespace:

* CascadeParameters
* PropertyEvaluationParameters
* UpdateParameters
* PropertyEvaluator
* DataDrivenPropertyEvaluator
* CrossFadedPropertyEvaluator
* PaintPropertyBinder
* PaintProperyStatistics
* PossiblyEvaluatedPropertyValue
* TransitioningLight
* EvaluatedLight
2017-05-03 08:30:17 -07:00

73 lines
2.2 KiB
C++

#pragma once
#include <mbgl/style/light.hpp>
#include <mbgl/renderer/transitioning_property.hpp>
#include <mbgl/renderer/cascade_parameters.hpp>
#include <mbgl/renderer/property_evaluator.hpp>
#include <mbgl/renderer/property_evaluation_parameters.hpp>
#include <mbgl/util/ignore.hpp>
namespace mbgl {
template <class TypeList>
class Transitioning;
template <class... Ps>
class Transitioning<TypeList<Ps...>> : public IndexedTuple<
TypeList<Ps...>,
TypeList<TransitioningProperty<typename Ps::ValueType>...>>
{
private:
using Properties = TypeList<Ps...>;
using Raw = IndexedTuple<Properties, Properties>;
using Super = IndexedTuple<
TypeList<Ps...>,
TypeList<TransitioningProperty<typename Ps::ValueType>...>>;
public:
Transitioning() = default;
Transitioning(const Raw& raw, Transitioning&& prior, const CascadeParameters& params)
: Super {
TransitioningProperty<typename Ps::ValueType>(
raw.template get<Ps>().value,
std::move(prior.template get<Ps>()),
raw.template get<Ps>().transition.reverseMerge(params.transition),
params.now)...
} {}
bool hasTransition() const {
bool result = false;
util::ignore({ result |= this->template get<Ps>().hasTransition()... });
return result;
}
};
template <class TypeList>
class Evaluated;
template <class... Ps>
class Evaluated<TypeList<Ps...>> : public IndexedTuple<
TypeList<Ps...>,
TypeList<typename Ps::Type...>>
{
private:
using Properties = TypeList<Ps...>;
using TransitioningPs = Transitioning<Properties>;
using Super = IndexedTuple<
TypeList<Ps...>,
TypeList<typename Ps::Type...>>;
public:
Evaluated() = default;
Evaluated(TransitioningPs& transitioning, const PropertyEvaluationParameters& params)
: Super {
transitioning.template get<Ps>()
.evaluate(PropertyEvaluator<typename Ps::Type>(params, Ps::defaultValue()), params.now)...
} {}
};
using TransitioningLight = Transitioning<style::LightProperties>;
using EvaluatedLight = Evaluated<style::LightProperties>;
} // namespace mbgl