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

Commit 30b4e57

Browse files
committed
[core] Fix rest of 'brace initialization' errors
1 parent 0ed719e commit 30b4e57

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

src/mbgl/renderer/layers/render_location_indicator_layer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void main() {
441441
mapbox::geometry::point<double>{oldParams.puckPosition.latitude(), oldParams.puckPosition.longitude()};
442442
mapbox::geometry::linear_ring<int64_t> border;
443443
for (const auto& v : puckGeometry) {
444-
vec4 p{v.x, v.y, 0, 1};
444+
vec4 p{{v.x, v.y, 0, 1}};
445445
matrix::transformMat4(p, p, translation);
446446
border.push_back(Point<int64_t>{int64_t(p[0]), int64_t(p[1])});
447447
}

src/mbgl/util/bounding_volumes.cpp

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace mbgl {
88
namespace {
99

1010
vec3 toVec3(const vec4& v) {
11-
return vec3{v[0], v[1], v[2]};
11+
return vec3{{v[0], v[1], v[2]}};
1212
}
1313

1414
double vec4Dot(const vec4& a, const vec4& b) {
@@ -33,14 +33,14 @@ static Point<double> ProjectPointsToAxis(const std::array<vec3, N>& points, cons
3333

3434
namespace util {
3535

36-
AABB::AABB() : min({0, 0, 0}), max({0, 0, 0}) {}
36+
AABB::AABB() : min({{0, 0, 0}}), max({{0, 0, 0}}) {}
3737

3838
AABB::AABB(const vec3& min_, const vec3& max_) : min(min_), max(max_) {}
3939

4040
vec3 AABB::closestPoint(const vec3& point) const {
41-
return {std::max(std::min(max[0], point[0]), min[0]),
42-
std::max(std::min(max[1], point[1]), min[1]),
43-
std::max(std::min(max[2], point[2]), min[2])};
41+
return {{std::max(std::min(max[0], point[0]), min[0]),
42+
std::max(std::min(max[1], point[1]), min[1]),
43+
std::max(std::min(max[2], point[2]), min[2])}};
4444
}
4545

4646
vec3 AABB::distanceXYZ(const vec3& point) const {
@@ -62,8 +62,8 @@ AABB AABB::quadrant(int idx) const {
6262

6363
// This aabb is split into 4 quadrants. For each axis define in which side of the split "idx" is
6464
// The result for indices 0, 1, 2, 3 is: { 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 }
65-
const std::array<int, 4> xSplit = {0, 1, 0, 1};
66-
const std::array<int, 4> ySplit = {0, 0, 1, 1};
65+
const std::array<int, 4> xSplit = {{0, 1, 0, 1}};
66+
const std::array<int, 4> ySplit = {{0, 0, 1, 1}};
6767

6868
quadrantMin[0] = xSplit[idx] ? xCenter : quadrantMin[0];
6969
quadrantMax[0] = xSplit[idx] ? quadrantMax[0] : xCenter;
@@ -103,26 +103,26 @@ enum {
103103

104104
Frustum::Frustum(const std::array<vec3, 8>& points_, const std::array<vec4, 6>& planes_)
105105
: points(points_), planes(planes_) {
106-
const Point<double> xBounds = ProjectPointsToAxis(points, {0, 0, 0}, {1, 0, 0});
107-
const Point<double> yBounds = ProjectPointsToAxis(points, {0, 0, 0}, {0, 1, 0});
108-
const Point<double> zBounds = ProjectPointsToAxis(points, {0, 0, 0}, {0, 0, 1});
106+
const Point<double> xBounds = ProjectPointsToAxis(points, {{0, 0, 0}}, {{1, 0, 0}});
107+
const Point<double> yBounds = ProjectPointsToAxis(points, {{0, 0, 0}}, {{0, 1, 0}});
108+
const Point<double> zBounds = ProjectPointsToAxis(points, {{0, 0, 0}}, {{0, 0, 1}});
109109

110-
bounds = AABB({xBounds.x, yBounds.x, zBounds.x}, {xBounds.y, yBounds.y, zBounds.y});
110+
bounds = AABB({{xBounds.x, yBounds.x, zBounds.x}}, {{xBounds.y, yBounds.y, zBounds.y}});
111111

112112
// Precompute a set of separating axis candidates for precise intersection tests.
113113
// Remaining axes not covered in basic intersection tests are: axis[] = (edges of aabb) x (edges of frustum)
114-
std::array<vec3, 6> frustumEdges = {vec3Sub(points[near_br], points[near_bl]),
115-
vec3Sub(points[near_tl], points[near_bl]),
116-
vec3Sub(points[far_tl], points[near_tl]),
117-
vec3Sub(points[far_tr], points[near_tr]),
118-
vec3Sub(points[far_br], points[near_br]),
119-
vec3Sub(points[far_bl], points[near_bl])};
114+
std::array<vec3, 6> frustumEdges = {{vec3Sub(points[near_br], points[near_bl]),
115+
vec3Sub(points[near_tl], points[near_bl]),
116+
vec3Sub(points[far_tl], points[near_tl]),
117+
vec3Sub(points[far_tr], points[near_tr]),
118+
vec3Sub(points[far_br], points[near_br]),
119+
vec3Sub(points[far_bl], points[near_bl])}};
120120

121121
for (size_t i = 0; i < frustumEdges.size(); i++) {
122122
// Cross product [1, 0, 0] x [a, b, c] == [0, -c, b]
123123
// Cross product [0, 1, 0] x [a, b, c] == [c, 0, -a]
124-
const vec3 axis0 = {0.0, -frustumEdges[i][2], frustumEdges[i][1]};
125-
const vec3 axis1 = {frustumEdges[i][2], 0.0, -frustumEdges[i][0]};
124+
const vec3 axis0 = {{0.0, -frustumEdges[i][2], frustumEdges[i][1]}};
125+
const vec3 axis1 = {{frustumEdges[i][2], 0.0, -frustumEdges[i][0]}};
126126

127127
projections[i * 2] = {axis0, ProjectPointsToAxis(points, points[0], axis0)};
128128
projections[i * 2 + 1] = {axis1, ProjectPointsToAxis(points, points[0], axis1)};
@@ -131,14 +131,14 @@ Frustum::Frustum(const std::array<vec3, 8>& points_, const std::array<vec4, 6>&
131131

132132
Frustum Frustum::fromInvProjMatrix(const mat4& invProj, double worldSize, double zoom, bool flippedY) {
133133
// Define frustum corner points in normalized clip space
134-
std::array<vec4, 8> cornerCoords = {vec4{-1.0, 1.0, -1.0, 1.0},
135-
vec4{1.0, 1.0, -1.0, 1.0},
136-
vec4{1.0, -1.0, -1.0, 1.0},
137-
vec4{-1.0, -1.0, -1.0, 1.0},
138-
vec4{-1.0, 1.0, 1.0, 1.0},
139-
vec4{1.0, 1.0, 1.0, 1.0},
140-
vec4{1.0, -1.0, 1.0, 1.0},
141-
vec4{-1.0, -1.0, 1.0, 1.0}};
134+
std::array<vec4, 8> cornerCoords = {{vec4{{-1.0, 1.0, -1.0, 1.0}},
135+
vec4{{1.0, 1.0, -1.0, 1.0}},
136+
vec4{{1.0, -1.0, -1.0, 1.0}},
137+
vec4{{-1.0, -1.0, -1.0, 1.0}},
138+
vec4{{-1.0, 1.0, 1.0, 1.0}},
139+
vec4{{1.0, 1.0, 1.0, 1.0}},
140+
vec4{{1.0, -1.0, 1.0, 1.0}},
141+
vec4{{-1.0, -1.0, 1.0, 1.0}}}};
142142

143143
const double scale = std::pow(2.0, zoom);
144144

@@ -148,14 +148,14 @@ Frustum Frustum::fromInvProjMatrix(const mat4& invProj, double worldSize, double
148148
for (auto& component : coord) component *= 1.0 / coord[3] / worldSize * scale;
149149
}
150150

151-
std::array<vec3i, 6> frustumPlanePointIndices = {
152-
vec3i{near_bl, near_br, far_br}, // bottom
153-
vec3i{near_tl, near_bl, far_bl}, // left
154-
vec3i{near_br, near_tr, far_tr}, // right
155-
vec3i{near_tl, far_tl, far_tr}, // top
156-
vec3i{near_tl, near_tr, near_br}, // near
157-
vec3i{far_br, far_tr, far_tl} // far
158-
};
151+
std::array<vec3i, 6> frustumPlanePointIndices = {{
152+
vec3i{{near_bl, near_br, far_br}}, // bottom
153+
vec3i{{near_tl, near_bl, far_bl}}, // left
154+
vec3i{{near_br, near_tr, far_tr}}, // right
155+
vec3i{{near_tl, far_tl, far_tr}}, // top
156+
vec3i{{near_tl, near_tr, near_br}}, // near
157+
vec3i{{far_br, far_tr, far_tl}} // far
158+
}};
159159

160160
if (flippedY) {
161161
std::for_each(frustumPlanePointIndices.begin(), frustumPlanePointIndices.end(), [](vec3i& tri) {
@@ -177,7 +177,7 @@ Frustum Frustum::fromInvProjMatrix(const mat4& invProj, double worldSize, double
177177
const vec3 b = vec3Sub(p2, p1);
178178
const vec3 n = vec3Normalize(vec3Cross(a, b));
179179

180-
frustumPlanes[i] = {n[0], n[1], n[2], -vec3Dot(n, p1)};
180+
frustumPlanes[i] = {{n[0], n[1], n[2], -vec3Dot(n, p1)}};
181181
}
182182

183183
std::array<vec3, 8> frustumPoints;
@@ -197,12 +197,12 @@ IntersectionResult Frustum::intersects(const AABB& aabb) const {
197197

198198
if (!bounds.intersects(aabb)) return IntersectionResult::Separate;
199199

200-
const std::array<vec4, 4> aabbPoints = {
201-
vec4{aabb.min[0], aabb.min[1], 0.0, 1.0},
202-
vec4{aabb.max[0], aabb.min[1], 0.0, 1.0},
203-
vec4{aabb.max[0], aabb.max[1], 0.0, 1.0},
204-
vec4{aabb.min[0], aabb.max[1], 0.0, 1.0},
205-
};
200+
const std::array<vec4, 4> aabbPoints = {{
201+
vec4{{aabb.min[0], aabb.min[1], 0.0, 1.0}},
202+
vec4{{aabb.max[0], aabb.min[1], 0.0, 1.0}},
203+
vec4{{aabb.max[0], aabb.max[1], 0.0, 1.0}},
204+
vec4{{aabb.min[0], aabb.max[1], 0.0, 1.0}},
205+
}};
206206

207207
bool fullyInside = true;
208208

@@ -232,10 +232,10 @@ IntersectionResult Frustum::intersectsPrecise(const AABB& aabb, bool edgeCasesOn
232232
if (result == IntersectionResult::Separate) return result;
233233
}
234234

235-
const std::array<vec3, 4> aabbPoints = {vec3{aabb.min[0], aabb.min[1], 0.0},
236-
vec3{aabb.max[0], aabb.min[1], 0.0},
237-
vec3{aabb.max[0], aabb.max[1], 0.0},
238-
vec3{aabb.min[0], aabb.max[1], 0.0}};
235+
const std::array<vec3, 4> aabbPoints = {{vec3{{aabb.min[0], aabb.min[1], 0.0}},
236+
vec3{{aabb.max[0], aabb.min[1], 0.0}},
237+
vec3{{aabb.max[0], aabb.max[1], 0.0}},
238+
vec3{{aabb.min[0], aabb.max[1], 0.0}}}};
239239

240240
// For a precise SAT-test all edge cases needs to be covered
241241
// Projections of the frustum on separating axis candidates have been precomputed already

src/mbgl/util/mat3.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using vec3i = std::array<int, 3>;
3333
using mat3 = std::array<double, 9>;
3434

3535
inline vec3 vec3Cross(const vec3& a, const vec3& b) {
36-
return vec3{a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]};
36+
return vec3{{a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]}};
3737
}
3838

3939
inline double vec3Dot(const vec3& a, const vec3& b) {
@@ -49,15 +49,15 @@ inline double vec3Length(const vec3& a) {
4949
}
5050

5151
inline vec3 vec3Scale(const vec3& a, double s) {
52-
return vec3{a[0] * s, a[1] * s, a[2] * s};
52+
return vec3{{a[0] * s, a[1] * s, a[2] * s}};
5353
}
5454

5555
inline vec3 vec3Normalize(const vec3& a) {
5656
return vec3Scale(a, 1.0 / vec3Length(a));
5757
}
5858

5959
inline vec3 vec3Sub(const vec3& a, const vec3& b) {
60-
return vec3{a[0] - b[0], a[1] - b[1], a[2] - b[2]};
60+
return vec3{{a[0] - b[0], a[1] - b[1], a[2] - b[2]}};
6161
}
6262

6363
namespace matrix {

src/mbgl/util/tile_cover.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ std::vector<OverscaledTileID> tileCover(const TransformState& state, uint8_t z,
171171
auto centerPoint =
172172
TileCoordinate::fromScreenCoordinate(state, z, {state.getSize().width / 2.0, state.getSize().height / 2.0}).p;
173173

174-
vec3 centerCoord = {centerPoint.x, centerPoint.y, 0.0};
174+
vec3 centerCoord = {{centerPoint.x, centerPoint.y, 0.0}};
175175

176176
const Frustum frustum = Frustum::fromInvProjMatrix(state.getInvProjectionMatrix(), worldSize, z, flippedY);
177177

178178
// There should always be a certain number of maximum zoom level tiles surrounding the center location
179179
const double radiusOfMaxLvlLodInTiles = 3;
180180

181181
const auto newRootTile = [&](int16_t wrap) -> Node {
182-
return {AABB({wrap * numTiles, 0.0, 0.0}, {(wrap + 1) * numTiles, numTiles, 0.0}),
182+
return {AABB({{wrap * numTiles, 0.0, 0.0}}, {{(wrap + 1) * numTiles, numTiles, 0.0}}),
183183
uint8_t(0),
184184
uint16_t(0),
185185
uint16_t(0),

0 commit comments

Comments
 (0)