rm rasterize_properties, should be close to working...doesn't work

This commit is contained in:
Lauren Budorick
2014-08-06 17:40:48 -07:00
parent 9e1156d660
commit 560cc112e1
20 changed files with 94 additions and 279 deletions

View File

@@ -26,6 +26,7 @@ public:
virtual bool hasData(std::shared_ptr<StyleLayer> layer_desc) const;
protected:
StyleBucketRaster properties;
RasterBucket bucket;
};

View File

@@ -14,6 +14,7 @@
namespace mbgl {
class Bucket;
class Texturepool;
class FontStack;
class GlyphAtlas;
class GlyphStore;
@@ -36,6 +37,7 @@ public:
const std::shared_ptr<GlyphStore> &glyphStore,
const std::shared_ptr<SpriteAtlas> &spriteAtlas,
const std::shared_ptr<Sprite> &sprite);
const std::shared_ptr<Texturepool> &texturepool);
public:
void parse();
@@ -46,7 +48,7 @@ private:
std::unique_ptr<Bucket> createBucket(std::shared_ptr<StyleBucket> bucket_desc);
std::unique_ptr<Bucket> createFillBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketFill &fill);
std::unique_ptr<Bucket> createRasterBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketRaster &raster);
std::unique_ptr<Bucket> createRasterBucket(const std::shared_ptr<Texturepool> &texturepool, const StyleBucketRaster &raster);
std::unique_ptr<Bucket> createLineBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketLine &line);
std::unique_ptr<Bucket> createSymbolBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketSymbol &symbol);
@@ -62,6 +64,7 @@ private:
std::shared_ptr<GlyphStore> glyphStore;
std::shared_ptr<SpriteAtlas> spriteAtlas;
std::shared_ptr<Sprite> sprite;
std::shared_ptr<Texturepool> texturePool;
Collision collision;
};

View File

@@ -5,7 +5,6 @@
#include <memory>
#include <mbgl/map/tile.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/renderer/prerendered_texture.hpp>
namespace mbgl {
@@ -18,7 +17,6 @@ public:
virtual bool hasData() const = 0;
virtual ~Bucket() {}
std::unique_ptr<PrerenderedTexture> prerendered;
};
}

View File

@@ -40,7 +40,8 @@ class FillBucket;
class LineBucket;
class SymbolBucket;
class RasterBucket;
class PrerenderedTexture;
struct FillProperties;
struct CompositeProperties;
@@ -84,15 +85,13 @@ public:
void renderLine(LineBucket& bucket, std::shared_ptr<StyleLayer> layer_desc, const Tile::ID& id);
void renderSymbol(SymbolBucket& bucket, std::shared_ptr<StyleLayer> layer_desc, const Tile::ID& id);
void renderRaster(RasterBucket& bucket, std::shared_ptr<StyleLayer> layer_desc, const Tile::ID& id);
void renderRaster(GLuint texture, const RasterizeProperties &properties); // do I want to save that?
void preparePrerender(PrerenderedTexture &texture);
void finishPrerender(PrerenderedTexture &texture);
void preparePrerender(RasterBucket &bucket);
void finishPrerender(RasterBucket &bucket);
template <typename Properties>
void renderPrerenderedTexture(PrerenderedTexture &texture, const Properties &properties);
void renderPrerenderedTexture(RasterBucket &bucket);
void createPrerendered(RasterBucket& bucket, std::shared_ptr<StyleLayer> layer_desc, const Tile::ID& id, const RasterizeProperties& properties);
void createPrerendered(RasterBucket& bucket, std::shared_ptr<StyleLayer> layer_desc, const Tile::ID& id);
void resize();

View File

