refactor: adjust for recent logger changes
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
6a257566bd
commit
311b20bdf2
14 changed files with 60 additions and 41 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <app/application.hpp>
|
#include <app/application.hpp>
|
||||||
|
#include <logger/logger.hpp>
|
||||||
#include <memory/scope.hpp>
|
#include <memory/scope.hpp>
|
||||||
|
|
||||||
auto main(int argc, char *argv[]) -> int32_t
|
auto main(int argc, char *argv[]) -> int32_t
|
||||||
|
|
@ -21,7 +22,7 @@ try
|
||||||
}
|
}
|
||||||
catch (const std::exception &exp)
|
catch (const std::exception &exp)
|
||||||
{
|
{
|
||||||
log_crt("Terminating due to uncaught exception:");
|
lt::log::critical("Terminating due to uncaught exception:");
|
||||||
log_crt("\texception.what(): {}", exp.what());
|
lt::log::critical("\texception.what(): {}", exp.what());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <logger/logger.hpp>
|
||||||
|
|
||||||
namespace lt::app {
|
namespace lt::app {
|
||||||
|
|
||||||
|
|
@ -72,7 +73,7 @@ public:
|
||||||
{
|
{
|
||||||
auto diag = m_diagnosis.emplace_back(std::move(diagnosis));
|
auto diag = m_diagnosis.emplace_back(std::move(diagnosis));
|
||||||
|
|
||||||
log_dbg("message: {}", diag.message);
|
log::debug("message: {}", diag.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto empty_diagnosis() const -> bool
|
[[nodiscard]] auto empty_diagnosis() const -> bool
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include <asset_baker/bakers.hpp>
|
#include <asset_baker/bakers.hpp>
|
||||||
#include <assets/shader.hpp>
|
#include <assets/shader.hpp>
|
||||||
|
#include <logger/logger.hpp>
|
||||||
|
|
||||||
auto main(int argc, char *argv[]) -> int32_t
|
auto main(int argc, char *argv[]) -> int32_t
|
||||||
try
|
try
|
||||||
|
|
@ -34,8 +35,8 @@ try
|
||||||
}
|
}
|
||||||
catch (const std::exception &exp)
|
catch (const std::exception &exp)
|
||||||
{
|
{
|
||||||
log_crt("Terminating due to uncaught exception:");
|
lt::log::critical("Terminating due to uncaught exception:");
|
||||||
log_crt("\texception.what: {}:", exp.what());
|
lt::log::critical("\texception.what: {}:", exp.what());
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <assets/shader.hpp>
|
#include <assets/shader.hpp>
|
||||||
|
#include <logger/logger.hpp>
|
||||||
|
|
||||||
inline void bake_shader(
|
inline void bake_shader(
|
||||||
const std::filesystem::path &in_path,
|
const std::filesystem::path &in_path,
|
||||||
|
|
@ -13,7 +14,7 @@ inline void bake_shader(
|
||||||
|
|
||||||
auto glsl_path = in_path.string();
|
auto glsl_path = in_path.string();
|
||||||
auto spv_path = std::format("{}.spv", glsl_path);
|
auto spv_path = std::format("{}.spv", glsl_path);
|
||||||
log_trc(
|
lt::log::trace(
|
||||||
"Compiling {} shader {} -> {}",
|
"Compiling {} shader {} -> {}",
|
||||||
type == vertex ? "vertex" : "fragment",
|
type == vertex ? "vertex" : "fragment",
|
||||||
glsl_path,
|
glsl_path,
|
||||||
|
|
@ -46,7 +47,7 @@ inline void bake_shader(
|
||||||
auto bytes = std::vector<std::byte>(size);
|
auto bytes = std::vector<std::byte>(size);
|
||||||
stream.seekg(0, std::ios::beg);
|
stream.seekg(0, std::ios::beg);
|
||||||
stream.read((char *)bytes.data(), size); // NOLINT
|
stream.read((char *)bytes.data(), size); // NOLINT
|
||||||
log_dbg("BYTES: {}", bytes.size());
|
lt::log::debug("BYTES: {}", bytes.size());
|
||||||
stream.close();
|
stream.close();
|
||||||
std::filesystem::remove(spv_path);
|
std::filesystem::remove(spv_path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ void Instrumentor::end_session_impl()
|
||||||
{
|
{
|
||||||
if (m_current_session_count == 0u)
|
if (m_current_session_count == 0u)
|
||||||
{
|
{
|
||||||
log_wrn("0 profiling for the ended session");
|
log::warn("0 profiling for the ended session");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_current_session_count = 0u;
|
m_current_session_count = 0u;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <logger/logger.hpp>
|
|
||||||
#include <source_location>
|
#include <source_location>
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
@ -28,7 +27,6 @@ struct ensure
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<typename Expression_T, typename... Args_T>
|
template<typename Expression_T, typename... Args_T>
|
||||||
ensure(Expression_T, std::format_string<Args_T...>, Args_T &&...)
|
ensure(Expression_T, std::format_string<Args_T...>, Args_T &&...)
|
||||||
-> ensure<Expression_T, Args_T...>;
|
-> ensure<Expression_T, Args_T...>;
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ public:
|
||||||
auto new_capacity = std::max(static_cast<size_t>(identifier + 1), m_sparse.size() * 2);
|
auto new_capacity = std::max(static_cast<size_t>(identifier + 1), m_sparse.size() * 2);
|
||||||
new_capacity = std::min(new_capacity, max_capacity);
|
new_capacity = std::min(new_capacity, max_capacity);
|
||||||
|
|
||||||
// log_dbg("Increasing sparse vector size:", m_dead_count);
|
// log::debug("Increasing sparse vector size:", m_dead_count);
|
||||||
// log_dbg("\tdead_count: {}", m_dead_count);
|
// log::debug("\tdead_count: {}", m_dead_count);
|
||||||
// log_dbg("\talive_count: {}", m_alive_count);
|
// log::debug("\talive_count: {}", m_alive_count);
|
||||||
// log_dbg("\tsparse.size: {} -> {}", m_sparse.size(), new_capacity);
|
// log::debug("\tsparse.size: {} -> {}", m_sparse.size(), new_capacity);
|
||||||
|
|
||||||
m_sparse.resize(new_capacity, null_identifier);
|
m_sparse.resize(new_capacity, null_identifier);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ void System::on_key_press(const lt::surface::KeyPressedEvent &event)
|
||||||
{
|
{
|
||||||
if (event.get_key() > m_keys.size())
|
if (event.get_key() > m_keys.size())
|
||||||
{
|
{
|
||||||
log_dbg(
|
log::debug(
|
||||||
"Key code larger than key container size, implement platform-dependant "
|
"Key code larger than key container size, implement platform-dependant "
|
||||||
"key-code-mapping!"
|
"key-code-mapping!"
|
||||||
);
|
);
|
||||||
|
|
@ -116,7 +116,7 @@ void System::on_key_release(const lt::surface::KeyReleasedEvent &event)
|
||||||
{
|
{
|
||||||
if (event.get_key() > m_keys.size())
|
if (event.get_key() > m_keys.size())
|
||||||
{
|
{
|
||||||
log_dbg(
|
log::debug(
|
||||||
"Key code larger than key container size, implement platform-dependant "
|
"Key code larger than key container size, implement platform-dependant "
|
||||||
"key-code-mapping!"
|
"key-code-mapping!"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <filesystem>
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <source_location>
|
#include <source_location>
|
||||||
#include <string_view>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
@ -78,13 +78,14 @@ struct [[maybe_unused]] print
|
||||||
"{} {} ==> {}",
|
"{} {} ==> {}",
|
||||||
to_string(level, location),
|
to_string(level, location),
|
||||||
std::format("{}:{}", path.filename().c_str(), location.line()),
|
std::format("{}:{}", path.filename().c_str(), location.line()),
|
||||||
std::format(format, std::forward<Args &&>(arguments)...)
|
std::format(format, std::forward<Args>(arguments)...)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
print(Level level, std::format_string<Args...>, Args &&...) noexcept -> print<Args...>;
|
print(Level, const std::source_location &, std::format_string<Args...>, Args &&...) noexcept
|
||||||
|
-> print<Args...>;
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
struct [[maybe_unused]] trace
|
struct [[maybe_unused]] trace
|
||||||
|
|
@ -95,7 +96,7 @@ struct [[maybe_unused]] trace
|
||||||
const std::source_location &location = std::source_location::current()
|
const std::source_location &location = std::source_location::current()
|
||||||
) noexcept
|
) noexcept
|
||||||
{
|
{
|
||||||
print(Level::trace, location, format, std::forward<Args &&>(arguments)...);
|
print(Level::trace, location, format, std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -111,7 +112,7 @@ struct [[maybe_unused]] debug
|
||||||
const std::source_location &location = std::source_location::current()
|
const std::source_location &location = std::source_location::current()
|
||||||
) noexcept
|
) noexcept
|
||||||
{
|
{
|
||||||
print(Level::debug, location, format, std::forward<Args &&>(arguments)...);
|
print(Level::debug, location, format, std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -127,7 +128,7 @@ struct [[maybe_unused]] info
|
||||||
const std::source_location &location = std::source_location::current()
|
const std::source_location &location = std::source_location::current()
|
||||||
) noexcept
|
) noexcept
|
||||||
{
|
{
|
||||||
print(Level::info, location, format, std::forward<Args &&>(arguments)...);
|
print(Level::info, location, format, std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -143,7 +144,7 @@ struct [[maybe_unused]] warn
|
||||||
const std::source_location &location = std::source_location::current()
|
const std::source_location &location = std::source_location::current()
|
||||||
) noexcept
|
) noexcept
|
||||||
{
|
{
|
||||||
print(Level::warn, location, format, std::forward<Args &&>(arguments)...);
|
print(Level::warn, location, format, std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -159,7 +160,7 @@ struct [[maybe_unused]] error
|
||||||
const std::source_location &location = std::source_location::current()
|
const std::source_location &location = std::source_location::current()
|
||||||
) noexcept
|
) noexcept
|
||||||
{
|
{
|
||||||
print(Level::error, location, format, std::forward<Args &&>(arguments)...);
|
print(Level::error, location, format, std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -175,7 +176,7 @@ struct [[maybe_unused]] critical
|
||||||
const std::source_location &location = std::source_location::current()
|
const std::source_location &location = std::source_location::current()
|
||||||
) noexcept
|
) noexcept
|
||||||
{
|
{
|
||||||
print(Level::critical, location, format, std::forward<Args &&>(arguments)...);
|
print(Level::critical, location, format, std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
16
modules/math/public/components/transform.hpp
Normal file
16
modules/math/public/components/transform.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <math/vec3.hpp>
|
||||||
|
|
||||||
|
namespace lt::math::components {
|
||||||
|
|
||||||
|
struct Transform
|
||||||
|
{
|
||||||
|
math::vec3 translation;
|
||||||
|
|
||||||
|
math::vec3 scale;
|
||||||
|
|
||||||
|
math::vec3 rotation;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lt::math::components
|
||||||
|
|
@ -91,8 +91,8 @@ System::~System()
|
||||||
}
|
}
|
||||||
catch (const std::exception &exp)
|
catch (const std::exception &exp)
|
||||||
{
|
{
|
||||||
log_err("Uncaught exception in surface::~System:");
|
log::error("Uncaught exception in surface::~System:");
|
||||||
log_err("\twhat: {}", exp.what());
|
log::error("\twhat: {}", exp.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,9 +189,9 @@ try
|
||||||
}
|
}
|
||||||
catch (const std::exception &exp)
|
catch (const std::exception &exp)
|
||||||
{
|
{
|
||||||
log_err("Exception thrown when on_constructing surface component");
|
log::error("Exception thrown when on_constructing surface component");
|
||||||
log_err("\tentity: {}", entity);
|
log::error("\tentity: {}", entity);
|
||||||
log_err("\twhat: {}", exp.what());
|
log::error("\twhat: {}", exp.what());
|
||||||
m_registry->remove<SurfaceComponent>(entity);
|
m_registry->remove<SurfaceComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ void System::on_surface_destruct(ecs::Registry ®istry, ecs::EntityId entity)
|
||||||
const auto &[display, window, _] = registry.get<SurfaceComponent>(entity).get_native_data();
|
const auto &[display, window, _] = registry.get<SurfaceComponent>(entity).get_native_data();
|
||||||
if (!display)
|
if (!display)
|
||||||
{
|
{
|
||||||
log_wrn("Surface component destroyed with null display");
|
log::warn("Surface component destroyed with null display");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,7 +316,7 @@ void System::handle_requests(SurfaceComponent &surface)
|
||||||
[&](const ModifyResolutionRequest &request) { modify_resolution(surface, request); },
|
[&](const ModifyResolutionRequest &request) { modify_resolution(surface, request); },
|
||||||
[&](const ModifyPositionRequest &request) { modify_position(surface, request); },
|
[&](const ModifyPositionRequest &request) { modify_position(surface, request); },
|
||||||
[&](const ModifyVisibilityRequest &request) { modify_visiblity(surface, request); },
|
[&](const ModifyVisibilityRequest &request) { modify_visiblity(surface, request); },
|
||||||
[&](const auto &) { log_err("Unknown surface request"); },
|
[&](const auto &) { log::error("Unknown surface request"); },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto &request : surface.peek_requests())
|
for (const auto &request : surface.peek_requests())
|
||||||
|
|
@ -380,7 +380,7 @@ void System::modify_resolution(SurfaceComponent &surface, const ModifyResolution
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds { 100 });
|
std::this_thread::sleep_for(std::chrono::microseconds { 100 });
|
||||||
if (timer.elapsed_time() > lifespan)
|
if (timer.elapsed_time() > lifespan)
|
||||||
{
|
{
|
||||||
log_err("Timed out waiting for XResizeWindow's event");
|
log::error("Timed out waiting for XResizeWindow's event");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -419,7 +419,7 @@ void System::modify_position(SurfaceComponent &surface, const ModifyPositionRequ
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds { 100 });
|
std::this_thread::sleep_for(std::chrono::microseconds { 100 });
|
||||||
if (timer.elapsed_time() > lifespan)
|
if (timer.elapsed_time() > lifespan)
|
||||||
{
|
{
|
||||||
log_err("Timed out waiting for XMoveWindow's event");
|
log::error("Timed out waiting for XMoveWindow's event");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -268,11 +268,11 @@ Suite tick_handles_requests = "tick_handles_requests"_suite = [] {
|
||||||
expect_eq(surface.get_position(), position);
|
expect_eq(surface.get_position(), position);
|
||||||
expect_eq(surface.get_resolution(), resolution);
|
expect_eq(surface.get_resolution(), resolution);
|
||||||
|
|
||||||
log_dbg("EVENT COUNT: {}", surface.peek_events().size());
|
log::debug("EVENT COUNT: {}", surface.peek_events().size());
|
||||||
for (const auto &event : surface.peek_events())
|
for (const auto &event : surface.peek_events())
|
||||||
{
|
{
|
||||||
const auto visitor = overloads {
|
const auto visitor = overloads {
|
||||||
[&](auto event) { log_dbg("event: {}", event.to_string()); },
|
[&](auto event) { log::debug("event: {}", event.to_string()); },
|
||||||
};
|
};
|
||||||
|
|
||||||
std::visit(visitor, event);
|
std::visit(visitor, event);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
add_library_module(test test.cpp entrypoint.cpp)
|
add_library_module(test test.cpp entrypoint.cpp)
|
||||||
add_library_module(fuzz_test test.cpp fuzz.cpp)
|
add_library_module(fuzz_test test.cpp fuzz.cpp)
|
||||||
|
|
||||||
target_link_libraries(test PUBLIC tbb logger)
|
target_link_libraries(test PUBLIC logger)
|
||||||
target_link_libraries(fuzz_test PUBLIC tbb logger)
|
target_link_libraries(fuzz_test PUBLIC logger)
|
||||||
|
|
||||||
add_test_module(test test.test.cpp)
|
add_test_module(test test.test.cpp)
|
||||||
|
|
|
||||||
|
|
@ -85,14 +85,14 @@ try
|
||||||
}
|
}
|
||||||
catch (const std::exception &exp)
|
catch (const std::exception &exp)
|
||||||
{
|
{
|
||||||
log_crt("Terminated due to uncaught exception:");
|
lt::log::critical("Terminated due to uncaught exception:");
|
||||||
log_crt("\twhat: {}", exp.what());
|
lt::log::critical("\twhat: {}", exp.what());
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
log_crt("Terminated due to uncaught non-std exception!");
|
lt::log::critical("Terminated due to uncaught non-std exception!");
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue