CMake stuff, add Unix/Win32 ifs, add GLFW source
This commit is contained in:
@@ -4,7 +4,6 @@ project(Fall-Fever)
|
||||
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
|
||||
find_package(glfw3 3.3 REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
# Specify the C++ standard
|
||||
|
||||
7
PreLoad.cmake
Normal file
7
PreLoad.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
if(UNIX)
|
||||
set(CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)
|
||||
endif(UNIX)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_GENERATOR "MinGW Makefiles" CACHE INTERNAL "" FORCE)
|
||||
endif(WIN32)
|
||||
6
lib/CMakeLists.txt
vendored
6
lib/CMakeLists.txt
vendored
@@ -1,4 +1,10 @@
|
||||
# Only build GLFW library
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glad)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stb)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glm)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/assimp)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glfw-3.3.2)
|
||||
|
||||
@@ -5,4 +5,6 @@ add_library(
|
||||
|
||||
target_include_directories(glad PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(glad dl)
|
||||
if(UNIX)
|
||||
target_link_libraries(glad dl)
|
||||
endif(UNIX)
|
||||
|
||||
@@ -13,9 +13,9 @@ add_executable(Fall-Fever
|
||||
|
||||
target_link_libraries(
|
||||
Fall-Fever PRIVATE
|
||||
glfw
|
||||
glad
|
||||
stb
|
||||
glfw
|
||||
${OPENGL_LIBRARIES}
|
||||
assimp
|
||||
)
|
||||
|
||||
@@ -94,7 +94,7 @@ Mesh Model::processMesh(aiMesh *mesh, const aiScene *scene) {
|
||||
}
|
||||
|
||||
// Material
|
||||
if(mesh->mMaterialIndex >= 0) {
|
||||
if(mesh->mMaterialIndex > 0) {
|
||||
aiMaterial *material = scene->mMaterials[mesh->mMaterialIndex];
|
||||
std::vector<Texture*> diffuseMaps = loadMaterialTextures(material, aiTextureType_DIFFUSE, texture_diffuse);
|
||||
textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());
|
||||
|
||||
@@ -9,7 +9,7 @@ Texture::Texture(const char* texturePath, uint8_t textureType) {
|
||||
this->textureType = textureType;
|
||||
|
||||
stbi_set_flip_vertically_on_load(1);
|
||||
auto *textureBuffer = stbi_load(texturePath, &textureWidth, &textureHeight, &bitsPerPixel, 4);
|
||||
auto *textureBuffer = stbi_load(texturePath, &textureWidth, &textureHeight, &bitsPerPixel, STBI_rgb_alpha);
|
||||
|
||||
// Push texture to grahics card;
|
||||
glGenTextures(1, &textureId);
|
||||
|
||||
Reference in New Issue
Block a user