Merge branch 'ui_widget_overhaul' into dev

This commit is contained in:
PS 2020-11-15 17:17:53 -08:00
commit 70971cc196
16 changed files with 1211 additions and 624 deletions

View File

@ -89,52 +89,8 @@ Editor_Update(app_state* State, context* Context, input_queue InputQueue)
} }
internal void internal void
Editor_Render(app_state* State, context* Context, render_command_buffer* RenderBuffer) Editor_DrawWidgetString(app_state* State, context* Context, render_command_buffer* RenderBuffer, ui_widget Widget, rect2 ClippingBox, v4 Color)
{ {
PushRenderOrthographic(RenderBuffer, State->WindowBounds);
PushRenderClearScreen(RenderBuffer);
ui_InterfaceReset(&State->Interface);
State->Interface.RenderBuffer = RenderBuffer;
ui_layout Layout = ui_CreateLayout(&State->Interface, Context->WindowBounds);
ui_PushLayout(&State->Interface, Layout);
DrawAllPanels(State->PanelSystem, RenderBuffer, &Context->Mouse, State, *Context);
for (s32 m = 0; m < State->Modes.ActiveModesCount; m++)
{
operation_mode OperationMode = State->Modes.ActiveModes[m];
if (OperationMode.Render != 0)
{
OperationMode.Render(State, RenderBuffer, OperationMode, Context->Mouse, *Context);
}
}
ui_PopLayout(&State->Interface);
// Draw the Interface
for (u32 i = 0; i < State->Interface.WidgetsCount; i++)
{
ui_widget Widget = State->Interface.Widgets[i];
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawBackground))
{
v4 Color = State->Interface.Style.ButtonColor_Inactive;
if (ui_WidgetIdsEqual(Widget.Id, State->Interface.HotWidget))
{
Color = State->Interface.Style.ButtonColor_Active;
}
if (ui_WidgetIdsEqual(Widget.Id, State->Interface.ActiveWidget))
{
Color = State->Interface.Style.ButtonColor_Selected;
}
PushRenderQuad2D(RenderBuffer, Widget.Bounds.Min, Widget.Bounds.Max, Color);
}
if (Widget.String.Length > 0)
{
v4 Color = State->Interface.Style.TextColor;
render_quad_batch_constructor BatchConstructor = PushRenderTexture2DBatch(RenderBuffer, render_quad_batch_constructor BatchConstructor = PushRenderTexture2DBatch(RenderBuffer,
Widget.String.Length, Widget.String.Length,
State->Interface.Style.Font->BitmapMemory, State->Interface.Style.Font->BitmapMemory,
@ -150,27 +106,264 @@ Editor_Render(app_state* State, context* Context, render_command_buffer* RenderB
{ {
case Align_Left: case Align_Left:
{ {
RegisterPosition = DrawStringLeftAligned(&BatchConstructor, StringExpand(Widget.String), RegisterPosition, State->Interface.Style.Font, Color); RegisterPosition = DrawStringLeftAligned(&BatchConstructor, StringExpand(Widget.String), RegisterPosition, State->Interface.Style.Font, ClippingBox, Color);
}break; }break;
case Align_Right: case Align_Right:
{ {
RegisterPosition = DrawStringRightAligned(&BatchConstructor, StringExpand(Widget.String), RegisterPosition, State->Interface.Style.Font, Color); RegisterPosition = DrawStringRightAligned(&BatchConstructor, StringExpand(Widget.String), RegisterPosition, State->Interface.Style.Font, ClippingBox, Color);
}break; }break;
InvalidDefaultCase; InvalidDefaultCase;
} }
}
internal void
Editor_DrawWidget(app_state* State, context* Context, render_command_buffer* RenderBuffer, ui_widget Widget, rect2 ParentClipBounds)
{
rect2 WidgetParentUnion = Widget.Bounds;
WidgetParentUnion = Rect2Union(Widget.Bounds, ParentClipBounds);
if (!Widget.Parent || (Rect2Area(WidgetParentUnion) > 0))
{
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawBackground))
{
v4 Color = State->Interface.Style.ButtonColor_Inactive;
if (ui_WidgetIdsEqual(Widget.Id, State->Interface.HotWidget))
{
Color = State->Interface.Style.ButtonColor_Active;
} }
if (ui_WidgetIdsEqual(Widget.Id, State->Interface.ActiveWidget))
{
Color = State->Interface.Style.ButtonColor_Selected;
}
PushRenderQuad2DClipped(RenderBuffer, Widget.Bounds, WidgetParentUnion, Color);
}
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawString) && Widget.String.Length > 0)
{
v4 Color = State->Interface.Style.TextColor;
Editor_DrawWidgetString(State, Context, RenderBuffer, Widget, WidgetParentUnion, Color);
}
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawHorizontalFill) ||
ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawVerticalFill))
{
v4 Color = State->Interface.Style.ButtonColor_Selected;
if (ui_WidgetIdsEqual(Widget.Id, State->Interface.HotWidget) ||
ui_WidgetIdsEqual(Widget.Id, State->Interface.ActiveWidget))
{
Color = WhiteV4;
}
rect2 FillBounds = {};
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawHorizontalFill))
{
FillBounds.Min.y = Widget.Bounds.Min.y;
FillBounds.Max.y = Widget.Bounds.Max.y;
r32 FillToPoint = LerpR32(Widget.FillPercent, Widget.Bounds.Min.x, Widget.Bounds.Max.x);
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawFillReversed))
{
FillBounds.Min.x = FillToPoint;
FillBounds.Max.x = Widget.Bounds.Max.x;
}
else if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawFillAsHandle))
{
FillBounds.Min.x = FillToPoint - 5;
FillBounds.Max.x = FillToPoint + 5;
}
else
{
FillBounds.Min.x = Widget.Bounds.Min.x;
FillBounds.Max.x = FillToPoint;
}
}
else if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawVerticalFill))
{
FillBounds.Min.x = Widget.Bounds.Min.x;
FillBounds.Max.x = Widget.Bounds.Max.x;
r32 FillToPoint = LerpR32(Widget.FillPercent, Widget.Bounds.Min.y, Widget.Bounds.Max.y);
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawFillReversed))
{
FillBounds.Min.y = FillToPoint;
FillBounds.Max.y = Widget.Bounds.Max.y;
}
else if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawFillAsHandle))
{
FillBounds.Min.y = FillToPoint - 5;
FillBounds.Max.y = FillToPoint + 5;
}
else
{
FillBounds.Min.y = Widget.Bounds.Min.y;
FillBounds.Max.y = FillToPoint;
}
}
PushRenderQuad2DClipped(RenderBuffer, FillBounds, WidgetParentUnion, Color);
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawString) && Widget.String.Length > 0)
{
// TODO(pjs): Mask this text by the horizontal fill
// TODO(pjs): add this color to the style
v4 TextColor = BlackV4;
Editor_DrawWidgetString(State, Context, RenderBuffer, Widget, WidgetParentUnion, TextColor);
}
}
if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawOutline)) if (ui_WidgetIsFlagSet(Widget, UIWidgetFlag_DrawOutline))
{ {
// TODO(pjs): replace these with values from the style // TODO(pjs): replace these with values from the style
r32 Thickness = 1.0f; r32 Thickness = 1.0f;
v4 Color = WhiteV4; v4 Color = WhiteV4;
PushRenderBoundingBox2D(RenderBuffer, Widget.Bounds.Min, Widget.Bounds.Max, Thickness, Color); PushRenderBoundingBox2D(RenderBuffer, WidgetParentUnion.Min, WidgetParentUnion.Max, Thickness, Color);
} }
} }
if (Widget.ChildrenRoot)
{
Editor_DrawWidget(State, Context, RenderBuffer, *Widget.ChildrenRoot, WidgetParentUnion);
}
if (Widget.Next)
{
Editor_DrawWidget(State, Context, RenderBuffer, *Widget.Next, ParentClipBounds);
}
}
global r32 TestSlider_Value = 5;
global r32 TestSlider_Min = 0;
global r32 TestSlider_Max = 10;
global bool TestToggle = true;
internal void
TestRender(app_state* State, context* Context, render_command_buffer* RenderBuffer)
{
ui_InterfaceReset(&State->Interface);
State->Interface.RenderBuffer = RenderBuffer;
State->Interface.WindowBounds = Context->WindowBounds;
gs_string A = MakeString("TestRender Layout");
ui_PushLayout(&State->Interface, A);
{
#if 1
ui_Label(&State->Interface, MakeString("Spacer"));
ui_Label(&State->Interface, MakeString("Spacer"));
ui_Label(&State->Interface, MakeString("Spacer"));
ui_Label(&State->Interface, MakeString("Spacer"));
ui_Label(&State->Interface, MakeString("Spacer"));
ui_BeginList(&State->Interface, MakeString("TestList"), 5, 16);
{
ui_BeginRow(&State->Interface, 3);
for (u32 i = 0; i < 16; i++)
{
ui_Button(&State->Interface, MakeString("B"));
ui_Button(&State->Interface, MakeString("C"));
ui_Button(&State->Interface, MakeString("D"));
}
ui_EndRow(&State->Interface);
}
ui_EndList(&State->Interface);
//ui_Button(&State->Interface, MakeString("B"));
//ui_Button(&State->Interface, MakeString("C"));
//TestSlider_Value = ui_RangeSlider(&State->Interface, MakeString("TestSlider"), TestSlider_Value, TestSlider_Min, TestSlider_Max);
#elif 0
ui_PushLayout(&State->Interface, MakeString("Outer"));
{
for (u32 i = 0; i < 3; i++)
{
ui_Button(&State->Interface, MakeString("A"));
}
}
ui_PopLayout(&State->Interface);
ui_BeginRow(&State->Interface, 2);
{
ui_PushLayout(&State->Interface, MakeString("TestLayout"));
{
for (u32 i = 0; i < 5; i++)
{
ui_Button(&State->Interface, MakeString("TestButon"));
}
}
ui_PopLayout(&State->Interface);
ui_PushLayout(&State->Interface, MakeString("TestLayout"));
{
ui_Button(&State->Interface, MakeString("TestButon"));
TestToggle = ui_Toggle(&State->Interface, MakeString("Toggle"), TestToggle);
TestSlider_Value = ui_RangeSlider(&State->Interface, MakeString("TestSlider"), TestSlider_Value, TestSlider_Min, TestSlider_Max);
if (ui_BeginDropdown(&State->Interface, MakeString("TestDropdown")))
{
ui_Button(&State->Interface, MakeString("TestButon"));
ui_Button(&State->Interface, MakeString("TestButon"));
ui_Button(&State->Interface, MakeString("TestButon"));
}
ui_EndDropdown(&State->Interface);
}
ui_PopLayout(&State->Interface);
}
ui_EndRow(&State->Interface);
ui_PushLayout(&State->Interface, MakeString("Outer"));
{
for (u32 i = 0; i < 3; i++)
{
ui_Button(&State->Interface, MakeString("B"));
}
}
ui_PopLayout(&State->Interface);
#else
ui_BeginList(&State->Interface, MakeString("Test List"), 10);
{
for (u32 i = 0; i < 32; i++)
{
ui_Button(&State->Interface, MakeString("Option"));
}
}
ui_EndList(&State->Interface);
#endif
}
ui_PopLayout(&State->Interface);
}
internal void
Editor_Render(app_state* State, context* Context, render_command_buffer* RenderBuffer)
{
PushRenderOrthographic(RenderBuffer, State->WindowBounds);
PushRenderClearScreen(RenderBuffer);
#if 0
TestRender(State, Context, RenderBuffer);
#else
ui_InterfaceReset(&State->Interface);
State->Interface.RenderBuffer = RenderBuffer;
ui_PushLayout(&State->Interface, Context->WindowBounds, LayoutDirection_TopDown, MakeString("Editor Layout"));
DrawAllPanels(State->PanelSystem, RenderBuffer, &Context->Mouse, State, *Context);
for (s32 m = 0; m < State->Modes.ActiveModesCount; m++)
{
operation_mode OperationMode = State->Modes.ActiveModes[m];
if (OperationMode.Render != 0)
{
OperationMode.Render(State, RenderBuffer, OperationMode, Context->Mouse, *Context);
}
}
ui_PopLayout(&State->Interface);
#endif
// Draw the Interface
if (State->Interface.DrawOrderRoot != 0)
{
ui_widget Widget = *State->Interface.DrawOrderRoot;
Editor_DrawWidget(State, Context, RenderBuffer, Widget, Context->WindowBounds);
}
Context->GeneralWorkQueue->CompleteQueueWork(Context->GeneralWorkQueue, Context->ThreadContext); Context->GeneralWorkQueue->CompleteQueueWork(Context->GeneralWorkQueue, Context->ThreadContext);
Context->GeneralWorkQueue->ResetWorkQueue(Context->GeneralWorkQueue); Context->GeneralWorkQueue->ResetWorkQueue(Context->GeneralWorkQueue);

View File

@ -386,7 +386,8 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect2 FooterB
rect2 PanelSelectBtnBounds = MakeRect2MinDim(FooterBounds.Min + v2{30, 1}, v2{100, 23}); rect2 PanelSelectBtnBounds = MakeRect2MinDim(FooterBounds.Min + v2{30, 1}, v2{100, 23});
if (ui_BeginDropdown(&State->Interface, MakeString("Select"), PanelSelectBtnBounds)) panel_definition CurrentDef = State->PanelSystem.PanelDefs[Panel->TypeIndex];
if (ui_BeginDropdown(&State->Interface, MakeString(CurrentDef.PanelName, CurrentDef.PanelNameLength), PanelSelectBtnBounds))
{ {
for (s32 i = 0; i < GlobalPanelDefsCount; i++) for (s32 i = 0; i < GlobalPanelDefsCount; i++)
{ {

View File

@ -241,13 +241,12 @@ SelectAndBeginDragAnimationBlock(animation_timeline_state* TimelineState, handle
operation_mode* DragAnimationBlockMode = ActivateOperationModeWithCommands(&State->Modes, DragAnimationBlockCommands, UpdateDragAnimationBlock); operation_mode* DragAnimationBlockMode = ActivateOperationModeWithCommands(&State->Modes, DragAnimationBlockCommands, UpdateDragAnimationBlock);
drag_animation_block_state* OpState = CreateOperationState(DragAnimationBlockMode, drag_animation_block_state* OpState = CreateOperationState(DragAnimationBlockMode,
&State->Modes, &State->Modes,
drag_animation_block_state); drag_animation_block_state);
OpState->TimelineBounds = TimelineBounds; OpState->TimelineBounds = TimelineBounds;
OpState->BlockHandle = BlockHandle; OpState->BlockHandle = BlockHandle;
OpState->VisibleRange = VisibleRange; OpState->VisibleRange = VisibleRange;
animation_block* SelectedBlock = Animation_GetBlockFromHandle(ActiveAnim, BlockHandle);
OpState->ClipRange = SelectedBlock->Range; OpState->ClipRange = SelectedBlock->Range;
} }
// ------------------- // -------------------
@ -303,10 +302,7 @@ DrawFrameBar (animation_system* AnimationSystem, ui_interface Interface, frame_r
r32 BarWidth = Rect2Width(BarBounds); r32 BarWidth = Rect2Width(BarBounds);
// Mouse clicked inside frame nubmer bar -> change current frame on timeline // Mouse clicked inside frame nubmer bar -> change current frame on timeline
// TODO(pjs): both of these functions can get wrapped in a MouseClickedRect if (ui_MouseClickedRect(Interface, BarBounds))
// and an alternate MouseIsDraggingRect
if (MouseButtonTransitionedDown(Interface.Mouse.LeftButtonState) &&
PointIsInRect(BarBounds, Interface.Mouse.DownPos))
{ {
StartDragTimeMarker(BarBounds, VisibleFrames, State); StartDragTimeMarker(BarBounds, VisibleFrames, State);
} }
@ -590,8 +586,7 @@ PANEL_MODAL_OVERRIDE_CALLBACK(LoadAnimationFileCallback)
internal void internal void
DrawAnimationPatternList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedAnimationLayerHandle, animation_system* AnimationSystem) DrawAnimationPatternList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedAnimationLayerHandle, animation_system* AnimationSystem)
{ {
ui_layout Layout = ui_CreateLayout(Interface, PanelBounds); ui_PushLayout(Interface, PanelBounds, LayoutDirection_TopDown, MakeString("AnimClips Layout"));
ui_PushLayout(Interface, Layout);
for (s32 i = 0; i < GlobalAnimationPatternsCount; i++) for (s32 i = 0; i < GlobalAnimationPatternsCount; i++)
{ {
animation_pattern Pattern = GlobalAnimationPatterns[i]; animation_pattern Pattern = GlobalAnimationPatterns[i];
@ -609,11 +604,10 @@ PlayBar_Render(animation_timeline_state* TimelineState, rect2 Bounds, panel* Pan
{ {
animation_system* AnimSystem = &State->AnimationSystem; animation_system* AnimSystem = &State->AnimationSystem;
ui_interface* Interface = &State->Interface; ui_interface* Interface = &State->Interface;
ui_layout Layout = ui_CreateLayout(Interface, Bounds); ui_PushLayout(Interface, Bounds, LayoutDirection_TopDown, MakeString("PlayBar Layout"));
ui_PushLayout(Interface, Layout);
ui_FillRect(Interface, Bounds, Interface->Style.PanelBGColors[0]); ui_FillRect(Interface, Bounds, Interface->Style.PanelBGColors[0]);
ui_StartRow(&State->Interface, 4); ui_BeginRow(&State->Interface, 4);
{ {
if (ui_Button(Interface, MakeString("Pause"))) if (ui_Button(Interface, MakeString("Pause")))
{ {
@ -797,14 +791,13 @@ AnimInfoView_Render(animation_timeline_state* TimelineState, rect2 Bounds, rende
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(AnimSystem); animation* ActiveAnim = AnimationSystem_GetActiveAnimation(AnimSystem);
ui_interface* Interface = &State->Interface; ui_interface* Interface = &State->Interface;
ui_layout Layout = ui_CreateLayout(Interface, Bounds); ui_PushLayout(Interface, Bounds, LayoutDirection_TopDown, MakeString("AnimInfo Layout"));
ui_PushLayout(Interface, Layout);
ui_FillRect(&State->Interface, Bounds, Interface->Style.PanelBGColors[0]); ui_FillRect(&State->Interface, Bounds, Interface->Style.PanelBGColors[0]);
ui_StartRow(&State->Interface, 2); ui_BeginRow(&State->Interface, 2);
{ {
ui_DrawString(Interface, MakeString("Active Animation")); ui_Label(Interface, MakeString("Active Animation"));
if (ui_BeginDropdown(Interface, ActiveAnim->Name)) if (ui_BeginDropdown(Interface, ActiveAnim->Name))
{ {
for (u32 i = 0; i < AnimSystem->Animations.Count; i++) for (u32 i = 0; i < AnimSystem->Animations.Count; i++)

View File

@ -88,8 +88,7 @@ internal void
FileView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context) FileView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
{ {
file_view_state* FileViewState = Panel_GetStateStruct(Panel, file_view_state); file_view_state* FileViewState = Panel_GetStateStruct(Panel, file_view_state);
ui_layout Layout = ui_CreateLayout(&State->Interface, PanelBounds); ui_PushLayout(&State->Interface, PanelBounds, LayoutDirection_TopDown, MakeString("FileView Layout"));
ui_PushLayout(&State->Interface, Layout);
if (ui_Button(&State->Interface, MakeString("Exit"))) if (ui_Button(&State->Interface, MakeString("Exit")))
{ {
@ -97,7 +96,7 @@ FileView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBu
} }
// Header // Header
ui_DrawString(&State->Interface, FileViewState->WorkingDirectory); ui_Label(&State->Interface, FileViewState->WorkingDirectory);
// File Display // File Display
for (u32 i = 0; i < FileViewState->FileNames.Count; i++) for (u32 i = 0; i < FileViewState->FileNames.Count; i++)
@ -108,7 +107,7 @@ FileView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBu
gs_const_string FileName = Substring(File.Path, LastSlashIndex + 1, File.Path.Length); gs_const_string FileName = Substring(File.Path, LastSlashIndex + 1, File.Path.Length);
gs_string PathString = PushString(State->Transient, FileName.Length); gs_string PathString = PushString(State->Transient, FileName.Length);
PrintF(&PathString, "%S", FileName); PrintF(&PathString, "%S", FileName);
if (ui_LayoutListButton(&State->Interface, &Layout, PathString, i)) if (ui_LayoutListButton(&State->Interface, PathString, i))
{ {
if (File.IsDirectory) if (File.IsDirectory)
{ {

View File

@ -38,18 +38,20 @@ GSMetaTag(panel_type_hierarchy);
internal void internal void
HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context) HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
{ {
ui_layout Layout = ui_CreateLayout(&State->Interface, PanelBounds); ui_PushLayout(&State->Interface, PanelBounds, LayoutDirection_TopDown, MakeString("Hierarchy Layout"));
ui_PushLayout(&State->Interface, Layout);
// TODO(pjs): Come back to this after the layout stuff is handled.
// Ideally it handles the visuals of the hierarchy itself.
#if 0
gs_string TempString = PushString(State->Transient, 256); gs_string TempString = PushString(State->Transient, 256);
u32 LineCount = (u32)(Rect2Height(PanelBounds) / Layout.RowHeight) + 1; u32 LineCount = (u32)(Rect2Height(PanelBounds) / Layout->RowHeight) + 1;
u32 AssembliesToDraw = Min(LineCount, State->Assemblies.Count); u32 AssembliesToDraw = Min(LineCount, State->Assemblies.Count);
rect2* LineBounds = PushArray(State->Transient, rect2, LineCount); rect2* LineBounds = PushArray(State->Transient, rect2, LineCount);
// Fill in alternating color rows for the backgrounds // Fill in alternating color rows for the backgrounds
for (u32 Line = 0; Line < LineCount; Line++) for (u32 Line = 0; Line < LineCount; Line++)
{ {
LineBounds[Line] = ui_ReserveElementBounds(&Layout);
v4 ListItemBGColor = ui_GetListItemBGColor(State->Interface.Style, Line); v4 ListItemBGColor = ui_GetListItemBGColor(State->Interface.Style, Line);
ui_FillRect(&State->Interface, LineBounds[Line], ListItemBGColor); ui_FillRect(&State->Interface, LineBounds[Line], ListItemBGColor);
} }
@ -62,7 +64,7 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
ui_StartRow(&State->Interface, 2); ui_StartRow(&State->Interface, 2);
{ {
ui_DrawString(&State->Interface, TempString); ui_DrawString(&State->Interface, TempString);
if (ui_LayoutListButton(&State->Interface, &Layout, MakeString("X"), AssemblyIndex)) if (ui_LayoutListButton(&State->Interface, MakeString("X"), AssemblyIndex))
{ {
UnloadAssembly(AssemblyIndex, State, Context); UnloadAssembly(AssemblyIndex, State, Context);
} }
@ -80,6 +82,7 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
Panel_PushModalOverride(Panel, FileBrowser, LoadAssemblyCallback); Panel_PushModalOverride(Panel, FileBrowser, LoadAssemblyCallback);
} }
} }
#endif
ui_PopLayout(&State->Interface); ui_PopLayout(&State->Interface);
} }

View File

@ -25,7 +25,7 @@ ProfilerView_Cleanup(panel* Panel, app_state* State)
} }
internal void internal void
RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_layout Layout, debug_frame* VisibleFrame, gs_memory_arena* Memory) RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_widget* Layout, debug_frame* VisibleFrame, gs_memory_arena* Transient)
{ {
v4 ThreadColors[] = { v4 ThreadColors[] = {
v4{.73f, .33f, .83f, 1}, v4{.73f, .33f, .83f, 1},
@ -35,7 +35,7 @@ RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_layout Layout, deb
v4{.74f, .40f, .25f, 1}, v4{.74f, .40f, .25f, 1},
}; };
rect2 Bounds = ui_LayoutRemaining(Layout); rect2 Bounds = ui_LayoutRemaining(*Layout);
r32 Width = Rect2Width(Bounds); r32 Width = Rect2Width(Bounds);
r32 DepthHeight = 64; r32 DepthHeight = 64;
@ -45,11 +45,7 @@ RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_layout Layout, deb
debug_scope_record_list* ThreadScopeCalls = GetScopeListForThreadInFrame(GlobalDebugServices, debug_scope_record_list* ThreadScopeCalls = GetScopeListForThreadInFrame(GlobalDebugServices,
VisibleFrame); VisibleFrame);
scope_record* HotRecord = 0; gs_string String = PushString(Transient, 256);
scope_name* HotRecordName = 0;
char Backbuffer[256];
gs_string String = MakeString(Backbuffer, 0, 256);
for (s32 i = 0; i < ThreadScopeCalls->Count; i++) for (s32 i = 0; i < ThreadScopeCalls->Count; i++)
{ {
scope_record* Record = ThreadScopeCalls->Calls + i; scope_record* Record = ThreadScopeCalls->Calls + i;
@ -70,41 +66,55 @@ RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_layout Layout, deb
if (PointIsInRect(ScopeBounds, Interface->Mouse.Pos)) if (PointIsInRect(ScopeBounds, Interface->Mouse.Pos))
{ {
Color = GreenV4; Color = GreenV4;
HotRecord = Record;
HotRecordName = Name; ui_BeginMousePopup(Interface, rect2{ 25, 25, 300, 57 }, LayoutDirection_TopDown, MakeString("Hover"));
{
PrintF(&String, "%S : %d - %d", Name->Name, Record->StartCycles, Record->EndCycles);
ui_Label(Interface, String);
}
ui_EndMousePopup(Interface);
} }
ui_FillRect(Interface, ScopeBounds, Color); ui_FillRect(Interface, ScopeBounds, Color);
ui_OutlineRect(Interface, ScopeBounds, 1, BlackV4); ui_OutlineRect(Interface, ScopeBounds, 1, BlackV4);
} }
} }
if (HotRecord != 0)
{
PrintF(&String, "%S : %d - %d", HotRecordName->Name, HotRecord->StartCycles, HotRecord->EndCycles);
rect2 TextBounds = MakeRect2MinDim(Interface->Mouse.Pos, v2{256, 32});
ui_DrawString(Interface, String, TextBounds);
}
} }
internal void internal void
RenderProfiler_ListVisualization(ui_interface* Interface, ui_layout Layout, debug_frame* VisibleFrame, gs_memory_arena* Memory) RenderProfiler_ListVisualization(ui_interface* Interface, ui_widget* Layout, debug_frame* VisibleFrame, gs_memory_arena* Memory)
{ {
char Backbuffer[256]; char Backbuffer[256];
gs_string String = MakeString(Backbuffer, 0, 256); gs_string String = MakeString(Backbuffer, 0, 256);
r32 ColumnWidths[] = {256, 128, 128, 128, 128}; ui_column_spec ColumnWidths[] = {
ui_StartRow(Interface, 5, &ColumnWidths[0]); { UIColumnSize_Fixed, 256 },
{ UIColumnSize_Fixed, 128 },
{ UIColumnSize_Fixed, 128 },
{ UIColumnSize_Fixed, 128 },
{ UIColumnSize_Fixed, 128 }};
ui_BeginRow(Interface, 5, &ColumnWidths[0]);
{ {
ui_DrawString(Interface, MakeString("Procedure")); ui_Label(Interface, MakeString("Procedure"));
ui_DrawString(Interface, MakeString("% Frame")); ui_Label(Interface, MakeString("% Frame"));
ui_DrawString(Interface, MakeString("Seconds")); ui_Label(Interface, MakeString("Seconds"));
ui_DrawString(Interface, MakeString("Cycles")); ui_Label(Interface, MakeString("Cycles"));
ui_DrawString(Interface, MakeString("Calls")); ui_Label(Interface, MakeString("Calls"));
} }
ui_EndRow(Interface); ui_EndRow(Interface);
s32 CountedScopes = 0;
for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++)
{
scope_name NameEntry = VisibleFrame->ScopeNamesHash[n];
if (NameEntry.Hash != 0)
{
CountedScopes += 1;
}
}
ui_BeginList(Interface, MakeString("Scope List"), 10, CountedScopes);
ui_BeginRow(Interface, 5, &ColumnWidths[0]);
for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++) for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++)
{ {
scope_name NameEntry = VisibleFrame->ScopeNamesHash[n]; scope_name NameEntry = VisibleFrame->ScopeNamesHash[n];
@ -112,26 +122,24 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_layout Layout, debu
{ {
collated_scope_record* CollatedRecord = VisibleFrame->CollatedScopes + n; collated_scope_record* CollatedRecord = VisibleFrame->CollatedScopes + n;
ui_StartRow(Interface, 5, &ColumnWidths[0]);
{
PrintF(&String, "%S", NameEntry.Name); PrintF(&String, "%S", NameEntry.Name);
ui_DrawString(Interface, String); ui_Label(Interface, String);
PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime); PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime);
ui_DrawString(Interface, String); ui_Label(Interface, String);
PrintF(&String, "%fs", CollatedRecord->TotalSeconds); PrintF(&String, "%fs", CollatedRecord->TotalSeconds);
ui_DrawString(Interface, String); ui_Label(Interface, String);
PrintF(&String, "%dcy", CollatedRecord->TotalCycles); PrintF(&String, "%dcy", CollatedRecord->TotalCycles);
ui_DrawString(Interface, String); ui_Label(Interface, String);
PrintF(&String, "%d", CollatedRecord->CallCount); PrintF(&String, "%d", CollatedRecord->CallCount);
ui_DrawString(Interface, String); ui_Label(Interface, String);
}
} }
ui_EndRow(Interface); ui_EndRow(Interface);
} ui_EndList(Interface);
}
} }
GSMetaTag(panel_render); GSMetaTag(panel_render);
@ -179,23 +187,22 @@ ProfilerView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Rend
debug_frame* VisibleFrame = GetLastDebugFrame(GlobalDebugServices); debug_frame* VisibleFrame = GetLastDebugFrame(GlobalDebugServices);
ui_layout Layout = ui_CreateLayout(&State->Interface, ProcListBounds); ui_widget* Layout = ui_PushLayout(&State->Interface, ProcListBounds, LayoutDirection_TopDown, MakeString("Profiler Layout"));
ui_PushLayout(&State->Interface, Layout);
ui_StartRow(&State->Interface, 4); ui_BeginRow(&State->Interface, 4);
{ {
s64 FrameStartCycles = VisibleFrame->FrameStartCycles; s64 FrameStartCycles = VisibleFrame->FrameStartCycles;
s64 FrameTotalCycles = VisibleFrame->FrameEndCycles - VisibleFrame->FrameStartCycles; s64 FrameTotalCycles = VisibleFrame->FrameEndCycles - VisibleFrame->FrameStartCycles;
u32 CurrentDebugFrame = GlobalDebugServices->CurrentDebugFrame - 1; u32 CurrentDebugFrame = GlobalDebugServices->CurrentDebugFrame - 1;
PrintF(&String, "Frame %d", CurrentDebugFrame); PrintF(&String, "Frame %d", CurrentDebugFrame);
ui_DrawString(&State->Interface, String); ui_Label(&State->Interface, String);
PrintF(&String, "Total Cycles: %lld", FrameTotalCycles); PrintF(&String, "Total Cycles: %lld", FrameTotalCycles);
ui_DrawString(&State->Interface, String); ui_Label(&State->Interface, String);
// NOTE(NAME): Skipping a space for aesthetic reasons, not functional, and could // NOTE(NAME): Skipping a space for aesthetic reasons, not functional, and could
// be removed, or used for something else // be removed, or used for something else
ui_ReserveElementBounds(&Layout); ui_ReserveBounds(&State->Interface, Layout, true);
if (ui_Button(&State->Interface, MakeString("Resume Recording"))) if (ui_Button(&State->Interface, MakeString("Resume Recording")))
{ {
@ -204,7 +211,7 @@ ProfilerView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Rend
} }
ui_EndRow(&State->Interface); ui_EndRow(&State->Interface);
ui_StartRow(&State->Interface, 8); ui_BeginRow(&State->Interface, 8);
{ {
if (ui_Button(&State->Interface, MakeString("Scope View"))) if (ui_Button(&State->Interface, MakeString("Scope View")))
{ {

View File

@ -106,10 +106,12 @@ INITIALIZE_APPLICATION(InitializeApplication)
State->Interface.Style.ListBGHover = v4{ .22f, .22f, .22f, 1.f }; State->Interface.Style.ListBGHover = v4{ .22f, .22f, .22f, 1.f };
State->Interface.Style.ListBGSelected = v4{.44f, .44f, .44f, 1.f }; State->Interface.Style.ListBGSelected = v4{.44f, .44f, .44f, 1.f };
State->Interface.Style.Margin = v2{5, 5}; State->Interface.Style.Margin = v2{5, 5};
State->Interface.Style.RowHeight = ui_GetTextLineHeight(State->Interface); State->Interface.Style.RowHeight = ui_GetTextLineHeight(State->Interface) + (2 * State->Interface.Style.Margin.y);
State->Interface.WidgetsCountMax = 4096; State->Interface.WidgetsCountMax = 4096;
State->Interface.Widgets = PushArray(&State->Permanent, ui_widget, State->Interface.WidgetsCountMax); State->Interface.Widgets = PushArray(&State->Permanent, ui_widget, State->Interface.WidgetsCountMax);
State->Interface.PerFrameMemory = PushStruct(&State->Permanent, gs_memory_arena);
*State->Interface.PerFrameMemory = CreateMemoryArena(Context.ThreadContext.Allocator);
State->SACN = SACN_Initialize(Context); State->SACN = SACN_Initialize(Context);
@ -152,7 +154,6 @@ INITIALIZE_APPLICATION(InitializeApplication)
State->AnimationSystem.TimelineShouldAdvance = true; State->AnimationSystem.TimelineShouldAdvance = true;
} // End Animation Playground } // End Animation Playground
PanelSystem_Init(&State->PanelSystem, GlobalPanelDefs, GlobalPanelDefsCount, &State->Permanent); PanelSystem_Init(&State->PanelSystem, GlobalPanelDefs, GlobalPanelDefsCount, &State->Permanent);
PanelSystem_PushPanel(&State->PanelSystem, PanelType_SculptureView, State, Context); PanelSystem_PushPanel(&State->PanelSystem, PanelType_SculptureView, State, Context);
} }

View File

@ -54,6 +54,7 @@ struct debug_frame
s64 FrameEndCycles; s64 FrameEndCycles;
s32 ScopeNamesMax; s32 ScopeNamesMax;
s32 ScopeNamesCount;
scope_name* ScopeNamesHash; scope_name* ScopeNamesHash;
s32 ThreadCount; s32 ThreadCount;
@ -302,6 +303,7 @@ EndDebugFrame (debug_services* Services)
CollateThreadScopeCalls(ClosingFrame->ThreadCalls + t, ClosingFrame); CollateThreadScopeCalls(ClosingFrame->ThreadCalls + t, ClosingFrame);
} }
s32 ScopeNamesCount = 0;
for (s32 n = 0; n < ClosingFrame->ScopeNamesMax; n++) for (s32 n = 0; n < ClosingFrame->ScopeNamesMax; n++)
{ {
if (ClosingFrame->ScopeNamesHash[n].Hash != 0) if (ClosingFrame->ScopeNamesHash[n].Hash != 0)
@ -310,8 +312,10 @@ EndDebugFrame (debug_services* Services)
CollatedRecord->TotalSeconds = (r32)CollatedRecord->TotalCycles / (r32)Services->PerformanceCountFrequency; CollatedRecord->TotalSeconds = (r32)CollatedRecord->TotalCycles / (r32)Services->PerformanceCountFrequency;
CollatedRecord->PercentFrameTime = (r32)CollatedRecord->TotalCycles / (r32)FrameTotalCycles; CollatedRecord->PercentFrameTime = (r32)CollatedRecord->TotalCycles / (r32)FrameTotalCycles;
CollatedRecord->AverageSecondsPerCall = CollatedRecord->TotalSeconds / CollatedRecord->CallCount; CollatedRecord->AverageSecondsPerCall = CollatedRecord->TotalSeconds / CollatedRecord->CallCount;
ScopeNamesCount += 1;
} }
} }
ClosingFrame->ScopeNamesCount = ScopeNamesCount;
Services->CurrentDebugFrame = (Services->CurrentDebugFrame + 1) % DEBUG_FRAME_COUNT; Services->CurrentDebugFrame = (Services->CurrentDebugFrame + 1) % DEBUG_FRAME_COUNT;
StartDebugFrame(&Services->Frames[Services->CurrentDebugFrame], Services); StartDebugFrame(&Services->Frames[Services->CurrentDebugFrame], Services);

View File

@ -589,6 +589,21 @@ PushRenderQuad2D (render_command_buffer* Buffer, v2 Min, v2 Max, v4 Color)
PushQuad2DOnBatch(&Batch, Min, Max, Color); PushQuad2DOnBatch(&Batch, Min, Max, Color);
} }
internal void
PushRenderQuad2D (render_command_buffer* Buffer, rect2 Rect, v4 Color)
{
render_quad_batch_constructor Batch = PushRenderQuad2DBatch(Buffer, 1);
PushQuad2DOnBatch(&Batch, Rect.Min, Rect.Max, Color);
}
internal void
PushRenderQuad2DClipped (render_command_buffer* Buffer, rect2 Rect, rect2 ClippingBox, v4 Color)
{
rect2 Clipped = Rect2Union(Rect, ClippingBox);
render_quad_batch_constructor Batch = PushRenderQuad2DBatch(Buffer, 1);
PushQuad2DOnBatch(&Batch, Clipped.Min, Clipped.Max, Color);
}
internal void internal void
PushRenderQuad2D(render_command_buffer* Buffer, v2 P0, v2 P1, v2 P2, v2 P3, v4 Color) PushRenderQuad2D(render_command_buffer* Buffer, v2 P0, v2 P1, v2 P2, v2 P3, v4 Color)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -187,7 +187,7 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, false, true, AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, false, true,
ShiftDown, AltDown, CtrlDown, false); ShiftDown, AltDown, CtrlDown, false);
Mouse->LeftButtonState = KeyState_IsDown & ~KeyState_WasDown; Mouse->LeftButtonState |= KeyState_IsDown;
Mouse->DownPos = Mouse->Pos; Mouse->DownPos = Mouse->Pos;
// :Win32MouseEventCapture // :Win32MouseEventCapture
@ -237,7 +237,7 @@ HandleWindowMessage (MSG Message, window* Window, input_queue* InputQueue, mouse
AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, true, false, AddInputEventEntry(InputQueue, KeyCode_MouseLeftButton, true, false,
ShiftDown, AltDown, CtrlDown, false); ShiftDown, AltDown, CtrlDown, false);
Mouse->LeftButtonState = ~KeyState_IsDown & KeyState_WasDown; Mouse->LeftButtonState &= ~KeyState_IsDown;
// :Win32MouseEventCapture // :Win32MouseEventCapture
ReleaseCapture(); ReleaseCapture();
@ -413,7 +413,7 @@ Win32_SendAddressedDataBuffers(gs_thread_context Context, addressed_data_buffer_
gs_string OutputStr = AllocatorAllocString(Context.Allocator, 256); gs_string OutputStr = AllocatorAllocString(Context.Allocator, 256);
PrintF(&OutputStr, "Buffers Sent: %d\n", BuffersSent); PrintF(&OutputStr, "Buffers Sent: %d\n", BuffersSent);
NullTerminate(&OutputStr); NullTerminate(&OutputStr);
OutputDebugStringA(OutputStr.Str); //OutputDebugStringA(OutputStr.Str);
} }
internal void internal void
@ -634,7 +634,7 @@ WinMain (
AddressedDataBufferList_Clear(&OutputData); AddressedDataBufferList_Clear(&OutputData);
{ // Mouse Position { // Mouse
POINT MousePos; POINT MousePos;
GetCursorPos (&MousePos); GetCursorPos (&MousePos);
ScreenToClient(MainWindow.Handle, &MousePos); ScreenToClient(MainWindow.Handle, &MousePos);
@ -643,6 +643,15 @@ WinMain (
Context.Mouse.OldPos = Context.Mouse.Pos; Context.Mouse.OldPos = Context.Mouse.Pos;
Context.Mouse.Pos = v2{(r32)MousePos.x, (r32)MainWindow.Height - MousePos.y}; Context.Mouse.Pos = v2{(r32)MousePos.x, (r32)MainWindow.Height - MousePos.y};
Context.Mouse.DeltaPos = Context.Mouse.Pos - Context.Mouse.OldPos; Context.Mouse.DeltaPos = Context.Mouse.Pos - Context.Mouse.OldPos;
if (KeyIsDown(Context.Mouse.LeftButtonState))
{
SetKeyWasDown(Context.Mouse.LeftButtonState);
}
else
{
SetKeyWasUp(Context.Mouse.LeftButtonState);
}
} }
MSG Message; MSG Message;
@ -726,6 +735,10 @@ WinMain (
LastFrameSecondsElapsed = SecondsElapsed; LastFrameSecondsElapsed = SecondsElapsed;
LastFrameEnd = GetWallClock(); LastFrameEnd = GetWallClock();
//OutputDebugStringA("-- Frame END -- \n");
} }
Context.CleanupApplication(Context); Context.CleanupApplication(Context);

View File

@ -46,6 +46,8 @@ Win32CreateThreadContext(gs_memory_arena* Transient = 0)
Win32EnumerateDirectory, Win32EnumerateDirectory,
Result.Transient); Result.Transient);
Result.DebugOutput.Print = Win32DebugPrint;
return Result; return Result;
} }

