The main Editor class, inheriting from Engine and providing editor-specific functionality and UI. More...
#include <Editor.hpp>
Classes | |
| struct | CopiedObjectData |
Public Member Functions | |
| Editor (const char *title, int width, int height, GameInfo gInfo, const std::string &projectBinaryPath) | |
| Constructs the Editor. | |
| void | render () override |
| Overrides the Engine's render function to inject the Editor UI logic (dockspace, viewport, tools). | |
| void | update (float deltaTime) override |
| Overrides the Engine's update function to handle editor-specific logic. | |
| void | processEvent (const SDL_Event &event, float deltaTime) override |
| Overrides the Engine's processEvent function to handle editor-specific events (e.g., gizmo interaction, camera movement). | |
| void | setFullscreen (bool enabled, bool exclusive=false) override |
| Overrides the Engine's setFullscreen function to disable auto fullscreen by gameModule. | |
| void | requestSceneReload (const std::string &scenePath) |
| Requests a scene reload with a specific path. The reload is typically executed in the main update loop. | |
| std::string | getProjectBinaryPath () const |
| Gets the path to the project's binary directory. | |
| AssetBrowser * | getAssetBrowser () const |
| Gets a pointer to the AssetBrowser instance. | |
| const BrowserIcons & | GetEditorIcons () const |
| Gets the collection of icons used within the editor's UI. | |
| EditorProperties * | getEditorProperties () |
| Gets a pointer to the mutable editor properties. | |
| ProjectProperties * | getProjectProperties () |
| Gets a pointer to the mutable project properties. | |
| void | HandleMeshDrop (const std::string &filepath, vex::Entity parent=vex::NULL_ENTITY) |
| Handles the dropping of a mesh asset. | |
| void | OnHotReload () |
| Handler for post-hot-reload operations. | |
| void | refreshForObject () override |
| Overrides the base Engine function to trigger a frame and refresh. | |
| void | ProcessEditorShortcuts () |
| Processes editor shortcuts. | |
| void | CopySelectedObject () |
| Copies the selected object to the clipboard. | |
| void | PasteObjectToScene () |
| Pastes the object from the clipboard to the scene. | |
| void | DuplicateSelectedObject () |
| Duplicates the selected object in the scene. | |
| void | DeleteSelectedObject () |
| Deletes the selected object from the scene. | |
| void | Undo () |
| Undoes the last action performed in the editor. | |
| void | Redo () |
| Redoes the last undone action in the editor. | |
| bool | IsEditor () override |
| Returns true if the engine is running in editor mode. | |
| void | ShowConsole () |
| Shows the debug console. | |
| Public Member Functions inherited from vex::Engine | |
| Engine (const char *title, int width, int height, GameInfo gInfo) | |
| Constructor for the Engine class. | |
| void | run (std::function< void()> onUpdateLoop=nullptr) |
| Starts and runs the main game loop. | |
| vex::Entity | getCamera () |
| Function returning the entity of the camera. | |
| void | setResolutionMode (ResolutionMode mode) |
| Sets the resolution mode and updates the resolution manager. | |
| void | setPaused (bool paused) |
| Internal function for handling pausing and resuming the game. | |
| bool | isPaused () const |
| Function returning the current state of the game. | |
| ResolutionMode | getResolutionMode () const |
| Returns the current resolution mode. | |
| ResolutionManager * | getResolutionManager () const |
| returns a pointer to the resolution manager. | |
| void | setInputMode (InputMode mode) |
| Function allowing for changing input mode at runtime. | |
| InputMode | getInputMode () const |
| Returns the current input mode. | |
| void | setEnvironmentSettings (environment settings) |
| Applies new global environment settings (lighting, shading) to the interface. | |
| environment | getEnvironmentSettings () |
| Returns the current environment settings. | |
| Interface * | getInterface () |
| Returns Interface, used internally. | |
| std::shared_ptr< VirtualFileSystem > | getFileSystem () |
| Returns std::shared_ptr of VirtualFileSystem. | |
| vex::Registry & | getRegistry () |
| Returns a reference to vex::Registry. | |
| PhysicsSystem * | getPhysicsSystem () |
| Returns pointer to PhysicsSystem. | |
| SceneManager * | getSceneManager () |
| Returns pointer to SceneManager. | |
| std::shared_ptr< VexUI > | createVexUI () |
| Creates and returns a shared pointer to a VexUI instance. | |
| int | GetCurrentFrame () |
| Returns current frame number. | |
| void | setRenderPhysicsDebug (bool value) |
| Function to enable/disable rendering collision shapes. | |
| bool | isFullscreen () |
| Function to check if fullscreen mode is enabled. | |
| std::vector< std::string > | getLastLoadedScenes () |
| Function to get the last loaded scenes. | |
| void | prepareScenesForHotReload () |
| Prepares the engine for a hot-reload event. | |
| virtual void | beginGame () |
| Internal virtual function for handling stuff right at the beginning of the game but after initialization of the engine. | |
| void | quit () |
| Simply sets m_running to false, Effectivelly soft shuting down the engine. | |
| void | WaitForGpu () |
| Waits for the GPU to finish all pending operations. | |
| void | setFrameLimit (int fps) |
| Sets the target frame rate limit. | |
| int | getFrameLimit () const |
| void | setVSync (bool enabled) |
| Toggles VSync (Vertical Synchronization). | |
| bool | getVSync () const |
| Returns the current state of VSync. | |
| float | getDeltaTime () const |
| Returns the time since last frame. | |
| std::shared_ptr< AudioSystem > | getAudioSystem () const |
| Returns the audio system. | |
Private Member Functions | |
| void | drawEditorLayout (const SceneRenderData &data, glm::uvec2 &outNewResolution) |
| Helper to draw the ImGUI dockspace and viewport window for the editor. | |
| void | drawGizmo (const glm::vec2 &viewportPos, const glm::vec2 &viewportSize) |
| Draws the ImGuizmo for the currently selected object. | |
| void | loadAssetIcons () |
| Loads the texture icons used for the Asset Browser and other UI elements. | |
| float | raySphereIntersect (const glm::vec3 &rayOrigin, const glm::vec3 &rayDir, const glm::vec3 &sphereCenter, float sphereRadius) |
| Performs a ray-sphere intersection test. | |
| float | rayTriangleIntersect (const glm::vec3 &rayOrigin, const glm::vec3 &rayDir, const glm::vec3 &v0, const glm::vec3 &v1, const glm::vec3 &v2) |
| Performs a ray-triangle intersection test (using the Möller–Trumbore algorithm). | |
| void | ExtractObjectByEntity (vex::Entity entity, std::pair< bool, vex::GameObject * > &selectedObject) |
| Retrieves the GameObject corresponding to a given entity ID and updates the selected object pair. | |
| void | SaveConfig (const EditorProperties &data, const std::string &filename) |
| Saves the current EditorProperties configuration to a JSON file. | |
| void | LoadConfig (EditorProperties &data, const std::string &filename) |
| Loads the EditorProperties configuration from a JSON file. | |
| void | SaveProjectConfig (const ProjectProperties &data, const std::string &filename) |
| Saves the current ProjectProperties configuration to a JSON file. | |
| void | LoadProjectConfig (ProjectProperties &data, const std::string &filename) |
| Loads the ProjectProperties configuration from a JSON file. | |
| void | PushCommand (ICommand *cmd) |
| Pushes a command onto the undo stack and clears the redo stack. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from vex::Engine | |
| static const char * | GetBuildHash () |
| returns engine hash generated during build process. | |
| static int | GetVersionMajor () |
| Returns the major version of the engine. | |
| static int | GetVersionMinor () |
| Returns the minor version of the engine. | |
| static int | GetVersionPatch () |
| Returns the patch version of the engine. | |
| static const char * | GetVersionString () |
| Returns the version string of the engine. | |
| Protected Member Functions inherited from vex::Engine | |
| Engine (SkipInit) | |
| Alternative constructor for editor to skip default init code. | |
| Protected Attributes inherited from vex::Engine | |
| std::shared_ptr< Window > | m_window |
| std::shared_ptr< VirtualFileSystem > | m_vfs |
| std::shared_ptr< AudioSystem > | m_audioSystem |
| std::unique_ptr< Interface > | m_interface |
| std::unique_ptr< ResolutionManager > | m_resolutionManager |
| std::unique_ptr< ImGUIWrapper > | m_imgui |
| std::unique_ptr< InputSystem > | m_inputSystem |
| std::unique_ptr< PhysicsSystem > | m_physicsSystem |
| std::unique_ptr< SceneManager > | m_sceneManager |
| vex::Registry | m_registry |
| bool | m_running = true |
| bool | m_paused = false |
| bool | m_internally_paused = false |
| bool | m_renderPhysicsDebug = false |
| int | m_frame = 0 |
| int | m_targetFps = 0 |
| bool | m_vsyncEnabled = false |
| float | m_deltaTime = 0.016f |
| GameInfo | m_gameInfo |
| std::vector< std::string > | lastLoadedScenes |
The main Editor class, inheriting from Engine and providing editor-specific functionality and UI.
Definition at line 32 of file Editor.hpp.
| vex::Editor::Editor | ( | const char * | title, |
| int | width, | ||
| int | height, | ||
| GameInfo | gInfo, | ||
| const std::string & | projectBinaryPath ) |
Constructs the Editor.
| const | char* title - The title of the editor window. |
| int | width - Initial width of the editor window. |
| int | height - Initial height of the editor window. |
| GameInfo | gInfo - Game Info class containing version, name etc. |
| const | std::string& projectBinaryPath - Path to the project's binary directory. |
Definition at line 36 of file Editor.cpp.
|
inline |
Definition at line 44 of file Editor.hpp.
| void vex::Editor::CopySelectedObject | ( | ) |
Copies the selected object to the clipboard.
Definition at line 159 of file Editor.cpp.
| void vex::Editor::DeleteSelectedObject | ( | ) |
Deletes the selected object from the scene.
Definition at line 199 of file Editor.cpp.
|
private |
Helper to draw the ImGUI dockspace and viewport window for the editor.
| const | SceneRenderData& data - Data required for scene rendering. |
| glm::uvec2& | outNewResolution - Output parameter for the new viewport resolution if it changed. |
Definition at line 604 of file Editor.cpp.
|
private |
Draws the ImGuizmo for the currently selected object.
| const | glm::vec2& viewportPos - The position of the viewport window. |
| const | glm::vec2& viewportSize - The size of the viewport window. |
Definition at line 408 of file Editor.cpp.
| void vex::Editor::DuplicateSelectedObject | ( | ) |
Duplicates the selected object in the scene.
Definition at line 194 of file Editor.cpp.
|
private |
Retrieves the GameObject corresponding to a given entity ID and updates the selected object pair.
| vex::Entity | entity - The entity ID to look up. |
| std::pair<bool,vex::GameObject*>& | selectedObject - The pair to update with the selection status and pointer. |
Definition at line 560 of file Editor.cpp.
|
inline |
Gets a pointer to the AssetBrowser instance.
Definition at line 71 of file Editor.hpp.
|
inline |
Gets the collection of icons used within the editor's UI.
Definition at line 75 of file Editor.hpp.
|
inline |
Gets a pointer to the mutable editor properties.
Definition at line 79 of file Editor.hpp.
|
inline |
Gets the path to the project's binary directory.
Definition at line 67 of file Editor.hpp.
|
inline |
Gets a pointer to the mutable project properties.
Definition at line 83 of file Editor.hpp.
| void vex::Editor::HandleMeshDrop | ( | const std::string & | filepath, |
| vex::Entity | parent = vex::NULL_ENTITY ) |
Handles the dropping of a mesh asset.
| const | std::string& filepath - Path to the dropped mesh asset. |
| vex::Entity | parent - Optional parent entity for the instantiated mesh. |
Definition at line 572 of file Editor.cpp.
|
inlineoverridevirtual |
Returns true if the engine is running in editor mode.
Reimplemented from vex::Engine.
Definition at line 121 of file Editor.hpp.
|
private |
Loads the texture icons used for the Asset Browser and other UI elements.
Definition at line 355 of file Editor.cpp.
|
inlineprivate |
Loads the EditorProperties configuration from a JSON file.
| EditorProperties& | data - The data structure to deserialize into. |
| const | std::string& filename - The path/filename of the JSON file. |
Definition at line 191 of file Editor.hpp.
|
inlineprivate |
Loads the ProjectProperties configuration from a JSON file.
| ProjectProperties& | data - The data structure to deserialize into. |
| const | std::string& filename - The path/filename of the JSON file. |
Definition at line 223 of file Editor.hpp.
| void vex::Editor::OnHotReload | ( | ) |
Handler for post-hot-reload operations.
Definition at line 939 of file Editor.cpp.
| void vex::Editor::PasteObjectToScene | ( | ) |
Pastes the object from the clipboard to the scene.
Definition at line 177 of file Editor.cpp.
| void vex::Editor::ProcessEditorShortcuts | ( | ) |
Processes editor shortcuts.
Definition at line 109 of file Editor.cpp.
|
overridevirtual |
Overrides the Engine's processEvent function to handle editor-specific events (e.g., gizmo interaction, camera movement).
| const | SDL_Event& event - Event to process. |
| float | deltaTime - Time since last frame. |
Reimplemented from vex::Engine.
Definition at line 287 of file Editor.cpp.
|
inlineprivate |
Pushes a command onto the undo stack and clears the redo stack.
Definition at line 242 of file Editor.hpp.
|
private |
Performs a ray-sphere intersection test.
| const | glm::vec3& rayOrigin - The origin point of the ray. |
| const | glm::vec3& rayDir - The direction vector of the ray. |
| const | glm::vec3& sphereCenter - The center point of the sphere. |
| float | sphereRadius - The radius of the sphere. |
Definition at line 523 of file Editor.cpp.
|
private |
Performs a ray-triangle intersection test (using the Möller–Trumbore algorithm).
| const | glm::vec3& rayOrigin - The origin point of the ray. |
| const | glm::vec3& rayDir - The direction vector of the ray. |
| const | glm::vec3& v0 - The first vertex of the triangle. |
| const | glm::vec3& v1 - The second vertex of the triangle. |
| const | glm::vec3& v2 - The third vertex of the triangle. |
Definition at line 534 of file Editor.cpp.
| void vex::Editor::Redo | ( | ) |
Redoes the last undone action in the editor.
Definition at line 152 of file Editor.cpp.
|
inlineoverridevirtual |
Overrides the base Engine function to trigger a frame and refresh.
Reimplemented from vex::Engine.
Definition at line 94 of file Editor.hpp.
|
overridevirtual |
Overrides the Engine's render function to inject the Editor UI logic (dockspace, viewport, tools).
Reimplemented from vex::Engine.
Definition at line 291 of file Editor.cpp.
| void vex::Editor::requestSceneReload | ( | const std::string & | scenePath | ) |
Requests a scene reload with a specific path. The reload is typically executed in the main update loop.
| const | std::string& scenePath - The path to the scene file to load. |
Definition at line 349 of file Editor.cpp.
|
inlineprivate |
Saves the current EditorProperties configuration to a JSON file.
| const | EditorProperties& data - The data structure to serialize and save. |
| const | std::string& filename - The path/filename of the JSON file. |
Definition at line 178 of file Editor.hpp.
|
inlineprivate |
Saves the current ProjectProperties configuration to a JSON file.
| const | ProjectProperties& data - The data structure to serialize and save. |
| const | std::string& filename - The path/filename of the JSON file. |
Definition at line 210 of file Editor.hpp.
|
inlineoverridevirtual |
Overrides the Engine's setFullscreen function to disable auto fullscreen by gameModule.
Reimplemented from vex::Engine.
Definition at line 59 of file Editor.hpp.
|
inline |
Shows the debug console.
Definition at line 124 of file Editor.hpp.
| void vex::Editor::Undo | ( | ) |
Undoes the last action performed in the editor.
Definition at line 145 of file Editor.cpp.
|
overridevirtual |
Overrides the Engine's update function to handle editor-specific logic.
| float | deltaTime - Time since last frame. |
Reimplemented from vex::Engine.
Definition at line 212 of file Editor.cpp.
|
private |
Definition at line 266 of file Editor.hpp.
|
private |
Definition at line 263 of file Editor.hpp.
|
private |
Definition at line 275 of file Editor.hpp.
|
private |
Definition at line 274 of file Editor.hpp.
|
private |
Definition at line 264 of file Editor.hpp.
|
private |
Definition at line 281 of file Editor.hpp.
|
private |
Definition at line 287 of file Editor.hpp.
|
private |
Definition at line 256 of file Editor.hpp.
|
private |
Definition at line 257 of file Editor.hpp.
|
private |
Definition at line 258 of file Editor.hpp.
|
private |
Definition at line 255 of file Editor.hpp.
|
private |
Definition at line 267 of file Editor.hpp.
|
private |
Definition at line 260 of file Editor.hpp.
|
private |
Definition at line 279 of file Editor.hpp.
|
private |
Definition at line 269 of file Editor.hpp.
|
private |
Definition at line 272 of file Editor.hpp.
|
private |
Definition at line 284 of file Editor.hpp.
|
private |
Definition at line 238 of file Editor.hpp.
|
private |
Definition at line 289 of file Editor.hpp.
|
private |
Definition at line 282 of file Editor.hpp.
|
private |
Definition at line 285 of file Editor.hpp.
|
private |
Definition at line 265 of file Editor.hpp.
|
private |
Definition at line 277 of file Editor.hpp.
|
private |
Definition at line 237 of file Editor.hpp.
|
private |
Definition at line 276 of file Editor.hpp.
|
private |
Definition at line 262 of file Editor.hpp.
|
private |
Definition at line 270 of file Editor.hpp.
|
private |
Definition at line 239 of file Editor.hpp.
|
private |
Definition at line 290 of file Editor.hpp.