Calculate clip IDs with a huffman prefix tree
This changes the clip IDs from sequential to a huffman prefix tree, meaning that parent tiles share the same prefix with child tiles (but are shorter). This allows us to use the same checkerboard pattern to draw all tiles. TODO: - make sure we're not overflowing the 8 bit limit of the stencil buffer - draw all checkerboard fields at the same time, with one draw call - fix raster drawing (fading, clipping) refs #132
This commit is contained in:
30
src/map/raster_tile_data.cpp
Normal file
30
src/map/raster_tile_data.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <llmr/map/map.hpp>
|
||||
#include <llmr/map/raster_tile_data.hpp>
|
||||
#include <llmr/style/layer_description.hpp>
|
||||
|
||||
using namespace llmr;
|
||||
|
||||
|
||||
RasterTileData::RasterTileData(Tile::ID id, Map &map, const std::string url)
|
||||
: TileData(id, map, url),
|
||||
bucket(map.getTexturepool()) {
|
||||
}
|
||||
|
||||
RasterTileData::~RasterTileData() {
|
||||
}
|
||||
|
||||
void RasterTileData::parse() {
|
||||
if (state != State::loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bucket.setImage(data)) {
|
||||
state = State::parsed;
|
||||
} else {
|
||||
state = State::invalid;
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTileData::render(Painter &painter, const LayerDescription& layer_desc) {
|
||||
bucket.render(painter, layer_desc.name, id);
|
||||
}
|
||||
Reference in New Issue
Block a user