@@ -3,16 +3,15 @@
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/platform/gl.hpp>
#include <mbgl/style/rasterize_properties.hpp>
//#include <mbgl/renderer/raster_bucket.hpp>
namespace mbgl {
class StyleBucketRaster;
class Painter;
class PrerenderedTexture : private util::noncopyable {
public:
PrerenderedTexture(const RasterBucket &properties);
PrerenderedTexture(const StyleBucketRaster &properties);
~PrerenderedTexture();
void bindTexture();
@@ -24,7 +23,7 @@ public:
void blur(Painter& painter, uint16_t passes);
public:
const RasterBucket properties;
const StyleBucketRaster &properties;
private:
GLint previous_fbo = 0;

View File

@@ -3,6 +3,10 @@
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/util/raster.hpp>
#include <mbgl/renderer/prerendered_texture.hpp>
#include <mbgl/style/style_bucket.hpp>
namespace mbgl {
@@ -12,12 +16,15 @@ class VertexArrayObject;
class RasterBucket : public Bucket {
public:
RasterBucket(const std::shared_ptr<Texturepool> &texturepool);
RasterBucket(const std::shared_ptr<Texturepool> &texturepool, const StyleBucketRaster& properties);
virtual void render(Painter& painter, std::shared_ptr<StyleLayer> layer_desc, const Tile::ID& id);
virtual bool hasData() const;
bool setImage(const std::string &data);
const StyleBucketRaster &properties;
PrerenderedTexture texture;
void drawRaster(RasterShader& shader, VertexBuffer &vertices, VertexArrayObject &array);

View File

@@ -1,38 +0,0 @@
#ifndef MBGL_STYLE_RASTERIZE_PROPERTIES
#define MBGL_STYLE_RASTERIZE_PROPERTIES
#include <mbgl/style/function_properties.hpp>
namespace mbgl {
// The calculated properties for a layer in a tile.
class RasterizedProperties {
public:
float buffer = 1.0f / 32.0f;
uint16_t size = 256;
uint8_t blur = 0;
};
class RasterizeProperties {
public:
Function<bool> enabled = ConstantFunction<bool>(false); // maybe delete?
Function<float> buffer = ConstantFunction<float>(1.0f / 32.0f);
Function<float> size = ConstantFunction<float>(256);
Function<float> blur = ConstantFunction<float>(0);
// inline bool isEnabled(const int8_t z) const {
// return util::apply_visitor(FunctionEvaluator<bool>(z), enabled);
// }
inline RasterizedProperties get(const int8_t z) const {
RasterizedProperties properties;
properties.buffer = util::apply_visitor(FunctionEvaluator<float>(z), buffer);
properties.size = util::apply_visitor(FunctionEvaluator<float>(z), size);
properties.blur = util::apply_visitor(FunctionEvaluator<float>(z), blur);
return properties;
}
};
}
#endif

View File

@@ -83,7 +83,7 @@ public:
class StyleBucketRaster {
public:
bool prerendered = false;
uint16_t raster_size = 256;
uint16_t size = 256;
float blur = 0.0f;
float buffer = 0.03125f;
};

View File

@@ -4,7 +4,6 @@
#include <mbgl/style/class_dictionary.hpp>
#include <mbgl/style/class_properties.hpp>
#include <mbgl/style/style_properties.hpp>
#include <mbgl/style/rasterize_properties.hpp>
#include <mbgl/style/applied_class_properties.hpp>
#include <vector>
@@ -79,11 +78,6 @@ public:
// layer's type.
StyleProperties properties;
// Rasterization properties are used for prerendering the tile to a bitmap,
// which is then used as a raster image instead of rendering this layer
// directly in every frame.
// const std::unique_ptr<const RasterizeProperties> rasterize;
// Child layer array (if this layer has child layers).
std::shared_ptr<StyleLayerGroup> layers;
};

View File

@@ -6,7 +6,6 @@
#include <mbgl/style/style_source.hpp>
#include <mbgl/style/filter_expression.hpp>
#include <mbgl/style/class_properties.hpp>
#include <mbgl/style/rasterize_properties.hpp>
#include <mbgl/style/style_bucket.hpp>
#include <unordered_map>
@@ -52,7 +51,6 @@ private:
void parseLayer(std::pair<JSVal, std::shared_ptr<StyleLayer>> &pair);
void parseStyles(JSVal value, std::map<ClassID, ClassProperties> &styles);
void parseStyle(JSVal, ClassProperties &properties);
std::unique_ptr<RasterizeProperties> parseRasterize(JSVal value);
void parseReference(JSVal value, std::shared_ptr<StyleLayer> &layer);
void parseBucket(JSVal value, std::shared_ptr<StyleLayer> &layer);
void parseRender(JSVal value, std::shared_ptr<StyleLayer> &layer);