From a4c1e537b0cb2540535357d880e46f63b38c134f Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Wed, 5 Oct 2022 23:49:41 -0400 Subject: graph edits; arch rework --- main.cpp | 84 +++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 30 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 60504e1..9db6588 100644 --- a/main.cpp +++ b/main.cpp @@ -36,9 +36,12 @@ #include "defines.h" #include "my_math.h" #include "structs.h" + +#include "memory.h" #include "main.h" + #include "debug.h" -#include "functions.h" +// #include "functions.h" // #include "sharebuffer.h" SDL_atomic_t CurrentEntry; @@ -48,29 +51,32 @@ static bool32 IsRendering = false; static instruction_mode InstructionMode = instruction_mode_scalar; static uint32 RandomGlobalIncrement = 0; -render_entry Entries[256]; +// render_entry Entries[256]; SDL_Thread *thread[8]; SDL_sem *Semaphore; #include "memory.cpp" +#include "strings.cpp" +#include "createcalls.cpp" +#include "ffmpeg_backend.cpp" +#if 0 #include "effects.cpp" #include "keyframes.cpp" #include "layer.cpp" -#include "strings.cpp" #include "bezier.cpp" #if THREADED #include "threading.cpp" #endif #include "prenderer.cpp" -#include "ffmpeg_backend.cpp" #include "bitmap_calls.cpp" -#include "createcalls.cpp" #include "my_imgui_widgets.cpp" #include "gl_calls.cpp" #include "undo.cpp" +#endif +#if 0 static void MainFunction(main_sdl *Main, memory *Memory, project_state *State, project_data *File, @@ -99,12 +105,13 @@ MainFunction(main_sdl *Main, memory *Memory, State->UpdateKeyframes = false; QueueCurrentFrame(File, CompBuffer, State); } +#endif int main(int argc, char *argv[]) { global_memory GlobalMemory = {}; - GlobalMemory.Size = ((uint64)4 * 1024 * 1024 * 1024); + GlobalMemory.Size = ((uint64)1 * 1024 * 1024 * 1024); GlobalMemory.CurrentPosition = 0; #if WINDOWS @@ -120,23 +127,19 @@ int main(int argc, char *argv[]) { memory Memory = {}; + Memory_InitTable(&GlobalMemory, &Memory, 1 * 1024 * 1024, P_AVInfo, "Image/video headers"); + Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, P_UndoBuffer, "Undo buffer"); + Memory_InitTable(&GlobalMemory, &Memory, 1 * 1024 * 1024, P_MiscCache, "Misc persistent"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, P_AVInfo, "Image/video headers"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, P_VectorPoints, "Vector Points"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, P_UndoBuffer, "Undo buffer"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, P_MiscCache, "Misc cache"); - - InitMemoryTable(&GlobalMemory, &Memory, 15 * 1024 * 1024, F_Layers, "Layers"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Effects, "Effects"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Keyframes, "Keyframe blocks"); - InitMemoryTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Strings, "Strings"); - - InitMemoryTable(&GlobalMemory, &Memory, (uint64)200 * 1024 * 1024, B_LayerBitmaps, "Layer buffer"); - InitMemoryTable(&GlobalMemory, &Memory, (uint64)200 * 1024 * 1024, B_LoadedBitmaps, "Loaded bitmap buffer"); + Memory_InitTable(&GlobalMemory, &Memory, sizeof(project_data), F_File, "File", sizeof(project_data)); + Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Precomps, "Precomps", sizeof(block_composition)); + // Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Layers, "Layers"); + Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Sources, "Sources", sizeof(block_source)); + // Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Effects, "Effects"); + // Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Keyframes, "Keyframe blocks"); + Memory_InitTable(&GlobalMemory, &Memory, 10 * 1024 * 1024, F_Strings, "Strings"); - Memory.Scratch = AllocateMemory(&Memory, (uint64)64*1024*1024, B_LayerBitmaps); - - project_state State = {}; + // Memory_InitTable(&GlobalMemory, &Memory, (uint64)200 * 1024 * 1024, B_CachedBitmaps, "Cached bitmap buffer"); #if ARM InstructionMode = instruction_mode_neon; @@ -149,14 +152,21 @@ int main(int argc, char *argv[]) { } #endif - project_data File = {}; - File.Width = 1920; - File.Height = 1080; - File.NumberOfFrames = 120; - File.FPS = 24; - File.CurrentFrame = 1; - File.StartFrame = 0; - File.EndFrame = 100; + project_state *State = (project_state *)Memory.Slot[P_MiscCache].Address; + project_data *File = (project_data *)Memory_Block_AllocateAddress(&Memory, F_File); + block_composition *MainComp = (block_composition *)Memory_Block_AllocateAddress(&Memory, F_Precomps); + + MainComp->Width = 1280; + MainComp->Height = 720; + MainComp->FPS = 24; + MainComp->BytesPerPixel = 4; + + MainComp->Frame_Count = 48; + MainComp->Frame_End = 48; + + Source_Generate(File, State, Memory, "../asset/a.jpg"); + +#if 0 #if DEBUG @@ -296,7 +306,7 @@ int main(int argc, char *argv[]) { IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); - ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable; + ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_NavEnableSetMousePos; (void)io; // NOTE(fox): Instead of constructing the position of the windows on @@ -344,11 +354,23 @@ int main(int argc, char *argv[]) { State.IsRunning = false; } + if (UI.WantSetPos) { + ImGui::GetIO().WantSetMousePos = true; + io.MousePos = UI.SetPos; + } + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); + if (UI.WantSetPos) { + ImGui_WrapMouseFinish(&UI, io.MousePos); + io.MouseDelta = {}; + UI.WantSetPos = false; + } + if (!io.WantCaptureKeyboard) ImGui_ProcessInputs(&File, &State, &CompBuffer, &Memory, &UI, io); @@ -427,5 +449,7 @@ int main(int argc, char *argv[]) { ImGui_ImplSDL2_Shutdown(); ImGui::DestroyContext(); SDL_Quit(); +#endif + return 0; } -- cgit v1.2.3