added documentation to all files

This commit is contained in:
Peter Slattery 2020-01-01 18:41:43 -08:00
parent 2ab7ff1194
commit 0164fea691
48 changed files with 960 additions and 336 deletions

View File

@ -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

View File

@ -1 +1,10 @@
//
// File: artnet.h
// Author: Peter Slattery
// Creation Date: 2020-01-01
//
/* For future artnet implementation */ /* For future artnet implementation */
#ifndef ARTNET_H
#define ARTNET_H
#endif // ARTNET_H

View File

@ -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)
@ -222,3 +229,6 @@ ParseAssemblyFile (u8* FileBase, s32 FileSize, memory_arena* Arena)
return AssemblyDefinition; return AssemblyDefinition;
} }
#define ASSEMBLY_PARSER_CPP
#endif // ASSEMBLY_PARSER_CPP

View File

@ -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"
@ -59,3 +66,6 @@ struct assembly_definition
s32 TotalLEDCount; s32 TotalLEDCount;
led_strip_definition* LEDStrips; led_strip_definition* LEDStrips;
}; };
#define ASSEMBLY_PARSER_H
#endif // ASSEMBLY_PARSER_H

View File

@ -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;
@ -45,3 +52,6 @@ DMXBufferListAppend (dmx_buffer_list* AppendTo, dmx_buffer_list* Append)
return Result; return Result;
} }
#define DMX_H
#endif // DMX_H

View File

@ -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"
@ -422,3 +429,6 @@ 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
@ -194,3 +201,6 @@ RegisterKeyPressCommand (input_command_registry* CommandRegistry,
Command->Mdfr = Mdfr; Command->Mdfr = Mdfr;
Command->Proc = Proc; Command->Proc = Proc;
} }
#define FOLDHAUS_COMMAND_DISPATCH_H
#endif // FOLDHAUS_COMMAND_DISPATCH_H

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
@ -267,3 +274,6 @@ 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

View File

@ -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

View File

@ -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

View File

@ -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;
}; };
@ -108,3 +122,6 @@ NODE_PROC(OutputNode, output_node_data)
{ {
} }
#define FOLDHAUS_NODE_H
#endif // FOLDHAUS_NODE_H

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)
{ {
@ -178,3 +185,6 @@ ClearRenderBuffer (render_command_buffer* Buffer)
{ {
Buffer->CommandMemoryUsed = 0; Buffer->CommandMemoryUsed = 0;
} }
#define FOLDHAUS_RENDERER_CPP
#endif // FOLDHAUS_RENDERER_CPP

View File

@ -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
@ -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

View File

@ -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)
@ -31,3 +38,6 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr
++PixelsDrawn; ++PixelsDrawn;
} }
} }
#define FOLDHAUS_SACN_VIEW_CPP
#endif // FOLDHAUS_SACN_VIEW_CPP

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,
@ -24,3 +31,6 @@ struct text_entry
text_entry_destination Destination; text_entry_destination Destination;
}; };
#define FOLDHAUS_TEXT_ENTRY_H
#endif // FOLDHAUS_TEXT_ENTRY_H

View File

@ -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)
@ -365,3 +372,6 @@ int main(int ArgCount, char* Args[])
return 0; return 0;
} }
#define FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP
#endif // FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP

View File

@ -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;
@ -227,3 +234,6 @@ RemoveElementAtIndex (s32 Index, element_type##_contiguous_array* Buffer) \
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

View File

@ -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
@ -119,3 +126,6 @@ NewLineYOffset (bitmap_font Font)
#define GS_FONT_H #define GS_FONT_H
#endif #endif
#define GS_FONT_H
#endif // GS_FONT_H

View File

@ -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

View File

@ -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,
@ -109,3 +116,6 @@ MouseButtonHeldDown (b32 MouseButtonState)
b32 IsDown = KeyIsDown(MouseButtonState); b32 IsDown = KeyIsDown(MouseButtonState);
return (WasDown && IsDown); return (WasDown && IsDown);
} }
#define GS_INPUT_H
#endif // GS_INPUT_H

