Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -73,13 +73,10 @@ struct Buffer {
Buffer(std::vector<GLfloat> data) {
MBGL_CHECK_ERROR(glGenBuffers(1, &buffer));
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, buffer));
MBGL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(GLfloat), data.data(),
GL_STATIC_DRAW));
MBGL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(GLfloat), data.data(), GL_STATIC_DRAW));
}
~Buffer() {
MBGL_CHECK_ERROR(glDeleteBuffers(1, &buffer));
}
~Buffer() { MBGL_CHECK_ERROR(glDeleteBuffers(1, &buffer)); }
GLuint buffer = 0;
};
@@ -98,20 +95,20 @@ TEST(GLContextMode, Shared) {
MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()),
ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets"));
map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json"));
map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0));
map.jumpTo(CameraOptions().withCenter(LatLng{37.8, -122.5}).withZoom(10.0));
// Set transparent background layer.
auto layer = map.getStyle().getLayer("background");
ASSERT_STREQ("background", layer->getTypeInfo()->type);
static_cast<BackgroundLayer*>(layer)->setBackgroundColor( { { 1.0f, 0.0f, 0.0f, 0.5f } } );
static_cast<BackgroundLayer*>(layer)->setBackgroundColor({{1.0f, 0.0f, 0.0f, 0.5f}});
{
// Custom rendering outside of GL Native render loop.
gfx::BackendScope scope { *frontend.getBackend() };
gfx::BackendScope scope{*frontend.getBackend()};
frontend.getBackend()->getDefaultRenderable().getResource<gl::RenderableResource>().bind();
Shader paintShader(vertexShaderSource, fragmentShaderSource);
Buffer triangleBuffer({ 0, 0.5, 0.5, -0.5, -0.5, -0.5 });
Buffer triangleBuffer({0, 0.5, 0.5, -0.5, -0.5, -0.5});
MBGL_CHECK_ERROR(glUseProgram(paintShader.program));
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, triangleBuffer.buffer));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(paintShader.a_pos));