diff --git a/src/display/framebuffer.hpp b/src/display/framebuffer.hpp index fc865f8..55b2867 100644 --- a/src/display/framebuffer.hpp +++ b/src/display/framebuffer.hpp @@ -13,7 +13,8 @@ public: FrameBuffer(int xres, int yres); void SetPixel(int x, int y, glm::vec3 p); - void SetPixelSafe(int x, int y, glm::vec3); + void SetPixelSafe(int x, int y, glm::vec3 p); + void DumpToFile(std::string path); void SetFramebuffer(uint32_t* fb); diff --git a/src/util/assetloader.cpp b/src/util/assetloader.cpp index 1ddc76d..258cc78 100644 --- a/src/util/assetloader.cpp +++ b/src/util/assetloader.cpp @@ -66,9 +66,10 @@ std::vector LoadTrianglesBasic(std::string path, std::string basePath anz[v] = attrib.normals[3 * idx.normal_index + 2]; } - tinyobj::material_t material = materials[shapes[s].mesh.material_ids[f]]; + // tinyobj::material_t material = materials[shapes[s].mesh.material_ids[f]]; - Material* mat = new Material({ material.diffuse[0], material.diffuse[1], material.diffuse[2] }, 0.0f, material.illum); + // Material* mat = new Material({ material.diffuse[0], material.diffuse[1], material.diffuse[2] }, 0.6f, material.illum); + Material* mat = new Material({ 1.0f, 1.0f, 1.0f }, 0.4f); // glm::vec3 normal = getNormal( // {avx[0], avy[0], avz[0]}, diff --git a/src/util/imgui/imgui_impl_sdl.cpp b/src/util/imgui/imgui_impl_sdl.cpp index e32390f..71e49fd 100644 --- a/src/util/imgui/imgui_impl_sdl.cpp +++ b/src/util/imgui/imgui_impl_sdl.cpp @@ -43,8 +43,13 @@ #include // SDL +#if _WIN32 #include #include +#else +#include +#include +#endif #if defined(__APPLE__) #include "TargetConditionals.h" #endif diff --git a/test/main.cpp b/test/main.cpp index 8c2d1a0..aab8789 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -2,8 +2,8 @@ #include "../src/inferno.hpp" -static const int width = 1000; -static const int height = 1000; +static const int width = 700; +static const int height = 700; int main(int argc, char** argv) { InfernoEngine inferno; @@ -18,17 +18,20 @@ int main(int argc, char** argv) { Scene* scene = new Scene(width, height); scene->camera = new Camera(width, height); - scene->objects.push_back(new Sphere({ 0.6f, 0.0f, -3.5f }, 0.5f, new Material({ 0.5f, 1.0f, 0.5f }, 0.4f))); - //scene->objects.push_back(new Sphere({ 0.0f, 0.0f, -8.0f }, 1.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.7f))); - //scene->objects.push_back(new Sphere({ 2.0f, 0.0f, -6.0f }, 1.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f))); - //scene->objects.push_back(new Sphere({ -2.0f, 0.0f, -9.0f }, 1.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f))); - //scene->objects.push_back(new Plane( { 0.0f, -1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, new Material({ 1.0f, 1.0f, 0.0f }, .3f))); + // scene->objects.push_back(new Sphere({ 0.0f, 0.0f, -8.0f }, 1.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.7f))); + // scene->objects.push_back(new Sphere({ 2.0f, 0.0f, -6.0f }, 1.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f))); + // scene->objects.push_back(new Sphere({ -2.0f, 0.0f, -9.0f }, 1.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f))); + scene->objects.push_back(new Sphere({ 5.0f, 6.0f, 9.0f }, 5.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f, 5.0f))); + scene->objects.push_back(new Plane( { 0.0f,-1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, new Material({ 1.0f, 0.9f, 0.9f }, 0.1f))); + // scene->objects.push_back(new Plane( { 0.0f, 10.0f, 0.0f }, { 1.0f, 1.0f, 1.0f }, new Material({ 1.0f, 0.9f, 0.9f }, 0.0f, 1.0f))); //std::vector tris = LoadTrianglesBasic("E://Projects//Inferno//resources//dragon-normals.obj", "E://Projects//Inferno//resources"); - //for (const auto& object : tris) + // std::vector tris = LoadTrianglesBasic("//home//ben//programming//inferno//resources//dragon-normals.obj", "//home//ben//programming//inferno//resources//resources"); + // for (const auto& object : tris) // object->Translate({ 0.0f, -5.0f, -20.0f }); //std::vector tris = LoadTrianglesBasic("E://Projects//Inferno//resources//lucy-normals.obj", "E://Projects//Inferno//resources"); + std::vector tris = LoadTrianglesBasic("//home//ben//programming//inferno//resources//lucy-normals.obj", "//home//ben//programming//inferno//resources//resources"); //Mesh* mesh = new Mesh(tris); //mesh->Translate({ 0.0f, -1.01f, -3.0f }); @@ -36,7 +39,7 @@ int main(int argc, char** argv) { //scene->meshs.push_back(mesh); //std::vector tris = LoadTrianglesBasic("E://Projects//Inferno//resources//cornell-box.obj", "E://Projects//Inferno//resources"); - std::vector tris = LoadTrianglesBasic("E://Projects//Inferno//resources//cornell.obj", "E://Projects//Inferno//resources"); + // std::vector tris = LoadTrianglesBasic("//home//ben//programming//inferno//resources//cornell.obj", "//home//ben//programming//inferno//resources//resources"); Mesh* mesh1 = new Mesh(tris); mesh1->Translate({ 0.0f, -1.0f, -3.0f });