[core] Remove dead code
- CollisionTile - FrameHistory - PlacementConfig
This commit is contained in:
@@ -1,81 +0,0 @@
|
||||
#include <mbgl/renderer/frame_history.hpp>
|
||||
#include <mbgl/math/minmax.hpp>
|
||||
#include <mbgl/gl/context.hpp>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
FrameHistory::FrameHistory() {
|
||||
changeOpacities.fill(0);
|
||||
opacities.fill(0);
|
||||
}
|
||||
|
||||
void FrameHistory::record(const TimePoint& now, float zoom, const Duration& duration) {
|
||||
|
||||
int16_t zoomIndex = std::floor(zoom * 10.0);
|
||||
|
||||
if (firstFrame) {
|
||||
changeTimes.fill(now);
|
||||
|
||||
for (int16_t z = 0; z <= zoomIndex; z++) {
|
||||
opacities.data[z] = 255u;
|
||||
}
|
||||
firstFrame = false;
|
||||
}
|
||||
|
||||
if (zoomIndex < previousZoomIndex) {
|
||||
for (int16_t z = zoomIndex + 1; z <= previousZoomIndex; z++) {
|
||||
changeTimes[z] = now;
|
||||
changeOpacities[z] = opacities.data[z];
|
||||
}
|
||||
} else {
|
||||
for (int16_t z = zoomIndex; z > previousZoomIndex; z--) {
|
||||
changeTimes[z] = now;
|
||||
changeOpacities[z] = opacities.data[z];
|
||||
}
|
||||
}
|
||||
|
||||
for (int16_t z = 0; z <= 255; z++) {
|
||||
const std::chrono::duration<float> timeDiff = now - changeTimes[z];
|
||||
const int32_t opacityChange = (duration == Milliseconds(0) ? 1 : (timeDiff / duration)) * 255;
|
||||
const uint8_t opacity = z <= zoomIndex
|
||||
? util::min(255, changeOpacities[z] + opacityChange)
|
||||
: util::max(0, changeOpacities[z] - opacityChange);
|
||||
if (opacities.data[z] != opacity) {
|
||||
opacities.data[z] = opacity;
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (zoomIndex != previousZoomIndex) {
|
||||
previousZoomIndex = zoomIndex;
|
||||
previousTime = now;
|
||||
}
|
||||
|
||||
time = now;
|
||||
}
|
||||
|
||||
bool FrameHistory::needsAnimation(const Duration& duration) const {
|
||||
return (time - previousTime) < duration;
|
||||
}
|
||||
|
||||
void FrameHistory::upload(gl::Context& context, uint32_t unit) {
|
||||
if (!texture) {
|
||||
texture = context.createTexture(opacities, unit);
|
||||
} else if (dirty) {
|
||||
context.updateTexture(*texture, opacities, unit);
|
||||
}
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
void FrameHistory::bind(gl::Context& context, uint32_t unit) {
|
||||
upload(context, unit);
|
||||
context.bindTexture(*texture, unit);
|
||||
}
|
||||
|
||||
bool FrameHistory::isVisible(const float zoom) const {
|
||||
return opacities.data[std::floor(zoom * 10)] != 0;
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <mbgl/util/platform.hpp>
|
||||
#include <mbgl/gl/texture.hpp>
|
||||
#include <mbgl/util/chrono.hpp>
|
||||
#include <mbgl/util/image.hpp>
|
||||
#include <mbgl/util/optional.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace gl {
|
||||
class Context;
|
||||
} // namespace gl
|
||||
|
||||
class FrameHistory {
|
||||
public:
|
||||
FrameHistory();
|
||||
void record(const TimePoint&, float zoom, const Duration&);
|
||||
|
||||
bool needsAnimation(const Duration&) const;
|
||||
void bind(gl::Context&, uint32_t);
|
||||
void upload(gl::Context&, uint32_t);
|
||||
bool isVisible(const float zoom) const;
|
||||
|
||||
private:
|
||||
std::array<TimePoint, 256> changeTimes;
|
||||
std::array<uint8_t, 256> changeOpacities;
|
||||
AlphaImage opacities{ { 256, 1 } };
|
||||
|
||||
int16_t previousZoomIndex = 0;
|
||||
TimePoint previousTime;
|
||||
TimePoint time;
|
||||
bool firstFrame = true;
|
||||
bool dirty = true;
|
||||
|
||||
mbgl::optional<gl::Texture> texture;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <mbgl/renderer/property_evaluation_parameters.hpp>
|
||||
#include <mbgl/renderer/render_tile.hpp>
|
||||
#include <mbgl/renderer/paint_parameters.hpp>
|
||||
#include <mbgl/renderer/frame_history.hpp>
|
||||
#include <mbgl/text/glyph_atlas.hpp>
|
||||
#include <mbgl/programs/programs.hpp>
|
||||
#include <mbgl/programs/symbol_program.hpp>
|
||||
@@ -81,8 +80,6 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
|
||||
const auto& layout = bucket.layout;
|
||||
|
||||
parameters.frameHistory.bind(parameters.context, 1);
|
||||
|
||||
auto draw = [&] (auto& program,
|
||||
auto&& uniformValues,
|
||||
const auto& buffers,
|
||||
|
||||
@@ -12,7 +12,6 @@ PaintParameters::PaintParameters(gl::Context& context_,
|
||||
const UpdateParameters& updateParameters,
|
||||
const EvaluatedLight& evaluatedLight_,
|
||||
RenderStaticData& staticData_,
|
||||
FrameHistory& frameHistory_,
|
||||
ImageManager& imageManager_,
|
||||
LineAtlas& lineAtlas_)
|
||||
: context(context_),
|
||||
@@ -20,7 +19,6 @@ PaintParameters::PaintParameters(gl::Context& context_,
|
||||
state(updateParameters.transformState),
|
||||
evaluatedLight(evaluatedLight_),
|
||||
staticData(staticData_),
|
||||
frameHistory(frameHistory_),
|
||||
imageManager(imageManager_),
|
||||
lineAtlas(lineAtlas_),
|
||||
mapMode(updateParameters.mode),
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace mbgl {
|
||||
class RendererBackend;
|
||||
class UpdateParameters;
|
||||
class RenderStaticData;
|
||||
class FrameHistory;
|
||||
class Programs;
|
||||
class TransformState;
|
||||
class ImageManager;
|
||||
@@ -33,7 +32,6 @@ public:
|
||||
const UpdateParameters&,
|
||||
const EvaluatedLight&,
|
||||
RenderStaticData&,
|
||||
FrameHistory&,
|
||||
ImageManager&,
|
||||
LineAtlas&);
|
||||
|
||||
@@ -44,7 +42,6 @@ public:
|
||||
const EvaluatedLight& evaluatedLight;
|
||||
|
||||
RenderStaticData& staticData;
|
||||
FrameHistory& frameHistory;
|
||||
ImageManager& imageManager;
|
||||
LineAtlas& lineAtlas;
|
||||
|
||||
|
||||
@@ -255,7 +255,6 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
updateParameters,
|
||||
renderLight.getEvaluated(),
|
||||
*staticData,
|
||||
frameHistory,
|
||||
*imageManager,
|
||||
*lineAtlas
|
||||
};
|
||||
@@ -368,9 +367,6 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
order.emplace_back(RenderItem { *layer, source });
|
||||
}
|
||||
|
||||
frameHistory.record(parameters.timePoint,
|
||||
parameters.state.getZoom(),
|
||||
parameters.mapMode == MapMode::Continuous ? util::DEFAULT_TRANSITION_DURATION : Milliseconds(0));
|
||||
bool symbolBucketsChanged = false;
|
||||
if (parameters.mapMode == MapMode::Still) {
|
||||
// TODO: Think about right way for symbol index to handle still rendering
|
||||
@@ -418,8 +414,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
|
||||
parameters.imageManager.upload(parameters.context, 0);
|
||||
parameters.lineAtlas.upload(parameters.context, 0);
|
||||
parameters.frameHistory.upload(parameters.context, 0);
|
||||
|
||||
|
||||
// Update all clipping IDs + upload buckets.
|
||||
for (const auto& entry : renderSources) {
|
||||
if (entry.second->isEnabled()) {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <mbgl/renderer/renderer.hpp>
|
||||
#include <mbgl/renderer/render_source_observer.hpp>
|
||||
#include <mbgl/renderer/render_light.hpp>
|
||||
#include <mbgl/renderer/frame_history.hpp>
|
||||
#include <mbgl/style/image.hpp>
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/style/layer.hpp>
|
||||
@@ -93,7 +92,6 @@ private:
|
||||
};
|
||||
|
||||
RenderState renderState = RenderState::Never;
|
||||
FrameHistory frameHistory;
|
||||
ZoomHistory zoomHistory;
|
||||
TransformState transformState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user