Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] TextureRectVertex ⇢ SymbolVertex
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Oct 5, 2016
1 parent 9cf57e7 commit da4527c
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 30 deletions.
4 changes: 2 additions & 2 deletions cmake/core-files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/mbgl/renderer/symbol_bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -48,20 +48,20 @@ class SymbolBucket : public Bucket {
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;

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/shader/icon_shader.cpp
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shader/icon_shader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/shader/sdf_shader.cpp
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shader/sdf_shader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
9 changes: 9 additions & 0 deletions src/mbgl/shader/symbol_vertex.cpp
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -40,13 +39,13 @@ class TextureRectVertex {
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)
}};
};
};
Expand Down
9 changes: 0 additions & 9 deletions src/mbgl/shader/texture_rect_vertex.cpp

This file was deleted.

0 comments on commit da4527c

Please sign in to comment.