Style: Rename LT_* Log macros to LOG
This commit is contained in:
parent
b1e60d08b7
commit
dcedb1799c
47 changed files with 2890 additions and 3017 deletions
|
@ -36,7 +36,7 @@ namespace Light {
|
|||
return std::unique_ptr<T>(rawPointer);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
||||
//========== PLATFORM ==========//
|
||||
#define LT_WIN(x) // windows
|
||||
|
@ -62,15 +62,28 @@ namespace Light {
|
|||
|
||||
//====================================================================== OPERATIONS ======================================================================//
|
||||
/* assertions */
|
||||
#define LT_ENGINE_ASSERT(x, ...) { if(!(x)) { LT_ENGINE_CRITICAL(__VA_ARGS__); LT_DEBUG_TRAP(); throw ::Light::FailedEngineAssertion(__FILE__, __LINE__); } }
|
||||
#define LT_CLIENT_ASSERT(x, ...) { if(!(x)) { LT_CLIENT_CRITICAL(__VA_ARGS__); LT_DEBUG_TRAP(); throw ::Light::FailedClientAssertion(__FILE__, __LINE__); } }
|
||||
#define ASSERT(x, ...) \
|
||||
{ \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
LOG(critical, __VA_ARGS__); \
|
||||
LT_DEBUG_TRAP(); \
|
||||
throw ::Light::FailedAssertion(__FILE__, __LINE__); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* bit-wise */
|
||||
#define BIT(x) 1 << x
|
||||
|
||||
/* token */
|
||||
#define LT_PAIR_TOKEN_VALUE_TO_NAME(token) { token, #token }
|
||||
#define LT_PAIR_TOKEN_NAME_TO_VALUE(token) { #token, token }
|
||||
#define LT_PAIR_TOKEN_VALUE_TO_NAME(token) \
|
||||
{ \
|
||||
token, #token \
|
||||
}
|
||||
#define LT_PAIR_TOKEN_NAME_TO_VALUE(token) \
|
||||
{ \
|
||||
#token, token \
|
||||
}
|
||||
#define LT_TOKEN_NAME(token) #token
|
||||
//====================================================================== OPERATIONS ======================================================================//
|
||||
|
||||
|
|
|
@ -21,35 +21,29 @@ int main(int argc, char* argv[])
|
|||
try
|
||||
{
|
||||
application = Light::CreateApplication(argv[0], args);
|
||||
LT_ENGINE_ASSERT(application, "main: Light::Application is not intialized");
|
||||
ASSERT(application, "Light::Application is not intialized");
|
||||
|
||||
for (int i = 0; i < argc; i++)
|
||||
LT_ENGINE_INFO("main: argv[{}]: {}", i, argv[i]);
|
||||
LOG(info, "argv[{}]: {}", i, argv[i]);
|
||||
|
||||
application->GameLoop();
|
||||
}
|
||||
// failed engine assertion
|
||||
catch (Light::FailedEngineAssertion)
|
||||
catch (Light::FailedAssertion)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'FailedEngineAssertion'");
|
||||
LOG(critical, "Terminating due to unhandled 'FailedEngineAssertion'");
|
||||
exitCode = -1;
|
||||
}
|
||||
// failed client assertion
|
||||
catch (Light::FailedClientAssertion)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'FailedClientAssertion'");
|
||||
exitCode = -2;
|
||||
}
|
||||
// gl exception
|
||||
catch (Light::glException)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'glException'");
|
||||
LOG(critical, "Terminating due to unhandled 'glException'");
|
||||
exitCode = -3;
|
||||
}
|
||||
// dx exception
|
||||
catch (Light::dxException)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'dxException'");
|
||||
LOG(critical, "Terminating due to unhandled 'dxException'");
|
||||
exitCode = -4;
|
||||
}
|
||||
|
||||
|
@ -73,26 +67,20 @@ int main(int argc, char* argv[])
|
|||
try
|
||||
{
|
||||
application = Light::CreateApplication();
|
||||
LT_ENGINE_ASSERT(application, "main: Light::Application is not intialized");
|
||||
ASSERT(application, "Light::Application is not intialized");
|
||||
|
||||
application->GameLoop();
|
||||
}
|
||||
// failed engine assertion
|
||||
catch (Light::FailedEngineAssertion)
|
||||
catch (Light::FailedAssertion)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'FailedEngineAssertion'");
|
||||
LOG(critical, "Exitting due to unhandled 'FailedEngineAssertion'");
|
||||
exitCode = -1;
|
||||
}
|
||||
// failed client assertion
|
||||
catch (Light::FailedClientAssertion)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'FailedClientAssertion'");
|
||||
exitCode = -2;
|
||||
}
|
||||
// gl exception
|
||||
catch (Light::glException)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("main: exitting due to unhandled 'glException'");
|
||||
LOG(critical, "main: exitting due to unhandled 'glException'");
|
||||
exitCode = -3;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,41 +41,63 @@
|
|||
#define LT_DEBUG_TRAP() __trap(42)
|
||||
|
||||
#elif defined(__DMC__) && defined(_M_IX86)
|
||||
static inline void LT_DEBUG_TRAP(void) { __asm int 3h; }
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm int 3h;
|
||||
}
|
||||
|
||||
#elif defined(__i386__) || defined(__x86_64__)
|
||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("int3"); }
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__("int3");
|
||||
}
|
||||
|
||||
#elif defined(__thumb__)
|
||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); }
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__(".inst 0xde01");
|
||||
}
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
static inline void LT_DEBUG_TRAP(void) {
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__(".inst 0xd4200000");
|
||||
}
|
||||
|
||||
#elif defined(__arm__)
|
||||
static inline void LT_DEBUG_TRAP(void) {
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__(".inst 0xe7f001f0");
|
||||
}
|
||||
|
||||
#elif defined(__alpha__) && !defined(__osf__)
|
||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); }
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__("bpt");
|
||||
}
|
||||
|
||||
#elif defined(_54_)
|
||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); }
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__("ESTOP");
|
||||
}
|
||||
|
||||
#elif defined(_55_)
|
||||
static inline void LT_DEBUG_TRAP(void) {
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP");
|
||||
}
|
||||
|
||||
#elif defined(_64P_)
|
||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); }
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__("SWBP 0");
|
||||
}
|
||||
|
||||
#elif defined(_6x_)
|
||||
static inline void LT_DEBUG_TRAP(void) {
|
||||
static inline void LT_DEBUG_TRAP(void)
|
||||
{
|
||||
__asm__ __volatile__("NOP\n .word 0x10000000");
|
||||
}
|
||||
|
||||
|
@ -103,23 +125,23 @@ static inline void LT_DEBUG_TRAP(void) {
|
|||
#elif defined(LIGHT_DIST)
|
||||
#ifdef _MSC_VER
|
||||
#define LT_DEBUG_TRAP() \
|
||||
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
|
||||
LOG(critical, "DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
|
||||
__FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
|
||||
|
||||
#else
|
||||
#define LT_DEBUG_TRAP() \
|
||||
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
|
||||
LOG(critical, "DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
|
||||
|
||||
#endif
|
||||
#else /* !defined(LIGHT_DIST) */
|
||||
#ifdef _MSC_VER
|
||||
#define LT_DEBUG_TRAP() \
|
||||
LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
|
||||
LOG(critical, "DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
|
||||
__FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
|
||||
|
||||
#else
|
||||
#define LT_DEBUG_TRAP() \
|
||||
LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
|
||||
LOG(critical, "DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,32 +1,23 @@
|
|||
#include "Application.h"
|
||||
|
||||
#include "Window.h"
|
||||
|
||||
#include "Debug/Instrumentor.h"
|
||||
|
||||
#include "Events/Event.h"
|
||||
|
||||
#include "Graphics/GraphicsContext.h"
|
||||
#include "Graphics/Renderer.h"
|
||||
#include "Graphics/RenderCommand.h"
|
||||
|
||||
#include "Graphics/Renderer.h"
|
||||
#include "Layer/Layer.h"
|
||||
|
||||
#include "Time/Timer.h"
|
||||
|
||||
#include "UserInterface/UserInterface.h"
|
||||
#include "Window.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
Application* Application::s_Context = nullptr;
|
||||
|
||||
Application::Application(std::string execName, std::vector<std::string> args)
|
||||
: m_Instrumentor(nullptr),
|
||||
m_LayerStack(nullptr),
|
||||
m_Input(nullptr),
|
||||
m_Window(nullptr)
|
||||
: m_Instrumentor(nullptr), m_LayerStack(nullptr), m_Input(nullptr), m_Window(nullptr)
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "Application::Application: repeated singleton construction");
|
||||
ASSERT(!s_Context, "Repeated singleton construction");
|
||||
s_Context = this;
|
||||
|
||||
m_Logger = Logger::Create();
|
||||
|
@ -45,14 +36,14 @@ namespace Light {
|
|||
|
||||
Application::~Application()
|
||||
{
|
||||
LT_ENGINE_TRACE("Application::~Application()");
|
||||
LOG(trace, "Application::~Application()");
|
||||
m_Instrumentor->EndSession(); // ProfileResults_Termination //
|
||||
}
|
||||
|
||||
void Application::GameLoop()
|
||||
{
|
||||
// check
|
||||
LT_ENGINE_ASSERT(!m_LayerStack->IsEmpty(), "Application::GameLoop(pre): LayerStack is empty");
|
||||
ASSERT(!m_LayerStack->IsEmpty(), "LayerStack is empty");
|
||||
|
||||
// log debug data
|
||||
m_Logger->LogDebugData();
|
||||
|
@ -140,17 +131,18 @@ namespace Light {
|
|||
|
||||
/* layers */
|
||||
for (auto it = m_LayerStack->rbegin(); it != m_LayerStack->rend(); it++)
|
||||
if ((*it)->OnEvent(event)) return;
|
||||
if ((*it)->OnEvent(event))
|
||||
return;
|
||||
}
|
||||
|
||||
void Application::LogDebugData()
|
||||
{
|
||||
// #todo: log more information
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LT_ENGINE_INFO("Platform::");
|
||||
LT_ENGINE_INFO(" OS: {}", LT_BUILD_PLATFORM);
|
||||
LT_ENGINE_INFO(" DIR: {}", std::filesystem::current_path().generic_string());
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LOG(info, "________________________________________");
|
||||
LOG(info, "Platform::");
|
||||
LOG(info, " OS: {}", LT_BUILD_PLATFORM);
|
||||
LOG(info, " DIR: {}", std::filesystem::current_path().generic_string());
|
||||
LOG(info, "________________________________________");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -10,32 +10,26 @@
|
|||
|
||||
namespace Light {
|
||||
|
||||
FailedEngineAssertion::FailedEngineAssertion(const char* file, int line)
|
||||
FailedAssertion::FailedAssertion(const char* file, int line)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("FailedAssertion::FailedAssertion: engine assertion failed in: {} (line {})", file, line);
|
||||
}
|
||||
|
||||
FailedClientAssertion::FailedClientAssertion(const char* file, int line)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("FailedClientAssertion::FailedClientAssertion: client assertion failed in: {} (line {})", file, line);
|
||||
LOG(critical, "Assertion failed in: {} (line {})", file, line);
|
||||
}
|
||||
|
||||
glException::glException(unsigned int source, unsigned int type, unsigned int id, const char* msg)
|
||||
{
|
||||
// #todo: improve
|
||||
LT_ENGINE_CRITICAL("________________________________________");
|
||||
LT_ENGINE_CRITICAL("glException::glException::");
|
||||
LT_ENGINE_CRITICAL(" Severity: {}", Stringifier::glDebugMsgSeverity(GL_DEBUG_SEVERITY_HIGH));
|
||||
LT_ENGINE_CRITICAL(" Source : {}", Stringifier::glDebugMsgSource(source));
|
||||
LT_ENGINE_CRITICAL(" Type : {}", Stringifier::glDebugMsgType(type));
|
||||
LT_ENGINE_CRITICAL(" ID : {}", id);
|
||||
LT_ENGINE_CRITICAL(" Vendor : {}", glGetString(GL_VENDOR));
|
||||
LT_ENGINE_CRITICAL(" Renderer: {}", glGetString(GL_RENDERER));
|
||||
LT_ENGINE_CRITICAL(" Version : {}", glGetString(GL_VERSION));
|
||||
LT_ENGINE_CRITICAL(" SVersion: {}", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
LT_ENGINE_CRITICAL(" {}", msg);
|
||||
|
||||
LT_ENGINE_CRITICAL("________________________________________");
|
||||
LOG(critical, "________________________________________");
|
||||
LOG(critical, "glException::glException::");
|
||||
LOG(critical, " Severity: {}", Stringifier::glDebugMsgSeverity(GL_DEBUG_SEVERITY_HIGH));
|
||||
LOG(critical, " Source : {}", Stringifier::glDebugMsgSource(source));
|
||||
LOG(critical, " Type : {}", Stringifier::glDebugMsgType(type));
|
||||
LOG(critical, " ID : {}", id);
|
||||
LOG(critical, " Vendor : {}", glGetString(GL_VENDOR));
|
||||
LOG(critical, " Renderer: {}", glGetString(GL_RENDERER));
|
||||
LOG(critical, " Version : {}", glGetString(GL_VERSION));
|
||||
LOG(critical, " critical, SVersion: {}", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
LOG(critical, " {}", msg);
|
||||
LOG(critical, "________________________________________");
|
||||
}
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -48,14 +42,14 @@ namespace Light {
|
|||
(LPSTR)(&message), NULL, nullptr);
|
||||
|
||||
// #todo: improve
|
||||
LT_ENGINE_CRITICAL("________________________________________");
|
||||
LT_ENGINE_CRITICAL("dxException::dxException::");
|
||||
LT_ENGINE_CRITICAL(" File: {}, Line: {}", file, line);
|
||||
LT_ENGINE_CRITICAL(" {}", message);
|
||||
LT_ENGINE_CRITICAL("________________________________________");
|
||||
LOG(critical, "________________________________________");
|
||||
LOG(critical, "dxException::dxException::");
|
||||
LOG(critical, " File: {}, Line: {}", file, line);
|
||||
LOG(critical, " {}", message);
|
||||
LOG(critical, "________________________________________");
|
||||
|
||||
LocalFree(message);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#define DXC(x) DXC_NO_REDIFINITION(x, __LINE__)
|
||||
|
||||
#define DXC_NO_REDIFINITION(x, line) DXC_NO_REDIFINITION2(x, line)
|
||||
#define DXC_NO_REDIFINITION2(x, line) HRESULT hr##line; if(FAILED(hr##line = x)) throw dxException(hr##line, __FILE__, line)
|
||||
|
||||
#define DXC_NO_REDIFINITION2(x, line) \
|
||||
HRESULT hr##line; \
|
||||
if (FAILED(hr##line = x)) \
|
||||
throw dxException(hr##line, __FILE__, line)
|
||||
|
||||
namespace Light {
|
||||
|
||||
struct FailedEngineAssertion : std::exception
|
||||
struct FailedAssertion: std::exception
|
||||
{
|
||||
FailedEngineAssertion(const char* file, int line);
|
||||
};
|
||||
|
||||
struct FailedClientAssertion : std::exception
|
||||
{
|
||||
FailedClientAssertion(const char* file, int line);
|
||||
FailedAssertion(const char* file, int line);
|
||||
};
|
||||
|
||||
// OpenGL
|
||||
|
@ -30,4 +30,4 @@ namespace Light {
|
|||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Light {
|
|||
: m_CurrentSessionCount(0u)
|
||||
{
|
||||
// #todo: maintenance
|
||||
LT_ENGINE_ASSERT(!s_Context, "Instrumentor::Instrumentor: an instance of 'Instrumentor' already exists, do not construct this class!");
|
||||
ASSERT(!s_Context, "An instance of 'Instrumentor' already exists, do not construct this class!");
|
||||
s_Context = this;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace Light {
|
|||
void Instrumentor::EndSessionImpl()
|
||||
{
|
||||
if (m_CurrentSessionCount == 0u)
|
||||
LT_ENGINE_WARN("Instrumentor::EndSessionImpl: 0 profiling for the ended session");
|
||||
LOG(warn, "0 profiling for the ended session");
|
||||
|
||||
m_CurrentSessionCount = 0u;
|
||||
|
||||
|
@ -69,4 +69,4 @@ namespace Light {
|
|||
Instrumentor::SubmitScopeProfile(m_Result);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "Logger.h"
|
||||
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
#include <spdlog/sinks/basic_file_sink.h>
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -13,25 +13,19 @@ namespace Light {
|
|||
}
|
||||
|
||||
Logger::Logger()
|
||||
: m_EngineLogger(nullptr),
|
||||
m_ClientLogger(nullptr),
|
||||
m_FileLogger(nullptr),
|
||||
m_LogFilePath(LT_LOG_FILE_LOCATION)
|
||||
: m_EngineLogger(nullptr), m_FileLogger(nullptr), m_LogFilePath(LT_LOG_FILE_LOCATION)
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "Logger::Logger: an instance of 'Logger' already exists, do not construct this class!");
|
||||
ASSERT(!s_Context, "An instance of 'Logger' already exists, do not construct this class!");
|
||||
s_Context = this;
|
||||
|
||||
// set spdlog pattern
|
||||
#if defined(LIGHT_PLATFORM_WINDOWS)
|
||||
spdlog::set_pattern("%^[%M:%S:%e] <%n>: %v%$");
|
||||
#elif defined(LIGHT_PLATFORM_LINUX)
|
||||
spdlog::set_pattern("%^{%l} - [%M:%S:%e] <%n>: %v%$");
|
||||
#endif
|
||||
// create loggers
|
||||
spdlog::set_pattern("%^[%H:%M:%S]%g@%! ==> %v%$");
|
||||
#ifndef LIGHT_DIST
|
||||
spdlog::set_pattern("%^[%H:%M:%S]%! ==> %v%$");
|
||||
m_EngineLogger = spdlog::stdout_color_mt("Engine");
|
||||
m_ClientLogger = spdlog::stdout_color_mt("Client");
|
||||
#endif
|
||||
|
||||
m_FileLogger = spdlog::basic_logger_mt("File", m_LogFilePath);
|
||||
m_FileLogger->set_pattern("%^[%M:%S:%e] <%l>: %v%$");
|
||||
|
||||
|
@ -48,13 +42,12 @@ namespace Light {
|
|||
void Logger::LogDebugData()
|
||||
{
|
||||
// #todo: improve
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LT_ENGINE_INFO("Logger::");
|
||||
LT_ENGINE_INFO(" ClientLevel : {}", Stringifier::spdlogLevel(m_ClientLogger->level()));
|
||||
LT_ENGINE_INFO(" EngineLevel : {}", Stringifier::spdlogLevel(m_EngineLogger->level()));
|
||||
LT_ENGINE_INFO(" FileLevel : {}", Stringifier::spdlogLevel(m_FileLogger->level()));
|
||||
LT_ENGINE_INFO(" DefaultLevel: {}", Stringifier::spdlogLevel(spdlog::get_level()));
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LOG(info, "________________________________________");
|
||||
LOG(info, "Logger::");
|
||||
LOG(info, " EngineLevel : {}", Stringifier::spdlogLevel(m_EngineLogger->level()));
|
||||
LOG(info, " FileLevel : {}", Stringifier::spdlogLevel(m_FileLogger->level()));
|
||||
LOG(info, " DefaultLevel: {}", Stringifier::spdlogLevel(spdlog::get_level()));
|
||||
LOG(info, "________________________________________");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -6,41 +6,12 @@
|
|||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
// LOGGER MACROS //
|
||||
|
||||
#define LT_LOG_FILE_LOCATION "Logs/Logger.txt"
|
||||
|
||||
// File
|
||||
#define LT_FILE_INFO(...) ::Light::Logger::GetFileLogger()->log(spdlog::level::info , __VA_ARGS__)
|
||||
#define LT_FILE_WARN(...) ::Light::Logger::GetFileLogger()->log(spdlog::level::warn , __VA_ARGS__)
|
||||
#define LT_FILE_ERROR(...) ::Light::Logger::GetFileLogger()->log(spdlog::level::err , __VA_ARGS__)
|
||||
#define LT_FILE_CRITICAL(...) ::Light::Logger::GetFileLogger()->log(spdlog::level::critical, __VA_ARGS__)
|
||||
|
||||
#ifndef LIGHT_DIST
|
||||
// Engine
|
||||
#define LT_ENGINE_TRACE(...) ::Light::Logger::GetEngineLogger()->log(spdlog::level::trace , __VA_ARGS__)
|
||||
#define LT_ENGINE_INFO(...) ::Light::Logger::GetEngineLogger()->log(spdlog::level::info , __VA_ARGS__)
|
||||
#define LT_ENGINE_WARN(...) ::Light::Logger::GetEngineLogger()->log(spdlog::level::warn , __VA_ARGS__)
|
||||
#define LT_ENGINE_ERROR(...) ::Light::Logger::GetEngineLogger()->log(spdlog::level::err , __VA_ARGS__)
|
||||
#define LT_ENGINE_CRITICAL(...) ::Light::Logger::GetEngineLogger()->log(spdlog::level::critical, __VA_ARGS__)
|
||||
|
||||
// Client
|
||||
#define LT_CLIENT_TRACE(...) ::Light::Logger::GetClientLogger()->log(spdlog::level::trace , __VA_ARGS__)
|
||||
#define LT_CLIENT_INFO(...) ::Light::Logger::GetClientLogger()->log(spdlog::level::info , __VA_ARGS__)
|
||||
#define LT_CLIENT_WARN(...) ::Light::Logger::GetClientLogger()->log(spdlog::level::warn , __VA_ARGS__)
|
||||
#define LT_CLIENT_ERROR(...) ::Light::Logger::GetClientLogger()->log(spdlog::level::err , __VA_ARGS__)
|
||||
#define LT_CLIENT_CRITICAL(...) ::Light::Logger::GetClientLogger()->log(spdlog::level::critical, __VA_ARGS__)
|
||||
#define LOG(logLevel, ...) SPDLOG_LOGGER_CALL(::Light::Logger::GetEngineLogger(), spdlog::level::logLevel, __VA_ARGS__)
|
||||
#else
|
||||
#define LT_ENGINE_TRACE(...)
|
||||
#define LT_ENGINE_INFO(...)
|
||||
#define LT_ENGINE_WARN(...)
|
||||
#define LT_ENGINE_ERROR(...)
|
||||
#define LT_ENGINE_CRITICAL(...)
|
||||
#define LT_CLIENT_TRACE(...)
|
||||
#define LT_CLIENT_INFO(...)
|
||||
#define LT_CLIENT_WARN(...)
|
||||
#define LT_CLIENT_ERROR(...)
|
||||
#define LT_CLIENT_CRITICAL(...)
|
||||
#define LOG(logLevel, ...) SPDLOG_LOGGER_CALL(::Light::Logger::GetFileLogger(), spdlog::level::logLevel, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
namespace Light {
|
||||
|
@ -52,14 +23,13 @@ namespace Light {
|
|||
static Logger* s_Context;
|
||||
|
||||
private:
|
||||
Ref<spdlog::logger> m_EngineLogger, m_ClientLogger, m_FileLogger;
|
||||
Ref<spdlog::logger> m_EngineLogger, m_FileLogger;
|
||||
std::string m_LogFilePath;
|
||||
|
||||
public:
|
||||
static Scope<Logger> Create();
|
||||
|
||||
static inline Ref<spdlog::logger> GetEngineLogger() { return s_Context->m_EngineLogger; }
|
||||
static inline Ref<spdlog::logger> GetClientLogger() { return s_Context->m_ClientLogger; }
|
||||
static inline Ref<spdlog::logger> GetFileLogger() { return s_Context->m_FileLogger; }
|
||||
|
||||
void LogDebugData();
|
||||
|
@ -68,6 +38,6 @@ namespace Light {
|
|||
Logger();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
||||
#endif
|
|
@ -1,4 +1,5 @@
|
|||
#include "Blender.h"
|
||||
|
||||
#include "OpenGL/glBlender.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -21,8 +22,8 @@ namespace Light {
|
|||
return CreateScope<dxBlender>(std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "Blender::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "Buffers.h"
|
||||
#include "OpenGL/glBuffers.h"
|
||||
|
||||
#include "OpenGL/glBuffers.h"
|
||||
#include "SharedContext.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -24,7 +24,7 @@ namespace Light {
|
|||
return CreateScope<dxConstantBuffer>(index, size, std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "ConstantBuffer::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace Light {
|
|||
return CreateRef<dxVertexBuffer>(vertices, stride, count, std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "VertexBuffer::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ namespace Light {
|
|||
return CreateRef<dxIndexBuffer>(indices, count, std::dynamic_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "IndexBuffer::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
//======================================== INDEX_BUFFER ========================================//
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Framebuffer.h"
|
||||
|
||||
#include "OpenGL/glFramebuffer.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -21,9 +22,9 @@ namespace Light {
|
|||
return CreateRef<dxFramebuffer>(specification, std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "Shader::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "GraphicsContext.h"
|
||||
|
||||
#include "OpenGL/glGraphicsContext.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -8,11 +9,9 @@
|
|||
|
||||
#include "Blender.h" // required for forward declaration
|
||||
#include "Buffers.h" // required for forward declaration
|
||||
#include "Renderer.h" // required for forward declaration
|
||||
#include "RenderCommand.h" // required for forward declaration
|
||||
|
||||
#include "Renderer.h" // required for forward declaration
|
||||
#include "UserInterface/UserInterface.h" // required for forward declaration
|
||||
|
||||
#include "Utility/ResourceManager.h" // required for forward declaration
|
||||
|
||||
namespace Light {
|
||||
|
@ -62,7 +61,7 @@ namespace Light {
|
|||
break;)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "GraphicsContext::Create: invalid/unsupported 'GraphicsAPI' {}", Stringifier::GraphicsAPIToString(api));
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", Stringifier::GraphicsAPIToString(api));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -71,10 +70,10 @@ namespace Light {
|
|||
s_Context->m_Renderer = Renderer::Create(windowHandle, s_Context->m_SharedContext);
|
||||
|
||||
// check
|
||||
LT_ENGINE_ASSERT(s_Context->m_UserInterface, "GraphicsContext::Create: failed to create UserInterface");
|
||||
LT_ENGINE_ASSERT(s_Context->m_Renderer, "GraphicsContext::Create: failed to create Renderer");
|
||||
ASSERT(s_Context->m_UserInterface, "Failed to create UserInterface");
|
||||
ASSERT(s_Context->m_Renderer, "Failed to create Renderer");
|
||||
|
||||
return std::move(scopeGfx);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "RenderCommand.h"
|
||||
|
||||
#include "OpenGL/glRenderCommand.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -21,9 +22,9 @@ namespace Light {
|
|||
return CreateScope<dxRenderCommand>((std::static_pointer_cast<dxSharedContext>)(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "RenderCommand::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -19,7 +19,7 @@ Renderer* Renderer::s_Context = nullptr;
|
|||
Renderer::Renderer(GLFWwindow* windowHandle, Ref<SharedContext> sharedContext)
|
||||
: m_QuadRenderer(LT_MAX_QUAD_RENDERER_VERTICES, sharedContext), m_TextureRenderer(LT_MAX_TEXTURE_RENDERER_VERTICES, sharedContext), m_TintedTextureRenderer(LT_MAX_TINTED_TEXTURE_RENDERER_VERTICES, sharedContext), m_ViewProjectionBuffer(nullptr), m_RenderCommand(nullptr), m_Blender(nullptr), m_DefaultFramebufferCamera(nullptr), m_TargetFramebuffer(nullptr), m_ShouldClearBackbuffer(false)
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "Renderer::Renderer: an instance of 'Renderer' already exists, do not construct this class!");
|
||||
ASSERT(!s_Context, "An instance of 'Renderer' already exists, do not construct this class!");
|
||||
s_Context = this;
|
||||
|
||||
m_ViewProjectionBuffer = ConstantBuffer::Create(ConstantBufferIndex::ViewProjection, sizeof(glm::mat4), sharedContext);
|
||||
|
@ -87,7 +87,7 @@ void Renderer::DrawQuadImpl(const glm::mat4& transform, const glm::vec4& tint)
|
|||
// advance
|
||||
if (!m_QuadRenderer.Advance())
|
||||
{
|
||||
LT_ENGINE_WARN("Renderer::DrawQuadImpl: exceeded LT_MAX_QUAD_RENDERER_VERTICES: {}", LT_MAX_QUAD_RENDERER_VERTICES);
|
||||
LOG(warn, "Exceeded LT_MAX_QUAD_RENDERER_VERTICES: {}", LT_MAX_QUAD_RENDERER_VERTICES);
|
||||
FlushScene();
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ void Renderer::DrawQuadImpl(const glm::mat4& transform, const glm::vec4& tint)
|
|||
void Renderer::DrawQuadImpl(const glm::mat4& transform, Ref<Texture> texture)
|
||||
{
|
||||
// #todo: implement a proper binding
|
||||
LT_ENGINE_ASSERT(texture, "Invalid texture passed to Renderer::DrawQuadImpl");
|
||||
ASSERT(texture, "Texture passed to Renderer::DrawQuadImpl");
|
||||
texture->Bind();
|
||||
|
||||
// locals
|
||||
|
@ -122,7 +122,7 @@ void Renderer::DrawQuadImpl(const glm::mat4& transform, Ref<Texture> texture)
|
|||
// advance
|
||||
if (!m_TextureRenderer.Advance())
|
||||
{
|
||||
LT_ENGINE_WARN("Renderer::DrawQuadImpl: exceeded LT_MAX_TEXTURE_RENDERER_VERTICES: {}", LT_MAX_TEXTURE_RENDERER_VERTICES);
|
||||
LOG(warn, "Exceeded LT_MAX_TEXTURE_RENDERER_VERTICES: {}", LT_MAX_TEXTURE_RENDERER_VERTICES);
|
||||
FlushScene();
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void Renderer::DrawQuadImpl(const glm::mat4& transform, Ref<Texture> texture)
|
|||
void Renderer::DrawQuadImpl(const glm::mat4& transform, const glm::vec4& tint, Ref<Texture> texture)
|
||||
{
|
||||
// #todo: implement a proper binding
|
||||
LT_ENGINE_ASSERT(texture, "Invalid texture passed to Renderer::DrawQuadImpl");
|
||||
ASSERT(texture, "Texture passed to Renderer::DrawQuadImpl");
|
||||
texture->Bind();
|
||||
|
||||
// locals
|
||||
|
@ -159,7 +159,7 @@ void Renderer::DrawQuadImpl(const glm::mat4& transform, const glm::vec4& tint, R
|
|||
// advance
|
||||
if (!m_TintedTextureRenderer.Advance())
|
||||
{
|
||||
LT_ENGINE_WARN("Renderer::DrawQuadImpl: exceeded LT_MAX_TEXTURE_RENDERER_VERTICES: {}", LT_MAX_TEXTURE_RENDERER_VERTICES);
|
||||
LOG(warn, "Exceeded LT_MAX_TEXTURE_RENDERER_VERTICES: {}", LT_MAX_TEXTURE_RENDERER_VERTICES);
|
||||
FlushScene();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
#include "QuadRendererProgram.h"
|
||||
|
||||
#include "Camera/Camera.h"
|
||||
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/Buffers.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/VertexLayout.h"
|
||||
|
||||
#include "Utility/ResourceManager.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
QuadRendererProgram::QuadRendererProgram(unsigned int maxVertices, Ref<SharedContext> sharedContext)
|
||||
: m_Shader(nullptr),
|
||||
m_IndexBuffer(nullptr),
|
||||
m_VertexLayout(nullptr),
|
||||
m_MapCurrent(nullptr),
|
||||
m_MapEnd(nullptr),
|
||||
m_QuadCount(0u),
|
||||
m_MaxVertices(maxVertices)
|
||||
: m_Shader(nullptr), m_IndexBuffer(nullptr), m_VertexLayout(nullptr), m_MapCurrent(nullptr), m_MapEnd(nullptr), m_QuadCount(0u), m_MaxVertices(maxVertices)
|
||||
{
|
||||
// #todo: don't use relative path
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_QUAD_SHADER", "Assets/Shaders/Quad/Quad_VS.glsl", "Assets/Shaders/Quad/Quad_PS.glsl");
|
||||
|
@ -25,8 +17,7 @@ namespace Light {
|
|||
m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_QUAD_SHADER");
|
||||
m_VertexBuffer = Ref<VertexBuffer>(VertexBuffer::Create(nullptr, sizeof(QuadVertexData), maxVertices, sharedContext));
|
||||
m_IndexBuffer = Ref<IndexBuffer>(IndexBuffer::Create(nullptr, (maxVertices / 4) * 6, sharedContext));
|
||||
m_VertexLayout = Ref<VertexLayout>(VertexLayout::Create(m_VertexBuffer, m_Shader, { { "POSITION", VertexElementType::Float4 },
|
||||
{ "COLOR" , VertexElementType::Float4 }}, sharedContext));
|
||||
m_VertexLayout = Ref<VertexLayout>(VertexLayout::Create(m_VertexBuffer, m_Shader, { { "POSITION", VertexElementType::Float4 }, { "COLOR", VertexElementType::Float4 } }, sharedContext));
|
||||
}
|
||||
|
||||
bool QuadRendererProgram::Advance()
|
||||
|
@ -35,7 +26,7 @@ namespace Light {
|
|||
|
||||
if (m_MapCurrent >= m_MapEnd)
|
||||
{
|
||||
LT_ENGINE_WARN("QuadRendererProgram::Advance: 'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices);
|
||||
LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -64,4 +55,4 @@ namespace Light {
|
|||
m_IndexBuffer->Bind();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
#include "TextureRendererProgram.h"
|
||||
|
||||
#include "Camera/Camera.h"
|
||||
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/Buffers.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/VertexLayout.h"
|
||||
|
||||
#include "Utility/ResourceManager.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
TextureRendererProgram::TextureRendererProgram(unsigned int maxVertices, Ref<SharedContext> sharedContext)
|
||||
: m_Shader(nullptr),
|
||||
m_IndexBuffer(nullptr),
|
||||
m_VertexLayout(nullptr),
|
||||
m_MapCurrent(nullptr),
|
||||
m_MapEnd(nullptr),
|
||||
m_QuadCount(0u),
|
||||
m_MaxVertices(maxVertices)
|
||||
: m_Shader(nullptr), m_IndexBuffer(nullptr), m_VertexLayout(nullptr), m_MapCurrent(nullptr), m_MapEnd(nullptr), m_QuadCount(0u), m_MaxVertices(maxVertices)
|
||||
{
|
||||
// #todo: don't use relative path
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER", "Assets/Shaders/Texture/Texture_VS.glsl", "Assets/Shaders/Texture/Texture_PS.glsl");
|
||||
|
@ -25,15 +17,14 @@ namespace Light {
|
|||
m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER");
|
||||
m_VertexBuffer = Ref<VertexBuffer>(VertexBuffer::Create(nullptr, sizeof(TextureVertexData), maxVertices, sharedContext));
|
||||
m_IndexBuffer = Ref<IndexBuffer>(IndexBuffer::Create(nullptr, (maxVertices / 4) * 6, sharedContext));
|
||||
m_VertexLayout = Ref<VertexLayout>(VertexLayout::Create(m_VertexBuffer, m_Shader, { { "POSITION", VertexElementType::Float4 },
|
||||
{ "TEXCOORD", VertexElementType::Float2 }}, sharedContext));
|
||||
m_VertexLayout = Ref<VertexLayout>(VertexLayout::Create(m_VertexBuffer, m_Shader, { { "POSITION", VertexElementType::Float4 }, { "TEXCOORD", VertexElementType::Float2 } }, sharedContext));
|
||||
}
|
||||
|
||||
bool TextureRendererProgram::Advance()
|
||||
{
|
||||
if (m_MapCurrent + 4 >= m_MapEnd)
|
||||
{
|
||||
LT_ENGINE_WARN("TextureRendererProgram::Advance: 'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices);
|
||||
LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -63,4 +54,4 @@ namespace Light {
|
|||
m_IndexBuffer->Bind();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
#include "TintedTextureRendererProgram.h"
|
||||
|
||||
#include "Camera/Camera.h"
|
||||
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/Buffers.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/VertexLayout.h"
|
||||
|
||||
#include "Utility/ResourceManager.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
TintedTextureRendererProgram::TintedTextureRendererProgram(unsigned int maxVertices, Ref<SharedContext> sharedContext)
|
||||
: m_Shader(nullptr),
|
||||
m_IndexBuffer(nullptr),
|
||||
m_VertexLayout(nullptr),
|
||||
m_MapCurrent(nullptr),
|
||||
m_MapEnd(nullptr),
|
||||
m_QuadCount(0u),
|
||||
m_MaxVertices(maxVertices)
|
||||
: m_Shader(nullptr), m_IndexBuffer(nullptr), m_VertexLayout(nullptr), m_MapCurrent(nullptr), m_MapEnd(nullptr), m_QuadCount(0u), m_MaxVertices(maxVertices)
|
||||
{
|
||||
// #todo: don't use relative path
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER", "Assets/Shaders/TintedTexture/TintedTexture_VS.glsl", "Assets/Shaders/TintedTexture/TintedTexture_PS.glsl");
|
||||
|
@ -25,9 +17,7 @@ namespace Light {
|
|||
m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER");
|
||||
m_VertexBuffer = Ref<VertexBuffer>(VertexBuffer::Create(nullptr, sizeof(TintedTextureVertexData), maxVertices, sharedContext));
|
||||
m_IndexBuffer = Ref<IndexBuffer>(IndexBuffer::Create(nullptr, (maxVertices / 4) * 6, sharedContext));
|
||||
m_VertexLayout = Ref<VertexLayout>(VertexLayout::Create(m_VertexBuffer, m_Shader, { { "POSITION", VertexElementType::Float4 },
|
||||
{ "TINT" , VertexElementType::Float4 },
|
||||
{ "TEXCOORD", VertexElementType::Float2 }}, sharedContext));
|
||||
m_VertexLayout = Ref<VertexLayout>(VertexLayout::Create(m_VertexBuffer, m_Shader, { { "POSITION", VertexElementType::Float4 }, { "TINT", VertexElementType::Float4 }, { "TEXCOORD", VertexElementType::Float2 } }, sharedContext));
|
||||
}
|
||||
|
||||
bool TintedTextureRendererProgram::Advance()
|
||||
|
@ -36,7 +26,7 @@ namespace Light {
|
|||
|
||||
if (m_MapCurrent >= m_MapEnd)
|
||||
{
|
||||
LT_ENGINE_WARN("TintedTextureRendererProgram::Advance: 'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices);
|
||||
LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -65,4 +55,4 @@ namespace Light {
|
|||
m_IndexBuffer->Bind();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Shader.h"
|
||||
|
||||
#include "OpenGL/glShader.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -22,9 +23,9 @@ namespace Light {
|
|||
return CreateRef<dxShader>(vertexFile, pixelFile, std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "Shader::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Texture.h"
|
||||
|
||||
#include "OpenGL/glTexture.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -21,14 +22,14 @@ namespace Light {
|
|||
return CreateRef<dxTexture>(width, height, components, pixels, std::static_pointer_cast<dxSharedContext>(sharedContext), filePath);)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "Texture::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Texture::Texture(const std::string& filePath):
|
||||
m_FilePath(filePath)
|
||||
Texture::Texture(const std::string& filePath)
|
||||
: m_FilePath(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "VertexLayout.h"
|
||||
|
||||
#include "OpenGL/glVertexLayout.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -21,9 +22,9 @@ namespace Light {
|
|||
return CreateRef<dxVertexLayout>(shader, elements, std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "VertexLayout::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "Invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
#include "ltpch.h"
|
||||
#include "Input.h"
|
||||
|
||||
#include "Events/Event.h"
|
||||
#include "Events/CharEvent.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/Event.h"
|
||||
#include "Events/KeyboardEvents.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Input/KeyCodes.h"
|
||||
#include "ltpch.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include "Input/KeyCodes.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
Input* Input::s_Context = nullptr;
|
||||
|
@ -20,15 +19,9 @@ namespace Light {
|
|||
}
|
||||
|
||||
Input::Input()
|
||||
: m_KeyboadKeys{},
|
||||
m_MouseButtons{},
|
||||
m_MousePosition{},
|
||||
m_MouseDelta{},
|
||||
m_MouseWheelDelta{},
|
||||
m_UserInterfaceEvents(true),
|
||||
m_GameEvents(true)
|
||||
: m_KeyboadKeys {}, m_MouseButtons {}, m_MousePosition {}, m_MouseDelta {}, m_MouseWheelDelta {}, m_UserInterfaceEvents(true), m_GameEvents(true)
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "Input::Input: an instance of 'Input' already exists, do not construct this class!");
|
||||
ASSERT(!s_Context, "Input::Input: an instance of 'Input' already exists, do not construct this class!");
|
||||
s_Context = this;
|
||||
|
||||
RestartInputState();
|
||||
|
@ -157,4 +150,4 @@ namespace Light {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#include "LayerStack.h"
|
||||
|
||||
#include "Layer.h"
|
||||
|
||||
#include "Events/Event.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/KeyboardEvents.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/WindowEvents.h"
|
||||
#include "Layer.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -17,11 +16,9 @@ namespace Light {
|
|||
}
|
||||
|
||||
LayerStack::LayerStack()
|
||||
: m_Layers{},
|
||||
m_Begin(),
|
||||
m_End()
|
||||
: m_Layers {}, m_Begin(), m_End()
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "LayerStack::LayerStack: an instance of 'LayerStack' already exists, do not construct this class!")
|
||||
ASSERT(!s_Context, "An instance of 'LayerStack' already exists, do not construct this class!")
|
||||
s_Context = this;
|
||||
}
|
||||
|
||||
|
@ -38,7 +35,7 @@ namespace Light {
|
|||
m_Begin = m_Layers.begin();
|
||||
m_End = m_Layers.end();
|
||||
|
||||
LT_ENGINE_TRACE("LayerStack::PushLayer: Attached [{}]", layer->GetName());
|
||||
LOG(trace, "Attached [{}]", layer->GetName());
|
||||
}
|
||||
|
||||
void LayerStack::DetachLayerImpl(Layer* layer)
|
||||
|
@ -48,7 +45,7 @@ namespace Light {
|
|||
m_Begin = m_Layers.begin();
|
||||
m_End = m_Layers.end();
|
||||
|
||||
LT_ENGINE_TRACE("LayerStack::PushLayer: Detached[{}]", layer->GetName());
|
||||
LOG(trace, "Detached [{}]", layer->GetName());
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "Components.h"
|
||||
#include "Entity.h"
|
||||
|
||||
#include "Graphics/Renderer.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
@ -22,9 +21,7 @@ namespace Light {
|
|||
{
|
||||
/* native scripts */
|
||||
{
|
||||
m_Registry.view<NativeScriptComponent>().
|
||||
each([](NativeScriptComponent& nsc)
|
||||
{
|
||||
m_Registry.view<NativeScriptComponent>().each([](NativeScriptComponent& nsc) {
|
||||
if (nsc.instance == nullptr)
|
||||
{
|
||||
nsc.instance = nsc.CreateInstance();
|
||||
|
@ -38,9 +35,7 @@ namespace Light {
|
|||
{
|
||||
/* native scripts */
|
||||
{
|
||||
m_Registry.view<NativeScriptComponent>().
|
||||
each([=](NativeScriptComponent& nsc)
|
||||
{
|
||||
m_Registry.view<NativeScriptComponent>().each([=](NativeScriptComponent& nsc) {
|
||||
nsc.instance->OnUpdate(deltaTime);
|
||||
});
|
||||
}
|
||||
|
@ -53,10 +48,7 @@ namespace Light {
|
|||
|
||||
/* scene camera */
|
||||
{
|
||||
m_Registry.group(entt::get<TransformComponent, CameraComponent>).
|
||||
each([&](TransformComponent& transformComp, CameraComponent& cameraComp)
|
||||
{
|
||||
|
||||
m_Registry.group(entt::get<TransformComponent, CameraComponent>).each([&](TransformComponent& transformComp, CameraComponent& cameraComp) {
|
||||
if (cameraComp.isPrimary)
|
||||
{
|
||||
sceneCamera = &cameraComp.camera;
|
||||
|
@ -71,9 +63,7 @@ namespace Light {
|
|||
{
|
||||
Renderer::BeginScene(sceneCamera, *sceneCameraTransform, targetFrameBuffer);
|
||||
|
||||
m_Registry.group(entt::get<TransformComponent, SpriteRendererComponent>).
|
||||
each([](TransformComponent& transformComp, SpriteRendererComponent& spriteRendererComp)
|
||||
{
|
||||
m_Registry.group(entt::get<TransformComponent, SpriteRendererComponent>).each([](TransformComponent& transformComp, SpriteRendererComponent& spriteRendererComp) {
|
||||
Renderer::DrawQuad(transformComp, spriteRendererComp.tint, spriteRendererComp.texture);
|
||||
});
|
||||
|
||||
|
@ -93,21 +83,18 @@ namespace Light {
|
|||
// entt::entity entity = entt::to_entity(m_Registry, tagComp);
|
||||
Entity entity;
|
||||
|
||||
m_Registry.view<TagComponent>().
|
||||
each([&](TagComponent& tagComp)
|
||||
{
|
||||
m_Registry.view<TagComponent>().each([&](TagComponent& tagComp) {
|
||||
if (tagComp.tag == tag)
|
||||
entity = Entity(entt::to_entity(m_Registry, tagComp), this);
|
||||
});
|
||||
|
||||
if (entity.IsValid())
|
||||
return entity;
|
||||
else {
|
||||
LT_ENGINE_ERROR("Scene::GetEntityByTag: failed to find entity by tag: {}", tag);
|
||||
else
|
||||
{
|
||||
ASSERT("Scene::GetEntityByTag: failed to find entity by tag: {}", tag);
|
||||
return Entity();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Entity Scene::CreateEntityWithUUID(const std::string& name, UUID uuid, const TransformComponent& transform)
|
||||
|
@ -120,4 +107,4 @@ namespace Light {
|
|||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "UserInterface.h"
|
||||
|
||||
#include "OpenGL/glUserInterface.h"
|
||||
|
||||
#ifdef LIGHT_PLATFORM_WINDOWS
|
||||
|
@ -6,13 +7,11 @@
|
|||
#include "DirectX/dxSharedContext.h"
|
||||
#endif
|
||||
|
||||
#include "Events/Event.h"
|
||||
#include "Events/CharEvent.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/Event.h"
|
||||
#include "Events/KeyboardEvents.h"
|
||||
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Graphics/GraphicsContext.h"
|
||||
|
||||
#include "Input/KeyCodes.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
@ -31,12 +30,13 @@ namespace Light {
|
|||
scopeUserInterface = CreateScope<glUserInterface>();
|
||||
break;
|
||||
|
||||
case GraphicsAPI::DirectX: LT_WIN(
|
||||
case GraphicsAPI::DirectX:
|
||||
LT_WIN(
|
||||
scopeUserInterface = CreateScope<dxUserInterface>();)
|
||||
break;
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "UserInterface::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
ASSERT(false, "UserInterface::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace Light {
|
|||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus)
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "UserInterface::UserInterface: an instance of 'UserInterface' already exists, do not construct this class!");
|
||||
ASSERT(!s_Context, "UserInterface::UserInterface: an instance of 'UserInterface' already exists, do not construct this class!");
|
||||
s_Context = this;
|
||||
}
|
||||
|
||||
|
@ -219,4 +219,4 @@ namespace Light {
|
|||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Light {
|
|||
// check
|
||||
if (!file)
|
||||
{
|
||||
LT_ENGINE_WARN("FileManager::ReadTextFile: failed to load text file: {}", path);
|
||||
LOG(warn, "Failed to load text file: {}", path);
|
||||
file.close();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace Light {
|
|||
file.seekg(0, std::ios::beg);
|
||||
|
||||
if (!size)
|
||||
LT_ENGINE_WARN("FileManager::ReadTextFile: empty text file: {}", path);
|
||||
LOG(warn, "Empty text file: {}", path);
|
||||
|
||||
// read file
|
||||
uint8_t* data = new uint8_t[size];
|
||||
|
@ -49,11 +49,11 @@ namespace Light {
|
|||
|
||||
// check
|
||||
if (!pixels)
|
||||
LT_ENGINE_WARN("FileManager::LoadImageFile: failed to load image file: <{}>", path);
|
||||
LOG(warn, "Failed to load image file: <{}>", path);
|
||||
else if (fetchedComponents != desiredComponents)
|
||||
LT_ENGINE_WARN("FileManager::LoadImageFile: mismatch of fetched/desired components: <{}> ({}/{})", name + '.' + extension, fetchedComponents, desiredComponents);
|
||||
LOG(warn, "Mismatch of fetched/desired components: <{}> ({}/{})", name + '.' + extension, fetchedComponents, desiredComponents);
|
||||
|
||||
return ImageFileHandle(pixels, width * height, path, name, extension, width, height, fetchedComponents, desiredComponents);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "ResourceManager.h"
|
||||
|
||||
#include "FileManager.h"
|
||||
|
||||
#include "Graphics/GraphicsContext.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Graphics/Texture.h"
|
||||
|
@ -15,28 +14,27 @@ namespace Light {
|
|||
return MakeScope(new ResourceManager());
|
||||
}
|
||||
|
||||
ResourceManager::ResourceManager() :
|
||||
m_Shaders{},
|
||||
m_Textures{}
|
||||
ResourceManager::ResourceManager()
|
||||
: m_Shaders {}, m_Textures {}
|
||||
{
|
||||
LT_ENGINE_ASSERT(!s_Context, "ResourceManager::ResourceManager: repeated singleton construction");
|
||||
ASSERT(!s_Context, "Repeated singleton construction");
|
||||
s_Context = this;
|
||||
}
|
||||
|
||||
void ResourceManager::LoadShaderImpl(const std::string& name, const std::string& vertexPath, const std::string& pixelPath)
|
||||
{
|
||||
// check
|
||||
LT_ENGINE_ASSERT(s_Context, "ResourceManager::LoadShaderImpl: uninitliazed singleton");
|
||||
LT_ENGINE_ASSERT(!vertexPath.empty(), "ResourceManager::LoadShaderImpl: empty 'vertexPath'");
|
||||
LT_ENGINE_ASSERT(!pixelPath.empty(), "ResourceManager::LoadShaderImpl: empty 'pixelPath'");
|
||||
ASSERT(s_Context, "Uninitliazed singleton");
|
||||
ASSERT(!vertexPath.empty(), "Empty 'vertexPath'");
|
||||
ASSERT(!pixelPath.empty(), "Empty 'pixelPath'");
|
||||
|
||||
// load files
|
||||
BasicFileHandle vertexFile = FileManager::ReadTextFile(vertexPath);
|
||||
BasicFileHandle pixelFile = FileManager::ReadTextFile(pixelPath);
|
||||
|
||||
// check
|
||||
LT_ENGINE_ASSERT(vertexFile.IsValid(), "ResourceManager::LoadShaderImpl: failed to read vertex file: {}", vertexPath);
|
||||
LT_ENGINE_ASSERT(pixelFile.IsValid(), "ResourceManager::LoadShaderImpl: failed to read vertex file: {}", pixelPath);
|
||||
ASSERT(vertexFile.IsValid(), "Failed to read vertex file: {}", vertexPath);
|
||||
ASSERT(pixelFile.IsValid(), "Failed to read vertex file: {}", pixelPath);
|
||||
|
||||
// create shader
|
||||
m_Shaders[name] = Ref<Shader>(Shader::Create(vertexFile, pixelFile, GraphicsContext::GetSharedContext()));
|
||||
|
@ -48,7 +46,7 @@ namespace Light {
|
|||
|
||||
void ResourceManager::LoadTextureImpl(const std::string& name, const std::string& path, unsigned int desiredComponents /* = 4u */)
|
||||
{
|
||||
LT_ENGINE_ASSERT(s_Context, "ResourceManager::LoadShaderImpl: uninitliazed singleton");
|
||||
ASSERT(s_Context, "Uninitliazed singleton");
|
||||
|
||||
// load file
|
||||
ImageFileHandle imgFile = FileManager::ReadImageFile(path, desiredComponents);
|
||||
|
@ -64,11 +62,11 @@ namespace Light {
|
|||
{
|
||||
if (!m_Textures[name])
|
||||
{
|
||||
LT_ENGINE_WARN("ResourceManager::ReleaseTextureImpl: failed to find texture named: {}", name);
|
||||
LOG(warn, "Failed to find texture named: {}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
m_Textures[name] = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#include "Serializer.h"
|
||||
|
||||
#include "Scene/Components.h"
|
||||
|
||||
#include "Graphics/Texture.h"
|
||||
|
||||
#include "Scene/Components.h"
|
||||
#include "Utility/ResourceManager.h"
|
||||
|
||||
namespace YAML {
|
||||
|
@ -57,7 +55,7 @@ namespace YAML {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace YAML
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -75,8 +73,8 @@ namespace Light {
|
|||
return out;
|
||||
}
|
||||
|
||||
SceneSerializer::SceneSerializer(const Ref<Scene>& scene):
|
||||
m_Scene(scene)
|
||||
SceneSerializer::SceneSerializer(const Ref<Scene>& scene)
|
||||
: m_Scene(scene)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -87,8 +85,7 @@ namespace Light {
|
|||
out << YAML::Key << "Scene" << YAML::Value << "Untitled";
|
||||
|
||||
out << YAML::Key << "Entities" << YAML::Value << YAML::BeginSeq;
|
||||
m_Scene->m_Registry.each([&](auto entityID)
|
||||
{
|
||||
m_Scene->m_Registry.each([&](auto entityID) {
|
||||
Entity entity = { entityID, m_Scene.get() };
|
||||
if (!entity.IsValid())
|
||||
return;
|
||||
|
@ -102,7 +99,7 @@ namespace Light {
|
|||
|
||||
std::ofstream fout(filePath);
|
||||
if (!fout.is_open())
|
||||
LT_ENGINE_ERROR("SceneSerializer::Serialize: failed to create fout at: {}", filePath);
|
||||
LOG(trace, "Failed to create fout at: {}", filePath);
|
||||
fout << out.c_str();
|
||||
}
|
||||
|
||||
|
@ -117,7 +114,7 @@ namespace Light {
|
|||
return false;
|
||||
|
||||
std::string sceneName = data["Scene"].as<std::string>();
|
||||
LT_ENGINE_TRACE("SceneSerializer::Deserialize: Deserializing scene: '{}'", sceneName);
|
||||
LOG(trace, "Deserializing scene: '{}'", sceneName);
|
||||
|
||||
auto entities = data["Entities"];
|
||||
if (entities)
|
||||
|
@ -136,12 +133,12 @@ namespace Light {
|
|||
if (tagComponent)
|
||||
name = tagComponent["Tag"].as<std::string>();
|
||||
|
||||
LT_ENGINE_TRACE("SceneSerializer::Deserialize: Deserialized entity '{}' : '{}'", uuid, name);
|
||||
LOG(trace, "Deserialized entity '{}' : '{}'", uuid, name);
|
||||
|
||||
Entity deserializedEntity = m_Scene->CreateEntityWithUUID(name, uuid);
|
||||
|
||||
TagComponent gg = deserializedEntity.GetComponent<TagComponent>();
|
||||
LT_ENGINE_TRACE(gg.tag);
|
||||
LOG(trace, gg.tag);
|
||||
auto transformComponent = entity["TransformComponent"];
|
||||
if (transformComponent)
|
||||
{
|
||||
|
@ -201,12 +198,12 @@ namespace Light {
|
|||
|
||||
void SceneSerializer::SerializeBinary(const std::string& filePath)
|
||||
{
|
||||
LT_ENGINE_ERROR("SceneSerializer::SerializeRuntime: NO_IMPLEMENT");
|
||||
LOG(err, "NO_IMPLEMENT");
|
||||
}
|
||||
|
||||
bool SceneSerializer::DeserializeBinary(const std::string& filePath)
|
||||
{
|
||||
LT_ENGINE_ERROR("SceneSerializer::DeserializeBinary: NO_IMPLEMENT");
|
||||
LOG(err, "NO_IMPLEMENT");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -282,4 +279,4 @@ namespace Light {
|
|||
out << YAML::EndMap; // entity
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
#include "dxBuffers.h"
|
||||
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
//======================================== CONSTANT_BUFFER ========================================//
|
||||
dxConstantBuffer::dxConstantBuffer(ConstantBufferIndex index, unsigned int size, Ref<dxSharedContext> sharedContext)
|
||||
: m_Context(sharedContext),
|
||||
m_Buffer(nullptr),
|
||||
m_Map{},
|
||||
m_Index(static_cast<int>(index))
|
||||
: m_Context(sharedContext), m_Buffer(nullptr), m_Map {}, m_Index(static_cast<int>(index))
|
||||
{
|
||||
D3D11_BUFFER_DESC bDesc = {};
|
||||
|
||||
|
@ -42,10 +40,7 @@ namespace Light {
|
|||
|
||||
//================================================== VERTEX_BUFFER ==================================================//
|
||||
dxVertexBuffer::dxVertexBuffer(float* vertices, unsigned int stride, unsigned int count, Ref<dxSharedContext> sharedContext)
|
||||
: m_Context(sharedContext),
|
||||
m_Buffer(nullptr),
|
||||
m_Map{},
|
||||
m_Stride(stride)
|
||||
: m_Context(sharedContext), m_Buffer(nullptr), m_Map {}, m_Stride(stride)
|
||||
{
|
||||
// buffer desc
|
||||
D3D11_BUFFER_DESC bDesc = {};
|
||||
|
@ -95,8 +90,7 @@ namespace Light {
|
|||
|
||||
//======================================== INDEX_BUFFER ========================================//
|
||||
dxIndexBuffer::dxIndexBuffer(unsigned int* indices, unsigned int count, Ref<dxSharedContext> sharedContext)
|
||||
: m_Context(sharedContext),
|
||||
m_Buffer(nullptr)
|
||||
: m_Context(sharedContext), m_Buffer(nullptr)
|
||||
{
|
||||
// generate indices if not provided
|
||||
bool hasIndices = !!indices;
|
||||
|
@ -105,8 +99,8 @@ namespace Light {
|
|||
// check
|
||||
if (count % 6 != 0)
|
||||
{
|
||||
LT_ENGINE_WARN("dxIndexBuffer::dxIndexBuffer: 'indices' can only be null if count is multiple of 6");
|
||||
LT_ENGINE_WARN("dxIndexBuffer::dxIndexBuffer: adding {} to 'count' -> {}", (6 - (count % 6)), count + (6 - (count % 6)));
|
||||
LOG(warn, "'indices' can only be null if count is multiple of 6");
|
||||
LOG(warn, "Adding {} to 'count' -> {}", (6 - (count % 6)), count + (6 - (count % 6)));
|
||||
count = count + (6 - (count % 6));
|
||||
}
|
||||
|
||||
|
@ -167,4 +161,4 @@ namespace Light {
|
|||
}
|
||||
//======================================== INDEX_BUFFER ========================================//
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
#include "dxFramebuffer.h"
|
||||
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
dxFramebuffer::dxFramebuffer(const FramebufferSpecification& specification, Ref<dxSharedContext> sharedContext)
|
||||
: m_Context(sharedContext),
|
||||
m_Specification(specification),
|
||||
m_RenderTargetView(nullptr),
|
||||
m_ColorAttachment(nullptr),
|
||||
m_DepthStencilAttachment(nullptr),
|
||||
m_ShaderResourceView(nullptr),
|
||||
m_DepthStencilView(nullptr)
|
||||
: m_Context(sharedContext), m_Specification(specification), m_RenderTargetView(nullptr), m_ColorAttachment(nullptr), m_DepthStencilAttachment(nullptr), m_ShaderResourceView(nullptr), m_DepthStencilView(nullptr)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -71,7 +66,7 @@ namespace Light {
|
|||
|
||||
void dxFramebuffer::BindAsResource()
|
||||
{
|
||||
LT_ENGINE_ERROR("dxFramebuffer::BindAsResource: NO_IMPLEMENT");
|
||||
LOG(err, "NO_IMPLEMENT");
|
||||
}
|
||||
|
||||
void dxFramebuffer::Resize(const glm::uvec2& size)
|
||||
|
@ -96,4 +91,4 @@ namespace Light {
|
|||
DXC(m_Context->GetDevice()->CreateShaderResourceView(m_ColorAttachment.Get(), &srvDesc, &m_ShaderResourceView));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
#include "dxGraphicsContext.h"
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
#include "Events/WindowEvents.h"
|
||||
|
||||
#include "Graphics/Blender.h" // required for forward declaration
|
||||
#include "Graphics/Buffers.h" // required for forward declaration
|
||||
#include "Graphics/Renderer.h" // required for forward declaration
|
||||
#include "Graphics/RenderCommand.h" // required for forward declaration
|
||||
|
||||
#include "Graphics/Renderer.h" // required for forward declaration
|
||||
#include "UserInterface/UserInterface.h" // required for forward declaration
|
||||
|
||||
#include "Utility/ResourceManager.h" // required for forward declaration
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#include <glfw/glfw3.h>
|
||||
|
@ -19,8 +16,7 @@
|
|||
namespace Light {
|
||||
|
||||
dxGraphicsContext::dxGraphicsContext(GLFWwindow* windowHandle)
|
||||
: m_WindowHandle(windowHandle),
|
||||
m_DebugInterface(nullptr)
|
||||
: m_WindowHandle(windowHandle), m_DebugInterface(nullptr)
|
||||
{
|
||||
// set 'GraphicsAPI';
|
||||
m_GraphicsAPI = GraphicsAPI::DirectX;
|
||||
|
@ -84,7 +80,6 @@ namespace Light {
|
|||
&context->GetDeviceRef(),
|
||||
nullptr,
|
||||
&context->GetDeviceContextRef()));
|
||||
|
||||
}
|
||||
|
||||
void dxGraphicsContext::SetupRenderTargets()
|
||||
|
@ -119,8 +114,7 @@ namespace Light {
|
|||
infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);
|
||||
infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true);
|
||||
|
||||
D3D11_MESSAGE_ID hide[] =
|
||||
{
|
||||
D3D11_MESSAGE_ID hide[] = {
|
||||
D3D11_MESSAGE_ID_UNKNOWN,
|
||||
// #todo: add more messages here as needed
|
||||
};
|
||||
|
@ -157,10 +151,10 @@ namespace Light {
|
|||
DXGIAdapter->Release();
|
||||
|
||||
// #todo: log more information
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LT_ENGINE_INFO("dxGraphicsContext:");
|
||||
LT_ENGINE_INFO(" Renderer: {}", adapterDesc);
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LOG(info, "________________________________________");
|
||||
LOG(info, "dxGraphicsContext:");
|
||||
LOG(info, " Renderer: {}", adapterDesc);
|
||||
LOG(info, "________________________________________");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "dxRenderCommand.h"
|
||||
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
namespace Light {
|
||||
|
@ -16,8 +17,8 @@ namespace Light {
|
|||
{
|
||||
if (hr == DXGI_ERROR_DEVICE_REMOVED)
|
||||
{
|
||||
LT_ENGINE_CRITICAL("dxRenderCommand::SwapBuffers: DeviceRemoved:");
|
||||
LT_ENGINE_CRITICAL(" {}", m_Context->GetDevice()->GetDeviceRemovedReason());
|
||||
LOG(critical, "dxRenderCommand::SwapBuffers: DeviceRemoved:");
|
||||
LOG(critical, " {}", m_Context->GetDevice()->GetDeviceRemovedReason());
|
||||
throw dxException(hr, __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
@ -88,4 +89,4 @@ namespace Light {
|
|||
m_Context->GetDeviceContext()->OMSetRenderTargets(1u, m_Context->GetRenderTargetView().GetAddressOf(), nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "dxShader.h"
|
||||
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
#include <d3dcompiler.h>
|
||||
|
@ -6,10 +7,7 @@
|
|||
namespace Light {
|
||||
|
||||
dxShader::dxShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile, Ref<dxSharedContext> sharedContext)
|
||||
: m_Context(sharedContext),
|
||||
m_VertexShader(nullptr),
|
||||
m_PixelShader(nullptr),
|
||||
m_VertexBlob(nullptr)
|
||||
: m_Context(sharedContext), m_VertexShader(nullptr), m_PixelShader(nullptr), m_VertexBlob(nullptr)
|
||||
{
|
||||
Microsoft::WRL::ComPtr<ID3DBlob> ps = nullptr, vsErr = nullptr, psErr = nullptr;
|
||||
|
||||
|
@ -18,8 +16,8 @@ namespace Light {
|
|||
D3DCompile(pixelFile.GetData(), pixelFile.GetSize(), NULL, nullptr, nullptr, "main", "ps_4_0", NULL, NULL, &ps, &psErr);
|
||||
|
||||
// check
|
||||
LT_ENGINE_ASSERT(!vsErr.Get(), "dxShader::dxShader: vertex shader compile error: {}", (char*)vsErr->GetBufferPointer());
|
||||
LT_ENGINE_ASSERT(!psErr.Get(), "dxShader::dxShader: pixels shader compile error: {}", (char*)psErr->GetBufferPointer());
|
||||
ASSERT(!vsErr.Get(), "Vertex shader compile error: {}", (char*)vsErr->GetBufferPointer());
|
||||
ASSERT(!psErr.Get(), "Pixels shader compile error: {}", (char*)psErr->GetBufferPointer());
|
||||
|
||||
// create shaders
|
||||
HRESULT hr;
|
||||
|
@ -44,4 +42,4 @@ namespace Light {
|
|||
m_Context->GetDeviceContext()->PSSetShader(nullptr, nullptr, 0u);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
#include "dxUserInterface.h"
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
#include "Input/KeyCodes.h"
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#include <backends/imgui_impl_dx11.h>
|
||||
#include <backends/imgui_impl_win32.h>
|
||||
#include <glfw/glfw3.h>
|
||||
#include <glfw/glfw3native.h>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <backends/imgui_impl_win32.h>
|
||||
#include <backends/imgui_impl_dx11.h>
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -54,12 +53,12 @@ namespace Light {
|
|||
void dxUserInterface::LogDebugData()
|
||||
{
|
||||
// #todo: improve
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LT_ENGINE_INFO("UserInterface::");
|
||||
LT_ENGINE_INFO(" API : ImGui");
|
||||
LT_ENGINE_INFO(" Version: {}", ImGui::GetVersion());
|
||||
LT_ENGINE_INFO(" GraphicsAPI : DirectX");
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LOG(info, "________________________________________");
|
||||
LOG(info, "UserInterface::");
|
||||
LOG(info, " API : ImGui");
|
||||
LOG(info, " Version: {}", ImGui::GetVersion());
|
||||
LOG(info, " GraphicsAPI : DirectX");
|
||||
LOG(info, "________________________________________");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include "dxVertexLayout.h"
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
#include "dxShader.h"
|
||||
#include "dxSharedContext.h"
|
||||
|
||||
namespace Light {
|
||||
|
||||
dxVertexLayout::dxVertexLayout(Ref<Shader> shader, const std::vector<std::pair<std::string, VertexElementType>>& elements, Ref<dxSharedContext> sharedContext)
|
||||
: m_Context(sharedContext),
|
||||
m_InputLayout(nullptr)
|
||||
: m_Context(sharedContext), m_InputLayout(nullptr)
|
||||
{
|
||||
// occupy space for input elements
|
||||
std::vector<D3D11_INPUT_ELEMENT_DESC> inputElementsDesc;
|
||||
|
@ -26,7 +25,7 @@ namespace Light {
|
|||
}
|
||||
|
||||
Ref<dxShader> dxpShader = std::dynamic_pointer_cast<dxShader>(shader);
|
||||
LT_ENGINE_ASSERT(dxpShader, "dxVertexLayout::dxVertexLayout: failed to cast 'Shader' to 'dxShader'");
|
||||
ASSERT(dxpShader, "Failed to cast 'Shader' to 'dxShader'");
|
||||
|
||||
// create input layout (vertex layout)
|
||||
HRESULT hr;
|
||||
|
@ -81,9 +80,9 @@ namespace Light {
|
|||
case Light::VertexElementType::Float4: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "dxVertexLayout::GetDxgiFormat: invalid 'VertexElementType'");
|
||||
ASSERT(false, "Invalid 'VertexElementType'");
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -6,8 +6,7 @@ namespace Light {
|
|||
|
||||
//==================== CONSTANT_BUFFER ====================//
|
||||
glConstantBuffer::glConstantBuffer(ConstantBufferIndex index, unsigned int size)
|
||||
: m_BufferID(NULL),
|
||||
m_Index(static_cast<int>(index))
|
||||
: m_BufferID(NULL), m_Index(static_cast<int>(index))
|
||||
{
|
||||
glCreateBuffers(1, &m_BufferID);
|
||||
glNamedBufferData(m_BufferID, size, nullptr, GL_DYNAMIC_DRAW);
|
||||
|
@ -82,8 +81,8 @@ namespace Light {
|
|||
// check
|
||||
if (count % 6 != 0)
|
||||
{
|
||||
LT_ENGINE_WARN("glIndexBuffer::dxIndexBuffer: 'indices' can only be null if count is multiple of 6");
|
||||
LT_ENGINE_WARN("glIndexBuffer::glIndexBuffer: adding {} to 'count' -> {}", (6 - (count % 6)), count + (6 - (count % 6)));
|
||||
LOG(warn, "'indices' can only be null if count is multiple of 6");
|
||||
LOG(warn, "Adding {} to 'count' -> {}", (6 - (count % 6)), count + (6 - (count % 6)));
|
||||
count = count + (6 - (count % 6));
|
||||
}
|
||||
|
||||
|
@ -129,4 +128,4 @@ namespace Light {
|
|||
}
|
||||
//==================== INDEX_BUFFER ====================//
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
#include "glFramebuffer.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace Light {
|
||||
|
||||
glFramebuffer::glFramebuffer(const FramebufferSpecification& specification)
|
||||
: m_Specification(specification),
|
||||
m_BufferID(NULL),
|
||||
m_ColorAttachmentID(NULL),
|
||||
m_DepthStencilAttachmentID(NULL)
|
||||
: m_Specification(specification), m_BufferID(NULL), m_ColorAttachmentID(NULL), m_DepthStencilAttachmentID(NULL)
|
||||
{
|
||||
Resize({ specification.width, specification.height });
|
||||
}
|
||||
|
@ -34,7 +30,7 @@ namespace Light {
|
|||
|
||||
void glFramebuffer::BindAsResource()
|
||||
{
|
||||
LT_ENGINE_ERROR("glFramebuffer::BindAsResource: NO_IMPLEMENT!");
|
||||
LOG(err, "NO_IMPLEMENT!");
|
||||
}
|
||||
|
||||
void glFramebuffer::Resize(const glm::uvec2& size)
|
||||
|
@ -68,9 +64,9 @@ namespace Light {
|
|||
// // glTextureStorage2D(m_DepthStencilAttachmentID, 0, GL_DEPTH24_STENCIL8, m_Specification.width, m_Specification.height);
|
||||
// glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_DepthStencilAttachmentID, 0);
|
||||
|
||||
LT_ENGINE_ASSERT((glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE), "glFramebuffer::Validate: framebuffer is incomplete");
|
||||
ASSERT((glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE), "Framebuffer is incomplete");
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#include "glGraphicsContext.h"
|
||||
|
||||
#include "Events/WindowEvents.h"
|
||||
|
||||
#include "Graphics/Blender.h" // required for forward declaration
|
||||
#include "Graphics/Buffers.h" // required for forward declaration
|
||||
#include "Graphics/Renderer.h" // required for forward declaration
|
||||
#include "Graphics/RenderCommand.h" // required for forward declaration
|
||||
|
||||
#include "Graphics/Renderer.h" // required for forward declaration
|
||||
#include "UserInterface/UserInterface.h" // required for forward declaration
|
||||
|
||||
#include "Utility/ResourceManager.h" // required for forward declaration
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#ifndef STOP_FUCKING_ORDERING_THESE_THE_WRONG_WAY_CLANG_FORMAT____
|
||||
#include <GLFW/glfw3.h>
|
||||
#endif
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace Light {
|
|||
glfwMakeContextCurrent(windowHandle);
|
||||
|
||||
// load opengl (glad)
|
||||
LT_ENGINE_ASSERT(gladLoadGLLoader((GLADloadproc)glfwGetProcAddress), "glGraphicsContext::glGraphicsContext: failed to initialize opengl (glad)");
|
||||
ASSERT(gladLoadGLLoader((GLADloadproc)glfwGetProcAddress), "Failed to initialize opengl (glad)");
|
||||
|
||||
SetDebugMessageCallback();
|
||||
}
|
||||
|
@ -34,12 +34,12 @@ namespace Light {
|
|||
void glGraphicsContext::LogDebugData()
|
||||
{
|
||||
// #todo: log more information
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LT_ENGINE_INFO("GraphicsContext::");
|
||||
LT_ENGINE_INFO(" API : OpenGL");
|
||||
LT_ENGINE_INFO(" Version : {}", glGetString(GL_VERSION));
|
||||
LT_ENGINE_INFO(" Renderer: {}", glGetString(GL_RENDERER));
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LOG(info, "________________________________________");
|
||||
LOG(info, "GraphicsContext::");
|
||||
LOG(info, " API : OpenGL");
|
||||
LOG(info, " Version : {}", glGetString(GL_VERSION));
|
||||
LOG(info, " Renderer: {}", glGetString(GL_RENDERER));
|
||||
LOG(info, "________________________________________");
|
||||
}
|
||||
|
||||
void glGraphicsContext::SetDebugMessageCallback()
|
||||
|
@ -50,8 +50,7 @@ namespace Light {
|
|||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE);
|
||||
|
||||
GLuint ids[] =
|
||||
{
|
||||
GLuint ids[] = {
|
||||
131185
|
||||
};
|
||||
glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, _countof(ids), ids, GL_FALSE);
|
||||
|
@ -68,33 +67,34 @@ namespace Light {
|
|||
glDebugMessageCallback([](unsigned int source, unsigned int type,
|
||||
unsigned int id, unsigned int severity,
|
||||
int length, const char* message,
|
||||
const void* userParam)
|
||||
{
|
||||
const void* userParam) {
|
||||
switch (severity)
|
||||
{
|
||||
case GL_DEBUG_SEVERITY_HIGH:
|
||||
// throw glException(source, type, id, message);
|
||||
return;
|
||||
|
||||
case GL_DEBUG_SEVERITY_MEDIUM: case GL_DEBUG_SEVERITY_LOW:
|
||||
LT_ENGINE_WARN("glMessageCallback: Severity: {} :: Source: {} :: Type: {} :: ID: {}",
|
||||
case GL_DEBUG_SEVERITY_MEDIUM:
|
||||
case GL_DEBUG_SEVERITY_LOW:
|
||||
LOG(warn, "glMessageCallback: Severity: {} :: Source: {} :: Type: {} :: ID: {}",
|
||||
Stringifier::glDebugMsgSeverity(severity),
|
||||
Stringifier::glDebugMsgSource(source),
|
||||
Stringifier::glDebugMsgType(type),
|
||||
id);
|
||||
LT_ENGINE_WARN(" {}", message);
|
||||
LOG(warn, " {}", message);
|
||||
return;
|
||||
|
||||
case GL_DEBUG_SEVERITY_NOTIFICATION:
|
||||
LT_ENGINE_TRACE("glMessageCallback: Severity: {} :: Source: {} :: Type: {} :: ID: {}",
|
||||
LOG(trace, "Severity: {} :: Source: {} :: Type: {} :: ID: {}",
|
||||
Stringifier::glDebugMsgSeverity(severity),
|
||||
Stringifier::glDebugMsgSource(source),
|
||||
Stringifier::glDebugMsgType(type),
|
||||
id);
|
||||
LT_ENGINE_TRACE(" {}", message);
|
||||
LOG(trace, " {}", message);
|
||||
return;
|
||||
}
|
||||
}, nullptr);
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -61,8 +61,8 @@ shaderc::SpvCompilationResult glShader::CompileGLSL(BasicFileHandle file, Shader
|
|||
// log error
|
||||
if (result.GetCompilationStatus() != shaderc_compilation_status_success)
|
||||
{
|
||||
LT_ENGINE_ERROR("Failed to compile {} shader at {}...", stage == Shader::Stage::VERTEX ? "vertex" : "pixel", file.GetPath());
|
||||
LT_ENGINE_ERROR(" {}", result.GetErrorMessage());
|
||||
LOG(err, "Failed to compile {} shader at {}...", stage == Shader::Stage::VERTEX ? "vertex" : "pixel", file.GetPath());
|
||||
LOG(err, " {}", result.GetErrorMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -92,7 +92,7 @@ unsigned int glShader::CompileShader(std::string source, Shader::Stage stage)
|
|||
char* errorLog = (char*)alloca(logLength);
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, &errorLog[0]);
|
||||
|
||||
LT_ENGINE_ERROR("glShader::glShader: failed to compile {} shader:\n {}", stage == Shader::Stage::VERTEX ? "Vertex" : "Pixel", errorLog);
|
||||
LOG(err, "glShader::glShader: failed to compile {} shader:\n {}", stage == Shader::Stage::VERTEX ? "Vertex" : "Pixel", errorLog);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ unsigned int glShader::CompileShader(std::string source, Shader::Stage stage)
|
|||
char* infoLog = (char*)alloca(logLength);
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, &infoLog[0]);
|
||||
|
||||
LT_ENGINE_WARN(infoLog);
|
||||
LOG(warn, infoLog);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ glTexture::glTexture(unsigned int width, unsigned int height, unsigned int compo
|
|||
NULL;
|
||||
|
||||
// check
|
||||
LT_ENGINE_ASSERT(format, "glTexture::glTexture: invalid number of components: {}", components);
|
||||
ASSERT(format, "Invalid number of components: {}", components);
|
||||
|
||||
|
||||
// #todo: isn't there something like glTextureImage2D ???
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
#include "Input/KeyCodes.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <backends/imgui_impl_glfw.h>
|
||||
#include <backends/imgui_impl_opengl3.h>
|
||||
#include <imgui.h>
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -51,12 +50,12 @@ namespace Light {
|
|||
void glUserInterface::LogDebugData()
|
||||
{
|
||||
// #todo: improve
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LT_ENGINE_INFO("UserInterface::");
|
||||
LT_ENGINE_INFO(" API : ImGui");
|
||||
LT_ENGINE_INFO(" Version: {}", ImGui::GetVersion());
|
||||
LT_ENGINE_INFO(" GraphicsAPI : OpenGL");
|
||||
LT_ENGINE_INFO("________________________________________");
|
||||
LOG(info, "________________________________________");
|
||||
LOG(info, "UserInterface::");
|
||||
LOG(info, " API : ImGui");
|
||||
LOG(info, " Version: {}", ImGui::GetVersion());
|
||||
LOG(info, " GraphicsAPI : OpenGL");
|
||||
LOG(info, "________________________________________");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -10,8 +10,8 @@ namespace Light {
|
|||
: m_ArrayID(NULL)
|
||||
{
|
||||
// check
|
||||
LT_ENGINE_ASSERT(std::dynamic_pointer_cast<glVertexBuffer>(buffer), "glVertexLayout::glVertexLayout: failed to cast 'VertexBuffer' to 'glVertexBuffer'");
|
||||
LT_ENGINE_ASSERT(!elements.empty(), "glVertexLayout::glVertexLayout: 'elements' is empty");
|
||||
ASSERT(std::dynamic_pointer_cast<glVertexBuffer>(buffer), "Failed to cast 'VertexBuffer' to 'glVertexBuffer'");
|
||||
ASSERT(!elements.empty(), "'elements' is empty");
|
||||
|
||||
// local
|
||||
std::vector<glVertexElementDesc> elementsDesc;
|
||||
|
@ -89,9 +89,9 @@ namespace Light {
|
|||
case VertexElementType::Float4: return { GL_FLOAT, 4u, sizeof(GLfloat), offset };
|
||||
|
||||
default:
|
||||
LT_ENGINE_ASSERT(false, "glVertexLayout::GetElementDesc: invalid 'VertexElementType'");
|
||||
ASSERT(false, "Invalid 'VertexElementType'");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#include "lWindow.h"
|
||||
|
||||
#include "Events/Event.h"
|
||||
#include "Events/CharEvent.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/Event.h"
|
||||
#include "Events/KeyboardEvents.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/WindowEvents.h"
|
||||
|
||||
#include "Graphics/GraphicsContext.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
@ -18,11 +17,10 @@ namespace Light {
|
|||
}
|
||||
|
||||
lWindow::lWindow(std::function<void(Event&)> callback)
|
||||
: m_Handle(nullptr),
|
||||
m_EventCallback(callback)
|
||||
: m_Handle(nullptr), m_EventCallback(callback)
|
||||
{
|
||||
// init glfw
|
||||
LT_ENGINE_ASSERT(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
|
||||
ASSERT(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
|
||||
|
||||
// create window
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||
|
@ -31,7 +29,7 @@ namespace Light {
|
|||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
|
||||
m_Handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr);
|
||||
LT_ENGINE_ASSERT(m_Handle, "lWindow::lWindow: failed to create 'GLFWwindow'");
|
||||
ASSERT(m_Handle, "lWindow::lWindow: failed to create 'GLFWwindow'");
|
||||
|
||||
// bind event stuff
|
||||
glfwSetWindowUserPointer(m_Handle, &m_EventCallback);
|
||||
|
@ -39,7 +37,7 @@ namespace Light {
|
|||
|
||||
// create graphics context
|
||||
m_GraphicsContext = GraphicsContext::Create(GraphicsAPI::OpenGL, m_Handle);
|
||||
LT_ENGINE_ASSERT(m_GraphicsContext, "lWindow::lWindow: failed to create 'GraphicsContext'");
|
||||
ASSERT(m_GraphicsContext, "lWindow::lWindow: failed to create 'GraphicsContext'");
|
||||
}
|
||||
|
||||
lWindow::~lWindow()
|
||||
|
@ -96,8 +94,10 @@ namespace Light {
|
|||
|
||||
void lWindow::SetSize(const glm::uvec2& size, bool additive /* = false */)
|
||||
{
|
||||
m_Properties.size.x = size.x == 0u ? m_Properties.size.x : additive ? m_Properties.size.x + size.x : size.x;
|
||||
m_Properties.size.y = size.y == 0u ? m_Properties.size.y : additive ? m_Properties.size.y + size.y : size.y;
|
||||
m_Properties.size.x = size.x == 0u ? m_Properties.size.x : additive ? m_Properties.size.x + size.x :
|
||||
size.x;
|
||||
m_Properties.size.y = size.y == 0u ? m_Properties.size.y : additive ? m_Properties.size.y + size.y :
|
||||
size.y;
|
||||
|
||||
|
||||
glfwSetWindowSize(m_Handle, size.x, size.y);
|
||||
|
@ -124,8 +124,7 @@ namespace Light {
|
|||
{
|
||||
//============================== MOUSE_EVENTS ==============================//
|
||||
/* cursor position */
|
||||
glfwSetCursorPosCallback(m_Handle, [](GLFWwindow* window, double xpos, double ypos)
|
||||
{
|
||||
glfwSetCursorPosCallback(m_Handle, [](GLFWwindow* window, double xpos, double ypos) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
MouseMovedEvent event(xpos, ypos);
|
||||
|
@ -133,8 +132,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* mouse button */
|
||||
glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow* window, int button, int action, int mods) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
if (action == GLFW_PRESS)
|
||||
|
@ -150,8 +148,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* scroll */
|
||||
glfwSetScrollCallback(m_Handle, [](GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
glfwSetScrollCallback(m_Handle, [](GLFWwindow* window, double xoffset, double yoffset) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
WheelScrolledEvent event(yoffset);
|
||||
|
@ -161,8 +158,7 @@ namespace Light {
|
|||
|
||||
//============================== KEYBOARD_EVENTS ==============================//
|
||||
/* key */
|
||||
glfwSetKeyCallback(m_Handle, [](GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
glfwSetKeyCallback(m_Handle, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
if (action == GLFW_PRESS)
|
||||
|
@ -177,8 +173,7 @@ namespace Light {
|
|||
}
|
||||
});
|
||||
/* char */
|
||||
glfwSetCharCallback(m_Handle, [](GLFWwindow* window, unsigned int character)
|
||||
{
|
||||
glfwSetCharCallback(m_Handle, [](GLFWwindow* window, unsigned int character) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
SetCharEvent event(character);
|
||||
|
@ -189,8 +184,7 @@ namespace Light {
|
|||
|
||||
//============================== WINDOW_EVENTS ==============================//
|
||||
/* window position */
|
||||
glfwSetWindowPosCallback(m_Handle, [](GLFWwindow* window, int xpos, int ypos)
|
||||
{
|
||||
glfwSetWindowPosCallback(m_Handle, [](GLFWwindow* window, int xpos, int ypos) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
WindowMovedEvent event(xpos, ypos);
|
||||
|
||||
|
@ -198,8 +192,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* window size */
|
||||
glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow* window, int width, int height) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
WindowResizedEvent event(width, height);
|
||||
|
||||
|
@ -207,8 +200,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* window close */
|
||||
glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow* window)
|
||||
{
|
||||
glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow* window) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
WindowClosedEvent event;
|
||||
|
||||
|
@ -216,8 +208,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* window focus */
|
||||
glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow* window, int focus)
|
||||
{
|
||||
glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow* window, int focus) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
if (focus == GLFW_TRUE)
|
||||
|
@ -234,4 +225,4 @@ namespace Light {
|
|||
//============================== WINDOW_EVENTS ==============================//
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "wWindow.h"
|
||||
|
||||
#include "Events/Event.h"
|
||||
#include "Events/CharEvent.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/Event.h"
|
||||
#include "Events/KeyboardEvents.h"
|
||||
#include "Events/MouseEvents.h"
|
||||
#include "Events/WindowEvents.h"
|
||||
|
||||
|
||||
#include "Graphics/GraphicsContext.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
@ -26,11 +24,10 @@ namespace Light {
|
|||
}
|
||||
|
||||
wWindow::wWindow(std::function<void(Event&)> callback)
|
||||
: m_Handle(nullptr),
|
||||
m_EventCallback(callback)
|
||||
: m_Handle(nullptr), m_EventCallback(callback)
|
||||
{
|
||||
// init glfw
|
||||
LT_ENGINE_ASSERT(glfwInit(), "wWindow::wWindow: failed to initialize 'glfw'");
|
||||
ASSERT(glfwInit(), "wWindow::wWindow: failed to initialize 'glfw'");
|
||||
|
||||
// create window
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||
|
@ -39,7 +36,7 @@ namespace Light {
|
|||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
|
||||
m_Handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr);
|
||||
LT_ENGINE_ASSERT(m_Handle, "wWindow::wWindow: glfwCreateWindow: failed to create 'GLFWwindow'");
|
||||
ASSERT(m_Handle, "wWindow::wWindow: glfwCreateWindow: failed to create 'GLFWwindow'");
|
||||
|
||||
// bind event stuff
|
||||
glfwSetWindowUserPointer(m_Handle, &m_EventCallback);
|
||||
|
@ -47,7 +44,7 @@ namespace Light {
|
|||
|
||||
// create graphics context
|
||||
m_GraphicsContext = GraphicsContext::Create(GraphicsAPI::DirectX, m_Handle);
|
||||
LT_ENGINE_ASSERT(m_GraphicsContext, "wWindow::wWindow: failed to create 'GraphicsContext'");
|
||||
ASSERT(m_GraphicsContext, "wWindow::wWindow: failed to create 'GraphicsContext'");
|
||||
}
|
||||
|
||||
wWindow::~wWindow()
|
||||
|
@ -104,8 +101,10 @@ namespace Light {
|
|||
|
||||
void wWindow::SetSize(const glm::uvec2& size, bool additive /* = false */)
|
||||
{
|
||||
m_Properties.size.x = size.x == 0u ? m_Properties.size.x : additive ? m_Properties.size.x + size.x : size.x;
|
||||
m_Properties.size.y = size.y == 0u ? m_Properties.size.y : additive ? m_Properties.size.y + size.y : size.y;
|
||||
m_Properties.size.x = size.x == 0u ? m_Properties.size.x : additive ? m_Properties.size.x + size.x :
|
||||
size.x;
|
||||
m_Properties.size.y = size.y == 0u ? m_Properties.size.y : additive ? m_Properties.size.y + size.y :
|
||||
size.y;
|
||||
|
||||
|
||||
glfwSetWindowSize(m_Handle, size.x, size.y);
|
||||
|
@ -132,8 +131,7 @@ namespace Light {
|
|||
{
|
||||
//============================== MOUSE_EVENTS ==============================//
|
||||
/* cursor position */
|
||||
glfwSetCursorPosCallback(m_Handle, [](GLFWwindow* window, double xpos, double ypos)
|
||||
{
|
||||
glfwSetCursorPosCallback(m_Handle, [](GLFWwindow* window, double xpos, double ypos) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
MouseMovedEvent event(xpos, ypos);
|
||||
|
@ -141,8 +139,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* mouse button */
|
||||
glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow* window, int button, int action, int mods) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
if (action == GLFW_PRESS)
|
||||
|
@ -158,8 +155,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* scroll */
|
||||
glfwSetScrollCallback(m_Handle, [](GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
glfwSetScrollCallback(m_Handle, [](GLFWwindow* window, double xoffset, double yoffset) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
WheelScrolledEvent event(yoffset);
|
||||
|
@ -169,8 +165,7 @@ namespace Light {
|
|||
|
||||
//============================== KEYBOARD_EVENTS ==============================//
|
||||
/* key */
|
||||
glfwSetKeyCallback(m_Handle, [](GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
glfwSetKeyCallback(m_Handle, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
if (action == GLFW_PRESS)
|
||||
|
@ -185,8 +180,7 @@ namespace Light {
|
|||
}
|
||||
});
|
||||
/* char */
|
||||
glfwSetCharCallback(m_Handle, [](GLFWwindow* window, unsigned int character)
|
||||
{
|
||||
glfwSetCharCallback(m_Handle, [](GLFWwindow* window, unsigned int character) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
SetCharEvent event(character);
|
||||
|
@ -197,8 +191,7 @@ namespace Light {
|
|||
|
||||
//============================== WINDOW_EVENTS ==============================//
|
||||
/* window position */
|
||||
glfwSetWindowPosCallback(m_Handle, [](GLFWwindow* window, int xpos, int ypos)
|
||||
{
|
||||
glfwSetWindowPosCallback(m_Handle, [](GLFWwindow* window, int xpos, int ypos) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
WindowMovedEvent event(xpos, ypos);
|
||||
|
||||
|
@ -206,8 +199,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* window size */
|
||||
glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow* window, int width, int height) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
WindowResizedEvent event(width, height);
|
||||
|
||||
|
@ -215,8 +207,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* window close */
|
||||
glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow* window)
|
||||
{
|
||||
glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow* window) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
WindowClosedEvent event;
|
||||
|
||||
|
@ -224,8 +215,7 @@ namespace Light {
|
|||
});
|
||||
|
||||
/* window focus */
|
||||
glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow* window, int focus)
|
||||
{
|
||||
glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow* window, int focus) {
|
||||
std::function<void(Event&)> callback = *(std::function<void(Event&)>*)glfwGetWindowUserPointer(window);
|
||||
|
||||
if (focus == GLFW_TRUE)
|
||||
|
@ -241,4 +231,4 @@ namespace Light {
|
|||
});
|
||||
//============================== WINDOW_EVENTS ==============================// }
|
||||
}
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -27,7 +27,7 @@ EditorLayer::EditorLayer(const std::string& name, const std::vector<std::string>
|
|||
else
|
||||
{
|
||||
SceneSerializer serializer(m_Scene);
|
||||
LT_ENGINE_ASSERT(serializer.Deserialize(m_SceneDir), "EditorLayer::EditorLayer: failed to de-serialize: ", m_SceneDir);
|
||||
ASSERT(serializer.Deserialize(m_SceneDir), "Failed to de-serialize: {}", m_SceneDir);
|
||||
|
||||
m_CameraEntity = m_Scene->GetEntityByTag("Game Camera");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "EditorLayer.h"
|
||||
|
||||
#include "Utility/Serializer.h"
|
||||
|
||||
namespace Light {
|
||||
|
@ -27,7 +26,7 @@ EditorLayer::EditorLayer(const std::string& name, const std::vector<std::string>
|
|||
else
|
||||
{
|
||||
SceneSerializer serializer(m_Scene);
|
||||
LT_ENGINE_ASSERT(serializer.Deserialize(m_SceneDir), "EditorLayer::EditorLayer: failed to de-serialize: ", m_SceneDir);
|
||||
ASSERT(serializer.Deserialize(m_SceneDir), "EditorLayer::EditorLayer: failed to de-serialize: ", m_SceneDir);
|
||||
|
||||
m_CameraEntity = m_Scene->GetEntityByTag("Game Camera");
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ void AssetBrowserPanel::OnUserInterfaceUpdate()
|
|||
m_DirectoryTexture->Bind(0u);
|
||||
for (auto& dirEntry : std::filesystem::directory_iterator(m_CurrentDirectory))
|
||||
{
|
||||
LT_ENGINE_TRACE("File: ", dirEntry.path().string());
|
||||
AssetType assetType;
|
||||
std::string extension = dirEntry.path().extension().string();
|
||||
|
||||
|
@ -71,7 +70,6 @@ void AssetBrowserPanel::OnUserInterfaceUpdate()
|
|||
if (ImGui::ImageButton(m_DirectoryTexture->GetTexture(), ImVec2(m_FileSize, m_FileSize), ImVec2 { 0.0f, 0.0f }, ImVec2 { 1.0f, 1.0f }, 0, ImVec4 { 0.0f, 0.0f, 0.0f, 0.0f }, ImVec4 { 1.0f, 1.0f, 1.0f, 1.0f }))
|
||||
{
|
||||
m_CurrentDirectory /= path.filename();
|
||||
LT_ENGINE_INFO(path.filename().string());
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue