Imported tool for loading models
This commit is contained in:
parent
5c96f8b90d
commit
644ac26403
5 changed files with 16 additions and 9 deletions
|
|
@ -23,15 +23,15 @@ find_package(SDL2 REQUIRED)
|
|||
find_package(SDL2_image REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
|
||||
find_package(GLM REQUIRED)
|
||||
message(STATUS "GLM included: ${GLM_INCLUDE_DIR}")
|
||||
find_package(assimp REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_IMAGE_DIRS}
|
||||
${OPENGL_INCLUDE_DIRS}
|
||||
${GLEW_INCLUDE_DIRS})
|
||||
${GLEW_INCLUDE_DIRS}
|
||||
${ASSIMP_INCLUDE_DIRS})
|
||||
|
||||
add_executable(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
|
||||
|
||||
|
|
@ -39,4 +39,5 @@ target_link_libraries(${PROJECT_NAME}
|
|||
${SDL2_LIBRARIES}
|
||||
${SDL2_IMAGE_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${GLEW_LIBRARIES})
|
||||
${GLEW_LIBRARIES}
|
||||
${ASSIMP_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -59,5 +59,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
|
|||
IF(GLM_FOUND)
|
||||
SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
|
||||
|
||||
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
|
||||
#MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
|
||||
ENDIF(GLM_FOUND)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "Model.h"
|
||||
|
||||
Model::Model(char *path) {}
|
||||
Model::Model(Mesh mesh) { this->meshes.push_back(mesh); }
|
||||
Model::Model(std::vector<Mesh> meshes) { this->meshes = meshes; }
|
||||
|
||||
|
|
@ -19,3 +20,5 @@ void Model::translate(glm::vec3 translation) {
|
|||
// set model transform
|
||||
this->model = glm::translate(glm::mat4(1.0f), glm::vec3(this->position));
|
||||
}
|
||||
|
||||
void Model::loadModel(char *path) {}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#include "Error.h"
|
||||
#include "Mesh.h"
|
||||
#include "ShaderLoader.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <vector>
|
||||
|
|
@ -19,7 +22,11 @@ private:
|
|||
// Position
|
||||
glm::vec4 position = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
void loadModel(char *path);
|
||||
|
||||
public:
|
||||
// Create a model from file
|
||||
Model(char *path);
|
||||
// Used to create a mesh out of a single mesh.
|
||||
Model(Mesh mesh);
|
||||
// Used to create a mesh out of multiple meshes.
|
||||
|
|
|
|||
|
|
@ -236,10 +236,6 @@ int main(int argc, char **argv) {
|
|||
// glBindVertexArray(VAO);
|
||||
|
||||
// TODO: Run game here lol
|
||||
// Draw triangle
|
||||
// glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
// glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
// glBindVertexArray(0);
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue