summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b144942..91a8ef2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -811,6 +811,19 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr
v2 Pos = V2(T.x, T.y);
real32 Scale = T.scale;
+ v2 TexCoord = V2(0.5, 0.5);
+
+ float Rada = -Rad;;
+ v2 XRotation = V2(cos(Rada), sin(Rada));
+ v2 YRotation = V2(sin(Rada), -cos(Rada));
+ v2 XAxis = (TexCoord.x - Anchor.x) * XRotation;
+ v2 YAxis = (TexCoord.y - Anchor.y) * YRotation;
+ v2 CompUV = Anchor + (XAxis + YAxis);
+ v2 ScreenPos = UIOffset + (CompUV * UIZoom);
+ v2 ScreenUV = ScreenPos / ScreenDimensions;
+ v2 ScreenPos2 = UIOffset + (TexCoord * UIZoom);
+ v2 ScreenUV2 = ScreenPos / ScreenDimensions;
+
for (int a = 0; a < 4; a++) {
real32 *PointX = &CompVerts[(a*6)];
@@ -1132,7 +1145,7 @@ int main(int argc, char *argv[]) {
global_memory GlobalMemory = {};
- GlobalMemory.Size = ((uint64)8 * 1024 * 1024 * 1024);
+ GlobalMemory.Size = ((uint64)1 * 1024 * 1024 * 1024);
GlobalMemory.CurrentPosition = 0;
#if WINDOWS
@@ -1167,7 +1180,7 @@ int main(int argc, char *argv[]) {
Memory_InitTable(&GlobalMemory, &Memory, (uint64)5 * 1024 * 1024, B_Thumbnails, "Thumbnails");
Memory_InitTable(&GlobalMemory, &Memory, (uint64)5 * 1024 * 1024, B_PointData, "Point data");
Memory_InitTable(&GlobalMemory, &Memory, (uint64)128 * 1024 * 1024, B_ScratchSpace, "Scratch");
- Memory_InitTable(&GlobalMemory, &Memory, (uint64)5400 * 1024 * 1024, B_CachedBitmaps, "Cached bitmap buffer");
+ Memory_InitTable(&GlobalMemory, &Memory, (uint64)700 * 1024 * 1024, B_CachedBitmaps, "Cached bitmap buffer");
uint8 *Test = (uint8 *)Memory.Slot[B_ScratchSpace].Address + Memory.Slot[B_ScratchSpace].Size + 2;
*Test = 30;
@@ -1285,6 +1298,8 @@ int main(int argc, char *argv[]) {
#if DEBUG
#if ARM
uint32 ScreenSize[2] = {(uint32)(2560/1.2), (uint32)(1600/1.2)};
+#elif WINDOWS
+ real32 ScreenSize[2] = {3840/1.6, 2160/1.6};
#else
real32 ScreenSize[2] = {3840/1.2, 2160/1.2};
#endif
@@ -1438,7 +1453,7 @@ int main(int argc, char *argv[]) {
while (State->IsRunning)
{
- // uint64 StartTime = GetCPUTime();
+ uint64 StartTime = GetCPUTime();
uint64 PerfFrequency = SDL_GetPerformanceFrequency();
uint64 PerfStart = SDL_GetPerformanceCounter();
@@ -1529,9 +1544,9 @@ int main(int argc, char *argv[]) {
// TODO(fox): Do the same thing with the timeline and viewport to
// reduce wasted rendering further; for now I am at least pausing all
// UI when no inputs happen.
- // uint64 InputStart = GetCPUTime();
+ uint64 InputStart = GetCPUTime();
State->UpdateScreen += Main_InputTest(File, State, &Memory, Sorted, &File->UI, window, textureID);
- // uint64 InputTime = GetCPUTime() - InputStart;
+ uint64 InputTime = GetCPUTime() - InputStart;
if (State->IsPlaying) {
block_composition *MainComp = (block_composition *)Memory_Block_AddressAtIndex(&Memory, F_Precomps, File->PrincipalCompIndex);
@@ -1634,7 +1649,7 @@ int main(int argc, char *argv[]) {
// frames, but we'd have to make sure the pop order stays the same in all scenarios.
Assert(Debug.ScratchState == 0);
- // uint64 RenderStart = GetCPUTime();
+ uint64 RenderStart = GetCPUTime();
bool32 UpdateScreen = 0;
if (State->IsPlaying && State->HotFramePerf > 1 && FullyCached) {
uint64 RenderTime = SDL_GetPerformanceCounter() - State->HotFramePerf;
@@ -1651,7 +1666,7 @@ int main(int argc, char *argv[]) {
UpdateScreen = 1;
}
}
- // uint64 RenderTime = GetCPUTime() - RenderStart;
+ uint64 RenderTime = GetCPUTime() - RenderStart;
if (State->HotFramePerf == 1) {
State->HotFramePerf = SDL_GetPerformanceCounter();
@@ -1673,9 +1688,11 @@ int main(int argc, char *argv[]) {
SDL_Delay((uint64)(TargetMS - FrameMS));
}
- // uint64 TotalTime = GetCPUTime() - StartTime;
+ uint64 TotalTime = GetCPUTime() - StartTime;
// printf("TOTAL: %.2lu, (%.2f ms) - INPUTS: %.2lu - RENDERING: %.2lu\n", PerfTime, FrameMS, InputTime, RenderTime);
- // printf("TOTAL: %.2lu - INPUTS: %.2lu (%.2f) - RENDERING: %.2lu (%.2f)\n", TotalTime, InputTime, (real64)InputTime / TotalTime, RenderTime, (real64)RenderTime / TotalTime);
+#if DEBUG
+ printf("TOTAL: %.2lu (%.2f ms) - INPUTS: %.2lu (%.2f) - RENDERING: %.2lu (%.2f)\n", TotalTime, FrameMS, InputTime, (real64)InputTime / TotalTime, RenderTime, (real64)RenderTime / TotalTime);
+#endif
// printf("TOTAL: %.2lu, (%.2f ms) - RENDERING: %.2lu\n", PerfTime, FrameMS, PerfTime);
}