Fix geometry shader normal homogenous coordinate, and use std::string instead of aString for model loading.

This commit is contained in:
Joey de Vries
2018-01-16 08:50:57 +01:00
parent 91bb8e8ca9
commit 3b605521fb
3 changed files with 4 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ struct Vertex {
struct Texture {
unsigned int id;
string type;
aiString path;
string path;
};
class Mesh {

View File

@@ -179,7 +179,7 @@ private:
bool skip = false;
for(unsigned int j = 0; j < textures_loaded.size(); j++)
{
if(std::strcmp(textures_loaded[j].path.C_Str(), str.C_Str()) == 0)
if(std::strcmp(textures_loaded[j].path.data(), str.C_Str()) == 0)
{
textures.push_back(textures_loaded[j]);
skip = true; // a texture with the same filepath has already been loaded, continue to next one. (optimization)
@@ -191,7 +191,7 @@ private:
Texture texture;
texture.id = TextureFromFile(str.C_Str(), this->directory);
texture.type = typeName;
texture.path = str;
texture.path = str.C_Str();
textures.push_back(texture);
textures_loaded.push_back(texture); // store it as texture loaded for entire model, to ensure we won't unnecesery load duplicate textures.
}

View File

@@ -13,6 +13,6 @@ uniform mat4 model;
void main()
{
mat3 normalMatrix = mat3(transpose(inverse(view * model)));
vs_out.normal = vec3(projection * vec4(normalMatrix * aNormal, 1.0));
vs_out.normal = vec3(projection * vec4(normalMatrix * aNormal, 0.0));
gl_Position = projection * view * model * vec4(aPos, 1.0);
}