added documentation to all files
This commit is contained in:
parent
2ab7ff1194
commit
0164fea691
|
@ -1,9 +1,16 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_animation.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
// TODO
|
// TODO
|
||||||
// [] - animation blending
|
// [] - animation blending
|
||||||
// [] - delete a layer
|
// [] - delete a layer
|
||||||
// [] - will need a way to create an empty layer
|
// [] - will need a way to create an empty layer
|
||||||
// [] - get a list of all animation procs
|
// [] - get a list of all animation procs
|
||||||
|
|
||||||
|
#ifndef FOLDHAUS_ANIMATION
|
||||||
|
|
||||||
#define ANIMATION_PROC(name) void name(assembly* Assembly, r32 Time)
|
#define ANIMATION_PROC(name) void name(assembly* Assembly, r32 Time)
|
||||||
typedef ANIMATION_PROC(animation_proc);
|
typedef ANIMATION_PROC(animation_proc);
|
||||||
|
|
||||||
|
@ -33,3 +40,6 @@ struct animation_system
|
||||||
r32 AnimationStart;
|
r32 AnimationStart;
|
||||||
r32 AnimationEnd;
|
r32 AnimationEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FOLDHAUS_ANIMATION
|
||||||
|
#endif // FOLDHAUS_ANIMATION
|
||||||
|
|
|
@ -1 +1,10 @@
|
||||||
/* For future artnet implementation */
|
//
|
||||||
|
// File: artnet.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
/* For future artnet implementation */
|
||||||
|
#ifndef ARTNET_H
|
||||||
|
|
||||||
|
#define ARTNET_H
|
||||||
|
#endif // ARTNET_H
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: assembly_parser.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef ASSEMBLY_PARSER_CPP
|
||||||
|
|
||||||
|
|
||||||
internal assembly_token
|
internal assembly_token
|
||||||
ParseToken (tokenizer* Tokenizer)
|
ParseToken (tokenizer* Tokenizer)
|
||||||
|
@ -221,4 +228,7 @@ ParseAssemblyFile (u8* FileBase, s32 FileSize, memory_arena* Arena)
|
||||||
ParseAssemblyFileBody(&AssemblyDefinition, &AssemblyFileTokenizer);
|
ParseAssemblyFileBody(&AssemblyDefinition, &AssemblyFileTokenizer);
|
||||||
|
|
||||||
return AssemblyDefinition;
|
return AssemblyDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ASSEMBLY_PARSER_CPP
|
||||||
|
#endif // ASSEMBLY_PARSER_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: assembly_parser.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef ASSEMBLY_PARSER_H
|
||||||
|
|
||||||
#define LED_STRIP_COUNT_IDENTIFIER "led_strip_count"
|
#define LED_STRIP_COUNT_IDENTIFIER "led_strip_count"
|
||||||
|
|
||||||
#define LED_STRIP_IDENTIFIER "led_strip"
|
#define LED_STRIP_IDENTIFIER "led_strip"
|
||||||
|
@ -58,4 +65,7 @@ struct assembly_definition
|
||||||
s32 LEDStripCount;
|
s32 LEDStripCount;
|
||||||
s32 TotalLEDCount;
|
s32 TotalLEDCount;
|
||||||
led_strip_definition* LEDStrips;
|
led_strip_definition* LEDStrips;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ASSEMBLY_PARSER_H
|
||||||
|
#endif // ASSEMBLY_PARSER_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: DMX_H
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef DMX_H
|
||||||
|
|
||||||
struct dmx_buffer
|
struct dmx_buffer
|
||||||
{
|
{
|
||||||
s32 Universe;
|
s32 Universe;
|
||||||
|
@ -44,4 +51,7 @@ DMXBufferListAppend (dmx_buffer_list* AppendTo, dmx_buffer_list* Append)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DMX_H
|
||||||
|
#endif // DMX_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_app.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_APP_CPP
|
||||||
|
|
||||||
#include "foldhaus_platform.h"
|
#include "foldhaus_platform.h"
|
||||||
#include "foldhaus_app.h"
|
#include "foldhaus_app.h"
|
||||||
|
|
||||||
|
@ -421,4 +428,7 @@ CLEANUP_APPLICATION(CleanupApplication)
|
||||||
{
|
{
|
||||||
app_state* State = (app_state*)Context.MemoryBase;
|
app_state* State = (app_state*)Context.MemoryBase;
|
||||||
SACNCleanup(&State->SACN, Context);
|
SACNCleanup(&State->SACN, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_APP_CPP
|
||||||
|
#endif // FOLDHAUS_APP_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_app.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_APP_H
|
||||||
|
|
||||||
#include "../meta/gs_meta_lexer.h"
|
#include "../meta/gs_meta_lexer.h"
|
||||||
|
|
||||||
#include "gs_font.h"
|
#include "gs_font.h"
|
||||||
|
@ -231,3 +238,7 @@ typedef PANEL_RENDER_PROC(panel_render_proc);
|
||||||
#include "generated/foldhaus_panels_generated.h"
|
#include "generated/foldhaus_panels_generated.h"
|
||||||
|
|
||||||
#include "foldhaus_interface.cpp"
|
#include "foldhaus_interface.cpp"
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_APP_H
|
||||||
|
#endif // FOLDHAUS_APP_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_assembly.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_ASSEMBLY_CPP
|
||||||
|
|
||||||
internal s32
|
internal s32
|
||||||
GetAssemblyMemorySizeFromDefinition(assembly_definition Definition, string Name)
|
GetAssemblyMemorySizeFromDefinition(assembly_definition Definition, string Name)
|
||||||
{
|
{
|
||||||
|
@ -115,3 +122,7 @@ UnloadAssembly (u32 AssemblyIndex, app_state* State, context Context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_ASSEMBLY_CPP
|
||||||
|
#endif // FOLDHAUS_ASSEMBLY_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_assembly.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_ASSEMBLY_H
|
||||||
|
|
||||||
struct led
|
struct led
|
||||||
{
|
{
|
||||||
s32 Index;
|
s32 Index;
|
||||||
|
@ -36,3 +43,7 @@ struct assembly
|
||||||
s32 LEDUniverseMapCount;
|
s32 LEDUniverseMapCount;
|
||||||
leds_in_universe_range* LEDUniverseMap;
|
leds_in_universe_range* LEDUniverseMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_ASSEMBLY_H
|
||||||
|
#endif // FOLDHAUS_ASSEMBLY_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_command_dispatch.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_COMMAND_DISPATCH_H
|
||||||
|
|
||||||
#define FOLDHAUS_INPUT_COMMAND_PROC(name) void name(app_state* State, input_entry Event, mouse_state Mouse)
|
#define FOLDHAUS_INPUT_COMMAND_PROC(name) void name(app_state* State, input_entry Event, mouse_state Mouse)
|
||||||
typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc);
|
typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc);
|
||||||
|
|
||||||
|
@ -193,4 +200,7 @@ RegisterKeyPressCommand (input_command_registry* CommandRegistry,
|
||||||
Command->Flags = Flags;
|
Command->Flags = Flags;
|
||||||
Command->Mdfr = Mdfr;
|
Command->Mdfr = Mdfr;
|
||||||
Command->Proc = Proc;
|
Command->Proc = Proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_COMMAND_DISPATCH_H
|
||||||
|
#endif // FOLDHAUS_COMMAND_DISPATCH_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_debug.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_DEBUG_H
|
||||||
|
|
||||||
#define SCOPE_NAME_LENGTH 256
|
#define SCOPE_NAME_LENGTH 256
|
||||||
struct scope_record
|
struct scope_record
|
||||||
{
|
{
|
||||||
|
@ -427,3 +434,7 @@ struct scope_tracker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_DEBUG_H
|
||||||
|
#endif // FOLDHAUS_DEBUG_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_debug_visuals.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_DEBUG_VISUALS_H
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
DrawDebugInterface (render_command_buffer* RenderBuffer, r32 StartX, interface_config Interface, r32 WindowWidth, r32 WindowHeight, r32 DeltaTime, app_state* State, camera Camera, mouse_state Mouse, memory_arena* Transient)
|
DrawDebugInterface (render_command_buffer* RenderBuffer, r32 StartX, interface_config Interface, r32 WindowWidth, r32 WindowHeight, r32 DeltaTime, app_state* State, camera Camera, mouse_state Mouse, memory_arena* Transient)
|
||||||
{
|
{
|
||||||
|
@ -113,3 +120,7 @@ DrawDebugInterface (render_command_buffer* RenderBuffer, r32 StartX, interface_c
|
||||||
TopOfScreenLinePos.y -= NewLineYOffset(*Interface.Font);
|
TopOfScreenLinePos.y -= NewLineYOffset(*Interface.Font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_DEBUG_VISUALS_H
|
||||||
|
#endif // FOLDHAUS_DEBUG_VISUALS_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_default_nodes.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_DEFAULT_NODES_H
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
//
|
//
|
||||||
// Values
|
// Values
|
||||||
|
@ -135,3 +142,7 @@ NODE_PROC(MultiplyPatterns, multiply_patterns_data)
|
||||||
LED++;
|
LED++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_DEFAULT_NODES_H
|
||||||
|
#endif // FOLDHAUS_DEFAULT_NODES_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_interface.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_INTERFACE_CPP
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Universe View
|
// Universe View
|
||||||
|
@ -603,3 +610,7 @@ DrawAllPanels(panel_layout PanelLayout, render_command_buffer* RenderBuffer, mou
|
||||||
DrawPanelBorder(*Panel, PanelBounds.Min, PanelBounds.Max, BorderColor, Mouse, RenderBuffer);
|
DrawPanelBorder(*Panel, PanelBounds.Min, PanelBounds.Max, BorderColor, Mouse, RenderBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_INTERFACE_CPP
|
||||||
|
#endif // FOLDHAUS_INTERFACE_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_memory.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_MEMORY_H
|
||||||
|
|
||||||
#ifndef GS_MEMORY_H
|
#ifndef GS_MEMORY_H
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -266,4 +273,7 @@ PushSize_ (static_memory_arena* Arena, u32 Size)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GS_MEMORY_H
|
#define GS_MEMORY_H
|
||||||
#endif // GS_MEMORY_H
|
#endif // GS_MEMORY_H
|
||||||
|
|
||||||
|
#define FOLDHAUS_MEMORY_H
|
||||||
|
#endif // FOLDHAUS_MEMORY_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_network_ordering.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_NETWORK_ORDERING_H
|
||||||
|
|
||||||
// Packs a u8 to a known big endian buffer
|
// Packs a u8 to a known big endian buffer
|
||||||
inline u8*
|
inline u8*
|
||||||
PackB1(u8* ptr, u8 val)
|
PackB1(u8* ptr, u8 val)
|
||||||
|
@ -131,3 +138,7 @@ UpackL8(const u8* ptr)
|
||||||
{
|
{
|
||||||
return *((u64*)ptr);
|
return *((u64*)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_NETWORK_ORDERING_H
|
||||||
|
#endif // FOLDHAUS_NETWORK_ORDERING_H
|
|
@ -1,6 +1,175 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_node.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_NODE_CPP
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
PushNodeOnWorkspace(s32 NodeSpecificationIndex, pattern_node_workspace* Workspace)
|
ClearNodeWorkspaceStorage(pattern_node_workspace* Workspace)
|
||||||
|
{
|
||||||
|
ClearArena(&Workspace->Storage);
|
||||||
|
Workspace->SparseToSortedNodeMap = 0;
|
||||||
|
Workspace->SortedNodeHandles = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct adjacency_list
|
||||||
|
{
|
||||||
|
// TODO(Peter): Can make these as buffers, not single digits later
|
||||||
|
gs_list_handle NodeHandle;
|
||||||
|
adjacency_list* Next;
|
||||||
|
};
|
||||||
|
|
||||||
|
internal u32
|
||||||
|
SortNodeNeighbors(u32 ContiguousNodeIndex, gs_list_handle NodeHandle, adjacency_list** NeighborsLists, b8* NodesVisited, gs_list_handle* SortedNodeHandles, u32 SortedNodesCount, s32* SparseToContiguousNodeMap)
|
||||||
|
{
|
||||||
|
NodesVisited[ContiguousNodeIndex] = true;
|
||||||
|
|
||||||
|
adjacency_list* Neighbor = NeighborsLists[ContiguousNodeIndex];
|
||||||
|
while (Neighbor)
|
||||||
|
{
|
||||||
|
u32 ContiguousNeighborNodeIndex = SparseToContiguousNodeMap[Neighbor->NodeHandle.Index];
|
||||||
|
if (!NodesVisited[ContiguousNeighborNodeIndex])
|
||||||
|
{
|
||||||
|
SortedNodesCount = SortNodeNeighbors(ContiguousNeighborNodeIndex, Neighbor->NodeHandle, NeighborsLists, NodesVisited, SortedNodeHandles, SortedNodesCount, SparseToContiguousNodeMap);
|
||||||
|
}
|
||||||
|
Neighbor = Neighbor->Next;
|
||||||
|
}
|
||||||
|
|
||||||
|
SortedNodeHandles[SortedNodesCount++] = NodeHandle;
|
||||||
|
return SortedNodesCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal s32*
|
||||||
|
CreateSparseToContiguousMap (pattern_node_workspace Workspace, memory_arena* Scratch)
|
||||||
|
{
|
||||||
|
s32* Result = PushArray(Scratch, s32, Workspace.Nodes.OnePastLastUsed);
|
||||||
|
s32 ContiguousIndex = 0;
|
||||||
|
for (u32 SparseNodeIndex = 0; SparseNodeIndex < Workspace.Nodes.OnePastLastUsed; SparseNodeIndex++)
|
||||||
|
{
|
||||||
|
gs_list_entry<pattern_node>* Entry = Workspace.Nodes.GetEntryAtIndex(SparseNodeIndex);
|
||||||
|
if (!EntryIsFree(Entry))
|
||||||
|
{
|
||||||
|
Result[SparseNodeIndex] = ContiguousIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
UpdateSortedNodes(pattern_node_workspace* Workspace, memory_arena* Scratch)
|
||||||
|
{
|
||||||
|
ClearNodeWorkspaceStorage(Workspace);
|
||||||
|
|
||||||
|
u32 NodeCount = Workspace->Nodes.Used;
|
||||||
|
u32 SparseNodeCount = Workspace->Nodes.OnePastLastUsed;
|
||||||
|
|
||||||
|
s32* SparseToContiguousNodeMap = CreateSparseToContiguousMap(*Workspace, &Workspace->Storage);
|
||||||
|
|
||||||
|
// NOTE(Peter): We need to sort this later on so I'm just storing list lengths in this format
|
||||||
|
// to begin with.
|
||||||
|
// NeighborsListLengths[n].Radix = the number of neighbors for the node
|
||||||
|
// NeighborsListLengths[n].ID = the sparse array index of the node
|
||||||
|
gs_radix_entry* NeighborsListLengths = PushArray(Scratch, gs_radix_entry, NodeCount);
|
||||||
|
adjacency_list** NeighborsLists = PushArray(Scratch, adjacency_list*, NodeCount);
|
||||||
|
GSZeroArray(NeighborsLists, adjacency_list*, SparseNodeCount);
|
||||||
|
|
||||||
|
// Fill Radix
|
||||||
|
for (u32 n = 0; n < SparseNodeCount; n++)
|
||||||
|
{
|
||||||
|
s32 ContiguousIndex = SparseToContiguousNodeMap[n];
|
||||||
|
if (ContiguousIndex >= 0)
|
||||||
|
{
|
||||||
|
NeighborsListLengths[ContiguousIndex].Radix = 0;
|
||||||
|
NeighborsListLengths[ContiguousIndex].ID = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct Adjaceny List
|
||||||
|
for (u32 c = 0; c < Workspace->Connections.Used; c++)
|
||||||
|
{
|
||||||
|
pattern_node_connection Connection = *Workspace->Connections.GetElementAtIndex(c);
|
||||||
|
|
||||||
|
adjacency_list* ListAddition = PushStruct(Scratch, adjacency_list);
|
||||||
|
ListAddition->NodeHandle = Connection.DownstreamNodeHandle;
|
||||||
|
|
||||||
|
s32 ContiguousNodeIndex = SparseToContiguousNodeMap[Connection.UpstreamNodeHandle.Index];
|
||||||
|
ListAddition->Next = NeighborsLists[ContiguousNodeIndex];
|
||||||
|
NeighborsLists[ContiguousNodeIndex] = ListAddition;
|
||||||
|
|
||||||
|
// Increment the number of neighbors - stored in Radix
|
||||||
|
NeighborsListLengths[ContiguousNodeIndex].Radix++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort by number of neighbors
|
||||||
|
RadixSortInPlace(NeighborsListLengths, Workspace->Nodes.Used);
|
||||||
|
|
||||||
|
char* OutputCharArray = PushArray(Scratch, char, 1024);
|
||||||
|
string OutputString = MakeString(OutputCharArray, 0, 1024);
|
||||||
|
|
||||||
|
PrintF(&OutputString, "Neighbors Lists: \n");
|
||||||
|
for (u32 d = 0; d < Workspace->Nodes.Used; d++)
|
||||||
|
{
|
||||||
|
PrintF(&OutputString, " %d: Node [ %d ] : neighbors { ", d, NeighborsListLengths[d].ID);
|
||||||
|
|
||||||
|
adjacency_list* Neighbors = NeighborsLists[d];
|
||||||
|
while (Neighbors)
|
||||||
|
{
|
||||||
|
PrintF(&OutputString, "%d, ", Neighbors->NodeHandle.Index);
|
||||||
|
Neighbors = Neighbors->Next;
|
||||||
|
}
|
||||||
|
PrintF(&OutputString, " }\n");
|
||||||
|
}
|
||||||
|
NullTerminate(&OutputString);
|
||||||
|
|
||||||
|
OutputDebugStringA(OutputCharArray);
|
||||||
|
// This is a contiguous array.
|
||||||
|
b8* NodesVisited = PushArray(Scratch, b8, NodeCount);
|
||||||
|
GSZeroArray(NodesVisited, b8, NodeCount);
|
||||||
|
|
||||||
|
Workspace->SortedNodeHandles = PushArray(&Workspace->Storage, gs_list_handle, NodeCount);
|
||||||
|
u32 SortedSparseNodeIndeciesUsed = 0;
|
||||||
|
|
||||||
|
for (u32 n = 0; n < Workspace->Nodes.Used; n++)
|
||||||
|
{
|
||||||
|
gs_radix_entry SortedNeighborsCount = NeighborsListLengths[n];
|
||||||
|
u32 NeighborCount = SortedNeighborsCount.Radix;
|
||||||
|
u32 NodeIndex = SortedNeighborsCount.ID;
|
||||||
|
gs_list_handle NodeHandle = Workspace->Nodes.GetEntryAtIndex(NodeIndex)->Handle;
|
||||||
|
u32 ContiguousNodeIndex = SparseToContiguousNodeMap[NodeIndex];
|
||||||
|
|
||||||
|
SortedSparseNodeIndeciesUsed = SortNodeNeighbors(ContiguousNodeIndex, NodeHandle, NeighborsLists, NodesVisited, Workspace->SortedNodeHandles, SortedSparseNodeIndeciesUsed, SparseToContiguousNodeMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
Workspace->SparseToSortedNodeMap = SparseToContiguousNodeMap;
|
||||||
|
for (u32 SortedIndex = 0; SortedIndex < NodeCount; SortedIndex++)
|
||||||
|
{
|
||||||
|
gs_list_handle SortedHandle = Workspace->SortedNodeHandles[SortedIndex];
|
||||||
|
Workspace->SparseToSortedNodeMap[SortedHandle.Index] = SortedIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
PushNodeOnWorkspace(s32 NodeSpecificationIndex, pattern_node_workspace* Workspace, memory_arena* Scratch)
|
||||||
{
|
{
|
||||||
pattern_node* NewNode = Workspace->Nodes.TakeElement();
|
pattern_node* NewNode = Workspace->Nodes.TakeElement();
|
||||||
NewNode->SpecificationIndex = NodeSpecificationIndex;
|
NewNode->SpecificationIndex = NodeSpecificationIndex;
|
||||||
|
|
||||||
|
UpdateSortedNodes(Workspace, Scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
PushNodeConnectionOnWorkspace(gs_list_handle UpstreamNodeHandle, u32 UpstreamPortIndex, gs_list_handle DownstreamNodeHandle, u32 DownstreamPortIndex, pattern_node_workspace* Workspace, memory_arena* Scratch)
|
||||||
|
{
|
||||||
|
pattern_node_connection Connection = {};
|
||||||
|
Connection.UpstreamNodeHandle = UpstreamNodeHandle;
|
||||||
|
Connection.DownstreamNodeHandle = DownstreamNodeHandle;
|
||||||
|
Connection.UpstreamPortIndex = UpstreamPortIndex;
|
||||||
|
Connection.DownstreamPortIndex = DownstreamPortIndex;
|
||||||
|
|
||||||
|
Workspace->Connections.PushElementOnBucket(Connection);
|
||||||
|
UpdateSortedNodes(Workspace, Scratch);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_NODE_CPP
|
||||||
|
#endif // FOLDHAUS_NODE_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_node.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_NODE_H
|
||||||
|
|
||||||
typedef enum node_type node_type;
|
typedef enum node_type node_type;
|
||||||
|
|
||||||
#define IsInputMember 1 << 0
|
#define IsInputMember 1 << 0
|
||||||
|
@ -75,6 +82,13 @@ struct pattern_node_workspace
|
||||||
{
|
{
|
||||||
gs_list<pattern_node> Nodes;
|
gs_list<pattern_node> Nodes;
|
||||||
gs_bucket<pattern_node_connection> Connections;
|
gs_bucket<pattern_node_connection> Connections;
|
||||||
|
|
||||||
|
// This is storage for all the structures which follow.
|
||||||
|
// It is cleared when new nodes are added so that the
|
||||||
|
// acceleration structures can be recalculated
|
||||||
|
memory_arena Storage;
|
||||||
|
s32* SparseToSortedNodeMap;
|
||||||
|
gs_list_handle* SortedNodeHandles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,4 +121,7 @@ NODE_STRUCT(output_node_data)
|
||||||
NODE_PROC(OutputNode, output_node_data)
|
NODE_PROC(OutputNode, output_node_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_NODE_H
|
||||||
|
#endif // FOLDHAUS_NODE_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_node_gui.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_NODE_GUI_H
|
||||||
|
|
||||||
struct gui_node
|
struct gui_node
|
||||||
{
|
{
|
||||||
s32 Handle;
|
s32 Handle;
|
||||||
|
@ -11,3 +18,7 @@ struct gui_node_list
|
||||||
s32 NodesUsed;
|
s32 NodesUsed;
|
||||||
gui_node Nodes[GUI_NODES_MAX];
|
gui_node Nodes[GUI_NODES_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_NODE_GUI_H
|
||||||
|
#endif // FOLDHAUS_NODE_GUI_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_operation_mode.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_OPERATION_MODE_H
|
||||||
|
|
||||||
typedef struct operation_mode operation_mode;
|
typedef struct operation_mode operation_mode;
|
||||||
|
|
||||||
#define OPERATION_STATE_DEF(name) struct name
|
#define OPERATION_STATE_DEF(name) struct name
|
||||||
|
@ -81,3 +88,7 @@ CreateOperationState_ (operation_mode* Mode, operation_mode_system* System, s32
|
||||||
Mode->OpStateMemory = PushSize(&System->Arena, StateSize);
|
Mode->OpStateMemory = PushSize(&System->Arena, StateSize);
|
||||||
return Mode->OpStateMemory;
|
return Mode->OpStateMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_OPERATION_MODE_H
|
||||||
|
#endif // FOLDHAUS_OPERATION_MODE_H
|
|
@ -1,14 +1,13 @@
|
||||||
/*
|
//
|
||||||
File: foldhaus_panel.cpp
|
// File: foldhaus_panel.h
|
||||||
Description: a system for laying out panels on a screen
|
// Author: Peter Slattery
|
||||||
Author: Peter Slattery
|
// Creation Date: 2019-12-26
|
||||||
Creation Date: 2019-12-26
|
//
|
||||||
|
// Usage:
|
||||||
Usage:
|
// Include this file in ONE file in your project.
|
||||||
Include this file in ONE file in your project.
|
// Define SetPanelDefinitionExternal
|
||||||
Define SetPanelDefinitionExternal
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_H
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct panel panel;
|
typedef struct panel panel;
|
||||||
|
|
||||||
|
@ -351,3 +350,7 @@ GetPanelContainingPoint(v2 Point, panel_system* PanelSystem, rect WindowBounds)
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_H
|
||||||
|
#endif // FOLDHAUS_PANEL_H
|
|
@ -1,9 +1,18 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_platform.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PLATFORM_H
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define GS_LANGUAGE_NO_PROFILER_DEFINES
|
#define GS_LANGUAGE_NO_PROFILER_DEFINES
|
||||||
#include <gs_language.h>
|
#include <gs_language.h>
|
||||||
#include "gs_platform.h"
|
#include "gs_platform.h"
|
||||||
|
|
||||||
|
#include <gs_radix_sort.h>
|
||||||
#include <gs_list.h>
|
#include <gs_list.h>
|
||||||
#include <gs_bucket.h>
|
#include <gs_bucket.h>
|
||||||
|
|
||||||
|
@ -151,3 +160,7 @@ struct context
|
||||||
platform_send_to* PlatformSendTo;
|
platform_send_to* PlatformSendTo;
|
||||||
platform_close_socket* PlatformCloseSocket;
|
platform_close_socket* PlatformCloseSocket;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_PLATFORM_H
|
||||||
|
#endif // FOLDHAUS_PLATFORM_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_renderer.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_RENDERER_CPP
|
||||||
|
|
||||||
internal render_command_buffer
|
internal render_command_buffer
|
||||||
AllocateRenderCommandBuffer (u8* Memory, s32 Size, renderer_realloc* Realloc)
|
AllocateRenderCommandBuffer (u8* Memory, s32 Size, renderer_realloc* Realloc)
|
||||||
{
|
{
|
||||||
|
@ -177,4 +184,7 @@ internal void
|
||||||
ClearRenderBuffer (render_command_buffer* Buffer)
|
ClearRenderBuffer (render_command_buffer* Buffer)
|
||||||
{
|
{
|
||||||
Buffer->CommandMemoryUsed = 0;
|
Buffer->CommandMemoryUsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_RENDERER_CPP
|
||||||
|
#endif // FOLDHAUS_RENDERER_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_renderer.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_RENDERER_H
|
||||||
|
|
||||||
#define IMMEDIATE_MODE_RENDERING 0
|
#define IMMEDIATE_MODE_RENDERING 0
|
||||||
|
|
||||||
struct camera
|
struct camera
|
||||||
|
@ -24,17 +31,17 @@ GetCameraModelViewMatrix (camera Camera)
|
||||||
r32 Z = Camera.Position.z;
|
r32 Z = Camera.Position.z;
|
||||||
|
|
||||||
m44 RotationMatrix = M44(
|
m44 RotationMatrix = M44(
|
||||||
CamRight.x, CamUp.x, CamForward.x, 0,
|
CamRight.x, CamUp.x, CamForward.x, 0,
|
||||||
CamRight.y, CamUp.y, CamForward.y, 0,
|
CamRight.y, CamUp.y, CamForward.y, 0,
|
||||||
CamRight.z, CamUp.z, CamForward.z, 0,
|
CamRight.z, CamUp.z, CamForward.z, 0,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
|
||||||
m44 PositionMatrix = M44(
|
m44 PositionMatrix = M44(
|
||||||
1, 0, 0, 0,
|
1, 0, 0, 0,
|
||||||
0, 1, 0, 0,
|
0, 1, 0, 0,
|
||||||
0, 0, 1, 0,
|
0, 0, 1, 0,
|
||||||
-X, -Y, -Z, 1
|
-X, -Y, -Z, 1
|
||||||
);
|
);
|
||||||
|
|
||||||
m44 ModelViewMatrix = PositionMatrix * RotationMatrix;
|
m44 ModelViewMatrix = PositionMatrix * RotationMatrix;
|
||||||
|
|
||||||
|
@ -654,3 +661,7 @@ PushRenderBoundingBox2D (render_command_buffer* Buffer, v2 Min, v2 Max, r32 Thic
|
||||||
PushQuad2DOnBatch(&Batch, v2{Max.x - Thickness, Min.y}, Max, Color);
|
PushQuad2DOnBatch(&Batch, v2{Max.x - Thickness, Min.y}, Max, Color);
|
||||||
PushQuad2DOnBatch(&Batch, Min, v2{Max.x, Min.y + Thickness}, Color);
|
PushQuad2DOnBatch(&Batch, Min, v2{Max.x, Min.y + Thickness}, Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_RENDERER_H
|
||||||
|
#endif // FOLDHAUS_RENDERER_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_sacn_view.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_SACN_VIEW_CPP
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw,
|
DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw,
|
||||||
v2 TopLeft, v2 Dimension)
|
v2 TopLeft, v2 Dimension)
|
||||||
|
@ -30,4 +37,7 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr
|
||||||
|
|
||||||
++PixelsDrawn;
|
++PixelsDrawn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_SACN_VIEW_CPP
|
||||||
|
#endif // FOLDHAUS_SACN_VIEW_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_search_lister.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_SEARCH_LISTER_CPP
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
NamePassesFilter (string Target, string Filter)
|
NamePassesFilter (string Target, string Filter)
|
||||||
{
|
{
|
||||||
|
@ -42,3 +49,7 @@ GetPrevFilteredItem (search_lister SearchLister)
|
||||||
s32 Result = GSMax(SearchLister.HotItem - 1, 0);
|
s32 Result = GSMax(SearchLister.HotItem - 1, 0);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_SEARCH_LISTER_CPP
|
||||||
|
#endif // FOLDHAUS_SEARCH_LISTER_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_search_lister.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_SEARCH_LISTER_H
|
||||||
|
|
||||||
struct search_lister
|
struct search_lister
|
||||||
{
|
{
|
||||||
// TODO(Peter): Giving up trying to just use the source list for now. At the moment
|
// TODO(Peter): Giving up trying to just use the source list for now. At the moment
|
||||||
|
@ -18,3 +25,7 @@ struct search_lister
|
||||||
|
|
||||||
string Filter;
|
string Filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_SEARCH_LISTER_H
|
||||||
|
#endif // FOLDHAUS_SEARCH_LISTER_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_text_entry.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_TEXT_ENTRY_CPP
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
ResetTextInput (text_entry* Input)
|
ResetTextInput (text_entry* Input)
|
||||||
{
|
{
|
||||||
|
@ -226,3 +233,7 @@ InitializeTextInputCommands (input_command_registry* Commands, memory_arena* Per
|
||||||
{ KeyCode_GreaterThan, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
{ KeyCode_GreaterThan, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
{ KeyCode_Tilde, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
{ KeyCode_Tilde, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
{ KeyCode_BackQuote, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }
|
{ KeyCode_BackQuote, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_TEXT_ENTRY_CPP
|
||||||
|
#endif // FOLDHAUS_TEXT_ENTRY_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_text_entry.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_TEXT_ENTRY_H
|
||||||
|
|
||||||
enum text_translation_type
|
enum text_translation_type
|
||||||
{
|
{
|
||||||
TextTranslateTo_String,
|
TextTranslateTo_String,
|
||||||
|
@ -23,4 +30,7 @@ struct text_entry
|
||||||
s32 CursorPosition;
|
s32 CursorPosition;
|
||||||
|
|
||||||
text_entry_destination Destination;
|
text_entry_destination Destination;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FOLDHAUS_TEXT_ENTRY_H
|
||||||
|
#endif // FOLDHAUS_TEXT_ENTRY_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_util_radialumia_file_converter.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#define DEBUG_TRACK_SCOPE(name)
|
#define DEBUG_TRACK_SCOPE(name)
|
||||||
|
|
||||||
|
@ -364,4 +371,7 @@ int main(int ArgCount, char* Args[])
|
||||||
fclose(OutputFile);
|
fclose(OutputFile);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP
|
||||||
|
#endif // FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP
|
374
src/gs_array.h
374
src/gs_array.h
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: gs_array.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_ARRAY_H
|
||||||
|
|
||||||
struct free_list
|
struct free_list
|
||||||
{
|
{
|
||||||
free_list* Next;
|
free_list* Next;
|
||||||
|
@ -31,12 +38,12 @@ struct array_entry_handle
|
||||||
|
|
||||||
#define TYPEDEF_ARRAY(element_type) \
|
#define TYPEDEF_ARRAY(element_type) \
|
||||||
struct element_type##_array_entry { \
|
struct element_type##_array_entry { \
|
||||||
s32 Generation; \
|
s32 Generation; \
|
||||||
union \
|
union \
|
||||||
{ \
|
{ \
|
||||||
element_type Entry; \
|
element_type Entry; \
|
||||||
free_list Free; \
|
free_list Free; \
|
||||||
}; \
|
}; \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
struct element_type##_array \
|
struct element_type##_array \
|
||||||
|
@ -50,180 +57,183 @@ struct element_type##_array \
|
||||||
\
|
\
|
||||||
internal void \
|
internal void \
|
||||||
GrowBuffer(element_type##_array* Buffer) \
|
GrowBuffer(element_type##_array* Buffer) \
|
||||||
{ \
|
{ \
|
||||||
s32 NewBucketSize = sizeof(element_type##_array_entry) * Buffer->BucketSize; \
|
s32 NewBucketSize = sizeof(element_type##_array_entry) * Buffer->BucketSize; \
|
||||||
element_type##_array_entry* NewBucket = (element_type##_array_entry*)malloc(NewBucketSize); \
|
element_type##_array_entry* NewBucket = (element_type##_array_entry*)malloc(NewBucketSize); \
|
||||||
GSZeroMemory((u8*)NewBucket, NewBucketSize); \
|
GSZeroMemory((u8*)NewBucket, NewBucketSize); \
|
||||||
\
|
\
|
||||||
s32 NewBucketIndex = Buffer->BucketCount++; \
|
s32 NewBucketIndex = Buffer->BucketCount++; \
|
||||||
if (!Buffer->Buckets) \
|
if (!Buffer->Buckets) \
|
||||||
{ \
|
{ \
|
||||||
Buffer->Buckets = (element_type##_array_entry**)malloc(sizeof(element_type##_array_entry*)); \
|
Buffer->Buckets = (element_type##_array_entry**)malloc(sizeof(element_type##_array_entry*)); \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
Buffer->Buckets = (element_type##_array_entry**)realloc(Buffer->Buckets, sizeof(element_type##_array_entry*) * Buffer->BucketCount); \
|
Buffer->Buckets = (element_type##_array_entry**)realloc(Buffer->Buckets, sizeof(element_type##_array_entry*) * Buffer->BucketCount); \
|
||||||
} \
|
} \
|
||||||
Buffer->Buckets[NewBucketIndex] = NewBucket; \
|
Buffer->Buckets[NewBucketIndex] = NewBucket; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal element_type##_array_entry* \
|
internal element_type##_array_entry* \
|
||||||
GetEntryAtIndex (s32 Index, element_type##_array Buffer) \
|
GetEntryAtIndex (s32 Index, element_type##_array Buffer) \
|
||||||
{ \
|
{ \
|
||||||
bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \
|
bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \
|
||||||
element_type##_array_entry* Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \
|
element_type##_array_entry* Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \
|
||||||
return Entry; \
|
return Entry; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal array_entry_handle \
|
internal array_entry_handle \
|
||||||
PushElement (element_type Data, element_type##_array* Buffer) \
|
PushElement (element_type Data, element_type##_array* Buffer) \
|
||||||
{ \
|
{ \
|
||||||
array_entry_handle Result = {}; \
|
array_entry_handle Result = {}; \
|
||||||
\
|
\
|
||||||
if (Buffer->FreeList.Next != &Buffer->FreeList) \
|
if (Buffer->FreeList.Next != &Buffer->FreeList) \
|
||||||
{ \
|
{ \
|
||||||
free_list* FreeList = Buffer->FreeList.Next; \
|
free_list* FreeList = Buffer->FreeList.Next; \
|
||||||
element_type##_array_entry* Entry = GetEntryAtIndex(FreeList->Index, *Buffer); \
|
element_type##_array_entry* Entry = GetEntryAtIndex(FreeList->Index, *Buffer); \
|
||||||
Buffer->FreeList.Next = Entry->Free.Next; \
|
Buffer->FreeList.Next = Entry->Free.Next; \
|
||||||
\
|
\
|
||||||
Result.Index = Entry->Free.Index; \
|
Result.Index = Entry->Free.Index; \
|
||||||
Result.Generation = Entry->Generation; \
|
Result.Generation = Entry->Generation; \
|
||||||
Entry->Entry = Data; \
|
Entry->Entry = Data; \
|
||||||
\
|
\
|
||||||
++Buffer->Used; \
|
++Buffer->Used; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \
|
if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \
|
||||||
{ \
|
{ \
|
||||||
GrowBuffer(Buffer); \
|
GrowBuffer(Buffer); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
s32 Index = Buffer->Used++; \
|
s32 Index = Buffer->Used++; \
|
||||||
s32 BucketIndex = Index / Buffer->BucketSize; \
|
s32 BucketIndex = Index / Buffer->BucketSize; \
|
||||||
s32 IndexInBucket = Index % Buffer->BucketSize; \
|
s32 IndexInBucket = Index % Buffer->BucketSize; \
|
||||||
\
|
\
|
||||||
Buffer->Buckets[BucketIndex][IndexInBucket].Entry = Data; \
|
Buffer->Buckets[BucketIndex][IndexInBucket].Entry = Data; \
|
||||||
Result.Index = Index; \
|
Result.Index = Index; \
|
||||||
Result.Generation = Buffer->Buckets[BucketIndex][IndexInBucket].Generation; \
|
Result.Generation = Buffer->Buckets[BucketIndex][IndexInBucket].Generation; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
return Result; \
|
return Result; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal element_type* \
|
internal element_type* \
|
||||||
GetElementAtIndex (s32 Index, element_type##_array Buffer) \
|
GetElementAtIndex (s32 Index, element_type##_array Buffer) \
|
||||||
{ \
|
{ \
|
||||||
Assert(Index < Buffer.Used); \
|
Assert(Index < Buffer.Used); \
|
||||||
element_type##_array_entry* Entry = GetEntryAtIndex(Index, Buffer); \
|
element_type##_array_entry* Entry = GetEntryAtIndex(Index, Buffer); \
|
||||||
element_type* Result = &Entry->Entry; \
|
element_type* Result = &Entry->Entry; \
|
||||||
return Result; \
|
return Result; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal element_type* \
|
internal element_type* \
|
||||||
GetElementWithHandle (array_entry_handle Handle, element_type##_array Buffer) \
|
GetElementWithHandle (array_entry_handle Handle, element_type##_array Buffer) \
|
||||||
{ \
|
{ \
|
||||||
element_type* Result = 0; \
|
element_type* Result = 0; \
|
||||||
\
|
\
|
||||||
element_type##_array_entry* Entry = GetEntryAtIndex(Handle.Index, Buffer); \
|
element_type##_array_entry* Entry = GetEntryAtIndex(Handle.Index, Buffer); \
|
||||||
\
|
\
|
||||||
if (Entry->Generation == Handle.Generation) \
|
if (Entry->Generation == Handle.Generation) \
|
||||||
{ \
|
{ \
|
||||||
Result = &Entry->Entry; \
|
Result = &Entry->Entry; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
return Result; \
|
return Result; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal void \
|
internal void \
|
||||||
RemoveElementAtIndex (s32 Index, element_type##_array* Buffer) \
|
RemoveElementAtIndex (s32 Index, element_type##_array* Buffer) \
|
||||||
{ \
|
{ \
|
||||||
Assert(Index < Buffer->Used); \
|
Assert(Index < Buffer->Used); \
|
||||||
\
|
\
|
||||||
element_type##_array_entry* Entry = GetEntryAtIndex(Index, *Buffer); \
|
element_type##_array_entry* Entry = GetEntryAtIndex(Index, *Buffer); \
|
||||||
++Entry->Generation; \
|
++Entry->Generation; \
|
||||||
Entry->Free.Index = Index; \
|
Entry->Free.Index = Index; \
|
||||||
\
|
\
|
||||||
Entry->Free.Next = Buffer->FreeList.Next; \
|
Entry->Free.Next = Buffer->FreeList.Next; \
|
||||||
Buffer->FreeList.Next = &Entry->Free; \
|
Buffer->FreeList.Next = &Entry->Free; \
|
||||||
\
|
\
|
||||||
} \
|
} \
|
||||||
|
|
||||||
// END OF CRAZY MACRO
|
// END OF CRAZY MACRO
|
||||||
|
|
||||||
|
|
||||||
#define TYPEDEF_CONTIGUOUS_ARRAY(element_type) \
|
#define TYPEDEF_CONTIGUOUS_ARRAY(element_type) \
|
||||||
struct element_type##_contiguous_array \
|
struct element_type##_contiguous_array \
|
||||||
{ \
|
{ \
|
||||||
element_type** Buckets; \
|
element_type** Buckets; \
|
||||||
s32 BucketSize; \
|
s32 BucketSize; \
|
||||||
s32 BucketCount; \
|
s32 BucketCount; \
|
||||||
s32 Used; \
|
s32 Used; \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
internal void \
|
internal void \
|
||||||
GrowBuffer(element_type##_contiguous_array* Buffer) \
|
GrowBuffer(element_type##_contiguous_array* Buffer) \
|
||||||
{ \
|
{ \
|
||||||
s32 NewBucketSize = sizeof(element_type) * Buffer->BucketSize; \
|
s32 NewBucketSize = sizeof(element_type) * Buffer->BucketSize; \
|
||||||
element_type* NewBucket = (element_type*)malloc(NewBucketSize); \
|
element_type* NewBucket = (element_type*)malloc(NewBucketSize); \
|
||||||
GSZeroMemory((u8*)NewBucket, NewBucketSize); \
|
GSZeroMemory((u8*)NewBucket, NewBucketSize); \
|
||||||
\
|
\
|
||||||
s32 NewBucketIndex = Buffer->BucketCount++; \
|
s32 NewBucketIndex = Buffer->BucketCount++; \
|
||||||
if (!Buffer->Buckets) \
|
if (!Buffer->Buckets) \
|
||||||
{ \
|
{ \
|
||||||
Buffer->Buckets = (element_type**)malloc(sizeof(element_type*)); \
|
Buffer->Buckets = (element_type**)malloc(sizeof(element_type*)); \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
Buffer->Buckets = (element_type**)realloc(Buffer->Buckets, sizeof(element_type*) * Buffer->BucketCount); \
|
Buffer->Buckets = (element_type**)realloc(Buffer->Buckets, sizeof(element_type*) * Buffer->BucketCount); \
|
||||||
} \
|
} \
|
||||||
Buffer->Buckets[NewBucketIndex] = NewBucket; \
|
Buffer->Buckets[NewBucketIndex] = NewBucket; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal element_type* \
|
internal element_type* \
|
||||||
GetElementAtIndex (s32 Index, element_type##_contiguous_array Buffer) \
|
GetElementAtIndex (s32 Index, element_type##_contiguous_array Buffer) \
|
||||||
{ \
|
{ \
|
||||||
element_type* Entry = 0; \
|
element_type* Entry = 0; \
|
||||||
if (Index <= Buffer.Used) \
|
if (Index <= Buffer.Used) \
|
||||||
{ \
|
{ \
|
||||||
bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \
|
bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \
|
||||||
Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \
|
Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \
|
||||||
} \
|
} \
|
||||||
return Entry; \
|
return Entry; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal s32 \
|
internal s32 \
|
||||||
PushElement (element_type Data, element_type##_contiguous_array* Buffer) \
|
PushElement (element_type Data, element_type##_contiguous_array* Buffer) \
|
||||||
{ \
|
{ \
|
||||||
s32 Result = -1; \
|
s32 Result = -1; \
|
||||||
\
|
\
|
||||||
if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \
|
if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \
|
||||||
{ \
|
{ \
|
||||||
GrowBuffer(Buffer); \
|
GrowBuffer(Buffer); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
s32 Index = Buffer->Used++; \
|
s32 Index = Buffer->Used++; \
|
||||||
s32 BucketIndex = Index / Buffer->BucketSize; \
|
s32 BucketIndex = Index / Buffer->BucketSize; \
|
||||||
s32 IndexInBucket = Index % Buffer->BucketSize; \
|
s32 IndexInBucket = Index % Buffer->BucketSize; \
|
||||||
\
|
\
|
||||||
Buffer->Buckets[BucketIndex][IndexInBucket] = Data; \
|
Buffer->Buckets[BucketIndex][IndexInBucket] = Data; \
|
||||||
Result = Index; \
|
Result = Index; \
|
||||||
return Result; \
|
return Result; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
internal void \
|
internal void \
|
||||||
RemoveElementAtIndex (s32 Index, element_type##_contiguous_array* Buffer) \
|
RemoveElementAtIndex (s32 Index, element_type##_contiguous_array* Buffer) \
|
||||||
{ \
|
{ \
|
||||||
Assert(Index < Buffer->Used); \
|
Assert(Index < Buffer->Used); \
|
||||||
\
|
\
|
||||||
bucket_index IndexToRemove = GetBucketIndexForIndex(Index, Buffer->BucketSize); \
|
bucket_index IndexToRemove = GetBucketIndexForIndex(Index, Buffer->BucketSize); \
|
||||||
bucket_index LastIndex = GetBucketIndexForIndex(Buffer->Used - 1, Buffer->BucketSize); \
|
bucket_index LastIndex = GetBucketIndexForIndex(Buffer->Used - 1, Buffer->BucketSize); \
|
||||||
element_type ValueAtLastIndex = Buffer->Buckets[LastIndex.Bucket][LastIndex.IndexInBucket]; \
|
element_type ValueAtLastIndex = Buffer->Buckets[LastIndex.Bucket][LastIndex.IndexInBucket]; \
|
||||||
Buffer->Buckets[IndexToRemove.Bucket][IndexToRemove.IndexInBucket] = ValueAtLastIndex; \
|
Buffer->Buckets[IndexToRemove.Bucket][IndexToRemove.IndexInBucket] = ValueAtLastIndex; \
|
||||||
--Buffer->Used; \
|
--Buffer->Used; \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
// END OF CRAZY MACRO
|
// END OF CRAZY MACRO
|
||||||
|
|
||||||
TYPEDEF_ARRAY(array_entry_handle);
|
TYPEDEF_ARRAY(array_entry_handle);
|
||||||
TYPEDEF_CONTIGUOUS_ARRAY(array_entry_handle);
|
TYPEDEF_CONTIGUOUS_ARRAY(array_entry_handle);
|
||||||
|
|
||||||
|
#define GS_ARRAY_H
|
||||||
|
#endif // GS_ARRAY_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: gs_font.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_FONT_H
|
||||||
|
|
||||||
#ifndef GS_FONT_H
|
#ifndef GS_FONT_H
|
||||||
|
|
||||||
struct codepoint_bitmap
|
struct codepoint_bitmap
|
||||||
|
@ -118,4 +125,7 @@ NewLineYOffset (bitmap_font Font)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GS_FONT_H
|
#define GS_FONT_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define GS_FONT_H
|
||||||
|
#endif // GS_FONT_H
|
|
@ -1 +1,11 @@
|
||||||
//
|
//
|
||||||
|
// File: gs_hashtable.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_HASHTABLE_H
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
#define GS_HASHTABLE_H
|
||||||
|
#endif // GS_HASHTABLE_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: gs_input.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_INPUT_H
|
||||||
|
|
||||||
enum key_state_flags
|
enum key_state_flags
|
||||||
{
|
{
|
||||||
KeyState_WasDown = 1 << 0,
|
KeyState_WasDown = 1 << 0,
|
||||||
|
@ -108,4 +115,7 @@ MouseButtonHeldDown (b32 MouseButtonState)
|
||||||
b32 WasDown = KeyWasDown(MouseButtonState);
|
b32 WasDown = KeyWasDown(MouseButtonState);
|
||||||
b32 IsDown = KeyIsDown(MouseButtonState);
|
b32 IsDown = KeyIsDown(MouseButtonState);
|
||||||
return (WasDown && IsDown);
|
return (WasDown && IsDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GS_INPUT_H
|
||||||
|
#endif // GS_INPUT_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: gs_platform.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_PLATFORM_H
|
||||||
|
|
||||||
#ifndef GS_PLATFORM_H
|
#ifndef GS_PLATFORM_H
|
||||||
|
|
||||||
#ifndef GS_LANGUAGE_H
|
#ifndef GS_LANGUAGE_H
|
||||||
|
@ -385,5 +392,8 @@ GetSecondsElapsed (s64 Start, s64 End, s64 PerformanceCountFrequency)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GS_PLATFORM_H
|
||||||
|
#endif // GS_PLATFORM_H
|
||||||
|
|
||||||
#define GS_PLATFORM_H
|
#define GS_PLATFORM_H
|
||||||
#endif // GS_PLATFORM_H
|
#endif // GS_PLATFORM_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: gs_win32.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_WIN32_CPP
|
||||||
|
|
||||||
#ifndef GS_WIN32_CPP
|
#ifndef GS_WIN32_CPP
|
||||||
|
|
||||||
struct win32_state
|
struct win32_state
|
||||||
|
@ -141,18 +148,18 @@ Win32CreateWindow (HINSTANCE HInstance, char* WindowName, s32 Width, s32 Height,
|
||||||
if (RegisterClass(&Result.Class))
|
if (RegisterClass(&Result.Class))
|
||||||
{
|
{
|
||||||
Result.Handle = CreateWindowEx(
|
Result.Handle = CreateWindowEx(
|
||||||
0,
|
0,
|
||||||
Result.Class.lpszClassName,
|
Result.Class.lpszClassName,
|
||||||
WindowName,
|
WindowName,
|
||||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
Width,
|
Width,
|
||||||
Height,
|
Height,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
HInstance,
|
HInstance,
|
||||||
0);
|
0);
|
||||||
Result.DeviceContext = GetDC(Result.Handle);
|
Result.DeviceContext = GetDC(Result.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,17 +288,17 @@ HandleWindowEventUnlessWouldUseDefault (HWND WindowHandle, UINT Msg, WPARAM wPar
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
Win32HandleWindowsEvents (
|
Win32HandleWindowsEvents (
|
||||||
HWND WindowHandle,
|
HWND WindowHandle,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam
|
LPARAM lParam
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
handle_window_event_result EventResult = HandleWindowEventUnlessWouldUseDefault(
|
handle_window_event_result EventResult = HandleWindowEventUnlessWouldUseDefault(
|
||||||
WindowHandle,
|
WindowHandle,
|
||||||
Msg,
|
Msg,
|
||||||
wParam,
|
wParam,
|
||||||
lParam);
|
lParam);
|
||||||
|
|
||||||
if (!EventResult.Handled)
|
if (!EventResult.Handled)
|
||||||
{
|
{
|
||||||
|
@ -409,8 +416,8 @@ Win32GetKeyCode (int Win32VirtualKey, bool NumpadValid, bool TranslateToChar)
|
||||||
|
|
||||||
internal handle_window_msg_result
|
internal handle_window_msg_result
|
||||||
HandleWindowsMessage (
|
HandleWindowsMessage (
|
||||||
HWND WindowHandle,
|
HWND WindowHandle,
|
||||||
MSG Message)
|
MSG Message)
|
||||||
{
|
{
|
||||||
handle_window_msg_result Result = {};
|
handle_window_msg_result Result = {};
|
||||||
Result.NeedsUpdate = 0;
|
Result.NeedsUpdate = 0;
|
||||||
|
@ -616,7 +623,7 @@ PLATFORM_REALLOC(Win32Realloc)
|
||||||
u8* NewMemory = Win32BasicAlloc(NewSize);
|
u8* NewMemory = Win32BasicAlloc(NewSize);
|
||||||
if (Base)
|
if (Base)
|
||||||
{
|
{
|
||||||
GSMemCopy(Base, NewMemory, OldSize);
|
GSMemCopy(Base, NewMemory, OldSize);
|
||||||
Win32Free(Base, OldSize);
|
Win32Free(Base, OldSize);
|
||||||
}
|
}
|
||||||
return NewMemory;
|
return NewMemory;
|
||||||
|
@ -629,13 +636,13 @@ PLATFORM_READ_ENTIRE_FILE(Win32ReadEntireFile)
|
||||||
Result.Error = PLATFORM_MEMORY_NO_ERROR;
|
Result.Error = PLATFORM_MEMORY_NO_ERROR;
|
||||||
|
|
||||||
HANDLE FileHandle = CreateFileA (
|
HANDLE FileHandle = CreateFileA (
|
||||||
Path,
|
Path,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (FileHandle != INVALID_HANDLE_VALUE)
|
if (FileHandle != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -671,13 +678,13 @@ PLATFORM_WRITE_ENTIRE_FILE(Win32WriteEntireFile)
|
||||||
{
|
{
|
||||||
b32 Result = false;
|
b32 Result = false;
|
||||||
HANDLE FileHandle = CreateFileA (
|
HANDLE FileHandle = CreateFileA (
|
||||||
Path,
|
Path,
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
CREATE_ALWAYS,
|
CREATE_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (FileHandle != INVALID_HANDLE_VALUE)
|
if (FileHandle != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -1014,5 +1021,8 @@ BindTexture (s32 TextureHandle)
|
||||||
glBindTexture(GL_TEXTURE_2D, TextureHandle);
|
glBindTexture(GL_TEXTURE_2D, TextureHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GS_WIN32_CPP
|
||||||
|
#endif // GS_WIN32_CPP
|
||||||
|
|
||||||
#define GS_WIN32_CPP
|
#define GS_WIN32_CPP
|
||||||
#endif // GS_WIN32_CPP
|
#endif // GS_WIN32_CPP
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: gs_win32.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef GS_WIN32_H
|
||||||
|
|
||||||
#ifndef GS_WIN32_H
|
#ifndef GS_WIN32_H
|
||||||
|
|
||||||
struct platform_font_info
|
struct platform_font_info
|
||||||
|
@ -11,3 +18,7 @@ struct platform_font_info
|
||||||
|
|
||||||
#define GS_WIN32_H
|
#define GS_WIN32_H
|
||||||
#endif // GS_WIN32_H
|
#endif // GS_WIN32_H
|
||||||
|
|
||||||
|
|
||||||
|
#define GS_WIN32_H
|
||||||
|
#endif // GS_WIN32_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: interface.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef INTERFACE_H
|
||||||
|
|
||||||
enum string_alignment
|
enum string_alignment
|
||||||
{
|
{
|
||||||
Align_Left,
|
Align_Left,
|
||||||
|
@ -612,4 +619,7 @@ EvaluateSearchLister (render_command_buffer* RenderBuffer, v2 TopLeft, v2 Dimens
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define INTERFACE_H
|
||||||
|
#endif // INTERFACE_H
|
|
@ -1,3 +1,9 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_node_interface.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLHAUS_NODE_INTERFACE_CPP
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -89,8 +95,8 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
|
||||||
for (s32 i = 0; i < OpState->SearchLister.SourceListCount; i++)
|
for (s32 i = 0; i < OpState->SearchLister.SourceListCount; i++)
|
||||||
{
|
{
|
||||||
OpState->SearchLister.SourceList[i] = MakeString(
|
OpState->SearchLister.SourceList[i] = MakeString(
|
||||||
NodeSpecifications[i].Name,
|
NodeSpecifications[i].Name,
|
||||||
NodeSpecifications[i].NameLength);
|
NodeSpecifications[i].NameLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OpState->SearchLister.Filter = MakeString(PushArray(&State->Modes.Arena, char, 64), 0, 64);
|
OpState->SearchLister.Filter = MakeString(PushArray(&State->Modes.Arena, char, 64), 0, 64);
|
||||||
|
@ -217,8 +223,8 @@ internal void
|
||||||
BeginDraggingNodePort(app_state* State, node_interaction Interaction)
|
BeginDraggingNodePort(app_state* State, node_interaction Interaction)
|
||||||
{
|
{
|
||||||
operation_mode* DragNodePortMode = ActivateOperationModeWithCommands(
|
operation_mode* DragNodePortMode = ActivateOperationModeWithCommands(
|
||||||
&State->Modes,
|
&State->Modes,
|
||||||
DragNodePortInputCommands);
|
DragNodePortInputCommands);
|
||||||
DragNodePortMode->Render = RenderDraggingNodePort;
|
DragNodePortMode->Render = RenderDraggingNodePort;
|
||||||
|
|
||||||
drag_node_port_operation_state* OpState = CreateOperationState(DragNodePortMode,
|
drag_node_port_operation_state* OpState = CreateOperationState(DragNodePortMode,
|
||||||
|
@ -276,8 +282,8 @@ internal void
|
||||||
BeginDraggingNode(app_state* State, node_interaction Interaction)
|
BeginDraggingNode(app_state* State, node_interaction Interaction)
|
||||||
{
|
{
|
||||||
operation_mode* DragNodeMode = ActivateOperationModeWithCommands(
|
operation_mode* DragNodeMode = ActivateOperationModeWithCommands(
|
||||||
&State->Modes,
|
&State->Modes,
|
||||||
DragNodeInputCommands);
|
DragNodeInputCommands);
|
||||||
DragNodeMode->Render = RenderDraggingNode;
|
DragNodeMode->Render = RenderDraggingNode;
|
||||||
|
|
||||||
drag_node_operation_state* OpState = CreateOperationState(DragNodeMode,
|
drag_node_operation_state* OpState = CreateOperationState(DragNodeMode,
|
||||||
|
@ -496,3 +502,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeView)
|
||||||
|
|
||||||
OpState->SelectedNodeHandle = 0;
|
OpState->SelectedNodeHandle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLHAUS_NODE_INTERFACE_CPP
|
||||||
|
#endif // FOLHAUS_NODE_INTERFACE_CPP
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_animation_timeline.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_ANIMATION_TIMELINE_H
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// [x] - Moving animation blocks
|
// [x] - Moving animation blocks
|
||||||
// [x] - dragging beginning and end of time blocks
|
// [x] - dragging beginning and end of time blocks
|
||||||
|
@ -479,3 +486,6 @@ PANEL_RENDER_PROC(AnimationTimeline_Render)
|
||||||
State->AnimationSystem.Time = 0;
|
State->AnimationSystem.Time = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_ANIMATION_TIMELINE_H
|
||||||
|
#endif // FOLDHAUS_PANEL_ANIMATION_TIMELINE_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_dmx_view.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_DMX_VIEW_H
|
||||||
|
|
||||||
PANEL_INIT_PROC(DMXView_Init)
|
PANEL_INIT_PROC(DMXView_Init)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -74,4 +81,8 @@ PANEL_RENDER_PROC(DMXView_Render)
|
||||||
UniverseList = UniverseList->Next;
|
UniverseList = UniverseList->Next;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_DMX_VIEW_H
|
||||||
|
#endif // FOLDHAUS_PANEL_DMX_VIEW_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_hierarchy.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_HIERARCHY_H
|
||||||
|
|
||||||
PANEL_INIT_PROC(HierarchyView_Init)
|
PANEL_INIT_PROC(HierarchyView_Init)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -75,4 +82,8 @@ PANEL_RENDER_PROC(HierarchyView_Render)
|
||||||
|
|
||||||
List.ListElementsCount++;
|
List.ListElementsCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_HIERARCHY_H
|
||||||
|
#endif // FOLDHAUS_PANEL_HIERARCHY_H
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_node_graph.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_NODE_GRAPH_H
|
||||||
|
|
||||||
struct visual_node
|
struct visual_node
|
||||||
{
|
{
|
||||||
node_specification Spec;
|
node_specification Spec;
|
||||||
|
@ -127,14 +134,10 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndConnectNodesOperation)
|
||||||
visual_port UpstreamPort = (OpState->IsInput & IsInputMember) ? VisualPort : OpState->VisualPort;
|
visual_port UpstreamPort = (OpState->IsInput & IsInputMember) ? VisualPort : OpState->VisualPort;
|
||||||
visual_port DownstreamPort = (OpState->IsInput & IsInputMember) ? OpState->VisualPort : VisualPort;
|
visual_port DownstreamPort = (OpState->IsInput & IsInputMember) ? OpState->VisualPort : VisualPort;
|
||||||
|
|
||||||
// Make Connection
|
PushNodeConnectionOnWorkspace(UpstreamPort.SparseNodeHandle, UpstreamPort.PortIndex,
|
||||||
pattern_node_connection Connection = {};
|
DownstreamPort.SparseNodeHandle, DownstreamPort.PortIndex,
|
||||||
Connection.UpstreamNodeHandle = UpstreamPort.SparseNodeHandle;
|
&State->NodeWorkspace, &State->Transient);
|
||||||
Connection.DownstreamNodeHandle = DownstreamPort.SparseNodeHandle;
|
|
||||||
Connection.UpstreamPortIndex = UpstreamPort.PortIndex;
|
|
||||||
Connection.DownstreamPortIndex = DownstreamPort.PortIndex;
|
|
||||||
|
|
||||||
State->NodeWorkspace.Connections.PushElementOnBucket(Connection);
|
|
||||||
GraphState->LayoutIsDirty = true;
|
GraphState->LayoutIsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +245,7 @@ DrawNodePorts(node_specification Spec, b32 InputMask, v2 Position, r32 LineHeigh
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
DrawNode (v2 Position, node_specification NodeSpecification, r32 NodeWidth, r32 LineHeight, interface_config Interface, render_command_buffer* RenderBuffer, mouse_state Mouse)
|
DrawNode (v2 Position, node_specification NodeSpecification, gs_list_handle NodeHandle, r32 NodeWidth, r32 LineHeight, interface_config Interface, render_command_buffer* RenderBuffer, mouse_state Mouse, memory_arena* Scratch)
|
||||||
{
|
{
|
||||||
u32 InputMembers = 0;
|
u32 InputMembers = 0;
|
||||||
u32 OutputMembers = 0;
|
u32 OutputMembers = 0;
|
||||||
|
@ -269,8 +272,11 @@ DrawNode (v2 Position, node_specification NodeSpecification, r32 NodeWidth, r32
|
||||||
v2 TextOffset = v2{Interface.Margin.x, 0};
|
v2 TextOffset = v2{Interface.Margin.x, 0};
|
||||||
|
|
||||||
PushRenderQuad2D(RenderBuffer, LinePosition, LinePosition + v2{NodeWidth, LineHeight}, v4{1.f, .24f, .39f, 1.f});
|
PushRenderQuad2D(RenderBuffer, LinePosition, LinePosition + v2{NodeWidth, LineHeight}, v4{1.f, .24f, .39f, 1.f});
|
||||||
|
|
||||||
string NodeName = MakeString(NodeSpecification.Name, NodeSpecification.NameLength);
|
string NodeName = MakeString(NodeSpecification.Name, NodeSpecification.NameLength);
|
||||||
DrawString(RenderBuffer, NodeName, Interface.Font, LinePosition + TextOffset, WhiteV4);
|
string NodePrintName = MakeString(PushArray(Scratch, char, 256), 0, 256);
|
||||||
|
PrintF(&NodePrintName, "%S [%d]", NodeName, NodeHandle.Index);
|
||||||
|
DrawString(RenderBuffer, NodePrintName, Interface.Font, LinePosition + TextOffset, WhiteV4);
|
||||||
LinePosition.y -= LineHeight;
|
LinePosition.y -= LineHeight;
|
||||||
|
|
||||||
DrawNodePorts(NodeSpecification, IsInputMember, LinePosition, LineHeight, Align_Left, TextOffset, Interface, RenderBuffer, Mouse);
|
DrawNodePorts(NodeSpecification, IsInputMember, LinePosition, LineHeight, Align_Left, TextOffset, Interface, RenderBuffer, Mouse);
|
||||||
|
@ -299,57 +305,18 @@ GetVisualPortIndexForNode(gs_list_handle SparseNodeHandle, u32 PortIndex, node_l
|
||||||
}
|
}
|
||||||
|
|
||||||
internal node_layout
|
internal node_layout
|
||||||
ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance, r32 LineHeight, memory_arena* Storage)
|
ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance, r32 LineHeight, memory_arena* Storage, app_state* State)
|
||||||
{
|
{
|
||||||
node_layout Result = {};
|
node_layout Result = {};
|
||||||
|
|
||||||
Result.SparseToContiguousNodeMapCount = Workspace.Nodes.OnePastLastUsed;
|
for (u32 n = 0; n < Workspace.Nodes.Used; n++)
|
||||||
Result.SparseToContiguousNodeMap = PushArray(Storage, s32, Result.SparseToContiguousNodeMapCount);
|
|
||||||
u32 DestinationIndex = 0;
|
|
||||||
Result.VisualPortsCount = 0;
|
|
||||||
for (u32 i = 0; i < Result.SparseToContiguousNodeMapCount; i++)
|
|
||||||
{
|
{
|
||||||
gs_list_entry<pattern_node>* Entry = Workspace.Nodes.GetEntryAtIndex(i);
|
gs_list_handle NodeHandle = Workspace.SortedNodeHandles[n];
|
||||||
if (!EntryIsFree(Entry))
|
pattern_node Node = *Workspace.Nodes.GetElementWithHandle(NodeHandle);
|
||||||
{
|
|
||||||
Result.SparseToContiguousNodeMap[i] = DestinationIndex++;
|
|
||||||
|
|
||||||
pattern_node Node = Entry->Value;
|
|
||||||
node_specification Spec = NodeSpecifications[Node.SpecificationIndex];
|
|
||||||
Result.VisualPortsCount += Spec.MemberListLength;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Result.SparseToContiguousNodeMap[i] = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out how to arrange nodes
|
|
||||||
Result.LayerCount = 1;
|
|
||||||
|
|
||||||
Result.VisualNodeLayers = PushArray(Storage, u32, Workspace.Nodes.Used);
|
|
||||||
GSZeroMemory((u8*)Result.VisualNodeLayers, sizeof(u32) * Workspace.Nodes.Used);
|
|
||||||
|
|
||||||
for (u32 c = 0; c < Workspace.Connections.Used; c++)
|
|
||||||
{
|
|
||||||
pattern_node_connection Connection = *Workspace.Connections.GetElementAtIndex(c);
|
|
||||||
|
|
||||||
u32 UpstreamNodeLayerIndex = Result.SparseToContiguousNodeMap[Connection.UpstreamNodeHandle.Index];
|
u32 SpecIndex = Node.SpecificationIndex;
|
||||||
u32 DownstreamNodeLayerIndex = Result.SparseToContiguousNodeMap[Connection.DownstreamNodeHandle.Index];
|
node_specification Spec = NodeSpecifications[SpecIndex];
|
||||||
|
Result.VisualPortsCount += Spec.MemberListLength;
|
||||||
u32 UpstreamNodeInitialLayer = Result.VisualNodeLayers[UpstreamNodeLayerIndex];
|
|
||||||
u32 DownstreamNodeLayer = Result.VisualNodeLayers[DownstreamNodeLayerIndex];
|
|
||||||
|
|
||||||
Result.VisualNodeLayers[UpstreamNodeLayerIndex] = GSMax(UpstreamNodeInitialLayer, DownstreamNodeLayer + 1);
|
|
||||||
Result.LayerCount = GSMax(Result.VisualNodeLayers[UpstreamNodeLayerIndex] + 1, Result.LayerCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Place Layer Columns
|
|
||||||
Result.LayerPositions = PushArray(Storage, v2, Result.LayerCount);
|
|
||||||
for (u32 l = 0; l < Result.LayerCount; l++)
|
|
||||||
{
|
|
||||||
u32 FromRight = Result.LayerCount - l;
|
|
||||||
Result.LayerPositions[l] = v2{ (NodeWidth + LayerDistance) * FromRight, 0 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place nodes and connections
|
// Place nodes and connections
|
||||||
|
@ -359,20 +326,17 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
|
||||||
u32 VisualPortsUsed = 0;
|
u32 VisualPortsUsed = 0;
|
||||||
Result.VisualPorts = PushArray(Storage, visual_port, Result.VisualPortsCount);
|
Result.VisualPorts = PushArray(Storage, visual_port, Result.VisualPortsCount);
|
||||||
|
|
||||||
for (u32 n = 0; n < Result.SparseToContiguousNodeMapCount; n++)
|
for (u32 n = 0; n < Workspace.Nodes.Used; n++)
|
||||||
{
|
{
|
||||||
u32 NodeIndex = Result.SparseToContiguousNodeMap[n];
|
gs_list_handle NodeHandle = Workspace.SortedNodeHandles[n];
|
||||||
gs_list_entry<pattern_node>* NodeEntry = Workspace.Nodes.GetEntryAtIndex(NodeIndex);
|
pattern_node Node = *Workspace.Nodes.GetElementWithHandle(NodeHandle);
|
||||||
pattern_node Node = NodeEntry->Value;
|
|
||||||
|
|
||||||
u32 SpecIndex = Node.SpecificationIndex;
|
u32 SpecIndex = Node.SpecificationIndex;
|
||||||
node_specification Spec = NodeSpecifications[SpecIndex];
|
node_specification Spec = NodeSpecifications[SpecIndex];
|
||||||
u32 NodeLayer = Result.VisualNodeLayers[n];
|
|
||||||
|
|
||||||
visual_node* VisualNode = Result.VisualNodes + n;
|
visual_node* VisualNode = Result.VisualNodes + n;
|
||||||
VisualNode->Spec = Spec;
|
VisualNode->Spec = Spec;
|
||||||
VisualNode->Position = Result.LayerPositions[NodeLayer];
|
VisualNode->Position = v2{(1.5f * NodeWidth) * n, 0};
|
||||||
Result.LayerPositions[NodeLayer].y -= 200;
|
|
||||||
|
|
||||||
// NOTE(Peter): These start at 2 to account for the offset past the node title
|
// NOTE(Peter): These start at 2 to account for the offset past the node title
|
||||||
s32 InputsCount = 2;
|
s32 InputsCount = 2;
|
||||||
|
@ -397,12 +361,14 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
|
||||||
PortBounds.Max = PortBounds.Min + v2{8, 8};
|
PortBounds.Max = PortBounds.Min + v2{8, 8};
|
||||||
|
|
||||||
visual_port* VisualPort = Result.VisualPorts + VisualPortsUsed++;
|
visual_port* VisualPort = Result.VisualPorts + VisualPortsUsed++;
|
||||||
VisualPort->SparseNodeHandle = NodeEntry->Handle;
|
VisualPort->SparseNodeHandle = NodeHandle;
|
||||||
VisualPort->PortIndex = p;
|
VisualPort->PortIndex = p;
|
||||||
VisualPort->PortBounds = PortBounds;
|
VisualPort->PortBounds = PortBounds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result.VisualConnectionsCount = 0;
|
||||||
|
|
||||||
Result.VisualConnectionsCount = Workspace.Connections.Used;
|
Result.VisualConnectionsCount = Workspace.Connections.Used;
|
||||||
Result.VisualConnections = PushArray(Storage, visual_connection, Result.VisualConnectionsCount);
|
Result.VisualConnections = PushArray(Storage, visual_connection, Result.VisualConnectionsCount);
|
||||||
for (u32 c = 0; c < Workspace.Connections.Used; c++)
|
for (u32 c = 0; c < Workspace.Connections.Used; c++)
|
||||||
|
@ -450,7 +416,7 @@ PANEL_RENDER_PROC(NodeGraph_Render)
|
||||||
ClearArena(&GraphState->LayoutMemory);
|
ClearArena(&GraphState->LayoutMemory);
|
||||||
GraphState->Layout = {};
|
GraphState->Layout = {};
|
||||||
|
|
||||||
GraphState->Layout = ArrangeNodes(State->NodeWorkspace, NodeWidth, LayerDistance, LineHeight, &GraphState->LayoutMemory);
|
GraphState->Layout = ArrangeNodes(State->NodeWorkspace, NodeWidth, LayerDistance, LineHeight, &GraphState->LayoutMemory, State);
|
||||||
GraphState->LayoutIsDirty = false;
|
GraphState->LayoutIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,6 +429,10 @@ PANEL_RENDER_PROC(NodeGraph_Render)
|
||||||
v2 Start = GraphState->ViewOffset + Connection.UpstreamPosition;
|
v2 Start = GraphState->ViewOffset + Connection.UpstreamPosition;
|
||||||
v2 End = GraphState->ViewOffset + Connection.DownstreamPosition;
|
v2 End = GraphState->ViewOffset + Connection.DownstreamPosition;
|
||||||
PushRenderLine2D(RenderBuffer, Start, End, 1.5f, WhiteV4);
|
PushRenderLine2D(RenderBuffer, Start, End, 1.5f, WhiteV4);
|
||||||
|
|
||||||
|
v2 TempDim = v2{6, 6};
|
||||||
|
PushRenderQuad2D(RenderBuffer, Start - TempDim, Start + TempDim, PinkV4);
|
||||||
|
PushRenderQuad2D(RenderBuffer, End - TempDim, End + TempDim, YellowV4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GraphState->Layout.ConnectionIsInProgress)
|
if (GraphState->Layout.ConnectionIsInProgress)
|
||||||
|
@ -476,7 +446,8 @@ PANEL_RENDER_PROC(NodeGraph_Render)
|
||||||
for (u32 i = 0; i < GraphState->Layout.VisualNodesCount; i++)
|
for (u32 i = 0; i < GraphState->Layout.VisualNodesCount; i++)
|
||||||
{
|
{
|
||||||
visual_node VisualNode = GraphState->Layout.VisualNodes[i];
|
visual_node VisualNode = GraphState->Layout.VisualNodes[i];
|
||||||
DrawNode(VisualNode.Position + GraphState->ViewOffset, VisualNode.Spec, NodeWidth, LineHeight, State->Interface, RenderBuffer, Mouse);
|
gs_list_handle NodeHandle = State->NodeWorkspace.SortedNodeHandles[i];
|
||||||
|
DrawNode(VisualNode.Position + GraphState->ViewOffset, VisualNode.Spec, NodeHandle, NodeWidth, LineHeight, State->Interface, RenderBuffer, Mouse, &State->Transient);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++)
|
for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++)
|
||||||
|
@ -529,7 +500,7 @@ PANEL_RENDER_PROC(NodeGraph_Render)
|
||||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
|
if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
|
||||||
&& PointIsInRect(Mouse.DownPos, ElementBounds))
|
&& PointIsInRect(Mouse.DownPos, ElementBounds))
|
||||||
{
|
{
|
||||||
PushNodeOnWorkspace(i, &State->NodeWorkspace);
|
PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient);
|
||||||
GraphState->LayoutIsDirty = true;
|
GraphState->LayoutIsDirty = true;
|
||||||
MouseHandled = true;
|
MouseHandled = true;
|
||||||
}
|
}
|
||||||
|
@ -539,4 +510,8 @@ PANEL_RENDER_PROC(NodeGraph_Render)
|
||||||
{
|
{
|
||||||
BeginPanNodeGraph(State, {}, Mouse);
|
BeginPanNodeGraph(State, {}, Mouse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_NODE_GRAPH_H
|
||||||
|
#endif // FOLDHAUS_PANEL_NODE_GRAPH_H
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_profiler.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_PROFILER_H
|
||||||
|
|
||||||
PANEL_INIT_PROC(ProfilerView_Init)
|
PANEL_INIT_PROC(ProfilerView_Init)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -196,4 +203,8 @@ PANEL_RENDER_PROC(ProfilerView_Render)
|
||||||
ViewModeMin, ViewModeMax,
|
ViewModeMin, ViewModeMax,
|
||||||
VisibleFrame, Memory);
|
VisibleFrame, Memory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_PROFILER_H
|
||||||
|
#endif // FOLDHAUS_PANEL_PROFILER_H
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_sculpture_view.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_SCULPTURE_VIEW_H
|
||||||
|
|
||||||
// 3D Mouse View
|
// 3D Mouse View
|
||||||
|
|
||||||
|
@ -166,3 +172,6 @@ PANEL_RENDER_PROC(SculptureView_Render)
|
||||||
Context.GeneralWorkQueue->DoQueueWorkUntilDone(Context.GeneralWorkQueue, 0);
|
Context.GeneralWorkQueue->DoQueueWorkUntilDone(Context.GeneralWorkQueue, 0);
|
||||||
Context.GeneralWorkQueue->ResetWorkQueue(Context.GeneralWorkQueue);
|
Context.GeneralWorkQueue->ResetWorkQueue(Context.GeneralWorkQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOLDHAUS_PANEL_SCULPTURE_VIEW_H
|
||||||
|
#endif // FOLDHAUS_PANEL_SCULPTURE_VIEW_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: sacn.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef SACN_H
|
||||||
|
|
||||||
#define NETWORKINTID_INVALID -1
|
#define NETWORKINTID_INVALID -1
|
||||||
|
|
||||||
#define DEFAULT_STREAMING_ACN_PORT 5568
|
#define DEFAULT_STREAMING_ACN_PORT 5568
|
||||||
|
@ -335,4 +342,8 @@ SACNGetUniverseSendAddress(s32 Universe)
|
||||||
|
|
||||||
u_long V4Address = (u_long)UpackB4(MulticastAddressBuffer);
|
u_long V4Address = (u_long)UpackB4(MulticastAddressBuffer);
|
||||||
return V4Address;
|
return V4Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define SACN_H
|
||||||
|
#endif // SACN_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: test_patterns.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef TEST_PATTERNS_H
|
||||||
|
|
||||||
|
|
||||||
NODE_STRUCT(solid_color_data)
|
NODE_STRUCT(solid_color_data)
|
||||||
{
|
{
|
||||||
|
@ -111,4 +118,7 @@ NODE_PROC(RevolvingDiscs, revolving_discs_data)
|
||||||
}
|
}
|
||||||
LED++;
|
LED++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TEST_PATTERNS_H
|
||||||
|
#endif // TEST_PATTERNS_H
|
|
@ -1,3 +1,10 @@
|
||||||
|
//
|
||||||
|
// File: win32_foldhaus.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-01-01
|
||||||
|
//
|
||||||
|
#ifndef WIN32_FOLDHAUS_CPP
|
||||||
|
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
@ -709,4 +716,7 @@ WinMain (
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WIN32_FOLDHAUS_CPP
|
||||||
|
#endif // WIN32_FOLDHAUS_CPP
|
Loading…
Reference in New Issue