You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
glm::vec3 vector; // We declare a placeholder vector since assimp uses its own vector class that doesn't directly convert to glm's vec3 class so we transfer the data to this placeholder glm::vec3 first.
110
-
111
-
// Positions
109
+
112
110
if (mesh->HasPositions()) {
113
-
vector.x = mesh->mVertices[i].x;
114
-
vector.y = mesh->mVertices[i].y;
115
-
vector.z = mesh->mVertices[i].z;
116
-
vertex.Position = vector;
111
+
vertex.Position.x = mesh->mVertices[i].x;
112
+
vertex.Position.y = mesh->mVertices[i].y;
113
+
vertex.Position.z = mesh->mVertices[i].z;
117
114
}
118
115
119
-
// Normals
120
116
if (mesh->HasNormals()) {
121
-
vector.x = mesh->mNormals[i].x;
122
-
vector.y = mesh->mNormals[i].y;
123
-
vector.z = mesh->mNormals[i].z;
124
-
vertex.Normal = vector;
117
+
vertex.Normal.x = mesh->mNormals[i].x;
118
+
vertex.Normal.y = mesh->mNormals[i].y;
119
+
vertex.Normal.z = mesh->mNormals[i].z;
125
120
}
126
121
127
-
// Tangents
128
122
if (mesh->HasTangentsAndBitangents()) {
129
-
vector.x = mesh->mTangents[i].x;
130
-
vector.y = mesh->mTangents[i].y;
131
-
vector.z = mesh->mTangents[i].z;
132
-
vertex.Tangent = vector;
123
+
vertex.Tangent.x = mesh->mTangents[i].x;
124
+
vertex.Tangent.y = mesh->mTangents[i].y;
125
+
vertex.Tangent.z = mesh->mTangents[i].z;
133
126
}
134
127
135
-
// Texture Coordinates
136
-
if (mesh->mTextureCoords[0]) { // Does the mesh contain texture coordinates?
137
-
glm::vec2 vec;
128
+
if (mesh->HasTextureCoords(0)) {
138
129
// A vertex can contain up to 8 different texture coordinates. We thus make the assumption that we won't
139
130
// use models where a vertex can have multiple texture coordinates so we always take the first set (0).
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // linearly interpolates between the two closest mipmaps and samples the texture via linear interpolation.
19
19
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Mipmaps do not apply to magnification.
0 commit comments