Refactored rect functionality of gs_vector_matrix to make it not conflict with windows headers (just added gs_ to all functions). refactored Profiler interface code to use the new interface layout system.
This commit is contained in:
parent
5922a4bf27
commit
b843937295
|
@ -224,9 +224,7 @@ static b32 CharArrayContainsSafe(char* Array, s32 ArrayLength, char* CheckF
|
|||
|
||||
// String
|
||||
|
||||
#define MakeStringBuffer(name, size) \
|
||||
char name##Backbuffer[(size)]; \
|
||||
string name = MakeString(name##Backbuffer, size);
|
||||
#define MakeStringBuffer(name, size) char name##Backbuffer[(size)]; string name = MakeString(name##Backbuffer, size);
|
||||
|
||||
static string MakeString (char* Array, s32 Length, s32 Max);
|
||||
static string MakeString (char* Array, s32 Length);
|
||||
|
@ -1792,7 +1790,8 @@ string name = MakeString(name##Backbuffer, size);
|
|||
}
|
||||
else if (FormatAt[0] == '%' && FormatAt[1] == '%') // Print the % symbol
|
||||
{
|
||||
*DestAt++ = *FormatAt++;
|
||||
*DestAt++ = '%';
|
||||
FormatAt += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -667,10 +667,10 @@ PointToPercentRange (v2 P, v2 Min, v2 Max)
|
|||
// you can just do:
|
||||
// Foo(RectExpand(MyRect))
|
||||
// which makes refactoring easier as you only have to change the identifier in one place
|
||||
#define RectExpand(r) (r).Min, (r).Max
|
||||
#define gs_RectExpand(r) (r).Min, (r).Max
|
||||
|
||||
static rect
|
||||
MakeRectMinWidth(v2 Min, v2 Width)
|
||||
gs_MakeRectMinWidth(v2 Min, v2 Width)
|
||||
{
|
||||
rect Rect = {0};
|
||||
Rect.Min = Min;
|
||||
|
@ -679,21 +679,21 @@ MakeRectMinWidth(v2 Min, v2 Width)
|
|||
}
|
||||
|
||||
inline float
|
||||
Width (rect Rect)
|
||||
gs_Width (rect Rect)
|
||||
{
|
||||
float Result = Rect.Max.x - Rect.Min.x;
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline float
|
||||
Height (rect Rect)
|
||||
gs_Height (rect Rect)
|
||||
{
|
||||
float Result = Rect.Max.y - Rect.Min.y;
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline v2
|
||||
TopLeft(rect Rect)
|
||||
gs_TopLeft(rect Rect)
|
||||
{
|
||||
v2 Result = {0};
|
||||
Result.x = Rect.Min.x;
|
||||
|
@ -702,19 +702,19 @@ TopLeft(rect Rect)
|
|||
}
|
||||
|
||||
inline v2
|
||||
TopRight(rect Rect)
|
||||
gs_TopRight(rect Rect)
|
||||
{
|
||||
return Rect.Max;
|
||||
}
|
||||
|
||||
inline v2
|
||||
BottomLeft(rect Rect)
|
||||
gs_BottomLeft(rect Rect)
|
||||
{
|
||||
return Rect.Min;
|
||||
}
|
||||
|
||||
inline v2
|
||||
BottomRight(rect Rect)
|
||||
gs_BottomRight(rect Rect)
|
||||
{
|
||||
v2 Result = {0};
|
||||
Result.x = Rect.Max.x;
|
||||
|
@ -723,21 +723,21 @@ BottomRight(rect Rect)
|
|||
}
|
||||
|
||||
inline float
|
||||
AspectRatio (rect Rect)
|
||||
gs_AspectRatio (rect Rect)
|
||||
{
|
||||
float Result = Width(Rect) / Height(Rect);
|
||||
float Result = gs_Width(Rect) / gs_Height(Rect);
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline v2
|
||||
CalculateRectCenter (rect Rect)
|
||||
gs_CalculateRectCenter (rect Rect)
|
||||
{
|
||||
v2 Result = (Rect.Min + Rect.Max) / 2.0f;
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline b32
|
||||
PointIsInRect (v2 Point, rect Rect)
|
||||
gs_PointIsInRect (v2 Point, rect Rect)
|
||||
{
|
||||
b32 Result = ((Point.x >= Rect.Min.x && Point.x <= Rect.Max.x) &&
|
||||
(Point.y >= Rect.Min.y && Point.y <= Rect.Max.y));
|
||||
|
@ -745,7 +745,7 @@ PointIsInRect (v2 Point, rect Rect)
|
|||
}
|
||||
|
||||
inline rect
|
||||
RectOffsetByVector(rect R, v2 V)
|
||||
gs_RectOffsetByVector(rect R, v2 V)
|
||||
{
|
||||
rect Result = R;
|
||||
Result.Min += V;
|
||||
|
@ -754,7 +754,7 @@ RectOffsetByVector(rect R, v2 V)
|
|||
}
|
||||
|
||||
static void
|
||||
HSplitRectAtValue(rect Bounds, r32 YValue, rect* Top, rect* Bottom)
|
||||
gs_HSplitRectAtValue(rect Bounds, r32 YValue, rect* Top, rect* Bottom)
|
||||
{
|
||||
if (YValue <= Bounds.Min.y)
|
||||
{
|
||||
|
@ -776,29 +776,28 @@ HSplitRectAtValue(rect Bounds, r32 YValue, rect* Top, rect* Bottom)
|
|||
}
|
||||
|
||||
static void
|
||||
HSplitRectAtDistanceFromTop(rect Bounds, r32 YDist, rect* Top, rect* Bottom)
|
||||
gs_HSplitRectAtDistanceFromTop(rect Bounds, r32 YDist, rect* Top, rect* Bottom)
|
||||
{
|
||||
r32 YValue = Bounds.Max.y - YDist;
|
||||
HSplitRectAtValue(Bounds, YValue, Top, Bottom);
|
||||
gs_HSplitRectAtValue(Bounds, YValue, Top, Bottom);
|
||||
}
|
||||
|
||||
static void
|
||||
HSplitRectAtDistanceFromBottom(rect Bounds, r32 YDist, rect* Top, rect* Bottom)
|
||||
gs_HSplitRectAtDistanceFromBottom(rect Bounds, r32 YDist, rect* Top, rect* Bottom)
|
||||
{
|
||||
r32 YValue = Bounds.Min.y + YDist;
|
||||
HSplitRectAtValue(Bounds, YValue, Top, Bottom);
|
||||
gs_HSplitRectAtValue(Bounds, YValue, Top, Bottom);
|
||||
}
|
||||
|
||||
static void
|
||||
HSplitRectAtPercent(rect Bounds, r32 YPercent, rect* Top, rect* Bottom)
|
||||
gs_HSplitRectAtPercent(rect Bounds, r32 YPercent, rect* Top, rect* Bottom)
|
||||
{
|
||||
r32 YValue = GSLerp(Bounds.Min.y, Bounds.Max.y, YPercent);
|
||||
HSplitRectAtValue(Bounds, YValue, Top, Bottom);
|
||||
gs_HSplitRectAtValue(Bounds, YValue, Top, Bottom);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VSplitRectAtValue(rect Bounds, r32 XValue, rect* Left, rect* Right)
|
||||
gs_VSplitRectAtValue(rect Bounds, r32 XValue, rect* Left, rect* Right)
|
||||
{
|
||||
if (XValue <= Bounds.Min.x)
|
||||
{
|
||||
|
@ -820,30 +819,46 @@ VSplitRectAtValue(rect Bounds, r32 XValue, rect* Left, rect* Right)
|
|||
}
|
||||
|
||||
static void
|
||||
VSplitRectAtDistanceFromRight(rect Bounds, r32 XDist, rect* Left, rect* Right)
|
||||
gs_VSplitRectAtDistanceFromRight(rect Bounds, r32 XDist, rect* Left, rect* Right)
|
||||
{
|
||||
r32 XValue = Bounds.Max.x - XDist;
|
||||
VSplitRectAtValue(Bounds, XValue, Left, Right);
|
||||
gs_VSplitRectAtValue(Bounds, XValue, Left, Right);
|
||||
}
|
||||
|
||||
static void
|
||||
VSplitRectAtDistanceFromLeft(rect Bounds, r32 XDist, rect* Left, rect* Right)
|
||||
gs_VSplitRectAtDistanceFromLeft(rect Bounds, r32 XDist, rect* Left, rect* Right)
|
||||
{
|
||||
r32 XValue = Bounds.Min.x + XDist;
|
||||
VSplitRectAtValue(Bounds, XValue, Left, Right);
|
||||
gs_VSplitRectAtValue(Bounds, XValue, Left, Right);
|
||||
}
|
||||
|
||||
static void
|
||||
VSplitRectAtPercent(rect Bounds, r32 XPercent, rect* Left, rect* Right)
|
||||
gs_VSplitRectAtPercent(rect Bounds, r32 XPercent, rect* Left, rect* Right)
|
||||
{
|
||||
r32 XValue = GSLerp(Bounds.Min.x, Bounds.Max.x, XPercent);
|
||||
VSplitRectAtValue(Bounds, XValue, Left, Right);
|
||||
gs_VSplitRectAtValue(Bounds, XValue, Left, Right);
|
||||
}
|
||||
|
||||
#define TranslateRectX(r, d) TranslateRect((r), v2{(d), 0})
|
||||
#define TranslateRectY(r, d) TranslateRect((r), v2{0, (d)})
|
||||
static rect
|
||||
TranslateRect(rect R, v2 Delta)
|
||||
gs_InsetRect(rect Rect, v2 Amount)
|
||||
{
|
||||
rect Result = {0};
|
||||
Result.Min = Rect.Min + Amount;
|
||||
Result.Max = Rect.Max - Amount;
|
||||
return Result;
|
||||
}
|
||||
|
||||
static rect
|
||||
gs_InsetRect(rect Rect, float Amount)
|
||||
{
|
||||
rect Result = gs_InsetRect(Rect, v2{Amount, Amount});
|
||||
return Result;
|
||||
}
|
||||
|
||||
#define gs_TranslateRectX(r, d) gs_TranslateRect((r), v2{(d), 0})
|
||||
#define gs_TranslateRectY(r, d) gs_TranslateRect((r), v2{0, (d)})
|
||||
static rect
|
||||
gs_TranslateRect(rect R, v2 Delta)
|
||||
{
|
||||
rect Result = R;
|
||||
Result.Min += Delta;
|
||||
|
@ -851,6 +866,13 @@ TranslateRect(rect R, v2 Delta)
|
|||
return Result;
|
||||
}
|
||||
|
||||
static v2
|
||||
gs_TransformPointIntoRectSpace(v2 Point, rect Rect)
|
||||
{
|
||||
v2 Result = Point - Rect.Min;
|
||||
return Point;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// MATRIX
|
||||
//////////////////////////////////////
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
#ifndef ASSEMBLY_PARSER_CPP
|
||||
|
||||
|
||||
internal assembly_token
|
||||
ParseToken (tokenizer* Tokenizer)
|
||||
{
|
||||
|
|
|
@ -12,8 +12,8 @@ internal v4
|
|||
MouseToWorldRay(r32 MouseX, r32 MouseY, camera* Camera, rect WindowBounds)
|
||||
{
|
||||
DEBUG_TRACK_SCOPE(MouseToWorldRay);
|
||||
r32 X = ((2.0f * MouseX) / Width(WindowBounds)) - 1;
|
||||
r32 Y = ((2.0f * MouseY) / Height(WindowBounds)) - 1;
|
||||
r32 X = ((2.0f * MouseX) / gs_Width(WindowBounds)) - 1;
|
||||
r32 Y = ((2.0f * MouseY) / gs_Height(WindowBounds)) - 1;
|
||||
|
||||
v4 ScreenPos = v4{X, Y, -1, 1};
|
||||
|
||||
|
@ -169,7 +169,7 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
|||
State->NetworkProtocolHeaderSize = STREAM_HEADER_SIZE;
|
||||
|
||||
State->Camera.FieldOfView = DegreesToRadians(45.0f);
|
||||
State->Camera.AspectRatio = AspectRatio(State->WindowBounds);
|
||||
State->Camera.AspectRatio = gs_AspectRatio(State->WindowBounds);
|
||||
State->Camera.Near = 1.0f;
|
||||
State->Camera.Far = 100.0f;
|
||||
State->Camera.Position = v3{0, 0, -250};
|
||||
|
@ -498,7 +498,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
}
|
||||
}
|
||||
|
||||
PushRenderOrthographic(RenderBuffer, 0, 0, Width(State->WindowBounds), Height(State->WindowBounds));
|
||||
PushRenderOrthographic(RenderBuffer, 0, 0, gs_Width(State->WindowBounds), gs_Height(State->WindowBounds));
|
||||
PushRenderClearScreen(RenderBuffer);
|
||||
|
||||
State->WindowBounds = Context->WindowBounds;
|
||||
|
|
|
@ -123,7 +123,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndDragPanelBorderOperation)
|
|||
}
|
||||
else
|
||||
{
|
||||
Panel->SplitPercent = (NewSplitY - PanelBounds.Min.y) / Height(PanelBounds);
|
||||
Panel->SplitPercent = (NewSplitY - PanelBounds.Min.y) / gs_Height(PanelBounds);
|
||||
}
|
||||
}
|
||||
else if (Panel->SplitDirection == PanelSplit_Vertical)
|
||||
|
@ -139,7 +139,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndDragPanelBorderOperation)
|
|||
}
|
||||
else
|
||||
{
|
||||
Panel->SplitPercent = (NewSplitX - PanelBounds.Min.x) / Width(PanelBounds);
|
||||
Panel->SplitPercent = (NewSplitX - PanelBounds.Min.x) / gs_Width(PanelBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,12 +241,12 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndSplitPanelOperation)
|
|||
|
||||
if (XDistance > YDistance)
|
||||
{
|
||||
r32 XPercent = (Mouse.Pos.x - PanelBounds.Min.x) / Width(PanelBounds);
|
||||
r32 XPercent = (Mouse.Pos.x - PanelBounds.Min.x) / gs_Width(PanelBounds);
|
||||
SplitPanelVertically(Panel, XPercent, PanelBounds, &State->PanelSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
r32 YPercent = (Mouse.Pos.y - PanelBounds.Min.y) / Height(PanelBounds);
|
||||
r32 YPercent = (Mouse.Pos.y - PanelBounds.Min.y) / gs_Height(PanelBounds);
|
||||
SplitPanelHorizontally(Panel, YPercent, PanelBounds, &State->PanelSystem);
|
||||
}
|
||||
|
||||
|
@ -301,11 +301,11 @@ HandleMouseDownPanelInteractionOrRecurse(panel* Panel, panel_edit_mode PanelEdit
|
|||
{
|
||||
rect TopPanelBounds = GetTopPanelBounds(Panel, PanelBounds);
|
||||
rect BottomPanelBounds = GetBottomPanelBounds(Panel, PanelBounds);
|
||||
if (PointIsInRect(Mouse.DownPos, BottomPanelBounds))
|
||||
if (gs_PointIsInRect(Mouse.DownPos, BottomPanelBounds))
|
||||
{
|
||||
HandleMouseDownPanelInteractionOrRecurse(&Panel->Bottom->Panel, PanelEditMode, BottomPanelBounds, Mouse, State);
|
||||
}
|
||||
if (PointIsInRect(Mouse.DownPos, TopPanelBounds))
|
||||
if (gs_PointIsInRect(Mouse.DownPos, TopPanelBounds))
|
||||
{
|
||||
HandleMouseDownPanelInteractionOrRecurse(&Panel->Top->Panel, PanelEditMode, TopPanelBounds, Mouse, State);
|
||||
}
|
||||
|
@ -324,11 +324,11 @@ HandleMouseDownPanelInteractionOrRecurse(panel* Panel, panel_edit_mode PanelEdit
|
|||
{
|
||||
rect LeftPanelBounds = GetLeftPanelBounds(Panel, PanelBounds);
|
||||
rect RightPanelBounds = GetRightPanelBounds(Panel, PanelBounds);
|
||||
if (PointIsInRect(Mouse.DownPos, LeftPanelBounds))
|
||||
if (gs_PointIsInRect(Mouse.DownPos, LeftPanelBounds))
|
||||
{
|
||||
HandleMouseDownPanelInteractionOrRecurse(&Panel->Left->Panel, PanelEditMode, LeftPanelBounds, Mouse, State);
|
||||
}
|
||||
if (PointIsInRect(Mouse.DownPos, RightPanelBounds))
|
||||
if (gs_PointIsInRect(Mouse.DownPos, RightPanelBounds))
|
||||
{
|
||||
HandleMouseDownPanelInteractionOrRecurse(&Panel->Right->Panel, PanelEditMode, RightPanelBounds, Mouse, State);
|
||||
}
|
||||
|
@ -403,14 +403,14 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect FooterBo
|
|||
PushRenderQuad2D(RenderBuffer, FooterBounds.Min, v2{FooterBounds.Max.x, FooterBounds.Min.y + 25}, v4{.5f, .5f, .5f, 1.f});
|
||||
PushRenderQuad2D(RenderBuffer, FooterBounds.Min, FooterBounds.Min + v2{25, 25}, WhiteV4);
|
||||
|
||||
rect PanelSelectBtnBounds = MakeRectMinWidth(FooterBounds.Min + v2{30, 1}, v2{100, 23});
|
||||
rect PanelSelectBtnBounds = gs_MakeRectMinWidth(FooterBounds.Min + v2{30, 1}, v2{100, 23});
|
||||
|
||||
if (Panel->PanelSelectionMenuOpen)
|
||||
{
|
||||
rect ButtonBounds = MakeRectMinWidth(v2{ PanelSelectBtnBounds.Min.x, FooterBounds.Max.y }, v2{ 100, 25 });
|
||||
rect ButtonBounds = gs_MakeRectMinWidth(v2{ PanelSelectBtnBounds.Min.x, FooterBounds.Max.y }, v2{ 100, 25 });
|
||||
|
||||
v2 MenuMin = ButtonBounds.Min;
|
||||
v2 MenuMax = v2{ButtonBounds.Min.x + Width(ButtonBounds), ButtonBounds.Min.y + (Height(ButtonBounds) * GlobalPanelDefsCount)};
|
||||
v2 MenuMax = v2{ButtonBounds.Min.x + gs_Width(ButtonBounds), ButtonBounds.Min.y + (gs_Height(ButtonBounds) * GlobalPanelDefsCount)};
|
||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
|
||||
&& !PointIsInRange(Mouse.DownPos, MenuMin, MenuMax))
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect FooterBo
|
|||
Panel->PanelSelectionMenuOpen = false;
|
||||
}
|
||||
|
||||
ButtonBounds = TranslateRectY(ButtonBounds, Height(ButtonBounds));
|
||||
ButtonBounds = gs_TranslateRectY(ButtonBounds, gs_Height(ButtonBounds));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -207,8 +207,9 @@ struct ui_layout
|
|||
r32 RowYAt;
|
||||
|
||||
b32 DrawHorizontal;
|
||||
u32 RowDivisions;
|
||||
u32 RowElementsCount;
|
||||
u32 ColumnsMax;
|
||||
r32* ColumnWidths;
|
||||
u32 ColumnsCount;
|
||||
};
|
||||
|
||||
struct ui_interface
|
||||
|
@ -230,11 +231,12 @@ ui_CreateLayout(ui_interface Interface, rect Bounds)
|
|||
}
|
||||
|
||||
static void
|
||||
ui_StartRow(ui_layout* Layout, u32 RowDivisions)
|
||||
ui_StartRow(ui_layout* Layout, u32 ColumnsMax)
|
||||
{
|
||||
Layout->DrawHorizontal = true;
|
||||
Layout->RowDivisions = RowDivisions;
|
||||
Layout->RowElementsCount = 0;
|
||||
Layout->ColumnsMax = ColumnsMax;
|
||||
Layout->ColumnWidths = 0;
|
||||
Layout->ColumnsCount = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -243,10 +245,21 @@ ui_StartRow(ui_layout* Layout)
|
|||
ui_StartRow(Layout, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
ui_StartRow(ui_layout* Layout, u32 ColumnsMax, r32* ColumnWidths)
|
||||
{
|
||||
Layout->DrawHorizontal = true;
|
||||
Layout->ColumnsMax = ColumnsMax;
|
||||
Layout->ColumnWidths = ColumnWidths;
|
||||
Layout->ColumnsCount = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ui_EndRow(ui_layout* Layout)
|
||||
{
|
||||
Layout->DrawHorizontal = false;
|
||||
Layout->ColumnWidths = 0;
|
||||
Layout->RowYAt -= Layout->RowHeight;
|
||||
}
|
||||
|
||||
static b32
|
||||
|
@ -261,19 +274,32 @@ ui_TryReserveElementBounds(ui_layout* Layout, rect* Bounds)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Layout->RowDivisions > 0)
|
||||
if (Layout->ColumnsMax > 0)
|
||||
{
|
||||
Assert(Layout->RowElementsCount < Layout->RowDivisions);
|
||||
r32 ElementWidth = Width(Layout->Bounds) / Layout->RowDivisions;
|
||||
Assert(Layout->ColumnsCount < Layout->ColumnsMax);
|
||||
if (Layout->ColumnWidths != 0)
|
||||
{
|
||||
v2 Min = { Layout->Bounds.Min.x, Layout->RowYAt };
|
||||
for (u32 i = 0; i < Layout->ColumnsCount; i++)
|
||||
{
|
||||
Min.x += Layout->ColumnWidths[i];
|
||||
}
|
||||
Bounds->Min = Min;
|
||||
Bounds->Max = Bounds->Min + v2{ Layout->ColumnWidths[Layout->ColumnsCount], Layout->RowHeight };
|
||||
}
|
||||
else
|
||||
{
|
||||
r32 ElementWidth = gs_Width(Layout->Bounds) / Layout->ColumnsMax;
|
||||
Bounds->Min = {
|
||||
Layout->Bounds.Min.x + (ElementWidth * Layout->RowElementsCount) + Layout->Margin.x,
|
||||
Layout->Bounds.Min.x + (ElementWidth * Layout->ColumnsCount) + Layout->Margin.x,
|
||||
Layout->RowYAt
|
||||
};
|
||||
Bounds->Max = {
|
||||
Bounds->Min.x + ElementWidth - Layout->Margin.x,
|
||||
Bounds->Min.y + Layout->RowHeight
|
||||
};
|
||||
Layout->RowElementsCount++;
|
||||
}
|
||||
Layout->ColumnsCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -302,6 +328,17 @@ ui_ReserveElementBounds(ui_layout* Layout)
|
|||
return Bounds;
|
||||
}
|
||||
|
||||
static rect
|
||||
ui_LayoutRemaining(ui_layout Layout)
|
||||
{
|
||||
rect Result = Layout.Bounds;
|
||||
Result.Max.y = Layout.RowYAt;
|
||||
if (Layout.DrawHorizontal)
|
||||
{
|
||||
Result.Max.y -= Layout.RowHeight;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
//
|
||||
// Drawing Functions
|
||||
//
|
||||
|
@ -309,7 +346,7 @@ ui_ReserveElementBounds(ui_layout* Layout)
|
|||
static void
|
||||
ui_FillRect(ui_interface* Interface, rect Bounds, v4 Color)
|
||||
{
|
||||
PushRenderQuad2D(Interface->RenderBuffer, RectExpand(Bounds), Color);
|
||||
PushRenderQuad2D(Interface->RenderBuffer, gs_RectExpand(Bounds), Color);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -371,7 +408,7 @@ ui_Button(ui_interface* Interface, string Text, rect Bounds, v4 InactiveColor, v
|
|||
{
|
||||
b32 Pressed = false;
|
||||
v4 ButtonBG = InactiveColor;
|
||||
if (PointIsInRect(Interface->Mouse.Pos, Bounds))
|
||||
if (gs_PointIsInRect(Interface->Mouse.Pos, Bounds))
|
||||
{
|
||||
ButtonBG = HoverColor;
|
||||
if (MouseButtonTransitionedDown(Interface->Mouse.LeftButtonState))
|
||||
|
|
|
@ -27,7 +27,7 @@ inline s32
|
|||
GetXPositionFromFrameInAnimationPanel (u32 Frame, rect PanelBounds, frame_range VisibleRange)
|
||||
{
|
||||
r32 PercentOfTimeline = (r32)(Frame - VisibleRange.Min) / (r32)GetFrameCount(VisibleRange);
|
||||
s32 XPositionAtFrame = (PercentOfTimeline * Width(PanelBounds)) + PanelBounds.Min.x;
|
||||
s32 XPositionAtFrame = (PercentOfTimeline * gs_Width(PanelBounds)) + PanelBounds.Min.x;
|
||||
return XPositionAtFrame;
|
||||
}
|
||||
|
||||
|
@ -295,14 +295,14 @@ DrawFrameBar (animation_system* AnimationSystem, render_command_buffer* RenderBu
|
|||
|
||||
s32 VisibleFrameCount = VisibleFrames.Max - VisibleFrames.Min;
|
||||
|
||||
r32 BarHeight = Height(BarBounds);
|
||||
r32 BarWidth = Width(BarBounds);
|
||||
r32 BarHeight = gs_Height(BarBounds);
|
||||
r32 BarWidth = gs_Width(BarBounds);
|
||||
|
||||
PushRenderQuad2D(RenderBuffer, RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f});
|
||||
PushRenderQuad2D(RenderBuffer, gs_RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f});
|
||||
|
||||
// Mouse clicked inside frame nubmer bar -> change current frame on timeline
|
||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState) &&
|
||||
PointIsInRange(Mouse.DownPos, RectExpand(BarBounds)))
|
||||
PointIsInRange(Mouse.DownPos, gs_RectExpand(BarBounds)))
|
||||
{
|
||||
StartDragTimeMarker(BarBounds, VisibleFrames, State);
|
||||
}
|
||||
|
@ -344,9 +344,9 @@ DrawTimelineRangeBar (animation_system* AnimationSystem, animation_timeline_stat
|
|||
{
|
||||
frame_range Result = {0};
|
||||
|
||||
r32 BarHeight = Height(BarBounds);
|
||||
r32 BarWidth = Width(BarBounds);
|
||||
PushRenderQuad2D(RenderBuffer, RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f});
|
||||
r32 BarHeight = gs_Height(BarBounds);
|
||||
r32 BarWidth = gs_Width(BarBounds);
|
||||
PushRenderQuad2D(RenderBuffer, gs_RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f});
|
||||
|
||||
r32 PlayableFrames = (r32)GetFrameCount(AnimationSystem->PlayableRange);
|
||||
v2 SliderBarDim = v2{25, BarHeight};
|
||||
|
@ -354,8 +354,8 @@ DrawTimelineRangeBar (animation_system* AnimationSystem, animation_timeline_stat
|
|||
// Convert Frames To Pixels
|
||||
r32 VisibleMinPercentPlayable = FrameToPercentRange(TimelineState->VisibleRange.Min, AnimationSystem->PlayableRange);
|
||||
r32 VisibleMaxPercentPlayable = FrameToPercentRange(TimelineState->VisibleRange.Max, AnimationSystem->PlayableRange);
|
||||
v2 RangeMinSliderMin = v2{BarBounds.Min.x + (VisibleMinPercentPlayable * Width(BarBounds)), BarBounds.Min.y};
|
||||
v2 RangeMaxSliderMin = v2{BarBounds.Min.x + (VisibleMaxPercentPlayable * Width(BarBounds)) - 25, BarBounds.Min.y};
|
||||
v2 RangeMinSliderMin = v2{BarBounds.Min.x + (VisibleMinPercentPlayable * gs_Width(BarBounds)), BarBounds.Min.y};
|
||||
v2 RangeMaxSliderMin = v2{BarBounds.Min.x + (VisibleMaxPercentPlayable * gs_Width(BarBounds)) - 25, BarBounds.Min.y};
|
||||
|
||||
if (MouseButtonHeldDown(Mouse.LeftButtonState) ||
|
||||
MouseButtonTransitionedUp(Mouse.LeftButtonState))
|
||||
|
@ -398,7 +398,7 @@ DrawTimelineRangeBar (animation_system* AnimationSystem, animation_timeline_stat
|
|||
internal void
|
||||
DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_buffer* RenderBuffer, app_state* State, mouse_state Mouse)
|
||||
{
|
||||
v2 LayerDim = { Width(PanelDim), LAYER_HEIGHT };
|
||||
v2 LayerDim = { gs_Width(PanelDim), LAYER_HEIGHT };
|
||||
v2 LayerListMin = PanelDim.Min + v2{0, 24};
|
||||
for (u32 LayerIndex = 0; LayerIndex < AnimationSystem->LayersCount; LayerIndex++)
|
||||
{
|
||||
|
@ -408,7 +408,7 @@ DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_b
|
|||
LayerBounds.Max = LayerBounds.Min + LayerDim;
|
||||
|
||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState) &&
|
||||
PointIsInRect(Mouse.Pos, LayerBounds))
|
||||
gs_PointIsInRect(Mouse.Pos, LayerBounds))
|
||||
{
|
||||
State->SelectedAnimationLayer = LayerIndex;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_b
|
|||
v2 LayerTextPos = { LayerBounds.Min.x + 6, LayerBounds.Max.y - 16};
|
||||
if (State->SelectedAnimationLayer == LayerIndex)
|
||||
{
|
||||
PushRenderBoundingBox2D(RenderBuffer, RectExpand(LayerBounds), 1, WhiteV4);
|
||||
PushRenderBoundingBox2D(RenderBuffer, gs_RectExpand(LayerBounds), 1, WhiteV4);
|
||||
}
|
||||
DrawString(RenderBuffer, Layer->Name, State->Interface.Font, LayerTextPos, WhiteV4);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ DrawAnimationBlock (animation_block AnimationBlock, v4 BlockColor, frame_range V
|
|||
{
|
||||
rect BlockBounds = {};
|
||||
|
||||
r32 TimelineWidth = Width(TimelineBounds);
|
||||
r32 TimelineWidth = gs_Width(TimelineBounds);
|
||||
|
||||
u32 ClampedBlockStartFrame = ClampFrameToRange(AnimationBlock.Range.Min, VisibleFrames);
|
||||
r32 StartFramePercent = FrameToPercentRange(ClampedBlockStartFrame, VisibleFrames);
|
||||
|
@ -454,12 +454,12 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
|
|||
gs_list_handle Result = SelectedBlockHandle;
|
||||
|
||||
rect LayerMenuBounds, TimelineBounds;
|
||||
VSplitRectAtDistanceFromLeft(PanelBounds, 256, &LayerMenuBounds, &TimelineBounds);
|
||||
gs_VSplitRectAtDistanceFromLeft(PanelBounds, 256, &LayerMenuBounds, &TimelineBounds);
|
||||
|
||||
// In Top To Bottom Order
|
||||
rect TimelineFrameBarBounds, TimelineBlockDisplayBounds, TimelineRangeBarBounds;
|
||||
HSplitRectAtDistanceFromTop(TimelineBounds, 32, &TimelineFrameBarBounds, &TimelineBounds);
|
||||
HSplitRectAtDistanceFromBottom(TimelineBounds, 24, &TimelineBlockDisplayBounds, &TimelineRangeBarBounds);
|
||||
gs_HSplitRectAtDistanceFromTop(TimelineBounds, 32, &TimelineFrameBarBounds, &TimelineBounds);
|
||||
gs_HSplitRectAtDistanceFromBottom(TimelineBounds, 24, &TimelineBlockDisplayBounds, &TimelineRangeBarBounds);
|
||||
|
||||
// TODO(Peter): Clean Up
|
||||
DrawLayerMenu(AnimationSystem, LayerMenuBounds, Interface->RenderBuffer, State, Interface->Mouse);
|
||||
|
@ -501,7 +501,7 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
|
|||
}
|
||||
// TODO(Peter): Clean Up
|
||||
rect BlockBounds = DrawAnimationBlock(AnimationBlockAt, BlockColor, AdjustedViewRange, TimelineBounds, Interface->RenderBuffer);
|
||||
if (PointIsInRect(Interface->Mouse.Pos, BlockBounds))
|
||||
if (gs_PointIsInRect(Interface->Mouse.Pos, BlockBounds))
|
||||
{
|
||||
DragBlockHandle = CurrentBlockHandle;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
|
|||
ui_OutlineRect(Interface, TimelineFrameBarBounds, 1.f, RedV4);
|
||||
ui_OutlineRect(Interface, TimelineBlockDisplayBounds, 1.f, RedV4);
|
||||
|
||||
if (MouseDownAndNotHandled && PointIsInRect(Interface->Mouse.Pos, TimelineBounds))
|
||||
if (MouseDownAndNotHandled && gs_PointIsInRect(Interface->Mouse.Pos, TimelineBounds))
|
||||
{
|
||||
DeselectCurrentAnimationBlock(State);
|
||||
}
|
||||
|
@ -581,9 +581,9 @@ AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* R
|
|||
animation_system* AnimationSystem = &State->AnimationSystem;
|
||||
|
||||
rect TitleBarBounds, PanelContentsBounds;
|
||||
HSplitRectAtDistanceFromTop(PanelBounds, Interface->Style.RowHeight, &TitleBarBounds, &PanelContentsBounds);
|
||||
gs_HSplitRectAtDistanceFromTop(PanelBounds, Interface->Style.RowHeight, &TitleBarBounds, &PanelContentsBounds);
|
||||
rect AnimationListBounds, TimelineBounds;
|
||||
VSplitRectAtDistanceFromLeft(PanelContentsBounds, 300, &AnimationListBounds, &TimelineBounds);
|
||||
gs_VSplitRectAtDistanceFromLeft(PanelContentsBounds, 300, &AnimationListBounds, &TimelineBounds);
|
||||
|
||||
ui_FillRect(Interface, TitleBarBounds, Interface->Style.PanelBGColors[0]);
|
||||
ui_layout TitleBarLayout = ui_CreateLayout(*Interface, TitleBarBounds);
|
||||
|
@ -605,7 +605,7 @@ AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* R
|
|||
}
|
||||
ui_EndRow(&TitleBarLayout);
|
||||
|
||||
if (Height(TimelineBounds) > 0)
|
||||
if (gs_Height(TimelineBounds) > 0)
|
||||
{
|
||||
SelectedBlockHandle = DrawAnimationTimeline(AnimationSystem, TimelineState, TimelineBounds, SelectedBlockHandle, Interface, State);
|
||||
DrawAnimationClipsList(AnimationListBounds, Interface, State->SelectedAnimationLayer, &State->AnimationSystem);
|
||||
|
|
|
@ -44,10 +44,10 @@ FileView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuff
|
|||
|
||||
rect ListBounds = {0};
|
||||
ListBounds.Min = PanelBounds.Min;
|
||||
ListBounds.Max = BottomRight(HeaderBounds);
|
||||
ListBounds.Max = gs_BottomRight(HeaderBounds);
|
||||
|
||||
PushRenderQuad2D(RenderBuffer, RectExpand(HeaderBounds), PinkV4);
|
||||
PushRenderQuad2D(RenderBuffer, RectExpand(ListBounds), RedV4);
|
||||
PushRenderQuad2D(RenderBuffer, gs_RectExpand(HeaderBounds), PinkV4);
|
||||
PushRenderQuad2D(RenderBuffer, gs_RectExpand(ListBounds), RedV4);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* Rende
|
|||
|
||||
string TempString = MakeString(PushArray(&State->Transient, char, 256), 0, 256);
|
||||
|
||||
u32 LineCount = (u32)(Height(PanelBounds) / Layout.RowHeight) + 1;
|
||||
u32 LineCount = (u32)(gs_Height(PanelBounds) / Layout.RowHeight) + 1;
|
||||
u32 LinesDrawn = 0;
|
||||
u32 AssembliesToDraw = GSMin(LineCount, State->ActiveAssemblyIndecies.Used);
|
||||
for (; LinesDrawn < AssembliesToDraw; LinesDrawn++)
|
||||
|
|
|
@ -128,8 +128,8 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndConnectNodesOperation)
|
|||
for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++)
|
||||
{
|
||||
visual_port VisualPort = GraphState->Layout.VisualPorts[p];
|
||||
rect ViewAdjustedBounds = RectOffsetByVector(VisualPort.PortBounds, GraphState->ViewOffset);
|
||||
if (PointIsInRect(Mouse.Pos, ViewAdjustedBounds))
|
||||
rect ViewAdjustedBounds = gs_RectOffsetByVector(VisualPort.PortBounds, GraphState->ViewOffset);
|
||||
if (gs_PointIsInRect(Mouse.Pos, ViewAdjustedBounds))
|
||||
{
|
||||
visual_port UpstreamPort = (OpState->IsInput & IsInputMember) ? VisualPort : OpState->VisualPort;
|
||||
visual_port DownstreamPort = (OpState->IsInput & IsInputMember) ? OpState->VisualPort : VisualPort;
|
||||
|
@ -161,7 +161,7 @@ BeginConnectNodesOperation(visual_port VisualPort, u32 VisualPortIndex, mouse_st
|
|||
node_graph_state* GraphState = (node_graph_state*)NodeGraphPanel.Panel->PanelStateMemory;
|
||||
|
||||
GraphState->Layout.ConnectionIsInProgress = true;
|
||||
GraphState->Layout.InProgressConnectionStart = CalculateRectCenter(VisualPort.PortBounds);
|
||||
GraphState->Layout.InProgressConnectionStart = gs_CalculateRectCenter(VisualPort.PortBounds);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -410,8 +410,8 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
|
|||
visual_port UpstreamPort = Result.VisualPorts[VisualConnection->UpstreamVisualPortIndex];
|
||||
visual_port DownstreamPort = Result.VisualPorts[VisualConnection->DownstreamVisualPortIndex];
|
||||
|
||||
VisualConnection->UpstreamPosition = CalculateRectCenter(UpstreamPort.PortBounds);
|
||||
VisualConnection->DownstreamPosition = CalculateRectCenter(DownstreamPort.PortBounds);
|
||||
VisualConnection->UpstreamPosition = gs_CalculateRectCenter(UpstreamPort.PortBounds);
|
||||
VisualConnection->DownstreamPosition = gs_CalculateRectCenter(DownstreamPort.PortBounds);
|
||||
}
|
||||
|
||||
return Result;
|
||||
|
@ -513,7 +513,7 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
|
|||
List.TextColor = WhiteV4;
|
||||
List.ListBounds = NodeSelectionWindowBounds;
|
||||
List.ListElementDimensions = v2{
|
||||
Width(NodeSelectionWindowBounds),
|
||||
gs_Width(NodeSelectionWindowBounds),
|
||||
(r32)(State->Interface.Font->PixelHeight + 8),
|
||||
};
|
||||
List.ElementLabelIndent = v2{10, 4};
|
||||
|
@ -527,7 +527,7 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
|
|||
rect ElementBounds = DrawListElement(Spec.Identifier, &List, Mouse, RenderBuffer, State->Interface);
|
||||
|
||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
|
||||
&& PointIsInRect(Mouse.DownPos, ElementBounds))
|
||||
&& gs_PointIsInRect(Mouse.DownPos, ElementBounds))
|
||||
{
|
||||
PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient);
|
||||
GraphState->LayoutIsDirty = true;
|
||||
|
|
|
@ -25,10 +25,7 @@ ProfilerView_Cleanup(panel* Panel, app_state* State)
|
|||
}
|
||||
|
||||
internal void
|
||||
RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
|
||||
interface_config Interface, mouse_state Mouse,
|
||||
v2 Min, v2 Max,
|
||||
debug_frame* VisibleFrame, memory_arena* Memory)
|
||||
RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_layout Layout, debug_frame* VisibleFrame, memory_arena* Memory)
|
||||
{
|
||||
v4 ThreadColors[] = {
|
||||
v4{.73f, .33f, .83f, 1},
|
||||
|
@ -38,7 +35,8 @@ RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
|
|||
v4{.74f, .40f, .25f, 1},
|
||||
};
|
||||
|
||||
r32 Width = Max.x - Min.x;
|
||||
rect Bounds = ui_LayoutRemaining(Layout);
|
||||
r32 Width = gs_Width(Bounds);
|
||||
r32 DepthHeight = 64;
|
||||
|
||||
s64 FrameStartCycles = VisibleFrame->FrameStartCycles;
|
||||
|
@ -47,6 +45,9 @@ RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
|
|||
debug_scope_record_list* ThreadScopeCalls = GetScopeListForThreadInFrame(GlobalDebugServices,
|
||||
VisibleFrame);
|
||||
|
||||
scope_record* HotRecord = 0;
|
||||
scope_name* HotRecordName = 0;
|
||||
|
||||
MakeStringBuffer(String, 256);
|
||||
for (s32 i = 0; i < ThreadScopeCalls->Count; i++)
|
||||
{
|
||||
|
@ -55,44 +56,50 @@ RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
|
|||
r32 PercentStart = (r32)(Record->StartCycles - FrameStartCycles) / (r32)FrameTotalCycles;
|
||||
r32 PercentEnd = (r32)(Record->EndCycles - FrameStartCycles) / (r32)FrameTotalCycles;
|
||||
|
||||
v2 ScopeMin = v2{Min.x + (Width * PercentStart), Max.y - ((Record->CallDepth + 1) * DepthHeight)};
|
||||
v2 ScopeMax = v2{Min.x + (Width * PercentEnd), ScopeMin.y + (DepthHeight - 4)};
|
||||
|
||||
if ((ScopeMax.x - ScopeMin.x) >= 1)
|
||||
r32 PixelStart = Bounds.Min.x + (Width * PercentStart);
|
||||
r32 PixelEnd = Bounds.Min.x + (Width * PercentEnd);
|
||||
r32 MinY = Bounds.Max.y - ((Record->CallDepth + 1) * DepthHeight);
|
||||
rect ScopeBounds = {
|
||||
v2{ PixelStart, MinY },
|
||||
v2{ PixelEnd, MinY + (DepthHeight - 4) }
|
||||
};
|
||||
if (gs_Width(ScopeBounds) >= 1)
|
||||
{
|
||||
v4 Color = ThreadColors[0];
|
||||
if (PointIsInRange(Mouse.Pos, ScopeMin, ScopeMax))
|
||||
if (gs_PointIsInRect(Interface->Mouse.Pos, ScopeBounds))
|
||||
{
|
||||
Color = GreenV4;
|
||||
HotRecord = Record;
|
||||
HotRecordName = Name;
|
||||
}
|
||||
|
||||
PushRenderQuad2D(RenderBuffer, ScopeMin, ScopeMax, Color);
|
||||
PushRenderBoundingBox2D(RenderBuffer, ScopeMin, ScopeMax, 1, BlackV4);
|
||||
ui_FillRect(Interface, ScopeBounds, Color);
|
||||
ui_OutlineRect(Interface, ScopeBounds, 1, BlackV4);
|
||||
}
|
||||
}
|
||||
|
||||
if (PointIsInRange(Mouse.Pos, ScopeMin, ScopeMax))
|
||||
if (HotRecord != 0)
|
||||
{
|
||||
PushRenderQuad2D(RenderBuffer, Mouse.Pos, Mouse.Pos + v2{256, 32}, BlackV4);
|
||||
PrintF(&String, "%.*s : %d - %d", Name->Name.Length, Name->Name.Memory, Record->StartCycles, Record->EndCycles);
|
||||
DrawString(RenderBuffer, String, Interface.Font, Mouse.Pos, WhiteV4);
|
||||
}
|
||||
}
|
||||
PrintF(&String, "%S : %d - %d", HotRecordName->Name, HotRecord->StartCycles, HotRecord->EndCycles);
|
||||
ui_TextBox(Interface, gs_MakeRectMinWidth(Interface->Mouse.Pos, v2{256, 32}), String, BlackV4, WhiteV4);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
RenderProfiler_ListVisualization(render_command_buffer* RenderBuffer,
|
||||
interface_config Interface, mouse_state Mouse,
|
||||
v2 Min, v2 Max,
|
||||
debug_frame* VisibleFrame, memory_arena* Memory)
|
||||
RenderProfiler_ListVisualization(ui_interface* Interface, ui_layout Layout, debug_frame* VisibleFrame, memory_arena* Memory)
|
||||
{
|
||||
MakeStringBuffer(String, 256);
|
||||
|
||||
r32 YAt = Max.y - Interface.Font->PixelHeight;
|
||||
r32 Column0X = Min.x;
|
||||
r32 Column1X = Column0X + 256;
|
||||
r32 Column2X = Column1X + 128;
|
||||
r32 Column3X = Column2X + 128;
|
||||
r32 Column4X = Column3X + 100;
|
||||
r32 ColumnWidths[] = {256, 128, 128, 128, 128};
|
||||
ui_StartRow(&Layout, 5, &ColumnWidths[0]);
|
||||
{
|
||||
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Procedure"), Interface->Style.TextColor);
|
||||
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("% Frame"), Interface->Style.TextColor);
|
||||
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Seconds"), Interface->Style.TextColor);
|
||||
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Cycles"), Interface->Style.TextColor);
|
||||
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Calls"), Interface->Style.TextColor);
|
||||
}
|
||||
ui_EndRow(&Layout);
|
||||
|
||||
for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++)
|
||||
{
|
||||
|
@ -101,24 +108,24 @@ RenderProfiler_ListVisualization(render_command_buffer* RenderBuffer,
|
|||
{
|
||||
collated_scope_record* CollatedRecord = VisibleFrame->CollatedScopes + n;
|
||||
|
||||
PrintF(&String, "%.*s", NameEntry.Name.Length, NameEntry.Name.Memory);
|
||||
DrawString(RenderBuffer, String, Interface.Font, v2{Column0X, YAt}, WhiteV4);
|
||||
ui_StartRow(&Layout, 5, &ColumnWidths[0]);
|
||||
{
|
||||
PrintF(&String, "%S", NameEntry.Name);
|
||||
ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
|
||||
|
||||
PrintF(&String, "%f", CollatedRecord->PercentFrameTime);
|
||||
DrawString(RenderBuffer, String, Interface.Font, v2{Column1X, YAt}, WhiteV4);
|
||||
PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime);
|
||||
ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
|
||||
|
||||
PrintF(&String, "%fs", CollatedRecord->TotalSeconds);
|
||||
DrawString(RenderBuffer, String, Interface.Font, v2{Column2X, YAt}, WhiteV4);
|
||||
ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
|
||||
|
||||
PrintF(&String, "%dcy", CollatedRecord->TotalCycles);
|
||||
DrawString(RenderBuffer, String, Interface.Font, v2{Column3X, YAt}, WhiteV4);
|
||||
ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
|
||||
|
||||
PrintF(&String, "%d calls", CollatedRecord->CallCount);
|
||||
DrawString(RenderBuffer, String, Interface.Font, v2{Column4X, YAt}, WhiteV4);
|
||||
|
||||
YAt -= Interface.Font->PixelHeight + 4;
|
||||
|
||||
if (YAt < Min.y) { break; }
|
||||
PrintF(&String, "%d", CollatedRecord->CallCount);
|
||||
ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
|
||||
}
|
||||
ui_EndRow(&Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,23 +141,18 @@ ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* Render
|
|||
v4 FrameColors[] = { GreenV4, YellowV4, RedV4, WhiteV4 };
|
||||
|
||||
r32 FrameListHeight = 64;
|
||||
v2 FrameListMin = v2{PanelBounds.Min.x + 16, PanelBounds.Max.y - (16 + FrameListHeight)};
|
||||
v2 FrameListMax = v2{PanelBounds.Max.x - 16, PanelBounds.Max.y - 16};
|
||||
rect FrameListBounds, ProcListBounds;
|
||||
gs_HSplitRectAtDistanceFromTop(PanelBounds, FrameListHeight, &FrameListBounds, &ProcListBounds);
|
||||
rect FrameListInner = gs_InsetRect(FrameListBounds, 4);
|
||||
|
||||
r32 FrameListPadding = 4;
|
||||
r32 FrameListInnerWidth = (FrameListMax.x - FrameListMin.x) - (FrameListPadding * 2);
|
||||
|
||||
r32 SingleFrameStep = FrameListInnerWidth / DEBUG_FRAME_COUNT;
|
||||
r32 SingleFrameStep = gs_Width(FrameListInner) / DEBUG_FRAME_COUNT;
|
||||
r32 SingleFrameWidth = (r32)((s32)SingleFrameStep - 2);
|
||||
|
||||
PushRenderBoundingBox2D(RenderBuffer, FrameListMin, FrameListMax, 2, WhiteV4);
|
||||
|
||||
if (PointIsInRange(Mouse.Pos, FrameListMin, FrameListMax) &&
|
||||
MouseButtonHeldDown(Mouse.LeftButtonState))
|
||||
ui_OutlineRect(&State->Interface_, FrameListBounds, 2, WhiteV4);
|
||||
if (gs_PointIsInRect(Mouse.Pos, FrameListBounds) && MouseButtonHeldDown(Mouse.LeftButtonState))
|
||||
{
|
||||
r32 LocalMouseX = (Mouse.Pos.x - FrameListMin.x) + FrameListPadding;
|
||||
s32 ClosestFrameIndex = (LocalMouseX / SingleFrameStep);
|
||||
|
||||
v2 LocalMouse = gs_TransformPointIntoRectSpace(Mouse.Pos, FrameListBounds);
|
||||
s32 ClosestFrameIndex = (LocalMouse.x / SingleFrameStep);
|
||||
if (ClosestFrameIndex >= 0 && ClosestFrameIndex < DEBUG_FRAME_COUNT)
|
||||
{
|
||||
GlobalDebugServices->RecordFrames = false;
|
||||
|
@ -158,60 +160,61 @@ ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* Render
|
|||
}
|
||||
}
|
||||
|
||||
rect FrameBounds = gs_MakeRectMinWidth(FrameListInner.Min, v2{SingleFrameWidth, gs_Height(FrameListInner)});
|
||||
for (s32 F = 0; F < DEBUG_FRAME_COUNT; F++)
|
||||
{
|
||||
v2 Min = v2{FrameListMin.x + FrameListPadding + (F * SingleFrameStep), FrameListMin.y + 4};
|
||||
v2 Max = v2{Min.x + SingleFrameWidth, FrameListMax.y - 4};
|
||||
|
||||
rect PositionedFrameBounds = gs_TranslateRectX(FrameBounds, F * SingleFrameStep);
|
||||
s32 FramesAgo = (GlobalDebugServices->CurrentDebugFrame - F);
|
||||
if (FramesAgo < 0) { FramesAgo += DEBUG_FRAME_COUNT; }
|
||||
v4 Color = FrameColors[GSClamp(0, FramesAgo, 3)];
|
||||
PushRenderQuad2D(RenderBuffer, Min, Max, Color);
|
||||
ui_FillRect(&State->Interface_, PositionedFrameBounds, Color);
|
||||
}
|
||||
|
||||
debug_frame* VisibleFrame = GetLastDebugFrame(GlobalDebugServices);
|
||||
|
||||
ui_layout Layout = ui_CreateLayout(State->Interface_, ProcListBounds);
|
||||
ui_StartRow(&Layout, 4);
|
||||
{
|
||||
s64 FrameStartCycles = VisibleFrame->FrameStartCycles;
|
||||
s64 FrameTotalCycles = VisibleFrame->FrameEndCycles - VisibleFrame->FrameStartCycles;
|
||||
u32 CurrentDebugFrame = GlobalDebugServices->CurrentDebugFrame - 1;
|
||||
PrintF(&String, "Frame %d", CurrentDebugFrame);
|
||||
ui_LayoutDrawString(&State->Interface_, &Layout, String, WhiteV4);
|
||||
|
||||
PrintF(&String, "Frame %d - Total Cycles: %lld",
|
||||
GlobalDebugServices->CurrentDebugFrame - 1,
|
||||
FrameTotalCycles);
|
||||
DrawString(RenderBuffer, String, State->Interface.Font, FrameListMin - v2{0, 32}, WhiteV4);
|
||||
PrintF(&String, "Total Cycles: %lld", FrameTotalCycles);
|
||||
ui_LayoutDrawString(&State->Interface_, &Layout, String, WhiteV4);
|
||||
|
||||
rect ResumeRecordingBtnBounds = MakeRectMinWidth(v2{ FrameListMax.x - 128, FrameListMin.y - 32 }, v2{ 128, 28 });
|
||||
if (ui_Button(&State->Interface_, MakeString("Resume Recording"), ResumeRecordingBtnBounds))
|
||||
// NOTE(NAME): Skipping a space for aesthetic reasons, not functional, and could
|
||||
// be removed, or used for something else
|
||||
ui_ReserveElementBounds(&Layout);
|
||||
|
||||
if (ui_LayoutButton(&State->Interface_, &Layout, MakeString("Resume Recording")))
|
||||
{
|
||||
GlobalDebugServices->RecordFrames = true;
|
||||
}
|
||||
}
|
||||
ui_EndRow(&Layout);
|
||||
|
||||
rect ScopeViewBtnBounds = {
|
||||
v2{ FrameListMin.x, FrameListMin.y - 60 },
|
||||
v2{ FrameListMin.x + 128, FrameListMin.y - 42 }
|
||||
};
|
||||
if (ui_Button(&State->Interface_, MakeString("Scope View"), ScopeViewBtnBounds))
|
||||
ui_StartRow(&Layout, 8);
|
||||
{
|
||||
if (ui_LayoutButton(&State->Interface_, &Layout, MakeString("Scope View")))
|
||||
{
|
||||
GlobalDebugServices->Interface.FrameView = FRAME_VIEW_PROFILER;
|
||||
}
|
||||
|
||||
rect ListViewBtnBounds = TranslateRectX(ScopeViewBtnBounds, 152);
|
||||
if (ui_Button(&State->Interface_, MakeString("List View"), ListViewBtnBounds))
|
||||
if (ui_LayoutButton(&State->Interface_, &Layout, MakeString("List View")))
|
||||
{
|
||||
GlobalDebugServices->Interface.FrameView = FRAME_VIEW_SCOPE_LIST;
|
||||
}
|
||||
}
|
||||
ui_EndRow(&Layout);
|
||||
|
||||
rect ViewModeBounds = {
|
||||
v2{ FrameListMin.x, PanelBounds.Min.y },
|
||||
v2{ FrameListMax.x, FrameListMin.y - 96 }
|
||||
};
|
||||
if (GlobalDebugServices->Interface.FrameView == FRAME_VIEW_PROFILER)
|
||||
{
|
||||
RenderProfiler_ScopeVisualization(RenderBuffer, State->Interface, Mouse, RectExpand(ViewModeBounds),
|
||||
VisibleFrame, Memory);
|
||||
RenderProfiler_ScopeVisualization(&State->Interface_, Layout, VisibleFrame, Memory);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderProfiler_ListVisualization(RenderBuffer, State->Interface, Mouse, RectExpand(ViewModeBounds),
|
||||
VisibleFrame, Memory);
|
||||
RenderProfiler_ListVisualization(&State->Interface_, Layout, VisibleFrame, Memory);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
78
todo.txt
78
todo.txt
|
@ -1,33 +1,22 @@
|
|||
TODO FOLDHAUS
|
||||
|
||||
STREAM #0: Metaprogramming
|
||||
- Metaprogramming
|
||||
- fix memory layout (remeber to profile before and after)
|
||||
|
||||
- Make the DLL truly platform agnostic
|
||||
- Make everything truly platform agnostic
|
||||
- Application DLL
|
||||
- math.h: present for trig functions (though this is part of the c-std lib, so it should be everywhere)
|
||||
- windows.h: only thing left is InterlockedIncrement and InterlockedAdd
|
||||
- Meta Layer
|
||||
- ???
|
||||
|
||||
- Win32 Platform Layer
|
||||
- Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h)
|
||||
|
||||
- Internal Log File
|
||||
NOTE: This should not be a part of the debug system
|
||||
- Save output log to a file continuously
|
||||
- Have a window where we can view the log within the app
|
||||
- Create a bar that displays the most recent error message
|
||||
- :ErrorLogging
|
||||
|
||||
- Make sure it works without building in Debug Mode
|
||||
|
||||
- Buckets & Lists
|
||||
- On second thought, I just really don't like these. Lets get rid of them, and put custom structures in place
|
||||
|
||||
STREAM #1: 3D Overhaul
|
||||
- Rendering (Working on this elsewhere)
|
||||
- OpenGL 3
|
||||
- Vertex Buffers
|
||||
- Clipping in shaders
|
||||
- Layers
|
||||
- Lighting
|
||||
- Clipping (with error checking)
|
||||
|
||||
- Camera
|
||||
- pan
|
||||
|
@ -43,28 +32,22 @@ TODO FOLDHAUS
|
|||
- led groups & subgroups - defined in file
|
||||
- motion
|
||||
|
||||
- Network
|
||||
- Handle Error Cases
|
||||
- Handle connecting a sculpture after launch
|
||||
- Artnet
|
||||
- Universe offsets (per sculpture)
|
||||
|
||||
- Interface
|
||||
- Layout functionality
|
||||
- styling
|
||||
- text input
|
||||
- lister with icon options
|
||||
- panel system: destroy panel by extending it beyond its max, not just its min
|
||||
|
||||
- Asset Loading
|
||||
- Need to figure out which textures are currently in graphics memory and which need to be resubmitted
|
||||
- images
|
||||
- icon system - integrate with interface
|
||||
|
||||
- Sculpture View
|
||||
- mouse spatial interaction - handles, and hover for info
|
||||
- debug capabilities (toggle strip/led/universe colors)
|
||||
|
||||
STREAM #2: Memory
|
||||
- Buckets & Lists
|
||||
- On second thought, I just really don't like these. Lets get rid of them, and put custom structures in place
|
||||
|
||||
- Internal Log File
|
||||
NOTE: This should not be a part of the debug system
|
||||
- Save output log to a file continuously
|
||||
- Have a window where we can view the log within the app
|
||||
- Create a bar that displays the most recent error message
|
||||
- :ErrorLogging
|
||||
|
||||
STREAM #3: Nodes
|
||||
- Animation System
|
||||
- blending between animation
|
||||
- layers
|
||||
|
@ -91,11 +74,32 @@ TODO FOLDHAUS
|
|||
- saving animation timelines
|
||||
- saving projects
|
||||
|
||||
- Settings
|
||||
STRAM #4: Completeness
|
||||
- Win32 Platform Layer
|
||||
- Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h)
|
||||
|
||||
- Platform Layer
|
||||
- Mac Platform Layer
|
||||
|
||||
- Make sure it works without building in Debug Mode
|
||||
|
||||
- Network
|
||||
- Handle Error Cases
|
||||
- Handle connecting a sculpture after launch
|
||||
- Artnet
|
||||
- Universe offsets (per sculpture)
|
||||
|
||||
- Interface
|
||||
- text input
|
||||
- lister with icon options
|
||||
|
||||
- Asset Loading
|
||||
- Need to figure out which textures are currently in graphics memory and which need to be resubmitted
|
||||
- images
|
||||
- icon system - integrate with interface
|
||||
|
||||
- Settings
|
||||
|
||||
Assembly -> SACN interface
|
||||
- need to create a data structure in CreateDMXBuffers that prevents duplication of DMXBuffers.
|
||||
- - thinking about a dictionary. Key is Universe, length is 256, create parallel arrays as necessary
|
||||
|
|
Loading…
Reference in New Issue