View File

@ -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
@ -387,3 +394,6 @@ GetSecondsElapsed (s64 Start, s64 End, s64 PerformanceCountFrequency)
#define GS_PLATFORM_H #define GS_PLATFORM_H
#endif // GS_PLATFORM_H #endif // GS_PLATFORM_H
#define GS_PLATFORM_H
#endif // GS_PLATFORM_H

View File

@ -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
@ -1016,3 +1023,6 @@ BindTexture (s32 TextureHandle)
#define GS_WIN32_CPP #define GS_WIN32_CPP
#endif // GS_WIN32_CPP #endif // GS_WIN32_CPP
#define GS_WIN32_CPP
#endif // GS_WIN32_CPP

View File

@ -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

View File

@ -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,
@ -613,3 +620,6 @@ EvaluateSearchLister (render_command_buffer* RenderBuffer, v2 TopLeft, v2 Dimens
return Result; return Result;
} }
#define INTERFACE_H
#endif // INTERFACE_H

View File

@ -1,3 +1,9 @@
//
// File: foldhaus_node_interface.cpp
// Author: Peter Slattery
// Creation Date: 2020-01-01
//
#ifndef FOLHAUS_NODE_INTERFACE_CPP
//////////////////////////////////////// ////////////////////////////////////////
// //
@ -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

View File

@ -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

View File

@ -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)
{ {
@ -75,3 +82,7 @@ PANEL_RENDER_PROC(DMXView_Render)
} }
#endif #endif
} }
#define FOLDHAUS_PANEL_DMX_VIEW_H
#endif // FOLDHAUS_PANEL_DMX_VIEW_H

View File

@ -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)
{ {
@ -76,3 +83,7 @@ PANEL_RENDER_PROC(HierarchyView_Render)
List.ListElementsCount++; List.ListElementsCount++;
} }
} }
#define FOLDHAUS_PANEL_HIERARCHY_H
#endif // FOLDHAUS_PANEL_HIERARCHY_H

View File

@ -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,58 +305,19 @@ 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; u32 SpecIndex = Node.SpecificationIndex;
node_specification Spec = NodeSpecifications[Node.SpecificationIndex]; node_specification Spec = NodeSpecifications[SpecIndex];
Result.VisualPortsCount += Spec.MemberListLength; 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 DownstreamNodeLayerIndex = Result.SparseToContiguousNodeMap[Connection.DownstreamNodeHandle.Index];
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
Result.VisualNodesCount = Workspace.Nodes.Used; Result.VisualNodesCount = Workspace.Nodes.Used;
@ -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;
} }
@ -540,3 +511,7 @@ PANEL_RENDER_PROC(NodeGraph_Render)
BeginPanNodeGraph(State, {}, Mouse); BeginPanNodeGraph(State, {}, Mouse);
} }
} }
#define FOLDHAUS_PANEL_NODE_GRAPH_H
#endif // FOLDHAUS_PANEL_NODE_GRAPH_H

View File

@ -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)
{ {
@ -197,3 +204,7 @@ PANEL_RENDER_PROC(ProfilerView_Render)
VisibleFrame, Memory); VisibleFrame, Memory);
} }
} }
#define FOLDHAUS_PANEL_PROFILER_H
#endif // FOLDHAUS_PANEL_PROFILER_H

View File

@ -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

View File

@ -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
@ -336,3 +343,7 @@ 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

View File

@ -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)
{ {
@ -112,3 +119,6 @@ NODE_PROC(RevolvingDiscs, revolving_discs_data)
LED++; LED++;
} }
} }
#define TEST_PATTERNS_H
#endif // TEST_PATTERNS_H

View File

@ -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>
@ -710,3 +717,6 @@ WinMain (
return 0; return 0;
} }
#define WIN32_FOLDHAUS_CPP
#endif // WIN32_FOLDHAUS_CPP