From 128fc2f9dc5e04aa5aff4826681aeab6441c56da Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 11 Feb 2023 12:53:32 -0500 Subject: [PATCH] Fix system namespace --- LICENSE | 6 +++--- include/blt/std/math.h | 9 +++------ include/blt/std/system.h | 2 +- include/blt/std/time.h | 2 +- src/blt/profiling/profiler.cpp | 6 +++--- src/blt/std/logging.cpp | 6 +++--- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index f288702..dd0d9fc 100644 --- a/LICENSE +++ b/LICENSE @@ -120,7 +120,7 @@ standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - The "System Libraries" of an executable work include anything, other + The "system Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that @@ -135,7 +135,7 @@ produce the work, or an object code interpreter used to run it. the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free +system Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for @@ -291,7 +291,7 @@ in one of these ways: charge under subsection 6d. A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be +from the Corresponding Source as a system Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any diff --git a/include/blt/std/math.h b/include/blt/std/math.h index 267f7e4..cefc2d1 100644 --- a/include/blt/std/math.h +++ b/include/blt/std/math.h @@ -516,12 +516,9 @@ namespace blt { float oneOverNearMFar = 1.0f / (near - far); float halfTan = tanf(fov * 0.5f * (float)M_PI / 180.0f); -// perspectiveMat4x4.m00(1.0f/(aspect_ratio*halfTan)); -// perspectiveMat4x4.m11(1.0f/halfTan); -// perspectiveMat4x4.m22((far + near) * oneOverNearMFar); -// perspectiveMat4x4.m32(2 * far * near * oneOverNearMFar); -// perspectiveMat4x4.m23(-1); -// perspectiveMat4x4.m33(0); + // this should be all it takes to create a mostly correct projection matrix + // the values are transposed because my matrix implementation is terrible. + // TODO: redo matrix implementation perspectiveMat4x4.m00(float(1.0 / (aspect_ratio * halfTan))); perspectiveMat4x4.m11(float(1.0 / halfTan)); perspectiveMat4x4.m22(float(-((far + near) / (far - near)))); diff --git a/include/blt/std/system.h b/include/blt/std/system.h index e888624..96e13a1 100644 --- a/include/blt/std/system.h +++ b/include/blt/std/system.h @@ -7,7 +7,7 @@ #ifndef BLT_SYSTEM_H #define BLT_SYSTEM_H -namespace blt::System { +namespace blt::system { // TODO: system memory and current CPU usage. (Linux Only currently) } diff --git a/include/blt/std/time.h b/include/blt/std/time.h index 8d177ce..abc9420 100644 --- a/include/blt/std/time.h +++ b/include/blt/std/time.h @@ -11,7 +11,7 @@ #ifndef BLT_TIME_H #define BLT_TIME_H -namespace blt::System { +namespace blt::system { static inline std::string ensureHasDigits(int current, int digits) { std::string asString = std::to_string(current); auto length = digits - asString.length(); diff --git a/src/blt/profiling/profiler.cpp b/src/blt/profiling/profiler.cpp index 2eac68c..a9461c3 100644 --- a/src/blt/profiling/profiler.cpp +++ b/src/blt/profiling/profiler.cpp @@ -21,19 +21,19 @@ namespace blt::profiling { void startInterval(const std::string& profileName, const std::string& intervalName) { std::scoped_lock lock(profileLock); CaptureInterval interval{}; - interval.start = System::getCurrentTimeNanoseconds(); + interval.start = system::getCurrentTimeNanoseconds(); profiles[profileName].intervals[intervalName] = interval; } void endInterval(const std::string& profileName, const std::string& intervalName) { std::scoped_lock lock(profileLock); - profiles[profileName].intervals[intervalName].end = System::getCurrentTimeNanoseconds(); + profiles[profileName].intervals[intervalName].end = system::getCurrentTimeNanoseconds(); } void point(const std::string& profileName, const std::string& pointName) { std::scoped_lock lock(profileLock); CapturePoint point{}; - point.point = System::getCurrentTimeNanoseconds(); + point.point = system::getCurrentTimeNanoseconds(); point.name = pointName; profiles[profileName].points.push(point); } diff --git a/src/blt/std/logging.cpp b/src/blt/std/logging.cpp index cba84d8..85a347b 100644 --- a/src/blt/std/logging.cpp +++ b/src/blt/std/logging.cpp @@ -33,7 +33,7 @@ namespace blt::logging { static constexpr int MAX_LINES = 100000; public: explicit LogFileWriter(const std::string& path): m_path(path){ - auto currentTime = System::getTimeStringFS(); + auto currentTime = system::getTimeStringFS(); output = new std::fstream(path + currentTime + ".log", std::ios::out | std::ios::app); if (!output->good()){ throw std::runtime_error("Unable to open console filestream!\n"); @@ -52,7 +52,7 @@ namespace blt::logging { output->close(); delete(output); currentLines = 0; - auto currentTime = System::getTimeStringFS(); + auto currentTime = system::getTimeStringFS(); output = new std::fstream(m_path + currentTime + ".log"); } } @@ -121,7 +121,7 @@ namespace blt::logging { inline void log(const std::string& str, bool hasEndingLinefeed, LOG_LEVEL level, const char* file, int currentLine, int auto_line){ if (level < BLT_LOGGING_PROPERTIES.minLevel) return; - std::string outputString = System::getTimeStringLog(); + std::string outputString = system::getTimeStringLog(); if (BLT_LOGGING_PROPERTIES.m_logWithData && currentLine >= 0) { outputString += '[';