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

Commit

Permalink
[core] Adhere to vertices/vertexBuffer naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Oct 5, 2016
1 parent da4527c commit f438bb6
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions src/mbgl/renderer/debug_bucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace mbgl {

std::vector<PlainVertex> buildTextVertexes(const OverscaledTileID& id,
std::vector<PlainVertex> buildTextVertices(const OverscaledTileID& id,
const bool renderable,
const bool complete,
optional<Timestamp> modified,
Expand Down Expand Up @@ -82,20 +82,20 @@ DebugBucket::DebugBucket(const OverscaledTileID& id,
modified(std::move(modified_)),
expires(std::move(expires_)),
debugMode(debugMode_),
textVertexes(context.createVertexBuffer(buildTextVertexes(id, renderable_, complete_, modified_, expires_, debugMode_))) {
vertexBuffer(context.createVertexBuffer(buildTextVertices(id, renderable_, complete_, modified_, expires_, debugMode_))) {
}

void DebugBucket::drawLines(PlainShader& shader, gl::Context& context) {
if (textVertexes.vertexCount != 0) {
array.bind(shader, textVertexes, BUFFER_OFFSET_0, context);
MBGL_CHECK_ERROR(glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(textVertexes.vertexCount)));
if (vertexBuffer.vertexCount != 0) {
array.bind(shader, vertexBuffer, BUFFER_OFFSET_0, context);
MBGL_CHECK_ERROR(glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(vertexBuffer.vertexCount)));
}
}

void DebugBucket::drawPoints(PlainShader& shader, gl::Context& context) {
if (textVertexes.vertexCount != 0) {
array.bind(shader, textVertexes, BUFFER_OFFSET_0, context);
MBGL_CHECK_ERROR(glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(textVertexes.vertexCount)));
if (vertexBuffer.vertexCount != 0) {
array.bind(shader, vertexBuffer, BUFFER_OFFSET_0, context);
MBGL_CHECK_ERROR(glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(vertexBuffer.vertexCount)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/debug_bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DebugBucket : private util::noncopyable {
const MapDebugOptions debugMode;

private:
gl::VertexBuffer<PlainVertex> textVertexes;
gl::VertexBuffer<PlainVertex> vertexBuffer;
gl::VertexArrayObject array;
};

Expand Down
6 changes: 3 additions & 3 deletions src/mbgl/renderer/painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ using namespace style;

Painter::Painter(const TransformState& state_)
: state(state_),
tileTriangleVertexes(context.createVertexBuffer(std::vector<PlainVertex> {{
tileTriangleVertexBuffer(context.createVertexBuffer(std::vector<PlainVertex> {{
{ 0, 0 },
{ util::EXTENT, 0 },
{ 0, util::EXTENT },
{ util::EXTENT, 0 },
{ 0, util::EXTENT },
{ util::EXTENT, util::EXTENT }
}})),
tileLineStripVertexes(context.createVertexBuffer(std::vector<PlainVertex> {{
tileLineStripVertexBuffer(context.createVertexBuffer(std::vector<PlainVertex> {{
{ 0, 0 },
{ util::EXTENT, 0 },
{ util::EXTENT, util::EXTENT },
{ 0, util::EXTENT },
{ 0, 0 }
}})),
rasterVertexes(context.createVertexBuffer(std::vector<RasterVertex> {{
rasterVertexBuffer(context.createVertexBuffer(std::vector<RasterVertex> {{
{ 0, 0, 0, 0 },
{ util::EXTENT, 0, 32767, 0 },
{ 0, util::EXTENT, 0, 32767 },
Expand Down
6 changes: 3 additions & 3 deletions src/mbgl/renderer/painter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ class Painter : private util::noncopyable {
std::unique_ptr<Shaders> overdrawShaders;
#endif

gl::VertexBuffer<PlainVertex> tileTriangleVertexes;
gl::VertexBuffer<PlainVertex> tileLineStripVertexes;
gl::VertexBuffer<RasterVertex> rasterVertexes;
gl::VertexBuffer<PlainVertex> tileTriangleVertexBuffer;
gl::VertexBuffer<PlainVertex> tileLineStripVertexBuffer;
gl::VertexBuffer<RasterVertex> rasterVertexBuffer;

gl::VertexArrayObject tileBorderArray;
};
Expand Down
6 changes: 3 additions & 3 deletions src/mbgl/renderer/painter_background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye
patternShader.u_opacity = properties.backgroundOpacity;

spriteAtlas->bind(true, context, 0);
arrayBackgroundPattern.bind(patternShader, tileTriangleVertexes, BUFFER_OFFSET(0), context);
arrayBackgroundPattern.bind(patternShader, tileTriangleVertexBuffer, BUFFER_OFFSET(0), context);

} else {
context.program = plainShader.getID();
plainShader.u_color = properties.backgroundColor;
plainShader.u_opacity = properties.backgroundOpacity;

arrayBackground.bind(plainShader, tileTriangleVertexes, BUFFER_OFFSET(0), context);
arrayBackground.bind(plainShader, tileTriangleVertexBuffer, BUFFER_OFFSET(0), context);
}

context.stencilTest = false;
Expand Down Expand Up @@ -84,7 +84,7 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye
plainShader.u_matrix = vertexMatrix;
}

MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, static_cast<GLsizei>(tileTriangleVertexes.vertexCount)));
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, static_cast<GLsizei>(tileTriangleVertexBuffer.vertexCount)));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/renderer/painter_clipping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void Painter::drawClippingMasks(PaintParameters& parameters, const std::map<Unwr
context.colorMask = { false, false, false, false };
context.stencilMask = mask;

arrayCoveringPlain.bind(plainShader, tileTriangleVertexes, BUFFER_OFFSET_0, context);
arrayCoveringPlain.bind(plainShader, tileTriangleVertexBuffer, BUFFER_OFFSET_0, context);

for (const auto& stencil : stencils) {
const auto& id = stencil.first;
Expand All @@ -42,7 +42,7 @@ void Painter::drawClippingMasks(PaintParameters& parameters, const std::map<Unwr

const GLint ref = (GLint)(clip.reference.to_ulong());
context.stencilFunc = { gl::StencilTestFunction::Always, ref, mask };
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(tileTriangleVertexes.vertexCount)));
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(tileTriangleVertexBuffer.vertexCount)));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/renderer/painter_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
plainShader.u_opacity = 1.0f;

// draw tile outline
tileBorderArray.bind(plainShader, tileLineStripVertexes, BUFFER_OFFSET_0, context);
tileBorderArray.bind(plainShader, tileLineStripVertexBuffer, BUFFER_OFFSET_0, context);
plainShader.u_color = { 1.0f, 0.0f, 0.0f, 1.0f };
context.lineWidth = 4.0f * frame.pixelRatio;
MBGL_CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0, static_cast<GLsizei>(tileLineStripVertexes.vertexCount)));
MBGL_CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0, static_cast<GLsizei>(tileLineStripVertexBuffer.vertexCount)));
}

#ifndef NDEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/painter_raster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void Painter::renderRaster(PaintParameters& parameters,
context.depthMask = false;
setDepthSublayer(0);

bucket.drawRaster(rasterShader, rasterVertexes, rasterVAO, context);
bucket.drawRaster(rasterShader, rasterVertexBuffer, rasterVAO, context);
}
}

Expand Down

0 comments on commit f438bb6

Please sign in to comment.