Fix texture coordinate tangent and bitangent calculation

This commit is contained in:
daeunSong
2020-08-13 17:53:03 +09:00
parent e09f4d657a
commit 3c4a88761b

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.