Skip to content

Commit

Permalink
Trade: GCC 4.8, happy to see you're still around, causing problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Jan 24, 2020
1 parent 328b003 commit 414347d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
15 changes: 9 additions & 6 deletions src/Magnum/Primitives/Implementation/Spheroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,20 @@ Trade::MeshData Spheroid::finalize() {

auto typedVertices = reinterpret_cast<VertexTextureCoords*>(_vertexData.data());
Trade::MeshAttributeData positions{Trade::MeshAttributeName::Position,
Containers::stridedArrayView(_vertexData, &typedVertices[0].position,
size, stride)};
/* GCC 4.8 needs the arrayView() */
Containers::stridedArrayView(Containers::arrayView(_vertexData),
&typedVertices[0].position, size, stride)};
Trade::MeshAttributeData normals{Trade::MeshAttributeName::Normal,
Containers::stridedArrayView(_vertexData, &typedVertices[0].normal,
size, stride)};
/* GCC 4.8 needs the arrayView() */
Containers::stridedArrayView(Containers::arrayView(_vertexData),
&typedVertices[0].normal, size, stride)};

Containers::Array<Trade::MeshAttributeData> attributes;
if(_textureCoords == TextureCoords::Generate) {
Trade::MeshAttributeData textureCoords{Trade::MeshAttributeName::TextureCoordinates,
Containers::stridedArrayView(_vertexData, &typedVertices[0].textureCoords,
size, stride)};
/* GCC 4.8 needs the arrayView() */
Containers::stridedArrayView(Containers::arrayView(_vertexData),
&typedVertices[0].textureCoords, size, stride)};
attributes = Containers::Array<Trade::MeshAttributeData>{Containers::InPlaceInit, {positions, normals, textureCoords}};
} else {
attributes = Containers::Array<Trade::MeshAttributeData>{Containers::InPlaceInit, {positions, normals}};
Expand Down
12 changes: 8 additions & 4 deletions src/Magnum/Trade/Test/MeshData2DTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ struct {
{{0xff98ab_rgbf, 0xff3366_rgbf}},
&State}},
{"from MeshData",
MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData2D{MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Position,
Expand All @@ -97,15 +99,17 @@ struct {
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords3, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State},
MeshData{MeshPrimitive::Lines, {}, Vertices, {
}, &State}},
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData2D{MeshData{MeshPrimitive::Lines, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::TextureCoordinates,
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State}
}, &State}}
}
};
CORRADE_IGNORE_DEPRECATED_POP
Expand Down
12 changes: 8 additions & 4 deletions src/Magnum/Trade/Test/MeshData3DTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ struct {
{{0xff98ab_rgbf, 0xff3366_rgbf}},
&State}},
{"from MeshData",
MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData3D{MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector3>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Position,
Expand All @@ -105,8 +107,10 @@ struct {
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords3, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State},
MeshData{MeshPrimitive::Lines, {}, Vertices, {
}, &State}},
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData3D{MeshData{MeshPrimitive::Lines, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector3>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Normal,
Expand All @@ -115,7 +119,7 @@ struct {
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State}
}, &State}}
}
};
CORRADE_IGNORE_DEPRECATED_POP
Expand Down

0 comments on commit 414347d

Please sign in to comment.