diff --git a/README.md b/README.md index ffdf03c..6c4da1a 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,6 @@ compile with `make -j[threads]` - OpenGL, utilised with GLAD and GLFW - ImGui for lovely GUI -- SPDLog for lovely logging +- YOLO for lovely logging ## Acknowledgements diff --git a/hart/inferno-hart-cpu/src/main.cpp b/hart/inferno-hart-cpu/src/main.cpp index f0a92a1..41794c9 100644 --- a/hart/inferno-hart-cpu/src/main.cpp +++ b/hart/inferno-hart-cpu/src/main.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -37,7 +38,7 @@ public: mState = EModuleState::Build; mVert = (float*)vert; mNorm = (float*)norm; mVc = vc; mIndices = (uint32_t*)indices; mIc = ic; - spdlog::info("[hartcpu] Recieved {} verticies ({}) and {} indicies ({})", vc / 3, vert, ic / 3, indices); + yolo::info("[hartcpu] Recieved {} verticies ({}) and {} indicies ({})", vc / 3, vert, ic / 3, indices); std::vector indicesToProcess(ic / 3); for (uint32_t i = 0; i < ic / 3; ++i) @@ -47,7 +48,7 @@ public: mKdTree = new KDTree(mVert, mIndices, indicesToProcess, 0, indicesToProcess.size() - 1, 10); mKdTree->printTree(mKdTree->getRoot(), 1); - spdlog::info("[hartcpu] Accelerator ready.."); + yolo::info("[hartcpu] Accelerator ready.."); mState = EModuleState::Idle; } @@ -61,7 +62,7 @@ public: mState = EModuleState::Trace; _mSignalCv.notify_all(); - spdlog::info("[hartcpu] Signal master to start"); + yolo::info("[hartcpu] Signal master to start"); { std::unique_lock doneLock(_mDoneMut); diff --git a/libhart/inferno_hart.hpp b/libhart/inferno_hart.hpp index e57b908..c10faa2 100644 --- a/libhart/inferno_hart.hpp +++ b/libhart/inferno_hart.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include @@ -93,7 +93,7 @@ public: std::lock_guard lock(_mData); for (const auto& e: queue) mToTrace.push(e); - spdlog::info("[hartmodule] New trace queue: {}", mToTrace.size()); + yolo::info("[hartmodule] New trace queue: {}", mToTrace.size()); } inline void pushtoQueue(Ray* ray) @@ -104,7 +104,7 @@ public: inline void passContext(void* context, HART_HIT_CALLBACK callback) { - spdlog::debug("[hartmodule] Recieved context"); + yolo::debug("[hartmodule] Recieved context"); std::lock_guard lock(_mData); mCtx = context; Hit = callback; diff --git a/libhart/thirdparty/yolo/yolo.hpp b/libhart/thirdparty/yolo/yolo.hpp index e1130b6..f41130d 100644 --- a/libhart/thirdparty/yolo/yolo.hpp +++ b/libhart/thirdparty/yolo/yolo.hpp @@ -14,7 +14,7 @@ namespace detail { static std::vector> modules; template - std::string format(const std::string& format, Args... args) + inline std::string format(const std::string& format, Args... args) { std::ostringstream oss; size_t start = 0; size_t pos; @@ -23,7 +23,7 @@ namespace detail { return oss.str(); } - std::string formatTime() + inline std::string formatTime() { auto now = std::chrono::system_clock::now(); std::time_t time = std::chrono::system_clock::to_time_t(now); diff --git a/src/hart_directory.cpp b/src/hart_directory.cpp index f6b828e..635d1eb 100644 --- a/src/hart_directory.cpp +++ b/src/hart_directory.cpp @@ -2,7 +2,7 @@ #include "inferno_hart.hpp" -#include +#include #include @@ -53,7 +53,7 @@ std::vector HARTModuleDirectory::discoverMo HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::filesystem::path file) { - spdlog::info("Registering module at {}", file.c_str()); + yolo::info("Registering module at {}", file.c_str()); discoveryEntry entry; entry.Location = file; @@ -62,7 +62,7 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil entry.Handle = LoadLibraryA(file.c_str()); if (entry.Handle == NULL) { - spdlog::error("Cannot load module at {}.", file.c_str()); + yolo::error("Cannot load module at {}.", file.c_str()); entry.Handle = NULL; entry.DidLink = false; return entry; } @@ -73,7 +73,7 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil entry.Handle = dlopen(file.c_str(), RTLD_NOW | RTLD_LOCAL); if (entry.Handle == NULL) { - spdlog::error("Cannot load module at ", dlerror()); + yolo::error("Cannot load module at ", dlerror()); entry.Handle = NULL; entry.DidLink = false; return entry; } @@ -84,30 +84,30 @@ HARTModuleDirectory::discoveryEntry HARTModuleDirectory::registerModule(std::fil if (credit == NULL) { - spdlog::error("Cannot load module at {}... No credit...", file.c_str()); + yolo::error("Cannot load module at {}... No credit...", file.c_str()); entry.Handle = NULL; entry.DidLink = false; return entry; } if (entry.InitCallback == NULL) { - spdlog::error("Cannot load module at {}... No get...", file.c_str()); + yolo::error("Cannot load module at {}... No get...", file.c_str()); entry.Handle = NULL; entry.DidLink = false; return entry; } if (entry.DestroyCallback == NULL) { - spdlog::error("Cannot load module at {}... No destroy...", file.c_str()); + yolo::error("Cannot load module at {}... No destroy...", file.c_str()); entry.Handle = NULL; entry.DidLink = false; return entry; } entry.Credit = (ModuleCredit*)credit(); - spdlog::info("Module {0} v{1}.{2}.{3} by {4}", entry.Credit->ModuleName, - entry.Credit->VersionMajor, - entry.Credit->VersionMinor, - entry.Credit->VersionBuild, - entry.Credit->AuthorName); + yolo::info("Module {} v{}.{}.{} by {}", entry.Credit->ModuleName, + entry.Credit->VersionMajor, + entry.Credit->VersionMinor, + entry.Credit->VersionBuild, + entry.Credit->AuthorName); entry.DidLink = true; mEntries[entry.Credit->ModuleName] = { entry, nullptr }; diff --git a/src/hart_module.cpp b/src/hart_module.cpp index 9379c5d..84fd7ed 100644 --- a/src/hart_module.cpp +++ b/src/hart_module.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include @@ -46,7 +46,7 @@ void HHM::newScene(Scene* scene) void* verticies; void* normals; void* indicies; int vertexCount = mesh->getVerticies(&verticies, &normals); int indexCount = mesh->getIndicies(&indicies); - spdlog::debug("Mesh for module ready... {} {}", verticies, normals); + yolo::debug("Mesh for module ready... {} {}", verticies, normals); mod->submitTris(verticies, normals, vertexCount, indicies, indexCount); } } @@ -77,7 +77,7 @@ void HHM::startTrace(RayField sourceScatter) // TODO: Signal start HARTModule* mod = mDirectory.getActiveModule(); mod->passContext((void*)this, &rayHitCallback); - spdlog::debug("SubmitQueue {}", sourceScatter.size()); + yolo::debug("SubmitQueue {}", sourceScatter.size()); mod->submitQueue(sourceScatter); mod->start(); } diff --git a/src/inferno.cpp b/src/inferno.cpp index b7165a2..3a11842 100644 --- a/src/inferno.cpp +++ b/src/inferno.cpp @@ -16,7 +16,7 @@ #include "scene/material.hpp" #include "scene/mesh.hpp" -#include +#include #include #include @@ -28,8 +28,7 @@ using namespace inferno; Inferno::Inferno() { // MOTD - spdlog::set_level(spdlog::level::trace); - spdlog::info("INFERNO HART v" INFERNO_VERSION); + yolo::info("INFERNO HART v" INFERNO_VERSION); // Create window mWin = &Window::GetInstance(); @@ -72,7 +71,7 @@ void Inferno::uiPreset() ImGui::DockBuilderDockWindow("Render", dock_main_id); ImGui::DockBuilderFinish(dockspace_id); - spdlog::info("LAYOUT SET TO DEFAULT"); + yolo::info("LAYOUT SET TO DEFAULT"); } void Inferno::moveInput() @@ -320,7 +319,7 @@ int Inferno::run() case GL_INVALID_FRAMEBUFFER_OPERATION: error = "INVALID_FRAMEBUFFER_OPERATION"; break; default: error = std::to_string((uint32_t)err); break; } - spdlog::error("[GL]: {0} {1}", err, error); + yolo::error("[GL]: {} {}", err, error); } mWin->render(); diff --git a/src/main.cpp b/src/main.cpp index 497c509..6ddbc6a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ #include "inferno.hpp" -#include "spdlog/spdlog.h" +#include "yolo/yolo.hpp" #include @@ -11,7 +11,7 @@ int main(int argc, char** argv) } catch (std::exception e) { - spdlog::error(e.what()); + yolo::error(e.what()); return -1; } } diff --git a/src/renderer/dispatcher.cpp b/src/renderer/dispatcher.cpp index 74c4502..bc1515e 100644 --- a/src/renderer/dispatcher.cpp +++ b/src/renderer/dispatcher.cpp @@ -3,8 +3,6 @@ #include "hart_module.hpp" #include "renderer.hpp" -#include - #include #include diff --git a/src/renderer/renderer.cpp b/src/renderer/renderer.cpp index efe5ff4..0cd3230 100644 --- a/src/renderer/renderer.cpp +++ b/src/renderer/renderer.cpp @@ -11,7 +11,7 @@ #include "hart_module.hpp" #include "ray_source.hpp" -#include +#include #include @@ -83,7 +83,7 @@ void RayRenderer::prepare() assert(mCurrentScene != nullptr); if (mCurrentScene->didUpdate()) { - spdlog::debug("New Scene!"); + yolo::debug("New Scene!"); mIface->newScene(mCurrentScene); } } @@ -105,7 +105,7 @@ void RayRenderer::draw() // before we start we now want to check that it hasn't been force-stopped mIface->startTrace(startRays.Field); - spdlog::info("Sample complete"); + yolo::info("Sample complete"); for (auto* ray : startRays.Field) { @@ -120,7 +120,7 @@ void RayRenderer::computeHit(HitInfo* info) // TODO: Make sure signal is started if (!(*mCurrentRefTable).count(info->Caller->Reference)) { - spdlog::warn("Why is the ray not in the map?!"); + yolo::warn("Why is the ray not in the map?!"); return; } glm::ivec2 pos = (*mCurrentRefTable)[info->Caller->Reference]; diff --git a/src/scene/mesh.cpp b/src/scene/mesh.cpp index 1fc1172..03f4bca 100644 --- a/src/scene/mesh.cpp +++ b/src/scene/mesh.cpp @@ -1,6 +1,6 @@ #include "mesh.hpp" -#include +#include #include @@ -71,14 +71,13 @@ void Mesh::ready() glBindVertexArray(0); - spdlog::debug("Mesh for preview ready..."); + yolo::debug("Mesh for preview ready..."); } int Mesh::getVerticies(void** v, void** n) { *v = (void*)&mObjLoader->getPositions()[0]; *n = (void*)&mObjLoader->getNormals()[0]; - // spdlog::debug("Mesh get {} {}", v, n); return mObjLoader->getVertCount(); } diff --git a/src/scene/objloader.cpp b/src/scene/objloader.cpp index b5a0968..8a0367a 100644 --- a/src/scene/objloader.cpp +++ b/src/scene/objloader.cpp @@ -1,7 +1,7 @@ // Adapted from https://raw.githubusercontent.com/tamato/simple-obj-loader/master/objloader.cpp #include "objloader.hpp" -#include +#include #include #include @@ -54,7 +54,7 @@ void ObjLoader::load(std::filesystem::path file) { if (!std::filesystem::exists(file)) { - spdlog::error("OBJ File does not exist at ", file.string()); + yolo::error("OBJ File does not exist at ", file.string()); return; } @@ -62,7 +62,7 @@ void ObjLoader::load(std::filesystem::path file) inf.open(file.c_str(), std::ios_base::in); if (!inf.is_open()) { - spdlog::error("Failed to open OBJ file ", file.string()); + yolo::error("Failed to open OBJ file ", file.string()); return; } diff --git a/src/window.cpp b/src/window.cpp index 989e1df..1c859bc 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2,7 +2,7 @@ #include "gui/style.hpp" -#include "spdlog/spdlog.h" +#include "yolo/yolo.hpp" using namespace inferno; @@ -188,5 +188,5 @@ void Window::glfwKeyCallback(GLFWwindow* window, int key, int scancode, int acti } void Window::glfwErrorCallback(int error, const char* description) { - spdlog::error("[GLFW {0}] {1}", error, description); + yolo::error("[GLFW {}] {}", error, description); }