Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ bld/

# Submodules folder
__externals/fmt
__externals/glm
__externals/imgui/src
__externals/imgui/src/examples/example_glfw_vulkan/out/
__externals/SDL2
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
[submodule "__externals/Vulkan-Loader"]
path = __externals/Vulkan-Loader
url = https://github.com/KhronosGroup/Vulkan-Loader
[submodule "__externals/glm"]
path = __externals/glm
url = https://github.com/g-truc/glm
[submodule "__externals/Vulkan-Headers"]
path = __externals/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ if (NOT LAUNCHER_ONLY)
add_subdirectory (${EXTERNAL_DIR}/imgui)
add_subdirectory (${EXTERNAL_DIR}/glfw)
add_subdirectory (${EXTERNAL_DIR}/spdlog)
add_subdirectory (${EXTERNAL_DIR}/glm)
add_subdirectory (${EXTERNAL_DIR}/entt)
add_subdirectory (${EXTERNAL_DIR}/assimp)
add_subdirectory (${EXTERNAL_DIR}/stduuid)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ See our roadmap here [Roadmap](Roadmap.md)

The project uses the following dependencies as submodules :
- [GLFW](https://github.com/glfw/glfw) for window creation and user input management for Windows, Linux, and MacOS,
- [GLM](https://glm.g-truc.net/0.9.9/index.html) for functions and mathematical calculations,
- [STB](https://github.com/nothings/stb) for loading and manipulating image files for textures.
- [ImGUI](https://github.com/ocornut/imgui) for GUI components and interaction.
- [SPDLOG](https://github.com/gabime/spdlog) for logging
Expand Down
4 changes: 1 addition & 3 deletions Scripts/BuildEngine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
}

# Define CMake Generator arguments
$cMakeOptions = " -DCMAKE_SYSTEM_NAME=$systemName", " -DCMAKE_BUILD_TYPE=$configuration"
$cMakeOptions = " -DCMAKE_SYSTEM_NAME=$systemName", " -DCMAKE_BUILD_TYPE=$configuration", "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
$submoduleCMakeOptions = @{
'ENTT' = @("-DENTT_INCLUDE_HEADERS=ON")
'SPDLOG' = @("-DSPDLOG_BUILD_SHARED=OFF", "-DBUILD_STATIC_LIBS=ON", "-DSPDLOG_FMT_EXTERNAL=ON", "-DSPDLOG_FMT_EXTERNAL_HO=OFF");
Expand All @@ -150,7 +150,6 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
'SPIRV_TOOLS' = @("-DSPIRV_SKIP_EXECUTABLES=ON", "-DSPIRV_SKIP_TESTS=ON")
'SPIRV_CROSS' = @("-DSPIRV_CROSS_ENABLE_TESTS=OFF")
'LAUNCHER_ONLY' = @("-DLAUNCHER_ONLY=ON")
'GLM' = @("-DCMAKE_POLICY_VERSION_MINIMUM=3.5")
}

$cMakeCacheVariableOverride = $cMakeOptions -join ' '
Expand Down Expand Up @@ -192,7 +191,6 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
$cMakeCacheVariableOverride += ' ' + $submoduleCMakeOptions.SPIRV_CROSS -join ' '
$cMakeCacheVariableOverride += ' ' + $submoduleCMakeOptions.SPIRV_TOOLS -join ' '
$cMakeCacheVariableOverride += ' ' + $submoduleCMakeOptions.GLFW -join ' '
$cMakeCacheVariableOverride += ' ' + $submoduleCMakeOptions.GLM -join ' '
}

$cMakeArguments = " -S $repositoryRootPath -B $buildDirectoryPath $cMakeGenerator $cMakeCacheVariableOverride"
Expand Down
10 changes: 5 additions & 5 deletions Tetragrama/Components/HierarchyViewUIComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#include <Editor.h>
#include <HierarchyViewUIComponent.h>
#include <ImGuizmo/ImGuizmo.h>
#include <ZEngine/Core/Maths/Matrix.h>
#include <ZEngine/Managers/AssetManager.h>
#include <ZEngine/Rendering/Scenes/GraphicScene.h>
#include <ZEngine/Windows/Inputs/KeyCodeDefinition.h>
#include <ZEngine/Windows/Inputs/Keyboard.h>
#include <ZEngine/Windows/Inputs/Mouse.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>

using namespace ZEngine;
using namespace ZEngine::Helpers;
using namespace ZEngine::Windows::Inputs;
using namespace ZEngine::Rendering::Scenes;
using namespace ZEngine::Core::Maths;

namespace Tetragrama::Components
{
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace Tetragrama::Components
if (camera && IDevice::As<Keyboard>()->IsKeyPressed(ZENGINE_KEY_F, app->CurrentWindow))
{
auto active_editor_camera = reinterpret_cast<Controllers::EditorCameraControllerPtr>(app->CameraController);
active_editor_camera->SetTarget(glm::vec3(global_transform[0][3], global_transform[1][3], global_transform[2][3]));
active_editor_camera->SetTarget(Vec3f(global_transform[0][3], global_transform[1][3], global_transform[2][3]));
}

// snapping
Expand All @@ -247,10 +247,10 @@ namespace Tetragrama::Components

if (m_gizmo_operation > 0)
{
ImGuizmo::Manipulate(glm::value_ptr(camera_view_matrix), glm::value_ptr(camera_projection), (ImGuizmo::OPERATION) m_gizmo_operation, ImGuizmo::MODE::WORLD, glm::value_ptr(global_transform), nullptr, is_snap_operation ? snap_array : nullptr);
ImGuizmo::Manipulate(value_ptr(camera_view_matrix), value_ptr(camera_projection), (ImGuizmo::OPERATION) m_gizmo_operation, ImGuizmo::MODE::WORLD, value_ptr(global_transform), nullptr, is_snap_operation ? snap_array : nullptr);
}

auto delta_transform = glm::inverse(initial_transform) * global_transform;
auto delta_transform = initial_transform.Inverse() * global_transform;
local_transform = local_transform * delta_transform;
// current_scene->MarkSceneNodeAsChanged(m_selected_node_identifier);

Expand Down
101 changes: 50 additions & 51 deletions Tetragrama/Components/InspectorViewUIComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
#include <InspectorViewUIComponent.h>
#include <UIComponentDrawerHelper.h>
#include <ZEngine/Core/Coroutine.h>
#include <ZEngine/Core/Maths/Matrix.h>
#include <ZEngine/Helpers/MeshHelper.h>
#include <ZEngine/Rendering/Textures/Texture.h>

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/matrix_decompose.hpp>

using namespace ZEngine::Rendering::Textures;
using namespace ZEngine::Helpers;
using namespace ZEngine::Core::Maths;

namespace Tetragrama::Components
{
Expand Down Expand Up @@ -56,20 +55,20 @@ namespace Tetragrama::Components
// Helpers::DrawEntityControl("Transform", m_scene_entity, m_node_flag, [this] {
// auto transform = m_scene_entity.GetTransform();

// glm::vec3 translation, scale, skew;
// glm::qua<float> rot_quat;
// glm::vec4 perspective;
// glm::decompose(transform, scale, rot_quat, translation, skew, perspective);
// Vec3f translation, scale, skew;
// Quaternion<float> rot_quat;
// Vec4f perspective;
// decompose(transform, scale, rot_quat, translation, skew, perspective);

// ImGui::Dummy(ImVec2(0, 3));
// Helpers::DrawVec3Control("Position", translation, [&translation](glm::vec3& value) { translation = value; });
// Helpers::DrawVec3Control("Position", translation, [&translation](Vec3f& value) { translation = value; });

// glm::vec3 rotation = glm::eulerAngles(rot_quat);
// Vec3f rotation = eulerAngles(rot_quat);
// ImGui::Dummy(ImVec2(0, 0.5));
// Helpers::DrawVec3Control("Rotation", rotation, [&rotation](glm::vec3& value) { rotation = value; });
// Helpers::DrawVec3Control("Rotation", rotation, [&rotation](Vec3f& value) { rotation = value; });

// ImGui::Dummy(ImVec2(0, 0.5));
// Helpers::DrawVec3Control("Scale", scale, [&scale](glm::vec3& value) { scale = value; }, 1.0f);
// Helpers::DrawVec3Control("Scale", scale, [&scale](Vec3f& value) { scale = value; }, 1.0f);
//});

// Mesh Renderer
Expand Down Expand Up @@ -143,24 +142,24 @@ namespace Tetragrama::Components
if (light_type == LightType::DIRECTIONAL)
{
auto light_ptr = reinterpret_cast<DirectionalLight*>(light.get());
auto direction = light_ptr->Direction.As<glm::vec3>();
auto ambient = light_ptr->Ambient.As<glm::vec3>();
auto diffuse = light_ptr->Diffuse.As<glm::vec3>();
auto specular = light_ptr->Specular.As<glm::vec3>();
auto direction = light_ptr->Direction.As<Vec3f>();
auto ambient = light_ptr->Ambient.As<Vec3f>();
auto diffuse = light_ptr->Diffuse.As<Vec3f>();
auto specular = light_ptr->Specular.As<Vec3f>();

ImGui::Dummy(ImVec2(0, 0.5f));
{
Helpers::DrawVec3Control("Direction", direction, [light_ptr](glm::vec3& value) {
light_ptr->Direction = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawVec3Control("Direction", direction, [light_ptr](Vec3f& value) {
light_ptr->Direction = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](glm::vec3& value) {
light_ptr->Ambient = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](Vec3f& value) {
light_ptr->Ambient = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](glm::vec3& value) {
light_ptr->Diffuse = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](Vec3f& value) {
light_ptr->Diffuse = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](glm::vec3& value) {
light_ptr->Specular = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](Vec3f& value) {
light_ptr->Specular = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
}
}

Expand All @@ -169,24 +168,24 @@ namespace Tetragrama::Components
auto transform = m_scene_entity.GetTransform();
auto light_ptr = reinterpret_cast<PointLight*>(light.get());

auto position = glm::vec3(transform[3]);
auto ambient = light_ptr->Ambient.As<glm::vec3>();
auto diffuse = light_ptr->Diffuse.As<glm::vec3>();
auto specular = light_ptr->Specular.As<glm::vec3>();
auto position = Vec3f(transform[3]);
auto ambient = light_ptr->Ambient.As<Vec3f>();
auto diffuse = light_ptr->Diffuse.As<Vec3f>();
auto specular = light_ptr->Specular.As<Vec3f>();

ImGui::Dummy(ImVec2(0, 0.5f));
{
Helpers::DrawVec3Control("Position", position, [light_ptr](glm::vec3& value) { light_ptr->Position =
glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawVec3Control("Position", position, [light_ptr](Vec3f& value) { light_ptr->Position =
Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](glm::vec3& value) {
light_ptr->Ambient = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](Vec3f& value) {
light_ptr->Ambient = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](glm::vec3& value) {
light_ptr->Diffuse = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](Vec3f& value) {
light_ptr->Diffuse = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](glm::vec3& value) {
light_ptr->Specular = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](Vec3f& value) {
light_ptr->Specular = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawDragFloatControl("Constant", light_ptr->Constant, 0.2f, 0.0f, 0.0f, "%.2f",
[light_ptr](float value) { light_ptr->Constant = value; }); ImGui::Dummy(ImVec2(0, 0.5f));
Expand All @@ -204,32 +203,32 @@ namespace Tetragrama::Components
auto transform = m_scene_entity.GetTransform();
auto light_ptr = reinterpret_cast<Spotlight*>(light.get());

auto direction = light_ptr->Direction.As<glm::vec3>();
auto position = glm::vec3(transform[3]);
auto ambient = light_ptr->Ambient.As<glm::vec3>();
auto diffuse = light_ptr->Diffuse.As<glm::vec3>();
auto specular = light_ptr->Specular.As<glm::vec3>();
auto direction = light_ptr->Direction.As<Vec3f>();
auto position = Vec3f(transform[3]);
auto ambient = light_ptr->Ambient.As<Vec3f>();
auto diffuse = light_ptr->Diffuse.As<Vec3f>();
auto specular = light_ptr->Specular.As<Vec3f>();
static float phi_angle = 12.5f;

ImGui::Dummy(ImVec2(0, 0.5f));
{
Helpers::DrawVec3Control("Position", position, [light_ptr](glm::vec3& value) { light_ptr->Position =
glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawVec3Control("Position", position, [light_ptr](Vec3f& value) { light_ptr->Position =
Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawVec3Control("Direction", direction, [light_ptr](glm::vec3& value) {
light_ptr->Direction = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawVec3Control("Direction", direction, [light_ptr](Vec3f& value) {
light_ptr->Direction = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](glm::vec3& value) {
light_ptr->Ambient = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](Vec3f& value) {
light_ptr->Ambient = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](glm::vec3& value) {
light_ptr->Diffuse = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](Vec3f& value) {
light_ptr->Diffuse = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](glm::vec3& value) {
light_ptr->Specular = glm::vec4(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](Vec3f& value) {
light_ptr->Specular = Vec4f(value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));

Helpers::DrawDragFloatControl("CutOff", phi_angle, 0.1f, 0.0f, 360.0f, "%.2f", [light_ptr](float
value) { phi_angle = value; light_ptr->CutOff = glm::cos(glm::radians(value));
value) { phi_angle = value; light_ptr->CutOff = cos(radians(value));
});
ImGui::Dummy(ImVec2(0, 0.5f));

Expand Down
4 changes: 3 additions & 1 deletion Tetragrama/Controllers/EditorCameraController.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <EditorCameraController.h>
#include <ZEngine/Core/Maths/MathUtils.h>

using namespace ZEngine::Rendering::Cameras;
using namespace ZEngine::Helpers;
using namespace ZEngine::Core::Maths;

namespace Tetragrama::Controllers
{
Expand All @@ -13,7 +15,7 @@ namespace Tetragrama::Controllers
m_window = window;

m_perspective_camera = ZPushStructCtor(arena, PerspectiveCamera);
m_perspective_camera->Initialize(m_camera_fov, m_aspect_ratio, m_camera_near, m_camera_far, glm::radians(yaw_degree), glm::radians(pitch_degree));
m_perspective_camera->Initialize(m_camera_fov, m_aspect_ratio, m_camera_near, m_camera_far, radians(yaw_degree), radians(pitch_degree));
m_perspective_camera->SetDistance(distance);

m_window = window;
Expand Down
9 changes: 5 additions & 4 deletions Tetragrama/EditorScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using namespace ZEngine::Rendering::Meshes;
using namespace ZEngine::Core::Containers;
using namespace ZEngine::Core::Maths;
using namespace ZEngine::Managers;
using namespace ZEngine::Helpers;

Expand Down Expand Up @@ -63,8 +64,8 @@ namespace Tetragrama

Hierarchies.push(new_node);
HierarchiesNodeRef.push({});
LocalTransforms.push(glm::mat4(1.0f));
GlobalTransforms.push(glm::mat4(1.0f));
LocalTransforms.push(Identity<Mat4f>());
GlobalTransforms.push(Identity<Mat4f>());

if (parent >= 0)
{
Expand Down Expand Up @@ -329,8 +330,8 @@ namespace Tetragrama
auto& root_name = Names.push_use({});
root_name.init(&LocalArena, Name);

LocalTransforms.push(glm::mat4(1.0f));
GlobalTransforms.push(glm::mat4(1.0f));
LocalTransforms.push(Identity<Mat4f>());
GlobalTransforms.push(Identity<Mat4f>());

auto& node = Hierarchies.push_use({});
HierarchiesNodeRef.push({});
Expand Down
Loading
Loading