Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
dc949e9
init(document-windows): init branch
iMeaNz Mar 25, 2025
2f153d0
fix(document-windows): imgui demo dont show up anymore
iMeaNz Apr 15, 2025
f7775d2
refactor(document-windows): now use std::any for sub inspector data
iMeaNz Apr 15, 2025
adc830a
docs(documents-windows): update docstring for getSubInspectorData
iMeaNz Apr 15, 2025
4bf04b8
feat(document-windows): add new user log level
iMeaNz Apr 15, 2025
bb3ef2c
feat(document-windows): add new utils function to open the file explorer
iMeaNz Apr 15, 2025
b40e7a0
feat(document-windows): add a log file system, when reaching a certai…
iMeaNz Apr 15, 2025
cb5e7db
chore(document-windows): add source files
iMeaNz Apr 15, 2025
b649803
fix(document-windows): now properly computes the padding based on the…
iMeaNz Apr 15, 2025
5fdd501
fix(document-windows): trying to fix windows
iMeaNz Apr 15, 2025
03a55d6
fix(document-windows): trying to fix again
iMeaNz Apr 15, 2025
4e5da49
fix(document-windows): trying to fix windows again
iMeaNz Apr 15, 2025
3ffecaf
fix(document-windows): trying to fix again
iMeaNz Apr 15, 2025
8345384
fix(documment-windows): fix scene renaming
iMeaNz Apr 15, 2025
3dc4f86
fix(document-windows): fix repeated print when modifying material
iMeaNz Apr 15, 2025
d87ae05
refactor(documents-windows): the ### are now directly in the USTRIDs …
iMeaNz Apr 16, 2025
b2f5093
fix(document-windows): scene name is now properly updated when renami…
iMeaNz Apr 16, 2025
d035339
feat(document-windows): add two utils function, findAllEditorScenes t…
iMeaNz Apr 16, 2025
79ff930
feat(documents-windows): add resetDockId method to remove a dock id f…
iMeaNz Apr 16, 2025
dc89447
refactor(document-windows): now set unique str id for the default sce…
iMeaNz Apr 16, 2025
fdc6bb2
feat(document-windows): add resetDockId + unregisterWindow method
iMeaNz Apr 16, 2025
f7c4c46
refactor(document-windows): use unique str id for the default scene
iMeaNz Apr 16, 2025
8a842ea
refactor(document-windows): firstDockSetup method handles when a wino…
iMeaNz Apr 16, 2025
64cd503
feat(document-windows): add delete scene and create scene feature
iMeaNz Apr 16, 2025
aac35a8
fix(document-windows): properly deletes an entity
iMeaNz Apr 16, 2025
5871b28
feat(document-windows): add popup bg in global style
iMeaNz Apr 16, 2025
d2ad75a
refactor(document-windows): popups now also have a gradient
iMeaNz Apr 16, 2025
8617877
refactor(document-windows): modify popupbg to better match color scheme
iMeaNz Apr 16, 2025
e9ebd09
fi(document-windows): camera does not update anymore when not active
iMeaNz Apr 17, 2025
04d63ed
feat(document-windows): add entity creation menu, primitives, models,…
iMeaNz Apr 17, 2025
d551061
feat(document-windows): add open popup with callback
iMeaNz Apr 17, 2025
2206bff
feat(document-windows): add viewport size getter
iMeaNz Apr 17, 2025
5abed2c
fix(document-windows): improve header's text centering
iMeaNz Apr 17, 2025
e0b48a5
feat(document-windows): add generic function for drawing camera and t…
iMeaNz Apr 17, 2025
4386aac
feat(documents-windows): add render boolean to camera component to co…
iMeaNz Apr 17, 2025
fcacb0a
refactor(document-windows): set render property of camera to true to …
iMeaNz Apr 17, 2025
205652e
feat(document-windows): add optional popup size to the open popup method
iMeaNz Apr 17, 2025
e8844c9
feat(document-windows): add billboards
iMeaNz Apr 17, 2025
acb5b34
feat(document-windows): add example billboard in the default scene
iMeaNz Apr 17, 2025
b574144
chore(document-windows): add source files
iMeaNz Apr 17, 2025
52f2d4e
fix(document-windows): add condition to handle transparent textures
iMeaNz Apr 17, 2025
db4f2ab
assets(document-windows): add camera icon
iMeaNz Apr 17, 2025
88381e9
feat(document-windows): add editor camera tag component
iMeaNz Apr 17, 2025
9793771
feat(document-windows): add exclude filter in getAllEntitiesWith in o…
iMeaNz Apr 17, 2025
aaf5bff
feat(document-windows): add renderable billboard to game cameras
iMeaNz Apr 17, 2025
7defacd
fix(document-windows): discard camera entities for the render property
iMeaNz Apr 17, 2025
ed92df1
feat(document-windows): add editor camera tag to main editor scene ca…
iMeaNz Apr 17, 2025
b5eb0cd
fix(document-windows): init size field to 1
iMeaNz Apr 17, 2025
f3b451d
feat(document-windows): add camera preview when hovering in the scene…
iMeaNz Apr 17, 2025
d4780fc
feat(document-windows): add scene type to know if the scene is render…
iMeaNz Apr 17, 2025
331a78f
fix(document-windows): fix winows compilation
iMeaNz Apr 17, 2025
83c3034
feat(document-windows): add camera target property
iMeaNz Apr 18, 2025
80f86f7
feat(document-windows): add component button + entity dropdown selection
iMeaNz Apr 18, 2025
50cf836
feat(document-windows): add draw camera controller and target + add a…
iMeaNz Apr 18, 2025
e08f42a
chore(document-windows): add source files
iMeaNz Apr 18, 2025
acc5f2b
rm(document-windows): remove useless helper func
iMeaNz Apr 18, 2025
d165eca
feat(document-windows): add switch to camera
iMeaNz Apr 18, 2025
0e99333
fix(document-windows): camera is now locked when using gizmo
iMeaNz Apr 18, 2025
f847de0
feat(document-windows): add toolbar
iMeaNz Apr 18, 2025
2bf3d7c
refactor(document-windows): add ImNexo namespace for imgui ui related…
iMeaNz Apr 18, 2025
312b171
feat(document-windows): rename old shader to phong + add shader for a…
iMeaNz Apr 19, 2025
a5ac666
fix(document-windows): corrected clear color in default argument
iMeaNz Apr 19, 2025
be70db3
feat(document-windows): add new selected tag component
iMeaNz Apr 19, 2025
5d11e2d
feat(document-windows): add shader library
iMeaNz Apr 19, 2025
6365d82
feat(document-windows): add enums for common uniforms + now stores th…
iMeaNz Apr 19, 2025
7892bd9
feat(document-windows): implement new setUniforms method
iMeaNz Apr 19, 2025
2305614
feat(document-windows): add methods for stencil and depth buffer hand…
iMeaNz Apr 19, 2025
a21c645
refactor(document-windows): now use shader library + pass the shader …
iMeaNz Apr 19, 2025
9bd6d49
feat(document-windows): add depth and stencil buffer handling
iMeaNz Apr 19, 2025
d3675bd
refactor(document-windows): updated the uniforms name to comply with …
iMeaNz Apr 19, 2025
629540b
fix(document-windows): fix incorrect winding order
iMeaNz Apr 19, 2025
194a058
feat(document-windows): implement depth + stencil buffer handling met…
iMeaNz Apr 19, 2025
35f4e42
fix(document-windows): now pass old and new signature to component ma…
iMeaNz Apr 19, 2025
9e812cc
feat(document-windows): add opaque boolean to handle material properly
iMeaNz Apr 19, 2025
14fbd58
feat(document-windows): add outline rendering
iMeaNz Apr 19, 2025
bf58ba6
chore(document-windows): add source files
iMeaNz Apr 19, 2025
ddae85f
feat(document-windows): add albedo unshaded transparent shader to cam…
iMeaNz Apr 19, 2025
732cf5b
style(document-windows): fix indent
iMeaNz Apr 19, 2025
0e68978
fix(document-windows): now properly set selection type when clicking …
iMeaNz Apr 19, 2025
b42d230
feat(document-windows): add and remove selected component tag to disp…
iMeaNz Apr 19, 2025
1c1f62d
refactor(document-windows): now using only one dir light per scene
iMeaNz Apr 19, 2025
db73800
fix(document-windows): fix ecs tests
iMeaNz Apr 19, 2025
473cae3
chore(document-windows): remove test for renderer2D + add source file
iMeaNz Apr 19, 2025
e8f609e
fix(document-windows): fix shader test, now use map instead of array
iMeaNz Apr 19, 2025
7adf900
chore(document-windows): remove useless print
iMeaNz Apr 19, 2025
d3446dc
fix(document-windows): fix warning
iMeaNz Apr 19, 2025
f73cf22
feat(document-windows): add utils function to attach render component…
iMeaNz Apr 19, 2025
c666611
feat(document-windows): now add render component to lights when creat…
iMeaNz Apr 19, 2025
c235318
refactor(document-windows): since we now use transform component for …
iMeaNz Apr 19, 2025
3e51fb0
chore(document-windows): add source file
iMeaNz Apr 19, 2025
3f3b333
chore(document-windows): remove useless print
iMeaNz Apr 19, 2025
393f213
refactor(document-windows): lights use transform component for their …
iMeaNz Apr 19, 2025
f604ad5
asset(document-windows): add point and spot light icon
iMeaNz Apr 19, 2025
283f06c
feat(document-windows): add utils function to project a ray in the world
iMeaNz Apr 20, 2025
c8b3008
feat(document-windows): add grid shader
iMeaNz Apr 20, 2025
478efb6
chore(document-windows): add source file
iMeaNz Apr 20, 2025
d1bea44
refactor(document-windows): changed default entities
iMeaNz Apr 20, 2025
0efee5c
feat(document-windows): add getter for size
iMeaNz Apr 20, 2025
9be4411
feat(document-windows): load grid shader
iMeaNz Apr 20, 2025
56f64d4
feat(document-windows): add depth mask setter
iMeaNz Apr 20, 2025
6c41fc9
feat(document-windows): now possible to edit grid params
iMeaNz Apr 20, 2025
5ca0d63
feat(document-windows): add util function to retrieve the lat guizmo op
iMeaNz Apr 20, 2025
5fbd0e1
fix(document-windows): fix camera test
iMeaNz Apr 20, 2025
872e3e5
feat(document-windows): add flat color shader
iMeaNz Apr 22, 2025
5fa5093
feat(document-windows): outline shader is now a post processing shade…
iMeaNz Apr 22, 2025
6653400
refactor(document-windows): outline is now rendering via post process…
iMeaNz Apr 22, 2025
3216556
feat(document-windows): add uniform for float2 and bool
iMeaNz Apr 22, 2025
4782642
feat(document-windows): add flat color shader loadd
iMeaNz Apr 22, 2025
e135be4
feat(document-windows): add dummy shortcuts
iMeaNz Apr 23, 2025
7f5263f
feat(document-windows): add input handling
iMeaNz Apr 23, 2025
aa8e968
feat(document-windows): add method to retrieve window state
iMeaNz Apr 23, 2025
0992df9
feat(document-windows): add method to retrieve focused window
iMeaNz Apr 23, 2025
ff9f456
feat(document-windows): shortcut helper bar display
iMeaNz Apr 23, 2025
eef0dc4
chore(document-windows): add source files
iMeaNz Apr 23, 2025
489711c
fix(document-windows): the bar does not disapear when pressing buttons
iMeaNz Apr 24, 2025
852616c
feat(document-windows): add gizmo shortcut handling
iMeaNz Apr 24, 2025
f568952
feat(document-windows): add on release callback
iMeaNz Apr 24, 2025
16150e9
feat(document-windows): now need to maintain press to show axis
iMeaNz Apr 24, 2025
32d99e2
feat(document-windows): add translation speed increase on camera cont…
iMeaNz Apr 25, 2025
6324eea
fix(document-windows): now ignore mouse key inputs when retrieving in…
iMeaNz Apr 25, 2025
54cfd47
feat(document-windows): add delete + snapping shortcut
iMeaNz Apr 25, 2025
0832b34
feat(document-windows): add key repeat handling
iMeaNz Apr 25, 2025
7d17c4d
feat(document-windows): add exclude axis + switch local/global shortcuts
iMeaNz Apr 25, 2025
708b9c7
fix(document-windows): mag filter is now linear
iMeaNz Apr 25, 2025
b8f8b96
feat(document-windows): add multi selection
iMeaNz Apr 25, 2025
11777e0
feat(document-windows): add hide shortcuts
iMeaNz Apr 25, 2025
78644f2
feat(document-windows): add restore/save/Memento to components
iMeaNz Apr 28, 2025
e4339b8
refactor(document-windows): now use a map of type index to component …
iMeaNz Apr 28, 2025
12dc602
feat(document-windows): add action management for undo/redo
iMeaNz Apr 28, 2025
cede59d
feat(document-windows): add undo/redo handling
iMeaNz Apr 28, 2025
b4b3353
chore(document-windows): add source files
iMeaNz Apr 28, 2025
3674e28
refactor(document-windows): move some function impl in source file
iMeaNz Apr 28, 2025
8bfac14
refactor(document-windows): split editor scene into multiple source file
iMeaNz Apr 28, 2025
d0c5ddf
refactor(document-windows): split asset manager window into multiple …
iMeaNz Apr 28, 2025
2129356
style(document-windows): change comment for more clarity
iMeaNz Apr 28, 2025
5ce2f82
refactor(document-windows): split console window into multiple source…
iMeaNz Apr 28, 2025
44276d1
refactor(document-windows): split inspector window and material inspe…
iMeaNz Apr 28, 2025
91cbdaa
refactor(document-windows): split scene tree window into multiple sou…
iMeaNz Apr 28, 2025
9addf14
refactor(document-windows): now using builder pattern for command sbo…
iMeaNz Apr 28, 2025
017c48b
feat(document-windows): add str uid for bottom bar
iMeaNz Apr 28, 2025
8001e20
refactor(document-windows): split into multiple method + fix: bottom …
iMeaNz Apr 28, 2025
b03c95d
feat(document-windows): add shortcuts for scene tree window
iMeaNz Apr 29, 2025
c2e1880
fix(document-windows): viewport now correspond to scene viewport when…
iMeaNz Apr 29, 2025
225a0ae
fix(document-windows): fix strange blip when cancelling the camera cr…
iMeaNz Apr 29, 2025
230a8a2
refactor(document-windows): add entity is now handled via a popup
iMeaNz Apr 29, 2025
19f698a
feat(document-windows): add expand/collapse shortcut + add entity sho…
iMeaNz Apr 29, 2025
66bf660
fix(document-windows): fix camera not working when creating scene
iMeaNz Apr 29, 2025
58c4554
fix(document-windows): add export compile commands for zed editor
iMeaNz Apr 29, 2025
bb10683
refactor(document-windows): add a check for window visiblity when it …
iMeaNz Apr 30, 2025
5b6eec2
fix(document-windows): camera not moving when switching scene
iMeaNz Apr 30, 2025
fbd4559
chore(document-windows): add source files
iMeaNz Apr 30, 2025
27bacea
fix(document-windows): now only using quat from the transfrom for cam…
iMeaNz Apr 30, 2025
cc43cd6
refactor(document-windows): add SceneInfo struct to pass to the run f…
iMeaNz Apr 30, 2025
b398870
refactor(document-windows): centralized the window pos/size and conte…
iMeaNz Apr 30, 2025
9ccce74
fix(document-windows): now use the viewport bounds for the gizmo rect…
iMeaNz Apr 30, 2025
5ce7f82
fix(document-windows): now properly retrieve the viewport bounds base…
iMeaNz Apr 30, 2025
56916f4
fix(document-windows): now pass viewport bounds to the engine to prop…
iMeaNz Apr 30, 2025
f3fcdb3
fix(document-windows): properly project the mouse position into the w…
iMeaNz Apr 30, 2025
7064c19
feat(document-windows): add utils function to check if 2D pos is with…
iMeaNz Apr 30, 2025
f184c4d
fix(document-windows): add header include for msvc
iMeaNz May 4, 2025
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: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(client CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(NEXO_COVERAGE OFF CACHE BOOL "Enable coverage for binaries")
set(NEXO_GIT_SUBMODULE OFF CACHE BOOL "Enable git submodules init and update")
Expand Down
12 changes: 7 additions & 5 deletions common/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,23 @@ namespace nexo {

enum class LogLevel {
FATAL,
ERROR,
ERR,
WARN,
INFO,
DEBUG,
DEV
DEV,
USER
};

inline std::string toString(const LogLevel level)
{
switch (level)
{
case LogLevel::FATAL: return "FATAL";
case LogLevel::ERROR: return "ERROR";
case LogLevel::ERR: return "ERROR";
case LogLevel::WARN: return "WARN";
case LogLevel::INFO: return "INFO";
case LogLevel::USER: return "USER";
case LogLevel::DEBUG: return "DEBUG";
case LogLevel::DEV: return "DEV";
}
Expand All @@ -71,7 +73,7 @@ namespace nexo {

inline void defaultCallback(const LogLevel level, const std::string &message)
{
if (level == LogLevel::FATAL || level == LogLevel::ERROR)
if (level == LogLevel::FATAL || level == LogLevel::ERR)
std::cerr << "[" << toString(level) << "] " << message << std::endl;
else
std::cout << "[" << toString(level) << "] " << message << std::endl;
Expand Down Expand Up @@ -258,7 +260,7 @@ namespace nexo {
NEXO_LOG_ONCE_KEY(fmt, ##__VA_ARGS__), ##__VA_ARGS__)

#define NEXO_FATAL nexo::LogLevel::FATAL
#define NEXO_ERROR nexo::LogLevel::ERROR
#define NEXO_ERROR nexo::LogLevel::ERR
#define NEXO_WARN nexo::LogLevel::WARN
#define NEXO_INFO nexo::LogLevel::INFO
#define NEXO_DEBUG nexo::LogLevel::DEBUG
Expand Down
39 changes: 39 additions & 0 deletions common/math/Projection.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//// Projection.cpp ///////////////////////////////////////////////////////////////
//
// zzzzz zzz zzzzzzzzzzzzz zzzz zzzz zzzzzz zzzzz
// zzzzzzz zzz zzzz zzzz zzzz zzzz
// zzz zzz zzz zzzzzzzzzzzzz zzzz zzzz zzz
// zzz zzz zzz z zzzz zzzz zzzz zzzz
// zzz zzz zzzzzzzzzzzzz zzzz zzz zzzzzzz zzzzz
//
// Author: Mehdy MORVAN
// Date: 20/04/2025
// Description: Source file for the math projection utils
//
///////////////////////////////////////////////////////////////////////////////

#include "Projection.hpp"

namespace nexo::math {

const glm::vec3 projectRayToWorld(float x, float y,
const glm::mat4 &viewProjectionMatrix,
const glm::vec3 &cameraPosition,
unsigned int width, unsigned int height
) {
// Convert to NDC
float ndcX = (2.0f * x) / width - 1.0f;
float ndcY = 1.0f - (2.0f * y) / height;

glm::mat4 inverseViewProj = glm::inverse(viewProjectionMatrix);

// Points in NDC space at near and far planes
glm::vec4 nearPoint = inverseViewProj * glm::vec4(ndcX, ndcY, -1.0f, 1.0f);

nearPoint /= nearPoint.w;

glm::vec3 rayDir = glm::normalize(glm::vec3(nearPoint) - cameraPosition);

return rayDir;
}
}
24 changes: 24 additions & 0 deletions common/math/Projection.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//// Projection.hpp ///////////////////////////////////////////////////////////////
//
// zzzzz zzz zzzzzzzzzzzzz zzzz zzzz zzzzzz zzzzz
// zzzzzzz zzz zzzz zzzz zzzz zzzz
// zzz zzz zzz zzzzzzzzzzzzz zzzz zzzz zzz
// zzz zzz zzz z zzzz zzzz zzzz zzzz
// zzz zzz zzzzzzzzzzzzz zzzz zzz zzzzzzz zzzzz
//
// Author: Mehdy MORVAN
// Date: 20/04/2025
// Description: Header file for the math projection utils
//
///////////////////////////////////////////////////////////////////////////////
#pragma once

#include <glm/glm.hpp>

namespace nexo::math {
const glm::vec3 projectRayToWorld(float x, float y,
const glm::mat4 &viewProjectionMatrix,
const glm::vec3 &cameraPosition,
unsigned int width, unsigned int height
);
}
5 changes: 5 additions & 0 deletions common/math/Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ namespace nexo::math {

return glm::degrees(euler);
}

bool isPosInBounds(const glm::vec2 pos, const glm::vec2 &min, const glm::vec2 &max)
{
return pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
}
}
2 changes: 2 additions & 0 deletions common/math/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ namespace nexo::math {
* when sinp approaches ±1.
*/
glm::vec3 customQuatToEuler(const glm::quat &q);

bool isPosInBounds(const glm::vec2 pos, const glm::vec2 &min, const glm::vec2 &max);
}
61 changes: 52 additions & 9 deletions editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,64 @@ set(SRCS
editor/src/backends/ImGuiBackend.cpp
editor/src/backends/opengl/openglImGuiBackend.cpp
editor/src/context/Selector.cpp
editor/src/Components/Components.cpp
editor/src/Components/EntityPropertiesComponents.cpp
editor/src/Components/Widgets.cpp
editor/src/context/ActionManager.cpp
editor/src/context/ActionHistory.cpp
editor/src/context/ActionGroup.cpp
editor/src/context/actions/EntityActions.cpp
editor/src/ImNexo/EntityProperties.cpp
editor/src/ImNexo/Components.cpp
editor/src/ImNexo/Elements.cpp
editor/src/ImNexo/Panels.cpp
editor/src/ImNexo/Utils.cpp
editor/src/ImNexo/Widgets.cpp
editor/src/utils/ScenePreview.cpp
editor/src/utils/Config.cpp
editor/src/utils/String.cpp
editor/src/utils/FileSystem.cpp
editor/src/utils/EditorProps.cpp
editor/src/inputs/Command.cpp
editor/src/inputs/InputManager.cpp
editor/src/inputs/WindowState.cpp
editor/src/Editor.cpp
editor/src/WindowRegistry.cpp
editor/src/DockingRegistry.cpp
editor/src/DocumentWindows/ConsoleWindow.cpp
editor/src/DocumentWindows/EditorScene.cpp
editor/src/DocumentWindows/SceneTreeWindow.cpp
editor/src/ADocumentWindow.cpp
editor/src/DocumentWindows/EditorScene/Gizmo.cpp
editor/src/DocumentWindows/EditorScene/Init.cpp
editor/src/DocumentWindows/EditorScene/Shortcuts.cpp
editor/src/DocumentWindows/EditorScene/Show.cpp
editor/src/DocumentWindows/EditorScene/Shutdown.cpp
editor/src/DocumentWindows/EditorScene/Toolbar.cpp
editor/src/DocumentWindows/EditorScene/Update.cpp
editor/src/DocumentWindows/AssetManager/Init.cpp
editor/src/DocumentWindows/AssetManager/Show.cpp
editor/src/DocumentWindows/AssetManager/Shutdown.cpp
editor/src/DocumentWindows/AssetManager/Update.cpp
editor/src/DocumentWindows/ConsoleWindow/Init.cpp
editor/src/DocumentWindows/ConsoleWindow/Log.cpp
editor/src/DocumentWindows/ConsoleWindow/Show.cpp
editor/src/DocumentWindows/ConsoleWindow/Shutdown.cpp
editor/src/DocumentWindows/ConsoleWindow/Update.cpp
editor/src/DocumentWindows/ConsoleWindow/Utils.cpp
editor/src/DocumentWindows/InspectorWindow/Init.cpp
editor/src/DocumentWindows/InspectorWindow/Show.cpp
editor/src/DocumentWindows/InspectorWindow/Shutdown.cpp
editor/src/DocumentWindows/InspectorWindow/Update.cpp
editor/src/DocumentWindows/MaterialInspector/Init.cpp
editor/src/DocumentWindows/MaterialInspector/Show.cpp
editor/src/DocumentWindows/MaterialInspector/Shutdown.cpp
editor/src/DocumentWindows/MaterialInspector/Update.cpp
editor/src/DocumentWindows/SceneTreeWindow/Hovering.cpp
editor/src/DocumentWindows/SceneTreeWindow/Init.cpp
editor/src/DocumentWindows/SceneTreeWindow/NodeHandling.cpp
editor/src/DocumentWindows/SceneTreeWindow/Rename.cpp
editor/src/DocumentWindows/SceneTreeWindow/SceneCreation.cpp
editor/src/DocumentWindows/SceneTreeWindow/Selection.cpp
editor/src/DocumentWindows/SceneTreeWindow/Show.cpp
editor/src/DocumentWindows/SceneTreeWindow/Shutdown.cpp
editor/src/DocumentWindows/SceneTreeWindow/Update.cpp
editor/src/DocumentWindows/SceneTreeWindow/Shortcuts.cpp
editor/src/DocumentWindows/PopupManager.cpp
editor/src/DocumentWindows/InspectorWindow.cpp
editor/src/DocumentWindows/MaterialInspector.cpp
editor/src/DocumentWindows/EntityProperties/TransformProperty.cpp
editor/src/DocumentWindows/EntityProperties/RenderProperty.cpp
editor/src/DocumentWindows/EntityProperties/AmbientLightProperty.cpp
Expand All @@ -38,7 +81,7 @@ set(SRCS
editor/src/DocumentWindows/EntityProperties/SpotLightProperty.cpp
editor/src/DocumentWindows/EntityProperties/CameraProperty.cpp
editor/src/DocumentWindows/EntityProperties/CameraController.cpp
editor/src/DocumentWindows/AssetManagerWindow.cpp
editor/src/DocumentWindows/EntityProperties/CameraTarget.cpp
)

# Windows App Icon
Expand Down
16 changes: 8 additions & 8 deletions editor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
///////////////////////////////////////////////////////////////////////////////

#include "src/Editor.hpp"
#include "src/DocumentWindows/ConsoleWindow.hpp"
#include "src/DocumentWindows/EditorScene.hpp"
#include "src/DocumentWindows/SceneTreeWindow.hpp"
#include "src/DocumentWindows/InspectorWindow.hpp"
#include "src/DocumentWindows/AssetManagerWindow.hpp"
#include "src/DocumentWindows/MaterialInspector.hpp"
#include "src/DocumentWindows/ConsoleWindow/ConsoleWindow.hpp"
#include "src/DocumentWindows/EditorScene/EditorScene.hpp"
#include "src/DocumentWindows/SceneTreeWindow/SceneTreeWindow.hpp"
#include "src/DocumentWindows/InspectorWindow/InspectorWindow.hpp"
#include "src/DocumentWindows/AssetManager/AssetManagerWindow.hpp"
#include "src/DocumentWindows/MaterialInspector/MaterialInspector.hpp"

#include <thread>
#include <core/exceptions/Exceptions.hpp>
Expand All @@ -30,14 +30,14 @@ int main(int argc, char **argv)
loguru::g_stderr_verbosity = loguru::Verbosity_3;
nexo::editor::Editor &editor = nexo::editor::Editor::getInstance();

editor.registerWindow<nexo::editor::EditorScene>(NEXO_WND_USTRID_DEFAULT_SCENE);
editor.registerWindow<nexo::editor::EditorScene>("Default Scene" NEXO_WND_USTRID_DEFAULT_SCENE + std::to_string(0));
editor.registerWindow<nexo::editor::SceneTreeWindow>(NEXO_WND_USTRID_SCENE_TREE);
editor.registerWindow<nexo::editor::InspectorWindow>(NEXO_WND_USTRID_INSPECTOR);
editor.registerWindow<nexo::editor::ConsoleWindow>(NEXO_WND_USTRID_CONSOLE);
editor.registerWindow<nexo::editor::MaterialInspector>(NEXO_WND_USTRID_MATERIAL_INSPECTOR);
editor.registerWindow<nexo::editor::AssetManagerWindow>(NEXO_WND_USTRID_ASSET_MANAGER);

if (auto defaultScene = editor.getWindow<nexo::editor::EditorScene>(NEXO_WND_USTRID_DEFAULT_SCENE).lock())
if (auto defaultScene = editor.getWindow<nexo::editor::EditorScene>("Default Scene" NEXO_WND_USTRID_DEFAULT_SCENE + std::to_string(0)).lock())
defaultScene->setDefault();

editor.init();
Expand Down
83 changes: 83 additions & 0 deletions editor/src/ADocumentWindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//// ADocumentWindow.cpp ///////////////////////////////////////////////////////////////
//
// zzzzz zzz zzzzzzzzzzzzz zzzz zzzz zzzzzz zzzzz
// zzzzzzz zzz zzzz zzzz zzzz zzzz
// zzz zzz zzz zzzzzzzzzzzzz zzzz zzzz zzz
// zzz zzz zzz z zzzz zzzz zzzz zzzz
// zzz zzz zzzzzzzzzzzzz zzzz zzz zzzzzzz zzzzz
//
// Author: Mehdy MORVAN
// Date: 29/04/2025
// Description: Source file for the abstract document window class
//
///////////////////////////////////////////////////////////////////////////////

#include "ADocumentWindow.hpp"

namespace nexo::editor {

void ADocumentWindow::beginRender(const std::string &windowName)
{
dockingUpdate(windowName);
visibilityUpdate();
sizeUpdate();
}

void ADocumentWindow::dockingUpdate(const std::string &windowName)
{
if (ImGuiWindow* currentWindow = ImGui::GetCurrentWindow(); currentWindow)
{
const bool isDocked = currentWindow->DockIsActive;
const ImGuiID currentDockID = currentWindow->DockId;
auto dockId = m_windowRegistry.getDockId(windowName);

// If it's the first time opening the window and we have a dock id saved in the registry, then we force set it
if (m_firstOpened && ((dockId && currentDockID != *dockId)))
ImGui::DockBuilderDockWindow(windowName.c_str(), *dockId);
// If the docks ids differ, it means the window got rearranged in the global layout
// If we are docked but we dont have a dock id saved in the registry, it means the user moved the window
// In both cases, we update our docking registry with the new dock id
else if ((dockId && currentDockID != *dockId) || (isDocked && !dockId))
m_windowRegistry.setDockId(windowName, currentDockID);


// If it is not docked anymore, we have a floating window without docking node,
// So we erase it from the docking registry
if (!m_firstOpened && !isDocked)
m_windowRegistry.resetDockId(windowName);
m_firstOpened = false;
}
}

void ADocumentWindow::visibilityUpdate()
{
m_focused = ImGui::IsWindowFocused();
bool isDocked = ImGui::IsWindowDocked();
ImGuiWindow* window = ImGui::GetCurrentWindow();

if (isDocked) {
ImGuiID dock_id = ImGui::GetWindowDockID();
ImGuiDockNode* node = ImGui::DockBuilderGetNode(dock_id);

// If the window is currently being rendered with normal content,
// and not hidden or set to skip items, then it is visible
m_isVisibleInDock = !window->Hidden && !window->SkipItems && window->Active;
}
else {
// Not docked windows are visible if we've reached this point
m_isVisibleInDock = true;
}

m_hovered = ImGui::IsWindowHovered();
}

void ADocumentWindow::sizeUpdate()
{
ImGuiWindow* window = ImGui::GetCurrentWindow();
m_windowPos = window->Pos;
m_windowSize = window->Size;
m_contentSizeMin = ImGui::GetWindowContentRegionMin();
m_contentSizeMax = ImGui::GetWindowContentRegionMax();
m_contentSize = ImGui::GetContentRegionAvail();
}
}
Loading