From 62e22979f362c4cdbe231741a66e0c20d21ecf12 Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Sat, 18 Jul 2020 12:27:36 -0700 Subject: [PATCH] Separated out the engine from the editor. --- build/build_app_msvc_win32_debug.bat | 2 +- src/app/{ => deprecated}/foldhaus_node.cpp | 0 src/app/{ => deprecated}/foldhaus_node.h | 0 src/app/{ => deprecated}/foldhaus_node_gui.h | 0 ...oldhaus_util_radialumia_file_converter.cpp | 0 .../{ => editor}/foldhaus_command_dispatch.h | 0 src/app/{ => editor}/foldhaus_interface.cpp | 0 .../{ => editor}/foldhaus_operation_mode.h | 0 src/app/{ => editor}/foldhaus_panel.h | 0 .../foldhaus_panel_animation_timeline.h | 0 .../panels/foldhaus_panel_dmx_view.h | 0 .../panels/foldhaus_panel_file_view.h | 0 .../panels/foldhaus_panel_hierarchy.h | 0 .../panels/foldhaus_panel_profiler.h | 0 .../panels/foldhaus_panel_sculpture_view.h | 0 .../animation/foldhaus_animation.h | 0 src/app/{ => engine}/artnet/artnet.h | 0 src/app/{ => engine}/assembly_parser.cpp | 0 src/app/{ => engine}/dmx/dmx.h | 0 src/app/{ => engine}/foldhaus_assembly.cpp | 0 src/app/{ => engine}/foldhaus_assembly.h | 0 .../{ => engine}/foldhaus_network_ordering.h | 0 src/app/{ => engine}/sacn/sacn.h | 0 src/app/first.cpp | 28 --------- src/app/foldhaus_app.cpp | 7 +-- src/app/foldhaus_app.h | 61 +++++++++---------- src/app/foldhaus_debug.h | 3 + src/app/{ => platform_osx}/gs_osx.mm | 0 src/app/{ => platform_osx}/gs_osx_fileio.mm | 0 src/app/{ => platform_osx}/gs_osx_lib.mm | 0 src/app/{ => platform_osx}/gs_osx_memory.mm | 0 src/app/{ => platform_osx}/gs_osx_opengl.mm | 0 src/app/{ => platform_osx}/gs_osx_time.mm | 0 src/app/{ => platform_osx}/gs_osx_window.mm | 0 .../{ => platform_win32}/win32_foldhaus.cpp | 8 +-- .../{ => platform_win32}/win32_foldhaus_dll.h | 0 .../win32_foldhaus_fileio.h | 0 .../win32_foldhaus_memory.h | 0 .../win32_foldhaus_timing.h | 0 39 files changed, 37 insertions(+), 72 deletions(-) rename src/app/{ => deprecated}/foldhaus_node.cpp (100%) rename src/app/{ => deprecated}/foldhaus_node.h (100%) rename src/app/{ => deprecated}/foldhaus_node_gui.h (100%) rename src/app/{ => deprecated}/foldhaus_util_radialumia_file_converter.cpp (100%) rename src/app/{ => editor}/foldhaus_command_dispatch.h (100%) rename src/app/{ => editor}/foldhaus_interface.cpp (100%) rename src/app/{ => editor}/foldhaus_operation_mode.h (100%) rename src/app/{ => editor}/foldhaus_panel.h (100%) rename src/app/{ => editor}/panels/foldhaus_panel_animation_timeline.h (100%) rename src/app/{ => editor}/panels/foldhaus_panel_dmx_view.h (100%) rename src/app/{ => editor}/panels/foldhaus_panel_file_view.h (100%) rename src/app/{ => editor}/panels/foldhaus_panel_hierarchy.h (100%) rename src/app/{ => editor}/panels/foldhaus_panel_profiler.h (100%) rename src/app/{ => editor}/panels/foldhaus_panel_sculpture_view.h (100%) rename src/app/{ => engine}/animation/foldhaus_animation.h (100%) rename src/app/{ => engine}/artnet/artnet.h (100%) rename src/app/{ => engine}/assembly_parser.cpp (100%) rename src/app/{ => engine}/dmx/dmx.h (100%) rename src/app/{ => engine}/foldhaus_assembly.cpp (100%) rename src/app/{ => engine}/foldhaus_assembly.h (100%) rename src/app/{ => engine}/foldhaus_network_ordering.h (100%) rename src/app/{ => engine}/sacn/sacn.h (100%) delete mode 100644 src/app/first.cpp rename src/app/{ => platform_osx}/gs_osx.mm (100%) rename src/app/{ => platform_osx}/gs_osx_fileio.mm (100%) rename src/app/{ => platform_osx}/gs_osx_lib.mm (100%) rename src/app/{ => platform_osx}/gs_osx_memory.mm (100%) rename src/app/{ => platform_osx}/gs_osx_opengl.mm (100%) rename src/app/{ => platform_osx}/gs_osx_time.mm (100%) rename src/app/{ => platform_osx}/gs_osx_window.mm (100%) rename src/app/{ => platform_win32}/win32_foldhaus.cpp (99%) rename src/app/{ => platform_win32}/win32_foldhaus_dll.h (100%) rename src/app/{ => platform_win32}/win32_foldhaus_fileio.h (100%) rename src/app/{ => platform_win32}/win32_foldhaus_memory.h (100%) rename src/app/{ => platform_win32}/win32_foldhaus_timing.h (100%) diff --git a/build/build_app_msvc_win32_debug.bat b/build/build_app_msvc_win32_debug.bat index 6151e16..1a4c884 100644 --- a/build/build_app_msvc_win32_debug.bat +++ b/build/build_app_msvc_win32_debug.bat @@ -25,7 +25,7 @@ set LastError=%ERRORLEVEL% del lock.tmp -cl %CommonCompilerFlags% %SourceCodePath%\win32_foldhaus.cpp /link %CommonLinkerFlags% user32.lib winmm.lib gdi32.lib opengl32.lib dsound.lib Ws2_32.lib Comdlg32.lib +cl %CommonCompilerFlags% %SourceCodePath%\platform_win32\win32_foldhaus.cpp /link %CommonLinkerFlags% user32.lib winmm.lib gdi32.lib opengl32.lib dsound.lib Ws2_32.lib Comdlg32.lib popd diff --git a/src/app/foldhaus_node.cpp b/src/app/deprecated/foldhaus_node.cpp similarity index 100% rename from src/app/foldhaus_node.cpp rename to src/app/deprecated/foldhaus_node.cpp diff --git a/src/app/foldhaus_node.h b/src/app/deprecated/foldhaus_node.h similarity index 100% rename from src/app/foldhaus_node.h rename to src/app/deprecated/foldhaus_node.h diff --git a/src/app/foldhaus_node_gui.h b/src/app/deprecated/foldhaus_node_gui.h similarity index 100% rename from src/app/foldhaus_node_gui.h rename to src/app/deprecated/foldhaus_node_gui.h diff --git a/src/app/foldhaus_util_radialumia_file_converter.cpp b/src/app/deprecated/foldhaus_util_radialumia_file_converter.cpp similarity index 100% rename from src/app/foldhaus_util_radialumia_file_converter.cpp rename to src/app/deprecated/foldhaus_util_radialumia_file_converter.cpp diff --git a/src/app/foldhaus_command_dispatch.h b/src/app/editor/foldhaus_command_dispatch.h similarity index 100% rename from src/app/foldhaus_command_dispatch.h rename to src/app/editor/foldhaus_command_dispatch.h diff --git a/src/app/foldhaus_interface.cpp b/src/app/editor/foldhaus_interface.cpp similarity index 100% rename from src/app/foldhaus_interface.cpp rename to src/app/editor/foldhaus_interface.cpp diff --git a/src/app/foldhaus_operation_mode.h b/src/app/editor/foldhaus_operation_mode.h similarity index 100% rename from src/app/foldhaus_operation_mode.h rename to src/app/editor/foldhaus_operation_mode.h diff --git a/src/app/foldhaus_panel.h b/src/app/editor/foldhaus_panel.h similarity index 100% rename from src/app/foldhaus_panel.h rename to src/app/editor/foldhaus_panel.h diff --git a/src/app/panels/foldhaus_panel_animation_timeline.h b/src/app/editor/panels/foldhaus_panel_animation_timeline.h similarity index 100% rename from src/app/panels/foldhaus_panel_animation_timeline.h rename to src/app/editor/panels/foldhaus_panel_animation_timeline.h diff --git a/src/app/panels/foldhaus_panel_dmx_view.h b/src/app/editor/panels/foldhaus_panel_dmx_view.h similarity index 100% rename from src/app/panels/foldhaus_panel_dmx_view.h rename to src/app/editor/panels/foldhaus_panel_dmx_view.h diff --git a/src/app/panels/foldhaus_panel_file_view.h b/src/app/editor/panels/foldhaus_panel_file_view.h similarity index 100% rename from src/app/panels/foldhaus_panel_file_view.h rename to src/app/editor/panels/foldhaus_panel_file_view.h diff --git a/src/app/panels/foldhaus_panel_hierarchy.h b/src/app/editor/panels/foldhaus_panel_hierarchy.h similarity index 100% rename from src/app/panels/foldhaus_panel_hierarchy.h rename to src/app/editor/panels/foldhaus_panel_hierarchy.h diff --git a/src/app/panels/foldhaus_panel_profiler.h b/src/app/editor/panels/foldhaus_panel_profiler.h similarity index 100% rename from src/app/panels/foldhaus_panel_profiler.h rename to src/app/editor/panels/foldhaus_panel_profiler.h diff --git a/src/app/panels/foldhaus_panel_sculpture_view.h b/src/app/editor/panels/foldhaus_panel_sculpture_view.h similarity index 100% rename from src/app/panels/foldhaus_panel_sculpture_view.h rename to src/app/editor/panels/foldhaus_panel_sculpture_view.h diff --git a/src/app/animation/foldhaus_animation.h b/src/app/engine/animation/foldhaus_animation.h similarity index 100% rename from src/app/animation/foldhaus_animation.h rename to src/app/engine/animation/foldhaus_animation.h diff --git a/src/app/artnet/artnet.h b/src/app/engine/artnet/artnet.h similarity index 100% rename from src/app/artnet/artnet.h rename to src/app/engine/artnet/artnet.h diff --git a/src/app/assembly_parser.cpp b/src/app/engine/assembly_parser.cpp similarity index 100% rename from src/app/assembly_parser.cpp rename to src/app/engine/assembly_parser.cpp diff --git a/src/app/dmx/dmx.h b/src/app/engine/dmx/dmx.h similarity index 100% rename from src/app/dmx/dmx.h rename to src/app/engine/dmx/dmx.h diff --git a/src/app/foldhaus_assembly.cpp b/src/app/engine/foldhaus_assembly.cpp similarity index 100% rename from src/app/foldhaus_assembly.cpp rename to src/app/engine/foldhaus_assembly.cpp diff --git a/src/app/foldhaus_assembly.h b/src/app/engine/foldhaus_assembly.h similarity index 100% rename from src/app/foldhaus_assembly.h rename to src/app/engine/foldhaus_assembly.h diff --git a/src/app/foldhaus_network_ordering.h b/src/app/engine/foldhaus_network_ordering.h similarity index 100% rename from src/app/foldhaus_network_ordering.h rename to src/app/engine/foldhaus_network_ordering.h diff --git a/src/app/sacn/sacn.h b/src/app/engine/sacn/sacn.h similarity index 100% rename from src/app/sacn/sacn.h rename to src/app/engine/sacn/sacn.h diff --git a/src/app/first.cpp b/src/app/first.cpp deleted file mode 100644 index 3501ced..0000000 --- a/src/app/first.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#include -#include - -typedef struct AppDel { - Class isa; - id window; -} AppDelegate; - -BOOL AppDel_didFinishLaunching(AppDelegate* self, SEL _command, id Notification) -{ - return YES; -} - -int main(int ArgCount, char** Args) -{ - Class NSApplicationClass = (Class)objc_getClass("NSApplication"); - Class AppDelegateClass = objc_allocateClassPair(NSApplicationClass, "AppDelegate", 0); - - SEL MethodSelector = sel_getUid("applicationDidFinishLaunching:"); - // NOTE(Peter): i = int, @ = object, : = method selector (SEL) - char MethodSignature[] = "i@:@"; - class_addMethod(AppDelegateClass, MethodSelector, (IMP)AppDel_didFinishLaunching, "i@:@"); - objc_registerClassPair(AppDelegateClass); - - return 0; -} \ No newline at end of file diff --git a/src/app/foldhaus_app.cpp b/src/app/foldhaus_app.cpp index 5d05907..866f278 100644 --- a/src/app/foldhaus_app.cpp +++ b/src/app/foldhaus_app.cpp @@ -141,7 +141,6 @@ INITIALIZE_APPLICATION(InitializeApplication) State->Interface.Style.RowHeight = ui_GetTextLineHeight(State->Interface); State->SACN = InitializeSACN(Context); - State->NetworkProtocolHeaderSize = STREAM_HEADER_SIZE; State->Camera.FieldOfView = 45.0f; State->Camera.AspectRatio = RectAspectRatio(State->WindowBounds); @@ -294,9 +293,6 @@ CreateDMXBuffers(assembly Assembly, led_system* LedSystem, s32 BufferHeaderSize, } -#define HANDMADE_MATH_IMPLEMENTATION -#include "handmade_math.h" - UPDATE_AND_RENDER(UpdateAndRender) { DEBUG_TRACK_FUNCTION; @@ -440,12 +436,11 @@ UPDATE_AND_RENDER(UpdateAndRender) // Skipped for performance at the moment #if 0 - s32 HeaderSize = State->NetworkProtocolHeaderSize; dmx_buffer_list* DMXBuffers = 0; for (u32 i = 0; i < State->Assemblies.Count; i++) { assembly* Assembly = &State->Assemblies.Values[i]; - dmx_buffer_list* NewDMXBuffers = CreateDMXBuffers(*Assembly, &State->LedSystem, HeaderSize, &State->Transient); + dmx_buffer_list* NewDMXBuffers = CreateDMXBuffers(*Assembly, &State->LedSystem, STREAM_HEADER_SIZE, &State->Transient); DMXBuffers = DMXBufferListAppend(DMXBuffers, NewDMXBuffers); } diff --git a/src/app/foldhaus_app.h b/src/app/foldhaus_app.h index cadf625..f01b555 100644 --- a/src/app/foldhaus_app.h +++ b/src/app/foldhaus_app.h @@ -13,24 +13,24 @@ #include "interface.h" -#include "foldhaus_network_ordering.h" -#include "dmx/dmx.h" -#include "sacn/sacn.h" +#include "engine/foldhaus_network_ordering.h" +#include "engine/dmx/dmx.h" +#include "engine/sacn/sacn.h" -#include "foldhaus_assembly.h" -#include "assembly_parser.cpp" +#include "engine/foldhaus_assembly.h" +#include "engine/assembly_parser.cpp" typedef struct app_state app_state; // TODO(Peter): something we can do later is to remove all reliance on app_state and context // from foldhaus_pane.h. It should just emit lists of things that the app can iterate over and // perform operations on, like panel_draw_requests = { bounds, panel* } etc. -#include "foldhaus_panel.h" +#include "editor/foldhaus_panel.h" -#include "foldhaus_command_dispatch.h" -#include "foldhaus_operation_mode.h" +#include "editor/foldhaus_command_dispatch.h" +#include "editor/foldhaus_operation_mode.h" -#include "animation/foldhaus_animation.h" +#include "engine/animation/foldhaus_animation.h" enum network_protocol { @@ -42,38 +42,33 @@ enum network_protocol struct app_state { - r32 CameraTheta; // TODO(Peter): @TEMPORARY - rect2 WindowBounds; - gs_memory_arena Permanent; gs_memory_arena Transient; - s32 NetworkProtocolHeaderSize; + // Engine + // network_protocol NetworkProtocol; - streaming_acn SACN; - led_system LedSystem; assembly_array Assemblies; + animation_system AnimationSystem; + event_log* GlobalLog; - camera Camera; - r32 PixelsToWorldScale; + // Interface + // + rect2 WindowBounds; operation_mode_system Modes; input_command_queue CommandQueue; ui_interface Interface; - - animation_system AnimationSystem; - gs_list_handle SelectedAnimationBlockHandle; - u32 SelectedAnimationLayer; - panel_system PanelSystem; panel* HotPanel; - //pattern_node_workspace NodeWorkspace; - - event_log* GlobalLog; + camera Camera; // TODO(Peter): move into the sculpture view + r32 PixelsToWorldScale; + gs_list_handle SelectedAnimationBlockHandle; // TODO(Peter): move into animation panel + u32 SelectedAnimationLayer; // TODO(Peter): move into animation panel }; internal void OpenColorPicker(app_state* State, v4* Address); @@ -180,7 +175,7 @@ TestPatternThree(led_buffer* Assembly, r32 Time) // END TEMPORARY PATTERNS -#include "foldhaus_assembly.cpp" +#include "engine/foldhaus_assembly.cpp" FOLDHAUS_INPUT_COMMAND_PROC(EndCurrentOperationMode) { @@ -208,16 +203,16 @@ struct panel_definition s32 InputCommandsCount; }; -#include "panels/foldhaus_panel_sculpture_view.h" -#include "panels/foldhaus_panel_profiler.h" -#include "panels/foldhaus_panel_dmx_view.h" -#include "panels/foldhaus_panel_animation_timeline.h" -#include "panels/foldhaus_panel_hierarchy.h" -#include "panels/foldhaus_panel_file_view.h" +#include "editor/panels/foldhaus_panel_sculpture_view.h" +#include "editor/panels/foldhaus_panel_profiler.h" +#include "editor/panels/foldhaus_panel_dmx_view.h" +#include "editor/panels/foldhaus_panel_animation_timeline.h" +#include "editor/panels/foldhaus_panel_hierarchy.h" +#include "editor/panels/foldhaus_panel_file_view.h" #include "generated/foldhaus_panels_generated.h" -#include "foldhaus_interface.cpp" +#include "editor/foldhaus_interface.cpp" #include "../meta/gs_meta_include.cpp" diff --git a/src/app/foldhaus_debug.h b/src/app/foldhaus_debug.h index c45ad69..ca26188 100644 --- a/src/app/foldhaus_debug.h +++ b/src/app/foldhaus_debug.h @@ -3,6 +3,9 @@ // Author: Peter Slattery // Creation Date: 2020-01-01 // +// DESCRIPTION: +// This file contains profiling capabilities for both the engine and app +// #ifndef FOLDHAUS_DEBUG_H #define SCOPE_NAME_LENGTH 256 diff --git a/src/app/gs_osx.mm b/src/app/platform_osx/gs_osx.mm similarity index 100% rename from src/app/gs_osx.mm rename to src/app/platform_osx/gs_osx.mm diff --git a/src/app/gs_osx_fileio.mm b/src/app/platform_osx/gs_osx_fileio.mm similarity index 100% rename from src/app/gs_osx_fileio.mm rename to src/app/platform_osx/gs_osx_fileio.mm diff --git a/src/app/gs_osx_lib.mm b/src/app/platform_osx/gs_osx_lib.mm similarity index 100% rename from src/app/gs_osx_lib.mm rename to src/app/platform_osx/gs_osx_lib.mm diff --git a/src/app/gs_osx_memory.mm b/src/app/platform_osx/gs_osx_memory.mm similarity index 100% rename from src/app/gs_osx_memory.mm rename to src/app/platform_osx/gs_osx_memory.mm diff --git a/src/app/gs_osx_opengl.mm b/src/app/platform_osx/gs_osx_opengl.mm similarity index 100% rename from src/app/gs_osx_opengl.mm rename to src/app/platform_osx/gs_osx_opengl.mm diff --git a/src/app/gs_osx_time.mm b/src/app/platform_osx/gs_osx_time.mm similarity index 100% rename from src/app/gs_osx_time.mm rename to src/app/platform_osx/gs_osx_time.mm diff --git a/src/app/gs_osx_window.mm b/src/app/platform_osx/gs_osx_window.mm similarity index 100% rename from src/app/gs_osx_window.mm rename to src/app/platform_osx/gs_osx_window.mm diff --git a/src/app/win32_foldhaus.cpp b/src/app/platform_win32/win32_foldhaus.cpp similarity index 99% rename from src/app/win32_foldhaus.cpp rename to src/app/platform_win32/win32_foldhaus.cpp index 65df438..8712d14 100644 --- a/src/app/win32_foldhaus.cpp +++ b/src/app/platform_win32/win32_foldhaus.cpp @@ -11,15 +11,15 @@ #include #include -#include "../meta/gs_meta_include.h" -#include "foldhaus_platform.h" +#include "../../meta/gs_meta_include.h" +#include "../foldhaus_platform.h" -#include "../gs_libs/gs_win32.cpp" +#include "../../gs_libs/gs_win32.cpp" #include "win32_foldhaus_memory.h" #include "win32_foldhaus_dll.h" #include "win32_foldhaus_timing.h" -#include "foldhaus_renderer.cpp" +#include "../foldhaus_renderer.cpp" global b32 Running = false; global b32 WindowIsActive = false; diff --git a/src/app/win32_foldhaus_dll.h b/src/app/platform_win32/win32_foldhaus_dll.h similarity index 100% rename from src/app/win32_foldhaus_dll.h rename to src/app/platform_win32/win32_foldhaus_dll.h diff --git a/src/app/win32_foldhaus_fileio.h b/src/app/platform_win32/win32_foldhaus_fileio.h similarity index 100% rename from src/app/win32_foldhaus_fileio.h rename to src/app/platform_win32/win32_foldhaus_fileio.h diff --git a/src/app/win32_foldhaus_memory.h b/src/app/platform_win32/win32_foldhaus_memory.h similarity index 100% rename from src/app/win32_foldhaus_memory.h rename to src/app/platform_win32/win32_foldhaus_memory.h diff --git a/src/app/win32_foldhaus_timing.h b/src/app/platform_win32/win32_foldhaus_timing.h similarity index 100% rename from src/app/win32_foldhaus_timing.h rename to src/app/platform_win32/win32_foldhaus_timing.h