Merge pull request #67 from 64/master

Fix OSX errors and warnings
This commit is contained in:
Joey de Vries
2017-06-18 01:54:02 +02:00
committed by GitHub
5 changed files with 30 additions and 31 deletions

View File

@@ -2,6 +2,7 @@
#define FILESYSTEM_H #define FILESYSTEM_H
#include <string> #include <string>
#include <cstdlib>
#include "root_directory.h" // This is a configuration file generated by CMake. #include "root_directory.h" // This is a configuration file generated by CMake.
class FileSystem class FileSystem

View File

@@ -141,8 +141,6 @@ private:
indices.push_back(face.mIndices[j]); indices.push_back(face.mIndices[j]);
} }
// process materials // process materials
if(mesh->mMaterialIndex >= 0)
{
aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex]; aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];
// we assume a convention for sampler names in the shaders. Each diffuse texture should be named // we assume a convention for sampler names in the shaders. Each diffuse texture should be named
// as 'texture_diffuseN' where N is a sequential number ranging from 1 to MAX_SAMPLER_NUMBER. // as 'texture_diffuseN' where N is a sequential number ranging from 1 to MAX_SAMPLER_NUMBER.
@@ -163,7 +161,6 @@ private:
// 4. height maps // 4. height maps
std::vector<Texture> heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, "texture_height"); std::vector<Texture> heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, "texture_height");
textures.insert(textures.end(), heightMaps.begin(), heightMaps.end()); textures.insert(textures.end(), heightMaps.begin(), heightMaps.end());
}
// return a mesh object created from the extracted mesh data // return a mesh object created from the extracted mesh data
return Mesh(vertices, indices, textures); return Mesh(vertices, indices, textures);

View File

@@ -2,6 +2,7 @@
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <iostream> #include <iostream>
#include <cmath>
void framebuffer_size_callback(GLFWwindow* window, int width, int height); void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow *window); void processInput(GLFWwindow *window);

View File

@@ -22,7 +22,7 @@ unsigned int loadTexture(const char *path, bool gammaCorrection);
// settings // settings
const unsigned int SCR_WIDTH = 1280; const unsigned int SCR_WIDTH = 1280;
const unsigned int SCR_HEIGHT = 720; const unsigned int SCR_HEIGHT = 720;
bool gamma = false; bool gammaEnabled = false;
bool gammaKeyPressed = false; bool gammaKeyPressed = false;
// camera // camera
@@ -160,14 +160,14 @@ int main()
glUniform3fv(glGetUniformLocation(shader.ID, "lightPositions"), 4, &lightPositions[0][0]); glUniform3fv(glGetUniformLocation(shader.ID, "lightPositions"), 4, &lightPositions[0][0]);
glUniform3fv(glGetUniformLocation(shader.ID, "lightColors"), 4, &lightColors[0][0]); glUniform3fv(glGetUniformLocation(shader.ID, "lightColors"), 4, &lightColors[0][0]);
shader.setVec3("viewPos", camera.Position); shader.setVec3("viewPos", camera.Position);
shader.setInt("gamma", gamma); shader.setInt("gamma", gammaEnabled);
// floor // floor
glBindVertexArray(planeVAO); glBindVertexArray(planeVAO);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gamma ? floorTextureGammaCorrected : floorTexture); glBindTexture(GL_TEXTURE_2D, gammaEnabled ? floorTextureGammaCorrected : floorTexture);
glDrawArrays(GL_TRIANGLES, 0, 6); glDrawArrays(GL_TRIANGLES, 0, 6);
std::cout << (gamma ? "Gamma enabled" : "Gamma disabled") << std::endl; std::cout << (gammaEnabled ? "Gamma enabled" : "Gamma disabled") << std::endl;
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.) // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@@ -202,7 +202,7 @@ void processInput(GLFWwindow *window)
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !gammaKeyPressed) if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !gammaKeyPressed)
{ {
gamma = !gamma; gammaEnabled = !gammaEnabled;
gammaKeyPressed = true; gammaKeyPressed = true;
} }
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE) if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)