Merge pull request #190 from daeunSong/master

Fix texture coordinate tangent and bitangent calculation
This commit is contained in:
Joey de Vries
2020-08-13 11:07:38 +02:00
committed by GitHub

View File

@@ -115,9 +115,6 @@ private:
vec.x = mesh->mTextureCoords[0][i].x; vec.x = mesh->mTextureCoords[0][i].x;
vec.y = mesh->mTextureCoords[0][i].y; vec.y = mesh->mTextureCoords[0][i].y;
vertex.TexCoords = vec; vertex.TexCoords = vec;
}
else
vertex.TexCoords = glm::vec2(0.0f, 0.0f);
// tangent // tangent
vector.x = mesh->mTangents[i].x; vector.x = mesh->mTangents[i].x;
vector.y = mesh->mTangents[i].y; vector.y = mesh->mTangents[i].y;
@@ -128,6 +125,10 @@ private:
vector.y = mesh->mBitangents[i].y; vector.y = mesh->mBitangents[i].y;
vector.z = mesh->mBitangents[i].z; vector.z = mesh->mBitangents[i].z;
vertex.Bitangent = vector; vertex.Bitangent = vector;
}
else
vertex.TexCoords = glm::vec2(0.0f, 0.0f);
vertices.push_back(vertex); vertices.push_back(vertex);
} }
// now wak through each of the mesh's faces (a face is a mesh its triangle) and retrieve the corresponding vertex indices. // now wak through each of the mesh's faces (a face is a mesh its triangle) and retrieve the corresponding vertex indices.