View File

@ -227,6 +227,11 @@ enum key_state_flags
#define KeyWasDown(event) ((event & KeyState_WasDown) > 0) #define KeyWasDown(event) ((event & KeyState_WasDown) > 0)
#define KeyIsDown(event) ((event & KeyState_IsDown) > 0) #define KeyIsDown(event) ((event & KeyState_IsDown) > 0)
#define SetKeyDown(key) (key |= KeyState_IsDown)
#define SetKeyWasDown(key) (key |= KeyState_WasDown)
#define SetKeyUp(key) (key &= ~KeyState_IsDown)
#define SetKeyWasUp(key) (key &= ~KeyState_WasDown)
struct input_entry struct input_entry
{ {
key_code Key; key_code Key;
@ -266,6 +271,8 @@ struct mouse_state
b32 MiddleButtonState; b32 MiddleButtonState;
b32 RightButtonState; b32 RightButtonState;
cursor_type CursorType; cursor_type CursorType;
}; };

View File

@ -942,6 +942,10 @@ Range2Union(range2 A, range2 B)
Result.Min.y = Max(A.Min.y, B.Min.y); Result.Min.y = Max(A.Min.y, B.Min.y);
Result.Max.x = Min(A.Max.x, B.Max.x); Result.Max.x = Min(A.Max.x, B.Max.x);
Result.Max.y = Min(A.Max.y, B.Max.y); Result.Max.y = Min(A.Max.y, B.Max.y);
if (Rect2Width(Result) < 0) { Result.Min.x = Result.Max.x; }
if (Rect2Height(Result) < 0) { Result.Min.y = Result.Max.y; }
return Result; return Result;
} }
internal range3 internal range3
@ -964,6 +968,41 @@ Rect2GetRectLocalPoint(rect2 Rect, v2 Point)
return Result; return Result;
} }
internal r32
Rect2Area(rect2 Rect)
{
r32 Result = Rect2Width(Rect) * Rect2Height(Rect);
return Result;
}
internal v2
Rect2BottomLeft(rect2 Rect)
{
v2 Result = Rect.Min;
return Result;
}
internal v2
Rect2BottomRight(rect2 Rect)
{
v2 Result = v2{ Rect.Max.x, Rect.Min.y };
return Result;
}
internal v2
Rect2TopRight(rect2 Rect)
{
v2 Result = Rect.Max;
return Result;
}
internal v2
Rect2TopLeft(rect2 Rect)
{
v2 Result = v2{ Rect.Min.x, Rect.Max.y };
return Result;
}
/////////////////////////// ///////////////////////////
// //
// Ray // Ray
@ -1994,31 +2033,31 @@ PrintFArgsList (gs_string* String, char* Format, va_list Args)
if (FormatAt[0] == 'h' && FormatAt[1] == 'h') if (FormatAt[0] == 'h' && FormatAt[1] == 'h')
{ {
LengthSpecified = true; LengthSpecified = true;
LengthSpecified = 1; Length = 1;
FormatAt += 2; FormatAt += 2;
} }
else if (FormatAt[0] == 'h') else if (FormatAt[0] == 'h')
{ {
LengthSpecified = true; LengthSpecified = true;
LengthSpecified = 2; Length = 2;
FormatAt++; FormatAt++;
} }
else if (FormatAt[0] == 'l' && FormatAt[1] == 'l') else if (FormatAt[0] == 'l' && FormatAt[1] == 'l')
{ {
LengthSpecified = true; LengthSpecified = true;
LengthSpecified = 8; Length = 8;
FormatAt += 2; FormatAt += 2;
} }
else if (FormatAt[0] == 'l') else if (FormatAt[0] == 'l')
{ {
LengthSpecified = true; LengthSpecified = true;
LengthSpecified = 4; Length = 4;
FormatAt++; FormatAt++;
} }
else if (FormatAt[0] == 'j') else if (FormatAt[0] == 'j')
{ {
LengthSpecified = true; LengthSpecified = true;
LengthSpecified = 8; Length = 8;
FormatAt++; FormatAt++;
} }
else if (FormatAt[0] == 'z') else if (FormatAt[0] == 'z')
@ -2049,7 +2088,7 @@ PrintFArgsList (gs_string* String, char* Format, va_list Args)
} }
else if (FormatAt[0] == 'u') else if (FormatAt[0] == 'u')
{ {
u32 UnsignedInt = ReadVarArgsUnsignedInteger(Length, &Args); u64 UnsignedInt = ReadVarArgsUnsignedInteger(Length, &Args);
U64ToASCII(&StringRemaining, UnsignedInt, 10, Base10Chars); U64ToASCII(&StringRemaining, UnsignedInt, 10, Base10Chars);
} }
else if (FormatAt[0] == 'o') else if (FormatAt[0] == 'o')
@ -2490,6 +2529,19 @@ PushStringF(gs_memory_arena* Arena, u32 MaxLength, char* Format, ...)
return Result; return Result;
} }
internal gs_string
PushStringCopy(gs_memory_arena* Arena, gs_const_string String)
{
gs_string Result = PushString(Arena, String.Length);
Result.Size = String.Length;
Result.Length = String.Length;
for (u32 i = 0; i < String.Length; i++)
{
Result.Str[i] = String.Str[i];
}
return Result;
}
internal void internal void
ClearArena(gs_memory_arena* Arena) ClearArena(gs_memory_arena* Arena)
{ {
@ -3126,6 +3178,24 @@ TimeHandlerGetSecondsElapsed(gs_time_handler TimeHandler, s64 StartCycles, s64 E
// //
// Hashes // Hashes
internal u32
HashAppendDJB2ToU32(u32 Hash, u8 Byte)
{
u32 Result = Hash;
if (Result == 0) { Result = 5381; }
Result = ((Result << 5) + Result) + Byte;
return Result;
}
internal u64
HashAppendDJB2ToU32(u64 Hash, u8 Byte)
{
u64 Result = Hash;
if (Result == 0) { Result = 5381; }
Result = ((Result << 5) + Result) + Byte;
return Result;
}
internal u32 internal u32
HashDJB2ToU32(char* String) HashDJB2ToU32(char* String)
{ {

View File

@ -43,7 +43,6 @@ STREAM #1: 3D Overhaul
- :ErrorLogging - :ErrorLogging
- Animation System - Animation System
- blending between animation
- layers - layers
- layer masks by sculpture - layer masks by sculpture
- layer masks by tag / value - layer masks by tag / value

View File

@ -1,3 +1,5 @@
x blending between animation
x saving animation timelines x saving animation timelines
x Buckets & Lists x Buckets & Lists
x On second thought, I just really don't like these. Lets get rid of them, and put custom structures in place x On second thought, I just really don't like these. Lets get rid of them, and put custom structures in place