Merge pull request #104 from d3BugErr/master

Another take on PBR tutorials missing rows and columns
This commit is contained in:
Joey de Vries
2018-04-10 15:51:48 +02:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -135,10 +135,10 @@ int main()
// render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively // render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively
glm::mat4 model; glm::mat4 model;
for (unsigned int row = 0; row < nrRows; ++row) for (int row = 0; row < nrRows; ++row)
{ {
shader.setFloat("metallic", (float)row / (float)nrRows); shader.setFloat("metallic", (float)row / (float)nrRows);
for (unsigned int col = 0; col < nrColumns; ++col) for (int col = 0; col < nrColumns; ++col)
{ {
// we clamp the roughness to 0.025 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off // we clamp the roughness to 0.025 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off
// on direct lighting. // on direct lighting.
@@ -146,8 +146,8 @@ int main()
model = glm::mat4(); model = glm::mat4();
model = glm::translate(model, glm::vec3( model = glm::translate(model, glm::vec3(
(col - (nrColumns / 2.)) * spacing, (col - (nrColumns / 2)) * spacing,
(row - (nrRows / 2.)) * spacing, (row - (nrRows / 2)) * spacing,
0.0f 0.0f
)); ));
shader.setMat4("model", model); shader.setMat4("model", model);

View File

@@ -151,9 +151,9 @@ int main()
// render rows*column number of spheres with material properties defined by textures (they all have the same material properties) // render rows*column number of spheres with material properties defined by textures (they all have the same material properties)
glm::mat4 model; glm::mat4 model;
for (unsigned int row = 0; row < nrRows; ++row) for (int row = 0; row < nrRows; ++row)
{ {
for (unsigned int col = 0; col < nrColumns; ++col) for (int col = 0; col < nrColumns; ++col)
{ {
model = glm::mat4(); model = glm::mat4();
model = glm::translate(model, glm::vec3( model = glm::translate(model, glm::vec3(