Update code and models
This commit is contained in:
parent
b9a007dd51
commit
d85c6073ec
@ -9,6 +9,10 @@ pkg_check_modules(EPOXY REQUIRED epoxy)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
pkg_check_modules(ASSIMP REQUIRED assimp)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
#find_package(OpenCL REQUIRED)
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/examples" "${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui" ${EPOXY_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
|
||||
@ -45,3 +49,10 @@ add_compile_options(-Wall)
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${IMGUI_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} m pthread ${EPOXY_LIBRARIES} ${SDL2_LIBRARIES} ${ASSIMP_LIBRARIES} glm)
|
||||
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
|
||||
target_precompile_headers(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:stb/stb_image.h>"
|
||||
"$<$<COMPILE_LANGUAGE:CXX>:glm/glm.hpp>"
|
||||
PRIVATE
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef GLOBALCANVASSETTINGS_H
|
||||
#define GLOBALCANVASSETTINGS_H
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
//#include <glm/glm.hpp>
|
||||
|
||||
class GlobalCanvasSettings
|
||||
{
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <opengl-playground/opengltexture.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
//#include <glm/glm.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class Material
|
||||
{
|
||||
@ -42,6 +42,8 @@ class Material
|
||||
glm::vec3 diff_color;
|
||||
glm::vec3 ambient_color;
|
||||
glm::vec3 specular_color;
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &os, Material const &material);
|
||||
};
|
||||
|
||||
#endif // MATERIAL_H
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <epoxy/gl.h>
|
||||
#include <opengl-playground/openglshader.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
//#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
|
||||
class OpenGlGraphics
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <epoxy/gl.h>
|
||||
#include <glm/glm.hpp>
|
||||
//#include <glm/glm.hpp>
|
||||
|
||||
class OpenGlShaderProgram
|
||||
{
|
||||
|
2
models/.gitignore
vendored
Normal file
2
models/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.blend1
|
||||
*.blend*
|
@ -1,6 +1,18 @@
|
||||
#include <opengl-playground/material.hpp>
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, glm::vec3 const &vec3)
|
||||
{
|
||||
return os << "(" << vec3.r << "|" << vec3.g << "|" << vec3.b << ")";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, Material const &material)
|
||||
{
|
||||
return os << "Diffuse Color: " << material.diff_color << ", "
|
||||
<< "Ambient Color: " << material.ambient_color << ", "
|
||||
<< "Specular Color: " << material.specular_color << ", "
|
||||
<< "Texture counts (diff, amb, spec): " << material.diffuse_textures.size()
|
||||
<< ", " << material.ambient_textures.size() << ", " << material.specular_textures.size();
|
||||
}
|
||||
|
||||
Material::Material()
|
||||
{
|
||||
|
@ -135,6 +135,7 @@ Mesh Model::processMesh(aiMesh *mesh, const aiScene *scene)
|
||||
|
||||
material->Get(AI_MATKEY_SHININESS, mesh_material.shininess);
|
||||
material->Get(AI_MATKEY_SHININESS_STRENGTH, mesh_material.shininess_strength);
|
||||
std::cout << "Material: " << mesh_material << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb/stb_image.h>
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
OpenGlTexture::OpenGlTexture(const std::string &texture_path)
|
||||
{
|
||||
@ -36,8 +37,14 @@ void OpenGlTexture::setRGBDataFromBytes(unsigned int width, unsigned int height,
|
||||
void OpenGlTexture::loadFromImagePath(const std::string &base_directory)
|
||||
{
|
||||
int width, height, nrChannels;
|
||||
std::string filename = this->texture_path;
|
||||
filename = base_directory + '/' + filename;
|
||||
std::filesystem::path base_path(base_directory);
|
||||
std::filesystem::path tex_path(this->texture_path);
|
||||
std::string filename;
|
||||
|
||||
if (tex_path.is_relative())
|
||||
filename = base_path / tex_path;
|
||||
else
|
||||
filename = tex_path;
|
||||
|
||||
unsigned char *data = stbi_load(filename.c_str(), &width, &height, &nrChannels, 0);
|
||||
if (data) {
|
||||
|
@ -1 +1,10 @@
|
||||
#include <opengl-playground/vertex.hpp>
|
||||
|
||||
Vertex operator+(Vertex const &a, Vertex const &b)
|
||||
{
|
||||
Vertex out = a;
|
||||
|
||||
out.Position + b.Position;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user