diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h
index bdcca5fbc..e9fc0d8ab 100644
--- a/src/AbstractShaderProgram.h
+++ b/src/AbstractShaderProgram.h
@@ -35,7 +35,7 @@ functions and properties:
- %Attribute location typedefs defining locations and types
for attribute binding with Mesh::bindAttribute(), for example:
@code
-typedef Attribute<0, Vector4> Vertex;
+typedef Attribute<0, Vector4> Position;
typedef Attribute<1, Vector3> Normal;
typedef Attribute<2, Vector2> TextureCoords;
@endcode
@@ -82,7 +82,7 @@ shader code, e.g.:
@code
#version 330
// or #extension GL_ARB_explicit_attrib_location: enable
-layout(location = 0) in vec4 vertex;
+layout(location = 0) in vec4 position;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 textureCoords;
@endcode
@@ -110,7 +110,7 @@ attaching the shaders and linking the program:
@code
// Shaders attached...
-bindAttributeLocation(Vertex::Location, "vertex");
+bindAttributeLocation(Position::Location, "position");
bindAttributeLocation(Normal::Location, "normal");
bindAttributeLocation(TextureCoords::Location, "textureCoords");
diff --git a/src/MeshTools/GenerateFlatNormals.cpp b/src/MeshTools/GenerateFlatNormals.cpp
index e52e4379e..1e70162e7 100644
--- a/src/MeshTools/GenerateFlatNormals.cpp
+++ b/src/MeshTools/GenerateFlatNormals.cpp
@@ -21,7 +21,7 @@ using namespace std;
namespace Magnum { namespace MeshTools {
-tuple, vector> generateFlatNormals(const std::vector< unsigned int >& indices, const vector< Vector4 >& vertices) {
+tuple, vector> generateFlatNormals(const vector& indices, const vector& positions) {
CORRADE_ASSERT(!(indices.size()%3), "MeshTools::generateFlatNormals(): index count is not divisible by 3!", (tuple, vector>()));
/* Create normal for every triangle (assuming counterclockwise winding) */
@@ -30,8 +30,8 @@ tuple, vector> generateFlatNormals(const std::vect
vector normals;
normals.reserve(indices.size()/3);
for(size_t i = 0; i != indices.size(); i += 3) {
- Vector3 normal = Vector3::cross(vertices[indices[i+2]].xyz()-vertices[indices[i+1]].xyz(),
- vertices[indices[i]].xyz()-vertices[indices[i+1]].xyz()).normalized();
+ Vector3 normal = Vector3::cross(positions[indices[i+2]].xyz()-positions[indices[i+1]].xyz(),
+ positions[indices[i]].xyz()-positions[indices[i+1]].xyz()).normalized();
/* Use the same normal for all three vertices of the face */
normalIndices.push_back(normals.size());
diff --git a/src/MeshTools/GenerateFlatNormals.h b/src/MeshTools/GenerateFlatNormals.h
index a5dfcbb9b..20a94b494 100644
--- a/src/MeshTools/GenerateFlatNormals.h
+++ b/src/MeshTools/GenerateFlatNormals.h
@@ -29,18 +29,18 @@ namespace Magnum { namespace MeshTools {
/**
@brief Generate flat normals
@param indices Array of triangle face indexes
-@param vertices Vertex array
+@param positions Array of vertex positions
@return Normal indices and vectors
For each face generates one normal vector, removes duplicates before
returning. Example usage:
@code
std::vector vertexIndices;
-std::vector vertices;
+std::vector positions;
std::vector normalIndices;
std::vector normals;
-std::tie(normalIndices, normals) = MeshTools::generateFlatNormals(vertexIndices, vertices);
+std::tie(normalIndices, normals) = MeshTools::generateFlatNormals(vertexIndices, positions);
@endcode
You can then use combineIndexedArrays() to combine normal and vertex array to
use the same indices.
@@ -48,7 +48,7 @@ use the same indices.
@attention Index count must be divisible by 3, otherwise zero length result
is generated.
*/
-std::tuple, std::vector> MESHTOOLS_EXPORT generateFlatNormals(const std::vector& indices, const std::vector& vertices);
+std::tuple, std::vector> MESHTOOLS_EXPORT generateFlatNormals(const std::vector& indices, const std::vector& positions);
}}
diff --git a/src/MeshTools/Interleave.h b/src/MeshTools/Interleave.h
index 3c7408e52..64198e6fe 100644
--- a/src/MeshTools/Interleave.h
+++ b/src/MeshTools/Interleave.h
@@ -108,12 +108,12 @@ so data for each attribute are in continuous place in memory. Size of the data
buffer can be computed from attribute count and stride, as shown below. Example
usage:
@code
-std::vector vertices;
+std::vector positions;
std::vector textureCoordinates;
size_t attributeCount;
size_t stride;
char* data;
-std::tie(attributeCount, stride, data) = MeshTools::interleave(vertices, textureCoordinates);
+std::tie(attributeCount, stride, data) = MeshTools::interleave(positions, textureCoordinates);
size_t dataSize = attributeCount*stride;
// ...
delete[] data;
diff --git a/src/MeshTools/Test/CleanTest.cpp b/src/MeshTools/Test/CleanTest.cpp
index e8978e3c9..55f8b1bfc 100644
--- a/src/MeshTools/Test/CleanTest.cpp
+++ b/src/MeshTools/Test/CleanTest.cpp
@@ -28,12 +28,12 @@ CleanTest::CleanTest() {
}
void CleanTest::cleanMesh() {
- vector vertices{1, 2, 1, 4};
+ vector positions{1, 2, 1, 4};
vector indices{0, 1, 2, 1, 2, 3};
- MeshTools::clean(indices, vertices);
+ MeshTools::clean(indices, positions);
/* Verify cleanup */
- CORRADE_VERIFY(vertices == (vector{1, 2, 4}));
+ CORRADE_VERIFY(positions == (vector{1, 2, 4}));
CORRADE_COMPARE(indices, (vector{0, 1, 0, 1, 0, 2}));
}
diff --git a/src/MeshTools/Test/SubdivideCleanBenchmark.cpp b/src/MeshTools/Test/SubdivideCleanBenchmark.cpp
index 6d6ec7307..fd56ef292 100644
--- a/src/MeshTools/Test/SubdivideCleanBenchmark.cpp
+++ b/src/MeshTools/Test/SubdivideCleanBenchmark.cpp
@@ -30,11 +30,11 @@ void SubdivideCleanBenchmark::subdivide() {
Primitives::Icosphere<0> icosphere;
/* Subdivide 5 times */
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
}
}
@@ -43,13 +43,13 @@ void SubdivideCleanBenchmark::subdivideAndCleanMeshAfter() {
Primitives::Icosphere<0> icosphere;
/* Subdivide 5 times */
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
- MeshTools::clean(*icosphere.indices(), *icosphere.vertices(0));
+ MeshTools::clean(*icosphere.indices(), *icosphere.positions(0));
}
}
@@ -58,16 +58,16 @@ void SubdivideCleanBenchmark::subdivideAndCleanMeshBetween() {
Primitives::Icosphere<0> icosphere;
/* Subdivide 5 times */
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::clean(*icosphere.indices(), *icosphere.vertices(0));
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::clean(*icosphere.indices(), *icosphere.vertices(0));
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::clean(*icosphere.indices(), *icosphere.vertices(0));
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::clean(*icosphere.indices(), *icosphere.vertices(0));
- MeshTools::subdivide(*icosphere.indices(), *icosphere.vertices(0), interpolator);
- MeshTools::clean(*icosphere.indices(), *icosphere.vertices(0));
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::clean(*icosphere.indices(), *icosphere.positions(0));
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::clean(*icosphere.indices(), *icosphere.positions(0));
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::clean(*icosphere.indices(), *icosphere.positions(0));
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::clean(*icosphere.indices(), *icosphere.positions(0));
+ MeshTools::subdivide(*icosphere.indices(), *icosphere.positions(0), interpolator);
+ MeshTools::clean(*icosphere.indices(), *icosphere.positions(0));
}
}
diff --git a/src/MeshTools/Test/SubdivideTest.cpp b/src/MeshTools/Test/SubdivideTest.cpp
index 611155a60..2e7153ef9 100644
--- a/src/MeshTools/Test/SubdivideTest.cpp
+++ b/src/MeshTools/Test/SubdivideTest.cpp
@@ -35,26 +35,26 @@ void SubdivideTest::wrongIndexCount() {
stringstream ss;
Error::setOutput(&ss);
- vector vertices;
+ vector positions;
vector indices{0, 1};
- MeshTools::subdivide(indices, vertices, interpolator);
+ MeshTools::subdivide(indices, positions, interpolator);
CORRADE_COMPARE(ss.str(), "MeshTools::subdivide(): index count is not divisible by 3!\n");
}
void SubdivideTest::subdivide() {
- vector vertices{0, 2, 6, 8};
+ vector positions{0, 2, 6, 8};
vector indices{0, 1, 2, 1, 2, 3};
- MeshTools::subdivide(indices, vertices, interpolator);
+ MeshTools::subdivide(indices, positions, interpolator);
CORRADE_COMPARE(indices.size(), 24);
- CORRADE_VERIFY(vertices == (vector{0, 2, 6, 8, 1, 4, 3, 4, 7, 5}));
+ CORRADE_VERIFY(positions == (vector{0, 2, 6, 8, 1, 4, 3, 4, 7, 5}));
CORRADE_COMPARE(indices, (vector{4, 5, 6, 7, 8, 9, 0, 4, 6, 4, 1, 5, 6, 5, 2, 1, 7, 9, 7, 2, 8, 9, 8, 3}));
- MeshTools::clean(indices, vertices);
+ MeshTools::clean(indices, positions);
- /* Vertices 0, 1, 2, 3, 4, 5, 6, 7, 8 */
- CORRADE_COMPARE(vertices.size(), 9);
+ /* Positions 0, 1, 2, 3, 4, 5, 6, 7, 8 */
+ CORRADE_COMPARE(positions.size(), 9);
}
}}}
diff --git a/src/Primitives/Capsule.cpp b/src/Primitives/Capsule.cpp
index 5df5b13f7..ccf2d2a9f 100644
--- a/src/Primitives/Capsule.cpp
+++ b/src/Primitives/Capsule.cpp
@@ -45,7 +45,7 @@ Capsule::Capsule(unsigned int rings, unsigned int segments, GLfloat length, Text
}
void Capsule::capVertex(GLfloat y, GLfloat normalY, GLfloat textureCoordsV) {
- vertices(0)->push_back({0.0f, y, 0.0f});
+ positions(0)->push_back({0.0f, y, 0.0f});
normals(0)->push_back({0.0f, normalY, 0.0f});
if(textureCoords == TextureCoords::Generate)
@@ -62,7 +62,7 @@ void Capsule::vertexRings(unsigned int count, GLfloat centerY, GLfloat startRing
for(unsigned int j = 0; j != segments; ++j) {
GLfloat segmentAngle = j*segmentAngleIncrement;
- vertices(0)->push_back({x*sin(segmentAngle), centerY+y, z*cos(segmentAngle)});
+ positions(0)->push_back({x*sin(segmentAngle), centerY+y, z*cos(segmentAngle)});
normals(0)->push_back({x*sin(segmentAngle), y, z*cos(segmentAngle)});
if(textureCoords == TextureCoords::Generate)
@@ -71,7 +71,7 @@ void Capsule::vertexRings(unsigned int count, GLfloat centerY, GLfloat startRing
/* Duplicate first segment in the ring for additional vertex for texture coordinate */
if(textureCoords == TextureCoords::Generate) {
- vertices(0)->push_back((*vertices(0))[vertices(0)->size()-segments]);
+ positions(0)->push_back((*positions(0))[positions(0)->size()-segments]);
normals(0)->push_back((*normals(0))[normals(0)->size()-segments]);
textureCoords2D(0)->push_back({1.0f, startTextureCoordsV + i*textureCoordsVIncrement});
}
diff --git a/src/Primitives/Cube.cpp b/src/Primitives/Cube.cpp
index ef908bf5c..467bfd942 100644
--- a/src/Primitives/Cube.cpp
+++ b/src/Primitives/Cube.cpp
@@ -42,7 +42,7 @@ Cube::Cube(): MeshData("", Mesh::Primitive::Triangles, new vector{
{-1.0f, 1.0f, 1.0f},
{ 1.0f, 1.0f, 1.0f}
}}, {}) {
- vertices(0)->assign(normals(0)->begin(), normals(0)->end());
+ positions(0)->assign(normals(0)->begin(), normals(0)->end());
}
}}
diff --git a/src/Primitives/Icosphere.cpp b/src/Primitives/Icosphere.cpp
index 7e667d141..640a360c1 100644
--- a/src/Primitives/Icosphere.cpp
+++ b/src/Primitives/Icosphere.cpp
@@ -54,7 +54,7 @@ Icosphere<0>::Icosphere(): MeshData("", Mesh::Primitive::Triangles, new vectorassign(normals(0)->begin(), normals(0)->end());
+ positions(0)->assign(normals(0)->begin(), normals(0)->end());
}
}}
diff --git a/src/Primitives/Icosphere.h b/src/Primitives/Icosphere.h
index 5cd011e03..eec4a50b1 100644
--- a/src/Primitives/Icosphere.h
+++ b/src/Primitives/Icosphere.h
@@ -57,7 +57,7 @@ template class Icosphere {
});
MeshTools::clean(*indices(), *normals(0));
- vertices(0)->assign(normals(0)->begin(), normals(0)->end());
+ positions(0)->assign(normals(0)->begin(), normals(0)->end());
}
};
diff --git a/src/Primitives/Test/CapsuleTest.cpp b/src/Primitives/Test/CapsuleTest.cpp
index a2cc760dd..03194016d 100644
--- a/src/Primitives/Test/CapsuleTest.cpp
+++ b/src/Primitives/Test/CapsuleTest.cpp
@@ -34,7 +34,7 @@ CapsuleTest::CapsuleTest() {
void CapsuleTest::withoutTextureCoords() {
Capsule capsule(2, 3, 1.0f);
- CORRADE_COMPARE(*capsule.vertices(0), (vector{
+ CORRADE_COMPARE(*capsule.positions(0), (vector{
Vector4(0.0f, -1.5f, 0.0f),
Vector4(0.0f, -1.20711f, 0.707107f),
@@ -90,7 +90,7 @@ void CapsuleTest::withoutTextureCoords() {
void CapsuleTest::withTextureCoords() {
Capsule capsule(2, 3, 1.0f, Capsule::TextureCoords::Generate);
- CORRADE_COMPARE(*capsule.vertices(0), (vector{
+ CORRADE_COMPARE(*capsule.positions(0), (vector{
Vector4(0.0f, -1.5f, 0.0f),
Vector4(0.0f, -1.20711f, 0.707107f),
diff --git a/src/Primitives/Test/UVSphereTest.cpp b/src/Primitives/Test/UVSphereTest.cpp
index 3fb613c61..091e508fe 100644
--- a/src/Primitives/Test/UVSphereTest.cpp
+++ b/src/Primitives/Test/UVSphereTest.cpp
@@ -31,7 +31,7 @@ UVSphereTest::UVSphereTest() {
void UVSphereTest::withoutTextureCoords() {
UVSphere sphere(3, 3);
- CORRADE_COMPARE(*sphere.vertices(0), (vector{
+ CORRADE_COMPARE(*sphere.positions(0), (vector{
Vector4(0.0f, -1.0f, 0.0f),
Vector4(0.0f, -0.5f, 0.866025f),
@@ -69,7 +69,7 @@ void UVSphereTest::withoutTextureCoords() {
void UVSphereTest::withTextureCoords() {
UVSphere sphere(3, 3, UVSphere::TextureCoords::Generate);
- CORRADE_COMPARE(*sphere.vertices(0), (vector{
+ CORRADE_COMPARE(*sphere.positions(0), (vector{
Vector4(0.0f, -1.0f, 0.0f),
Vector4(0.0f, -0.5f, 0.866025f),
diff --git a/src/Shaders/PhongShader.h b/src/Shaders/PhongShader.h
index ceb79af6b..da5201fee 100644
--- a/src/Shaders/PhongShader.h
+++ b/src/Shaders/PhongShader.h
@@ -32,7 +32,7 @@ namespace Magnum { namespace Shaders {
*/
class SHADERS_EXPORT PhongShader: public AbstractShaderProgram {
public:
- typedef Attribute<0, Vector4> Vertex; /**< @brief Vertex position */
+ typedef Attribute<0, Vector4> Position; /**< @brief Vertex position */
typedef Attribute<1, Vector3> Normal; /**< @brief Normal direction */
/** @brief Constructor */
diff --git a/src/Trade/MeshData.cpp b/src/Trade/MeshData.cpp
index 8c51fd064..4d735f80f 100644
--- a/src/Trade/MeshData.cpp
+++ b/src/Trade/MeshData.cpp
@@ -19,7 +19,7 @@ namespace Magnum { namespace Trade {
MeshData::~MeshData() {
delete _indices;
- for(auto i: _vertices) delete i;
+ for(auto i: _positions) delete i;
for(auto i: _normals) delete i;
for(auto i: _textureCoords2D) delete i;
}
diff --git a/src/Trade/MeshData.h b/src/Trade/MeshData.h
index 7617f56c3..4261913fb 100644
--- a/src/Trade/MeshData.h
+++ b/src/Trade/MeshData.h
@@ -42,13 +42,13 @@ class MAGNUM_EXPORT MeshData {
* @param primitive Primitive
* @param indices Array with indices or 0, if this is not
* indexed mesh
- * @param vertices Array with vertex arrays. At least one
- * vertex array should be present.
+ * @param positions Array with vertex positions. At least one
+ * position array should be present.
* @param normals Array with normal arrays or empty array
* @param textureCoords2D Array with two-dimensional texture
* coordinate arrays or empty array
*/
- inline MeshData(const std::string& name, Mesh::Primitive primitive, std::vector* indices, std::vector*> vertices, std::vector*> normals, std::vector*> textureCoords2D): _name(name), _primitive(primitive), _indices(indices), _vertices(vertices), _normals(normals), _textureCoords2D(textureCoords2D) {}
+ inline MeshData(const std::string& name, Mesh::Primitive primitive, std::vector* indices, std::vector*> positions, std::vector*> normals, std::vector*> textureCoords2D): _name(name), _primitive(primitive), _indices(indices), _positions(positions), _normals(normals), _textureCoords2D(textureCoords2D) {}
/** @brief Destructor */
~MeshData();
@@ -66,17 +66,17 @@ class MAGNUM_EXPORT MeshData {
inline std::vector* indices() { return _indices; }
inline const std::vector* indices() const { return _indices; } /**< @overload */
- /** @brief Count of vertex arrays */
- inline unsigned int vertexArrayCount() const { return _vertices.size(); }
+ /** @brief Count of vertex position arrays */
+ inline unsigned int positionArrayCount() const { return _positions.size(); }
/**
- * @brief Vertices
- * @param id ID of vertex data array
- * @return Vertices or nullptr if there is no vertex array with given
+ * @brief Positions
+ * @param id ID of position data array
+ * @return Positions or nullptr if there is no vertex array with given
* ID.
*/
- inline std::vector* vertices(unsigned int id) { return _vertices[id]; }
- inline const std::vector* vertices(unsigned int id) const { return _vertices[id]; } /**< @overload */
+ inline std::vector* positions(unsigned int id) { return _positions[id]; }
+ inline const std::vector* positions(unsigned int id) const { return _positions[id]; } /**< @overload */
/** @brief Count of normal arrays */
inline unsigned int normalArrayCount() const { return _normals.size(); }
@@ -106,7 +106,7 @@ class MAGNUM_EXPORT MeshData {
std::string _name;
Mesh::Primitive _primitive;
std::vector* _indices;
- std::vector*> _vertices;
+ std::vector*> _positions;
std::vector*> _normals;
std::vector*> _textureCoords2D;
};