[core] TextureRectVertex ⇢ SymbolVertex

This commit is contained in:
John Firebaugh
2016-10-04 15:10:16 -07:00
parent 9cf57e7142
commit da4527cd3a
9 changed files with 29 additions and 30 deletions

View File

@@ -205,8 +205,8 @@ set(MBGL_CORE_FILES
src/mbgl/shader/sdf_shader.cpp
src/mbgl/shader/sdf_shader.hpp
src/mbgl/shader/shaders.hpp
src/mbgl/shader/texture_rect_vertex.cpp
src/mbgl/shader/texture_rect_vertex.hpp
src/mbgl/shader/symbol_vertex.cpp
src/mbgl/shader/symbol_vertex.hpp
# sprite
include/mbgl/sprite/sprite_image.hpp

View File

@@ -5,7 +5,7 @@
#include <mbgl/map/mode.hpp>
#include <mbgl/gl/vertex_buffer.hpp>
#include <mbgl/gl/index_buffer.hpp>
#include <mbgl/shader/texture_rect_vertex.hpp>
#include <mbgl/shader/symbol_vertex.hpp>
#include <mbgl/shader/collision_box_vertex.hpp>
#include <mbgl/text/glyph_range.hpp>
#include <mbgl/style/layers/symbol_layer_properties.hpp>
@@ -48,20 +48,20 @@ private:
friend class SymbolLayout;
struct TextBuffer {
std::vector<TextureRectVertex> vertices;
std::vector<SymbolVertex> vertices;
std::vector<gl::Triangle> triangles;
std::vector<ElementGroup<SDFShader>> groups;
optional<gl::VertexBuffer<TextureRectVertex>> vertexBuffer;
optional<gl::VertexBuffer<SymbolVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangle>> indexBuffer;
} text;
struct IconBuffer {
std::vector<TextureRectVertex> vertices;
std::vector<SymbolVertex> vertices;
std::vector<gl::Triangle> triangles;
std::vector<ElementGroup<SDFShader, IconShader>> groups;
optional<gl::VertexBuffer<TextureRectVertex>> vertexBuffer;
optional<gl::VertexBuffer<SymbolVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangle>> indexBuffer;
} icon;

View File

@@ -1,7 +1,7 @@
#include <mbgl/shader/icon_shader.hpp>
#include <mbgl/shader/icon.vertex.hpp>
#include <mbgl/shader/icon.fragment.hpp>
#include <mbgl/shader/texture_rect_vertex.hpp>
#include <mbgl/shader/symbol_vertex.hpp>
namespace mbgl {

View File

@@ -6,13 +6,13 @@
namespace mbgl {
class TextureRectVertex;
class SymbolVertex;
class IconShader : public gl::Shader {
public:
IconShader(gl::Context&, Defines defines = None);
using VertexType = TextureRectVertex;
using VertexType = SymbolVertex;
gl::Attribute<int16_t, 2> a_pos = { "a_pos", *this };
gl::Attribute<int16_t, 2> a_offset = { "a_offset", *this };

View File

@@ -1,7 +1,7 @@
#include <mbgl/shader/sdf_shader.hpp>
#include <mbgl/shader/sdf.vertex.hpp>
#include <mbgl/shader/sdf.fragment.hpp>
#include <mbgl/shader/texture_rect_vertex.hpp>
#include <mbgl/shader/symbol_vertex.hpp>
namespace mbgl {

View File

@@ -7,13 +7,13 @@
namespace mbgl {
class TextureRectVertex;
class SymbolVertex;
class SDFShader : public gl::Shader {
public:
SDFShader(gl::Context&, Defines defines = None);
using VertexType = TextureRectVertex;
using VertexType = SymbolVertex;
gl::Attribute<int16_t, 2> a_pos = { "a_pos", *this };
gl::Attribute<int16_t, 2> a_offset = { "a_offset", *this };

View File

@@ -0,0 +1,9 @@
#include <mbgl/shader/symbol_vertex.hpp>
#include <mbgl/gl/shader.hpp>
#include <mbgl/gl/gl.hpp>
namespace mbgl {
static_assert(sizeof(SymbolVertex) == 16, "expected SymbolVertex size");
} // namespace mbgl

View File

@@ -8,10 +8,9 @@
namespace mbgl {
// A vertex that holds a position, offset and texture coordinate. Used for symbol layer icons and glyphs.
class TextureRectVertex {
class SymbolVertex {
public:
TextureRectVertex(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle)
SymbolVertex(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle)
: a_pos {
x,
y
@@ -40,13 +39,13 @@ public:
namespace gl {
template <class Shader>
struct AttributeBindings<Shader, TextureRectVertex> {
struct AttributeBindings<Shader, SymbolVertex> {
std::array<AttributeBinding, 4> operator()(const Shader& shader) {
return {{
MBGL_MAKE_ATTRIBUTE_BINDING(TextureRectVertex, shader, a_pos),
MBGL_MAKE_ATTRIBUTE_BINDING(TextureRectVertex, shader, a_offset),
MBGL_MAKE_ATTRIBUTE_BINDING(TextureRectVertex, shader, a_texture_pos),
MBGL_MAKE_ATTRIBUTE_BINDING(TextureRectVertex, shader, a_data)
MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_pos),
MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_offset),
MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_texture_pos),
MBGL_MAKE_ATTRIBUTE_BINDING(SymbolVertex, shader, a_data)
}};
};
};

View File

@@ -1,9 +0,0 @@
#include <mbgl/shader/texture_rect_vertex.hpp>
#include <mbgl/gl/shader.hpp>
#include <mbgl/gl/gl.hpp>
namespace mbgl {
static_assert(sizeof(TextureRectVertex) == 16, "expected TextureRectVertex size");
} // namespace mbgl