Skip to content
Snippets Groups Projects
Commit 3b8356f4 authored by Woohyung Choi's avatar Woohyung Choi
Browse files

improve stabillity loadobj()

Increase fov of camera.
parent 6820c1ce
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,7 @@ void RenderObject::render(Camera &camera)
set_uniform_value(prog, "material.shininess", glm::fvec1{ 64.0f });
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)_SCR_WIDTH / (float)_SCR_HEIGHT, 0.1f, 100.0f);
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)_SCR_WIDTH / (float)_SCR_HEIGHT, 0.1f, 500.0f);
glm::mat4 view = camera.GetViewMatrix();
set_uniform_value(prog, "projection", projection);
set_uniform_value(prog, "view", view);
......
......@@ -60,6 +60,11 @@ bool openObj(const std::string fileName, std::vector<glm::vec3> &vertices, std::
line.erase(0, charPos + 1);
}
if (line[0] == ' ')
{
line.erase(0, 1);
}
if (strcmp(op, "v") == false)
{
glm::vec3 pos = { 0,0,0 };
......@@ -101,19 +106,6 @@ bool openObj(const std::string fileName, std::vector<glm::vec3> &vertices, std::
sscanf_s(line.substr(0, charPos).c_str(), "%d%*[-//]%d", &vIndex, &vnIndex);
line.erase(0, charPos + 1);
}
if (vIndex >= 1)
{
faceVertexIndicies.push_back(vIndex - 1);
}
if (uvIndex >= 1)
{
faceVertexTexCoordIndicies.push_back(uvIndex - 1);
}
if (vnIndex >= 1)
{
faceVertexNormalIndicies.push_back(vnIndex - 1);
}
}
if (line.size() > 0)
......@@ -214,7 +206,6 @@ bool openObj(const std::string fileName, std::vector<glm::vec3> &vertices, std::
log_warn(infoLog, fileName + " : " + "faceVertexNormalIndices.size() : " + std::to_string(faceVertexNormalIndicies.size()));
}
}
}
ifs.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment