Added EnTT

- Added EnTT
- Minor maintenance and fixes
This commit is contained in:
Light 2021-07-24 13:54:50 +04:30
parent 4abde46290
commit b54afb6046
13 changed files with 48965 additions and 18 deletions

View file

@ -26,3 +26,4 @@ include "../Dependencies/GLFW/build.lua"
include "../Dependencies/GLAD/build.lua"
include "../Dependencies/imgui/build.lua"
include "../Dependencies/stb_image/build.lua"
include "../Dependencies/entt/build.lua"

36
Dependencies/entt/build.lua vendored Normal file
View file

@ -0,0 +1,36 @@
project "entt"
location "%{wks.location}/Dependencies/entt"
-- Output Directories --
targetdir ("%{wks.location}/bin/" .. outputdir)
objdir ("%{wks.location}/bin-int/" .. outputdir)
-- Compiler --
kind "StaticLib"
language "C++"
cppdialect "C++17"
optimize "on"
-- Project Files ---
files
{
"entt.cpp",
"entt.hpp",
"build.lua"
}
--- Filters ---
-- windows
filter "system:windows"
systemversion "latest"
staticruntime "On"
defines
{
"_CRT_SECURE_NO_WARNINGS",
}
flags { "MultiProcessorCompile" }

1
Dependencies/entt/entt.cpp vendored Normal file
View file

@ -0,0 +1 @@
#include "entt.hpp"

48909
Dependencies/entt/entt.hpp vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -15,8 +15,8 @@ project "stb_image"
-- Project Files ---
files
{
"**.c",
"**.h",
"stb_image.c",
"stb_image.h",
"build.lua"
}

View file

@ -49,6 +49,7 @@ project "Engine"
(dependenciesdir .. "imgui/"),
(dependenciesdir .. "stb_image/"),
(dependenciesdir .. "glm/"),
(dependenciesdir .. "entt/"),
}
links
@ -56,7 +57,8 @@ project "Engine"
"GLFW" ,
"GLAD" ,
"ImGui" ,
"stb_image" ,
"stb_image",
"entt",
}
--- Filters ---

View file

@ -35,7 +35,6 @@
#define BIT(x) 1 << x
// assertions
// #todo: log to file in distribution builds
#if defined(LIGHT_DIST)
#define LT_ENGINE_ASSERT(x, ...) { if(!(x)) { LT_FILE_CRITICAL(__VA_ARGS__); throw ::Light::FailedEngineAssertion(__FILE__, __LINE__); } }
#define LT_CLIENT_ASSERT(x, ...) { if(!(x)) { LT_FILE_CRITICAL(__VA_ARGS__); throw ::Light::FailedClientAssertion(__FILE__, __LINE__); } }

View file

@ -8,7 +8,6 @@
#define LT_LOG_FILE_LOCATION "Logs/Logger.txt";
// #todo: log function signature
// 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__)

View file

@ -29,12 +29,12 @@ namespace Light {
{
// delim
std::string delim = GraphicsContext::GetGraphicsAPI() == GraphicsAPI::OpenGL ? "GLSL" :
GraphicsContext::GetGraphicsAPI() == GraphicsAPI::DirectX ? "HLSL" : NULL;
GraphicsContext::GetGraphicsAPI() == GraphicsAPI::DirectX ? "HLSL" : "";
// check
LT_ENGINE_ASSERT(!vertexSource.empty(), "ResourceManager::CreateShader: 'vertexSource' is empty");
LT_ENGINE_ASSERT(!vertexSource.empty(), "ResourceManager::CreateShader: 'pixelSource' is empty");
LT_ENGINE_ASSERT(!delim.empty(), "ResourceManager::LoadShader: invalid/unsupported 'GraphicsAPI': {}", GraphicsContext::GetGraphicsAPI());
LT_ENGINE_ASSERT(!vertexSource.empty(), "ResourceManager::CreateShaderImpl: 'vertexSource' is empty");
LT_ENGINE_ASSERT(!vertexSource.empty(), "ResourceManager::CreateShaderImpl: 'pixelSource' is empty");
LT_ENGINE_ASSERT(!delim.empty(), "ResourceManager::CreateShaderImpl: invalid/unsupported 'GraphicsAPI': {}", GraphicsContext::GetGraphicsAPI());
// save to string
std::string vsSource = vertexSource;
@ -51,8 +51,8 @@ namespace Light {
void ResourceManager::LoadShaderImpl(const std::string& name, const std::string& vertexPath, const std::string& pixelPath)
{
// check
LT_ENGINE_ASSERT(!vertexPath.empty(), "ResourceManager::LoadShader: 'vertexPath' is empty");
LT_ENGINE_ASSERT(!pixelPath.empty(), "ResourceManager::LoadShader: 'pixelPath' is empty");
LT_ENGINE_ASSERT(!vertexPath.empty(), "ResourceManager::LoadShaderImpl: 'vertexPath' is empty");
LT_ENGINE_ASSERT(!pixelPath.empty(), "ResourceManager::LoadShaderImpl: 'pixelPath' is empty");
std::string vPath = vertexPath + (GraphicsContext::GetGraphicsAPI() == GraphicsAPI::OpenGL ? ".glsl" : ".hlsl");
std::string pPath = pixelPath + (GraphicsContext::GetGraphicsAPI() == GraphicsAPI::OpenGL ? ".glsl" : ".hlsl");
@ -80,11 +80,11 @@ namespace Light {
unsigned char* pixels = stbi_load(path.c_str(), &width, &height, &components, desiredComponents);
// check
LT_ENGINE_ASSERT(pixels, "ResourceManager::LoadTexture: failed to load texture <{}>, 'path': {}", name, path);
LT_ENGINE_ASSERT(pixels, "ResourceManager::LoadTextureImpl: failed to load texture <{}>, 'path': {}", name, path);
if (components != desiredComponents)
{
LT_ENGINE_WARN("ResourceManager::LoadTexture: image file compoenents != 'desiredComponents' ({} - {})", components, desiredComponents);
LT_ENGINE_WARN("ResourceManager::LoadTexture: <{}> 'path': {}", name, path);
LT_ENGINE_WARN("ResourceManager::LoadTextureImpl: image file compoenents != 'desiredComponents' ({} - {})", components, desiredComponents);
LT_ENGINE_WARN("ResourceManager::LoadTextureImpl: <{}> 'path': {}", name, path);
}
// create texture

View file

@ -38,8 +38,8 @@ namespace Light {
DXGI_SWAP_CHAIN_DESC sd = { 0 };
// buffer desc
sd.BufferDesc.Width = 800u;
sd.BufferDesc.Height = 600u;
sd.BufferDesc.Width = 1u;
sd.BufferDesc.Height = 1u;
sd.BufferDesc.RefreshRate.Numerator = NULL; // :#todo
sd.BufferDesc.RefreshRate.Denominator = NULL; // :#todo
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;

View file

@ -76,8 +76,6 @@ namespace Light {
// delete shaders (free memory)
glDeleteShader(vertexShader);
glDeleteShader(fragmentShader);
// #todo: validate program
}
glShader::~glShader()

View file

@ -43,6 +43,7 @@ project "Mirror"
"GLAD",
"ImGui",
"stb_image" ,
"entt",
}
--- Filters ---

View file

@ -43,6 +43,7 @@ project "Sandbox"
"GLAD",
"ImGui",
"stb_image" ,
"entt",
}
--- Filters ---