Lets GOOOO
This commit is contained in:
parent
cc4fc02931
commit
ffabc974aa
35 changed files with 929 additions and 664 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
|||
bin/
|
||||
bin-obj/
|
||||
build/
|
||||
.cache/
|
||||
|
||||
# VS Files
|
||||
**.vcxproj**
|
||||
|
@ -27,3 +28,6 @@ Makefile
|
|||
!**/default_gui_layout.ini
|
||||
|
||||
CMake/
|
||||
|
||||
.vimspector.json
|
||||
compiled_commands.json
|
||||
|
|
9
.gitmodules
vendored
9
.gitmodules
vendored
|
@ -13,9 +13,12 @@
|
|||
[submodule "Dependencies/entt"]
|
||||
path = Dependencies/entt
|
||||
url = https://github.com/skypjack/entt
|
||||
[submodule "Dependencies/ShaderConductor"]
|
||||
path = Dependencies/ShaderConductor
|
||||
url = https://github.com/Light3039/shaderconductor
|
||||
[submodule "Dependencies/yaml-cpp"]
|
||||
path = Dependencies/yaml-cpp
|
||||
url = https://github.com/jbeder/yaml-cpp
|
||||
[submodule "Dependencies/shaderc"]
|
||||
path = Dependencies/shaderc
|
||||
url = https://github.com/google/shaderc
|
||||
[submodule "Dependencies/spirv-cross"]
|
||||
path = Dependencies/spirv-cross
|
||||
url = https://github.com/KhronosGroup/SPIRV-Cross
|
||||
|
|
10
Assets/Shaders/Quad/Quad_PS.glsl
Normal file
10
Assets/Shaders/Quad/Quad_PS.glsl
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 440 core
|
||||
|
||||
in vec4 vso_FragmentColor;
|
||||
|
||||
out vec4 fso_FragmentColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fso_FragmentColor = vso_FragmentColor;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
float4 main(float4 Color : COLOR) : SV_Target
|
||||
{
|
||||
return Color;
|
||||
}
|
17
Assets/Shaders/Quad/Quad_VS.glsl
Normal file
17
Assets/Shaders/Quad/Quad_VS.glsl
Normal file
|
@ -0,0 +1,17 @@
|
|||
#version 440 core
|
||||
|
||||
layout(location = 0) in vec4 a_Position;
|
||||
layout(location = 1) in vec4 a_Color;
|
||||
|
||||
layout(std140, binding = 0) uniform ub_ViewProjection
|
||||
{
|
||||
mat4 viewProjection;
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 vso_FragmentColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = viewProjection * a_Position;
|
||||
vso_FragmentColor = a_Color;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
struct VertexOut
|
||||
{
|
||||
float4 Color : COLOR;
|
||||
float4 Position : SV_Position;
|
||||
};
|
||||
|
||||
cbuffer cv_ViewProjection : register(b0)
|
||||
{
|
||||
row_major matrix viewProjection;
|
||||
}
|
||||
|
||||
VertexOut main(float4 InPosition : POSITION, float4 InColor : COLOR)
|
||||
{
|
||||
VertexOut vso;
|
||||
vso.Position = mul(InPosition, viewProjection);
|
||||
vso.Color = InColor;
|
||||
|
||||
return vso;
|
||||
}
|
12
Assets/Shaders/Texture/Texture_PS.glsl
Normal file
12
Assets/Shaders/Texture/Texture_PS.glsl
Normal file
|
@ -0,0 +1,12 @@
|
|||
#version 450 core
|
||||
|
||||
in vec2 vso_TexCoord;
|
||||
|
||||
uniform sampler2D u_Texture;
|
||||
|
||||
out vec4 fso_FragmentColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fso_FragmentColor = texture(u_Texture, vso_TexCoord);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
sampler samplerState : register(s0);
|
||||
Texture2D<float4> myTexture : register(t0);
|
||||
|
||||
float4 main(float2 InTexChoord : TEXCOORD) : SV_Target
|
||||
{
|
||||
return myTexture.Sample(samplerState, InTexChoord);
|
||||
}
|
19
Assets/Shaders/Texture/Texture_VS.glsl
Normal file
19
Assets/Shaders/Texture/Texture_VS.glsl
Normal file
|
@ -0,0 +1,19 @@
|
|||
#version 450 core
|
||||
|
||||
layout(location = 0) in vec4 a_Position;
|
||||
layout(location = 1) in vec2 a_TexCoord;
|
||||
|
||||
layout(std140, binding = 0) uniform ub_ViewProjection
|
||||
{
|
||||
mat4 u_ViewProjection;
|
||||
};
|
||||
|
||||
layout(location = 0) out vec2 vso_TexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_ViewProjection * a_Position;
|
||||
|
||||
vso_TexCoord = a_TexCoord;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
struct VertexOut
|
||||
{
|
||||
float2 TexChoord : TEXCOORD;
|
||||
float4 Position : SV_Position;
|
||||
};
|
||||
|
||||
cbuffer cb_ViewProjection : register(b0)
|
||||
{
|
||||
row_major matrix viewProjection;
|
||||
}
|
||||
|
||||
VertexOut main(float4 InPosition : POSITION, float2 InTexChoord : TEXCOORD)
|
||||
{
|
||||
VertexOut vso;
|
||||
vso.Position = mul(float4(InPosition), viewProjection);
|
||||
vso.TexChoord = InTexChoord;
|
||||
|
||||
return vso;
|
||||
}
|
14
Assets/Shaders/TintedTexture/TintedTexture_PS.glsl
Normal file
14
Assets/Shaders/TintedTexture/TintedTexture_PS.glsl
Normal file
|
@ -0,0 +1,14 @@
|
|||
#version 450 core
|
||||
|
||||
in vec4 vso_Tint;
|
||||
in vec2 vso_TexCoord;
|
||||
|
||||
uniform sampler2D u_Texture;
|
||||
|
||||
out vec4 fso_FragmentColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fso_FragmentColor = texture(u_Texture, vso_TexCoord) * vso_Tint;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
sampler samplerState : register(s0);
|
||||
Texture2D<float4> myTexture : register(t0);
|
||||
|
||||
float4 main(float2 InTexChoord : TEXCOORD, float4 InTint : TINT) : SV_Target
|
||||
{
|
||||
return myTexture.Sample(samplerState, InTexChoord) * InTint;
|
||||
}
|
22
Assets/Shaders/TintedTexture/TintedTexture_VS.glsl
Normal file
22
Assets/Shaders/TintedTexture/TintedTexture_VS.glsl
Normal file
|
@ -0,0 +1,22 @@
|
|||
#version 450 core
|
||||
|
||||
layout(location = 0) in vec4 a_Position;
|
||||
layout(location = 1) in vec4 a_Tint;
|
||||
layout(location = 2) in vec2 a_TexCoord;
|
||||
|
||||
layout(std140, binding = 0) uniform ub_ViewProjection
|
||||
{
|
||||
mat4 u_ViewProjection;
|
||||
};
|
||||
|
||||
out vec4 vso_Tint;
|
||||
out vec2 vso_TexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_ViewProjection * a_Position;
|
||||
|
||||
vso_Tint = a_Tint;
|
||||
vso_TexCoord = a_TexCoord;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
struct VertexOut
|
||||
{
|
||||
float2 TexChoord : TEXCOORD;
|
||||
float4 Tint : TINT;
|
||||
float4 Position : SV_Position;
|
||||
};
|
||||
|
||||
cbuffer cb_ViewProjection : register(b0)
|
||||
{
|
||||
row_major matrix viewProjection;
|
||||
}
|
||||
|
||||
VertexOut main(float4 InPosition : POSITION, float4 InTint : TINT, float2 InTexChoord : TEXCOORD)
|
||||
{
|
||||
VertexOut vso;
|
||||
vso.Position = mul(float4(InPosition), viewProjection);
|
||||
vso.Tint = InTint;
|
||||
vso.TexChoord = InTexChoord;
|
||||
|
||||
return vso;
|
||||
}
|
|
@ -1,15 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(Light VERSION 1.0.0)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(SPIRV_CROSS_ENABLE_TESTS OFF)
|
||||
set(INSTALL_GTEST OFF)
|
||||
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
|
||||
endif()
|
||||
add_subdirectory(Dependencies/ShaderConductor) # <-- this project should not use "cxx_standard 17"
|
||||
project(Light)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
# directories
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
@ -20,8 +12,9 @@ set(MIRROR_DIR ${CMAKE_BINARY_DIR}/../Mirror/)
|
|||
set(ENGINE_DIR ${CMAKE_BINARY_DIR}/../Engine/)
|
||||
set(DEPENDENCIES_DIR ${CMAKE_BINARY_DIR}/../Dependencies/)
|
||||
|
||||
# projects
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
if(NOT MSV)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_compile_definitions(LIGHT_PLATFORM_WINDOWS)
|
||||
|
@ -29,8 +22,11 @@ elseif(UNIX)
|
|||
add_compile_definitions(LIGHT_PLATFORM_LINUX)
|
||||
endif()
|
||||
|
||||
# Projects
|
||||
add_subdirectory(${ENGINE_DIR}/)
|
||||
add_subdirectory(${MIRROR_DIR}/)
|
||||
|
||||
# Dependencies
|
||||
add_subdirectory(${DEPENDENCIES_DIR}GLAD/)
|
||||
add_subdirectory(${DEPENDENCIES_DIR}GLFW/)
|
||||
add_subdirectory(${DEPENDENCIES_DIR}spdlog/)
|
||||
|
@ -39,20 +35,35 @@ add_subdirectory(${DEPENDENCIES_DIR}entt/)
|
|||
add_subdirectory(${DEPENDENCIES_DIR}imgui/)
|
||||
add_subdirectory(${DEPENDENCIES_DIR}stb_image/)
|
||||
add_subdirectory(${DEPENDENCIES_DIR}yaml-cpp/)
|
||||
add_subdirectory(${DEPENDENCIES_DIR}shaderc/)
|
||||
|
||||
target_link_libraries(Engine glad)
|
||||
target_link_libraries(Engine glfw)
|
||||
target_link_libraries(Engine spdlog)
|
||||
target_link_libraries(Engine imgui)
|
||||
target_link_libraries(Engine stb_image)
|
||||
target_link_libraries(Engine ShaderConductor)
|
||||
target_link_libraries(Engine yaml-cpp)
|
||||
target_link_libraries(imgui glad)
|
||||
target_link_libraries(imgui glfw)
|
||||
target_link_libraries(Mirror Engine)
|
||||
# Link
|
||||
target_link_libraries(
|
||||
Engine
|
||||
PRIVATE glad
|
||||
PRIVATE glfw
|
||||
PRIVATE spdlog
|
||||
PRIVATE imgui
|
||||
PRIVATE stb_image
|
||||
PRIVATE yaml-cpp
|
||||
PRIVATE shaderc)
|
||||
|
||||
target_link_libraries(
|
||||
imgui
|
||||
PRIVATE glad
|
||||
PRIVATE glfw)
|
||||
|
||||
target_link_libraries(
|
||||
Mirror
|
||||
PRIVATE Engine)
|
||||
|
||||
# Precompiled headers
|
||||
target_precompile_headers(Engine PUBLIC ${ENGINE_DIR}src/Engine/ltpch.h)
|
||||
|
||||
if(MSVC)
|
||||
set_property(DIRECTORY ${CMAE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Mirror)
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_BUILD_TYPE debug)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS_ON)
|
||||
|
|
1
Dependencies/ShaderConductor
vendored
1
Dependencies/ShaderConductor
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit 30a77c78d24fa08f4fe5fc4428f10dbfc92717a6
|
1
Dependencies/shaderc
vendored
Submodule
1
Dependencies/shaderc
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 96b1dd72a827304817470274a470c4d3b2293451
|
1
Dependencies/spirv-cross
vendored
Submodule
1
Dependencies/spirv-cross
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3915c37bb184c66760f75e9b027d4229b1b1924a
|
139
Engine/.clang-format
Normal file
139
Engine/.clang-format
Normal file
|
@ -0,0 +1,139 @@
|
|||
---
|
||||
# Core
|
||||
Language: Cpp
|
||||
Standard: Cpp11
|
||||
ColumnLimit: '0' # No limit
|
||||
|
||||
### Bin pack ###
|
||||
BinPackArguments: 'true'
|
||||
BinPackParameters: 'true'
|
||||
|
||||
# Includes
|
||||
SortIncludes: 'true'
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# Current Project
|
||||
- Regex: '"'
|
||||
Priority: 001
|
||||
|
||||
# Custom Project Categories...
|
||||
|
||||
# Dependecies
|
||||
- Regex: '<'
|
||||
Priority: 500
|
||||
|
||||
# Custom Deependencies Categories...
|
||||
|
||||
# C++ includes
|
||||
- Regex: '[^.h .hpp]>'
|
||||
Priority: 998
|
||||
|
||||
# C includes
|
||||
- Regex: '<[^/\n]+[.]h>'
|
||||
Priority: 999
|
||||
|
||||
# Braces
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
|
||||
# Indentation
|
||||
UseTab: ForIndentation
|
||||
TabWidth: '4'
|
||||
IndentWidth: '4'
|
||||
ContinuationIndentWidth: '4'
|
||||
ConstructorInitializerIndentWidth: '4'
|
||||
IndentCaseLabels: 'false'
|
||||
IndentWrappedFunctionNames: 'true'
|
||||
IndentPPDirectives: BeforeHash
|
||||
NamespaceIndentation: None
|
||||
AccessModifierOffset: '-4'
|
||||
|
||||
# Space
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceAfterLogicalNot: 'false'
|
||||
SpaceAfterTemplateKeyword: 'false'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeCpp11BracedList: 'true'
|
||||
SpaceBeforeCtorInitializerColon: 'false'
|
||||
SpaceBeforeInheritanceColon: 'false'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: 'true'
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '1'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInContainerLiterals: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
|
||||
### Alignment ###
|
||||
PointerAlignment: Left
|
||||
DerivePointerAlignment: 'false'
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignEscapedNewlines: Left
|
||||
AlignConsecutiveDeclarations: 'false'
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignConsecutiveMacros: 'true'
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
|
||||
### Single Line ###
|
||||
AllowShortCaseLabelsOnASingleLine: 'true'
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortLambdasOnASingleLine: Inline
|
||||
AllowAllArgumentsOnNextLine: 'false'
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'false'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
|
||||
### Break ###
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'false'
|
||||
AlwaysBreakTemplateDeclarations: 'Yes'
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: 'false'
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakStringLiterals: 'false'
|
||||
|
||||
# Penalties
|
||||
PenaltyBreakAssignment: '0'
|
||||
PenaltyBreakBeforeFirstCallParameter: '0'
|
||||
PenaltyBreakComment: '0'
|
||||
PenaltyBreakFirstLessLess: '0'
|
||||
PenaltyBreakString: '0'
|
||||
PenaltyBreakTemplateDeclaration: '0'
|
||||
PenaltyExcessCharacter: '0'
|
||||
PenaltyReturnTypeOnItsOwnLine: '999999999' # Nope
|
||||
|
||||
# Constructor Initializers
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||
AllowAllConstructorInitializersOnNextLine: 'true'
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
|
||||
# Comments
|
||||
ReflowComments: 'false'
|
||||
CommentPragmas: '^ TODO@:'
|
||||
FixNamespaceComments: 'true'
|
||||
|
||||
# Misc
|
||||
Cpp11BracedListStyle: 'false'
|
||||
SortUsingDeclarations: 'true'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
MaxEmptyLinesToKeep: '2'
|
|
@ -47,8 +47,8 @@ ${DEPENDENCIES_DIR}glm/
|
|||
${DEPENDENCIES_DIR}imgui/
|
||||
${DEPENDENCIES_DIR}spdlog/include/
|
||||
${DEPENDENCIES_DIR}stb_image/
|
||||
${DEPENDENCIES_DIR}ShaderConductor/Include/
|
||||
${DEPENDENCIES_DIR}yaml-cpp/include/
|
||||
${DEPENDENCIES_DIR}shaderc/libshaderc/include
|
||||
)
|
||||
|
||||
source_group(TREE ${ENGINE_DIR} FILES ${ENGINE_ALL_FILES} ${ENGINE_RES_FILES})
|
||||
|
@ -62,11 +62,3 @@ endif()
|
|||
|
||||
|
||||
message(BINARY DIRECTORY IS IN ${CMAKE_BINARY_DIR})
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(
|
||||
TARGET Engine
|
||||
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_BINARY_DIR}/Dependencies/ShaderConductor/Bin/Debug/ShaderConductor.dll
|
||||
${CMAKE_BINARY_DIR}/bin/Debug)
|
||||
endif()
|
|
@ -2,32 +2,22 @@
|
|||
|
||||
#include "Blender.h"
|
||||
#include "Buffers.h"
|
||||
#include "Camera/SceneCamera.h"
|
||||
#include "Events/WindowEvents.h"
|
||||
#include "Framebuffer.h"
|
||||
#include "RenderCommand.h"
|
||||
#include "Texture.h"
|
||||
|
||||
#include "Camera/SceneCamera.h"
|
||||
|
||||
#include "Events/WindowEvents.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
|
||||
namespace Light {
|
||||
|
||||
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)
|
||||
: 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!");
|
||||
s_Context = this;
|
||||
|
@ -107,6 +97,7 @@ namespace Light {
|
|||
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");
|
||||
texture->Bind();
|
||||
|
||||
// locals
|
||||
|
@ -139,6 +130,7 @@ namespace Light {
|
|||
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");
|
||||
texture->Bind();
|
||||
|
||||
// locals
|
||||
|
@ -275,4 +267,4 @@ namespace Light {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Light {
|
|||
m_MaxVertices(maxVertices)
|
||||
{
|
||||
// #todo: don't use relative path
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_QUAD_SHADER", "Assets/Shaders/Quad/Quad_VS.hlsl", "Assets/Shaders/Quad/Quad_PS.hlsl");
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_QUAD_SHADER", "Assets/Shaders/Quad/Quad_VS.glsl", "Assets/Shaders/Quad/Quad_PS.glsl");
|
||||
|
||||
m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_QUAD_SHADER");
|
||||
m_VertexBuffer = Ref<VertexBuffer>(VertexBuffer::Create(nullptr, sizeof(QuadVertexData), maxVertices, sharedContext));
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Light {
|
|||
m_MaxVertices(maxVertices)
|
||||
{
|
||||
// #todo: don't use relative path
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER", "Assets/Shaders/Texture/Texture_VS.hlsl", "Assets/Shaders/Texture/Texture_PS.hlsl");
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER", "Assets/Shaders/Texture/Texture_VS.glsl", "Assets/Shaders/Texture/Texture_PS.glsl");
|
||||
|
||||
m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER");
|
||||
m_VertexBuffer = Ref<VertexBuffer>(VertexBuffer::Create(nullptr, sizeof(TextureVertexData), maxVertices, sharedContext));
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Light {
|
|||
m_MaxVertices(maxVertices)
|
||||
{
|
||||
// #todo: don't use relative path
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER", "Assets/Shaders/TintedTexture/TintedTexture_VS.hlsl", "Assets/Shaders/TintedTexture/TintedTexture_PS.hlsl");
|
||||
ResourceManager::LoadShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER", "Assets/Shaders/TintedTexture/TintedTexture_VS.glsl", "Assets/Shaders/TintedTexture/TintedTexture_PS.glsl");
|
||||
|
||||
m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER");
|
||||
m_VertexBuffer = Ref<VertexBuffer>(VertexBuffer::Create(nullptr, sizeof(TintedTextureVertexData), maxVertices, sharedContext));
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Light {
|
|||
switch (severity)
|
||||
{
|
||||
case GL_DEBUG_SEVERITY_HIGH:
|
||||
throw glException(source, type, id, message);
|
||||
// throw glException(source, type, id, message);
|
||||
return;
|
||||
|
||||
case GL_DEBUG_SEVERITY_MEDIUM: case GL_DEBUG_SEVERITY_LOW:
|
||||
|
|
|
@ -9,27 +9,16 @@
|
|||
|
||||
namespace Light {
|
||||
|
||||
glShader::glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile):
|
||||
m_ShaderID(NULL)
|
||||
glShader::glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile)
|
||||
: m_ShaderID(0u)
|
||||
{
|
||||
// create
|
||||
m_ShaderID = glCreateProgram();
|
||||
|
||||
// compile hlsl to glsl
|
||||
ShaderConductor::Compiler::ResultDesc vertexResult = CompileHLSL(vertexFile, Shader::Stage::VERTEX);
|
||||
ShaderConductor::Compiler::ResultDesc pixelResult = CompileHLSL(pixelFile, Shader::Stage::PIXEL);
|
||||
std::string vertexSource(vertexFile.GetData(), vertexFile.GetData() + vertexFile.GetSize());
|
||||
std::string pixelSource(pixelFile.GetData(), pixelFile.GetData() + pixelFile.GetSize());
|
||||
LT_ENGINE_WARN(pixelSource);
|
||||
|
||||
LT_ENGINE_ASSERT(!vertexResult.hasError, "glShader::glShader: failed to compile hlsl vertex shader: {}", vertexFile.GetPath());
|
||||
LT_ENGINE_ASSERT(!pixelResult.hasError, "glShader::glShader: failed to compile hlsl pixel shader: {}", pixelFile.GetPath());
|
||||
|
||||
// extract glsl source
|
||||
std::string vertexSource = std::string(reinterpret_cast<const char*>(vertexResult.target.Data()));
|
||||
vertexSource.resize(vertexResult.target.Size());
|
||||
|
||||
std::string pixelSource = std::string(reinterpret_cast<const char*>(pixelResult.target.Data()));
|
||||
pixelSource.resize(pixelResult.target.Size());
|
||||
|
||||
// compile glsl
|
||||
unsigned int vertexShader = CompileShader(vertexSource, Shader::Stage::VERTEX);
|
||||
unsigned int pixelShader = CompileShader(pixelSource, Shader::Stage::PIXEL);
|
||||
|
||||
|
@ -60,60 +49,32 @@ namespace Light {
|
|||
glUseProgram(NULL);
|
||||
}
|
||||
|
||||
ShaderConductor::Compiler::ResultDesc glShader::CompileHLSL(BasicFileHandle file, Shader::Stage stage)
|
||||
shaderc::SpvCompilationResult glShader::CompileGLSL(BasicFileHandle file, Shader::Stage stage)
|
||||
{
|
||||
// check
|
||||
LT_ENGINE_ASSERT(file.IsValid(), "glShader::CompileHLSL: invalid 'file'");
|
||||
LT_ENGINE_ASSERT(stage, "glShader::CompileHLSL: invalid 'stage': None");
|
||||
// compile options
|
||||
shaderc::CompileOptions options;
|
||||
options.SetTargetEnvironment(shaderc_target_env_opengl, shaderc_env_version_opengl_4_5);
|
||||
options.SetOptimizationLevel(shaderc_optimization_level_performance);
|
||||
|
||||
// compiler options
|
||||
ShaderConductor::Compiler::Options options = {};
|
||||
options.packMatricesInRowMajor = true;
|
||||
options.enableDebugInfo = true;
|
||||
options.disableOptimizations = true;
|
||||
options.inheritCombinedSamplerBindings = true;
|
||||
options.shaderModel = { 4, 5 };
|
||||
// compile
|
||||
shaderc::Compiler compiler;
|
||||
shaderc::SpvCompilationResult result = compiler.CompileGlslToSpv(reinterpret_cast<const char*>(file.GetData()), stage == Shader::Stage::VERTEX ? shaderc_shader_kind::shaderc_vertex_shader : shaderc_shader_kind::shaderc_fragment_shader, file.GetName().c_str(), options);
|
||||
|
||||
// compiler target descriptor
|
||||
ShaderConductor::Compiler::TargetDesc targetDesc = {};
|
||||
targetDesc.language = ShaderConductor::ShadingLanguage::Glsl;
|
||||
targetDesc.version = "440 core";
|
||||
targetDesc.asModule = false;
|
||||
|
||||
// compiler source descriptor
|
||||
ShaderConductor::Compiler::SourceDesc sourceDesc = {};
|
||||
std::string source = std::string(reinterpret_cast<char*>(file.GetData()), file.GetSize());
|
||||
sourceDesc.source = source.c_str();
|
||||
sourceDesc.fileName = file.GetName().c_str();
|
||||
sourceDesc.entryPoint = "main";
|
||||
sourceDesc.stage = stage == Shader::Stage::VERTEX ? ShaderConductor::ShaderStage::VertexShader :
|
||||
stage == Shader::Stage::PIXEL ? ShaderConductor::ShaderStage::PixelShader :
|
||||
ShaderConductor::ShaderStage::GeometryShader;
|
||||
sourceDesc.defines = nullptr;
|
||||
sourceDesc.numDefines = 0u;
|
||||
sourceDesc.loadIncludeCallback = nullptr;
|
||||
|
||||
// compilation result
|
||||
ShaderConductor::Compiler::ResultDesc result = ShaderConductor::Compiler::Compile(sourceDesc, options, targetDesc);
|
||||
|
||||
// log error/warning
|
||||
if (result.errorWarningMsg.Size() != 0u)
|
||||
// log error
|
||||
if (result.GetCompilationStatus() != shaderc_compilation_status_success)
|
||||
{
|
||||
const char* errorWarningStr = reinterpret_cast<const char*>(result.errorWarningMsg.Data());
|
||||
|
||||
if(result.hasError)
|
||||
LT_ENGINE_ERROR("glShader::CompileHLSL: ShaderConductor error:'{}': {}", file.GetName(), errorWarningStr);
|
||||
else
|
||||
LT_ENGINE_WARN("glShader::CompileHLSL: ShaderConductor warning:'{}': {}", errorWarningStr);
|
||||
LT_ENGINE_ERROR("Failed to compile {} shader at {}...", stage == Shader::Stage::VERTEX ? "vertex" : "pixel", file.GetPath());
|
||||
LT_ENGINE_ERROR(" {}", result.GetErrorMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned int glShader::CompileShader(const std::string& source, Shader::Stage stage)
|
||||
unsigned int glShader::CompileShader(std::string source, Shader::Stage stage)
|
||||
{
|
||||
// &(address of) needs an lvalue
|
||||
const char* lvalue_source = reinterpret_cast<const char*>(source.c_str());
|
||||
const char* lvalue_source = source.c_str();
|
||||
LT_ENGINE_WARN("Source______________________________________\n{}", lvalue_source);
|
||||
unsigned int shader = glCreateShader(stage == Shader::Stage::VERTEX ? GL_VERTEX_SHADER :
|
||||
stage == Shader::Stage::PIXEL ? GL_FRAGMENT_SHADER :
|
||||
stage == Shader::Stage::GEOMETRY ? GL_GEOMETRY_SHADER :
|
||||
|
@ -134,20 +95,20 @@ namespace Light {
|
|||
char* errorLog = (char*)alloca(logLength);
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, &errorLog[0]);
|
||||
|
||||
LT_ENGINE_ASSERT(false, "glShader::glShader: failed to compile vertex shader:\n {}", errorLog);
|
||||
LT_ENGINE_ERROR("glShader::glShader: failed to compile {} shader:\n {}", stage == Shader::Stage::VERTEX ? "Vertex" : "Pixel", errorLog);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
|
||||
#ifdef LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
|
||||
// info log
|
||||
{
|
||||
int logLength = 0;
|
||||
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &logLength);
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if (logLength)
|
||||
{
|
||||
char* infoLog = (char*)alloca(logLength);
|
||||
glGetShaderInfoLog(vertexShader, logLength, &logLength, &infoLog[0]);
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, &infoLog[0]);
|
||||
|
||||
LT_ENGINE_TRACE(infoLog);
|
||||
}
|
||||
|
@ -157,4 +118,4 @@ namespace Light {
|
|||
return shader;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "Utility/FileManager.h"
|
||||
|
||||
#include <ShaderConductor/ShaderConductor.hpp>
|
||||
#include <shaderc/shaderc.hpp>
|
||||
|
||||
namespace Light {
|
||||
|
||||
|
@ -23,9 +23,9 @@ namespace Light {
|
|||
void UnBind() override;
|
||||
|
||||
private:
|
||||
ShaderConductor::Compiler::ResultDesc CompileHLSL(BasicFileHandle file, Shader::Stage stage);
|
||||
shaderc::SpvCompilationResult CompileGLSL(BasicFileHandle file, Shader::Stage stage);
|
||||
|
||||
unsigned int CompileShader(const std::string& source, Shader::Stage stage);
|
||||
unsigned int CompileShader(std::string source, Shader::Stage stage);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
139
Mirror/.clang-format
Normal file
139
Mirror/.clang-format
Normal file
|
@ -0,0 +1,139 @@
|
|||
---
|
||||
# Core
|
||||
Language: Cpp
|
||||
Standard: Cpp11
|
||||
ColumnLimit: '0' # No limit
|
||||
|
||||
### Bin pack ###
|
||||
BinPackArguments: 'true'
|
||||
BinPackParameters: 'true'
|
||||
|
||||
# Includes
|
||||
SortIncludes: 'true'
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# Current Project
|
||||
- Regex: '"'
|
||||
Priority: 001
|
||||
|
||||
# Custom Project Categories...
|
||||
|
||||
# Dependecies
|
||||
- Regex: '<'
|
||||
Priority: 500
|
||||
|
||||
# Custom Deependencies Categories...
|
||||
|
||||
# C++ includes
|
||||
- Regex: '[^.h .hpp]>'
|
||||
Priority: 998
|
||||
|
||||
# C includes
|
||||
- Regex: '<[^/\n]+[.]h>'
|
||||
Priority: 999
|
||||
|
||||
# Braces
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
|
||||
# Indentation
|
||||
UseTab: ForIndentation
|
||||
TabWidth: '4'
|
||||
IndentWidth: '4'
|
||||
ContinuationIndentWidth: '4'
|
||||
ConstructorInitializerIndentWidth: '4'
|
||||
IndentCaseLabels: 'false'
|
||||
IndentWrappedFunctionNames: 'true'
|
||||
IndentPPDirectives: BeforeHash
|
||||
NamespaceIndentation: None
|
||||
AccessModifierOffset: '-4'
|
||||
|
||||
# Space
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceAfterLogicalNot: 'false'
|
||||
SpaceAfterTemplateKeyword: 'false'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeCpp11BracedList: 'true'
|
||||
SpaceBeforeCtorInitializerColon: 'false'
|
||||
SpaceBeforeInheritanceColon: 'false'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: 'true'
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '1'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInContainerLiterals: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
|
||||
### Alignment ###
|
||||
PointerAlignment: Left
|
||||
DerivePointerAlignment: 'false'
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignEscapedNewlines: Left
|
||||
AlignConsecutiveDeclarations: 'false'
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignConsecutiveMacros: 'true'
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
|
||||
### Single Line ###
|
||||
AllowShortCaseLabelsOnASingleLine: 'true'
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortLambdasOnASingleLine: Inline
|
||||
AllowAllArgumentsOnNextLine: 'false'
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'false'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
|
||||
### Break ###
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'false'
|
||||
AlwaysBreakTemplateDeclarations: 'Yes'
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: 'false'
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakStringLiterals: 'false'
|
||||
|
||||
# Penalties
|
||||
PenaltyBreakAssignment: '0'
|
||||
PenaltyBreakBeforeFirstCallParameter: '0'
|
||||
PenaltyBreakComment: '0'
|
||||
PenaltyBreakFirstLessLess: '0'
|
||||
PenaltyBreakString: '0'
|
||||
PenaltyBreakTemplateDeclaration: '0'
|
||||
PenaltyExcessCharacter: '0'
|
||||
PenaltyReturnTypeOnItsOwnLine: '999999999' # Nope
|
||||
|
||||
# Constructor Initializers
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||
AllowAllConstructorInitializersOnNextLine: 'true'
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
|
||||
# Comments
|
||||
ReflowComments: 'false'
|
||||
CommentPragmas: '^ TODO@:'
|
||||
FixNamespaceComments: 'true'
|
||||
|
||||
# Misc
|
||||
Cpp11BracedListStyle: 'false'
|
||||
SortUsingDeclarations: 'true'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
MaxEmptyLinesToKeep: '2'
|
|
@ -1,13 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
add_compile_options(-w)
|
||||
endif()
|
||||
if(MSVC)
|
||||
add_compile_options(/MP)
|
||||
add_compile_options(/W0)
|
||||
endif()
|
||||
|
||||
add_compile_definitions(LIGHT_PLATFORM_WINDOWS)
|
||||
|
||||
include_directories(
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
namespace Light {
|
||||
|
||||
EditorLayer::EditorLayer(const std::string& name, const std::vector<std::string>& args) :
|
||||
Layer(name),
|
||||
m_SceneDir(args.empty() ? "" : args[0])
|
||||
EditorLayer::EditorLayer(const std::string& name, const std::vector<std::string>& args)
|
||||
: Layer(name), m_SceneDir(args.empty() ? "" : args[0])
|
||||
{
|
||||
m_Scene = CreateRef<Scene>();
|
||||
|
||||
|
@ -20,14 +19,19 @@ namespace Light {
|
|||
{
|
||||
m_CameraEntity = m_Scene->CreateEntity("Camera");
|
||||
m_CameraEntity.AddComponent<CameraComponent>(SceneCamera(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
ResourceManager::LoadTexture("Awesomeface", "Assets/Textures/awesomeface.png");
|
||||
Entity entity = m_Scene->CreateEntity("Awesomeface", {});
|
||||
entity.AddComponent<SpriteRendererComponent>(ResourceManager::GetTexture("Awesomeface"), glm::vec4 { 0.0f, 1.0f, 1.0f, 1.0f });
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneSerializer serializer(m_Scene);
|
||||
LT_ENGINE_ASSERT(serializer.Deserialize(m_SceneDir), "EditorLayer::EditorLayer: failed to de-serialize: ", m_SceneDir);
|
||||
|
||||
m_CameraEntity = m_Scene->GetEntityByTag("Game Camera");
|
||||
}
|
||||
}
|
||||
|
||||
EditorLayer::~EditorLayer()
|
||||
{
|
||||
|
@ -43,10 +47,12 @@ namespace Light {
|
|||
m_Scene->OnUpdate(deltaTime);
|
||||
|
||||
m_Direction.x = Input::GetKeyboardKey(Key::A) ? -1.0f :
|
||||
Input::GetKeyboardKey(Key::D) ? 1.0f : 0.0f;
|
||||
Input::GetKeyboardKey(Key::D) ? 1.0f :
|
||||
0.0f;
|
||||
|
||||
m_Direction.y = Input::GetKeyboardKey(Key::S) ? -1.0f :
|
||||
Input::GetKeyboardKey(Key::W) ? 1.0f : 0.0f;
|
||||
Input::GetKeyboardKey(Key::W) ? 1.0f :
|
||||
0.0f;
|
||||
|
||||
auto& cameraTranslation = m_CameraEntity.GetComponent<TransformComponent>().translation;
|
||||
cameraTranslation += glm::vec3(m_Direction * m_Speed * deltaTime, 0.0f);
|
||||
|
@ -83,9 +89,10 @@ namespace Light {
|
|||
ImGui::Image(m_Framebuffer->GetColorAttachment(), regionAvail);
|
||||
else
|
||||
ImGui::Image(m_Framebuffer->GetColorAttachment(), regionAvail, ImVec2(0, 1), ImVec2(1, 0));
|
||||
} ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
// panels
|
||||
// Panels
|
||||
m_SceneHierarchyPanel->OnUserInterfaceUpdate();
|
||||
m_PropertiesPanel->OnUserInterfaceUpdate();
|
||||
m_ContentBrowserPanel->OnUserInterfaceUpdate();
|
||||
|
@ -93,4 +100,4 @@ namespace Light {
|
|||
UserInterface::DockspaceEnd();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <LightEngine.h>
|
||||
|
||||
#include "Panels/SceneHierarchyPanel.h"
|
||||
#include "Panels/PropertiesPanel.h"
|
||||
#include "Panels/ContentBrowser.h"
|
||||
#include "Panels/PropertiesPanel.h"
|
||||
#include "Panels/SceneHierarchyPanel.h"
|
||||
|
||||
#include <LightEngine.h>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
namespace Light {
|
||||
|
@ -42,4 +41,4 @@ namespace Light {
|
|||
void OnUserInterfaceUpdate() override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Light
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
|
||||
namespace Light {
|
||||
|
||||
ContentBrowserPanel::ContentBrowserPanel() :
|
||||
m_CurrentDirectory("assets"),
|
||||
m_AssetsPath("assets")
|
||||
{
|
||||
}
|
||||
ContentBrowserPanel::ContentBrowserPanel()
|
||||
: m_CurrentDirectory("Assets"), m_AssetsPath("Assets") {}
|
||||
|
||||
void ContentBrowserPanel::OnUserInterfaceUpdate()
|
||||
{
|
||||
ImGui::Begin("Content Browser");
|
||||
|
||||
if (m_CurrentDirectory != std::filesystem::path("assets"))
|
||||
if (m_CurrentDirectory != std::filesystem::path("Assets"))
|
||||
{
|
||||
if (ImGui::Button(" <-- "))
|
||||
{
|
||||
|
@ -25,8 +22,8 @@ namespace Light {
|
|||
for (auto& dirEntry : std::filesystem::directory_iterator(m_CurrentDirectory))
|
||||
{
|
||||
const auto& path = dirEntry.path();
|
||||
Texture2D
|
||||
auto relativePathasd; = std::filesystem::relative(path, m_AssetsPath);
|
||||
{
|
||||
auto relativePath = std::filesystem::relative(path, m_AssetsPath);
|
||||
std::string relativePathString = relativePath.string();
|
||||
|
||||
if (dirEntry.is_directory())
|
||||
|
@ -40,12 +37,12 @@ namespace Light {
|
|||
{
|
||||
if (ImGui::Button(relativePathString.c_str()))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace Light
|
||||
|
|
1
compile_commands.json
Symbolic link
1
compile_commands.json
Symbolic link
|
@ -0,0 +1 @@
|
|||
build/compile_commands.json
|
|
@ -1,43 +1,53 @@
|
|||
[Window][Dockspace]
|
||||
Pos=0,0
|
||||
Size=1280,720
|
||||
Size=1270,1404
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
ViewportPos=2170,695
|
||||
ViewportId=0x4DBAC3CB
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
DockId=0x00000007,0
|
||||
|
||||
[Window][Dear ImGui Demo]
|
||||
Pos=730,24
|
||||
Size=275,696
|
||||
Pos=737,24
|
||||
Size=335,1380
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][Hierarchy]
|
||||
Pos=0,24
|
||||
Size=363,696
|
||||
Size=363,1380
|
||||
Collapsed=0
|
||||
DockId=0x00000001,0
|
||||
|
||||
[Window][Properties]
|
||||
Pos=1007,24
|
||||
Size=273,696
|
||||
Pos=1074,24
|
||||
Size=182,1380
|
||||
Collapsed=0
|
||||
DockId=0x00000005,0
|
||||
|
||||
[Window][Game]
|
||||
Pos=365,24
|
||||
Size=363,696
|
||||
Size=370,1380
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x1ED03EE2 Window=0x5B816B74 Pos=366,289 Size=1280,696 Split=X
|
||||
DockNode ID=0x00000006 Parent=0x1ED03EE2 SizeRef=728,696 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000006 SizeRef=363,696 Selected=0x788BAA0D
|
||||
DockNode ID=0x00000002 Parent=0x00000006 SizeRef=363,696 CentralNode=1 Selected=0x83199EB2
|
||||
DockNode ID=0x00000003 Parent=0x1ED03EE2 SizeRef=550,696 Split=X
|
||||
DockNode ID=0x00000004 Parent=0x00000003 SizeRef=275,680 Selected=0xE927CF2F
|
||||
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=273,680 Selected=0xC89E3217
|
||||
[Window][Content Browser]
|
||||
ViewportPos=2170,695
|
||||
ViewportId=0x4DBAC3CB
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
DockId=0x00000007,1
|
||||
|
||||
[Docking][Data]
|
||||
DockNode ID=0x00000007 Pos=2170,695 Size=400,400 Selected=0x371352B7
|
||||
DockSpace ID=0x1ED03EE2 Window=0x5B816B74 Pos=6,30 Size=1256,1380 Split=X
|
||||
DockNode ID=0x00000006 Parent=0x1ED03EE2 SizeRef=735,696 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000006 SizeRef=363,696 Selected=0x788BAA0D
|
||||
DockNode ID=0x00000002 Parent=0x00000006 SizeRef=370,696 CentralNode=1 Selected=0x83199EB2
|
||||
DockNode ID=0x00000003 Parent=0x1ED03EE2 SizeRef=519,696 Split=X
|
||||
DockNode ID=0x00000004 Parent=0x00000003 SizeRef=335,680 Selected=0xE927CF2F
|
||||
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=182,680 Selected=0xC89E3217
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue