Working on Meta System Attempted to tag all panel related procedures
This commit is contained in:
parent
5592ae97e1
commit
33338daab7
|
@ -98,6 +98,18 @@ WriteStringBuilderToFile(string_builder StringBuilder, FILE* WriteFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
StdPrintStringBuilder(string_builder StringBuilder)
|
||||||
|
{
|
||||||
|
string_builder_buffer* BufferAt = StringBuilder.Buffers;
|
||||||
|
while (BufferAt)
|
||||||
|
{
|
||||||
|
string String = BufferAt->String;
|
||||||
|
printf("%.*s", StringExpand(String));
|
||||||
|
BufferAt = BufferAt->Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // GS_STRING_BUILDER_NO_STDIO
|
#endif // GS_STRING_BUILDER_NO_STDIO
|
||||||
|
|
||||||
#define GS_STRING_BUILDER_H
|
#define GS_STRING_BUILDER_H
|
||||||
|
|
|
@ -8,6 +8,62 @@
|
||||||
#include "gs_meta.cpp"
|
#include "gs_meta.cpp"
|
||||||
#include "gs_meta_typeinfo_generator.h"
|
#include "gs_meta_typeinfo_generator.h"
|
||||||
|
|
||||||
|
internal void
|
||||||
|
GenerateNodeMetaInfo (gsm_code_generator* NodeTypeGen, string_builder* CallNodeProcGen, gs_meta_preprocessor Meta)
|
||||||
|
{
|
||||||
|
// TODO(Peter): Create a FilterTypesByTag function to create a contiguous array
|
||||||
|
// of type_definition**
|
||||||
|
|
||||||
|
WriteF(CallNodeProcGen, "void CallNodeProc(node_type Type, u8* NodeData)\n{\n");
|
||||||
|
WriteF(CallNodeProcGen, " switch(Type) { \n");
|
||||||
|
for (u32 b = 0; b < Meta.TypeTable.TypeBucketsCount; b++)
|
||||||
|
{
|
||||||
|
type_table_hash_bucket Bucket = Meta.TypeTable.Types[b];
|
||||||
|
for (u32 i = 0; i < TYPE_TABLE_BUCKET_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Bucket.Keys[i] == 0) { continue; }
|
||||||
|
|
||||||
|
type_definition* Decl = Bucket.Values + i;
|
||||||
|
if (HasTag(MakeStringLiteral("node_proc"), Decl->MetaTags) &&
|
||||||
|
Decl->Type == TypeDef_Function)
|
||||||
|
{
|
||||||
|
if (Decl->Function.Parameters.Used > 1)
|
||||||
|
{
|
||||||
|
WriteF(CallNodeProcGen, "ERROR: Procedure tagged with node_proc has more than one parameter\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddEnumElement(NodeTypeGen, Decl->Identifier);
|
||||||
|
|
||||||
|
type_table_handle ReturnTypeHandle = Decl->Function.ReturnTypeHandle;
|
||||||
|
type_definition* ReturnType = GetTypeDefinition(ReturnTypeHandle, Meta.TypeTable);
|
||||||
|
|
||||||
|
WriteF(CallNodeProcGen, " case NodeType_%.*s:\n", StringExpand(Decl->Identifier));
|
||||||
|
WriteF(CallNodeProcGen, " {\n");
|
||||||
|
WriteF(CallNodeProcGen, " %.*s(", StringExpand(Decl->Identifier));
|
||||||
|
|
||||||
|
for (u32 j = 0; j < Decl->Function.Parameters.Used; j++)
|
||||||
|
{
|
||||||
|
variable_decl* Param = Decl->Function.Parameters.GetElementAtIndex(j);
|
||||||
|
type_table_handle ParamTypeHandle = Param->TypeHandle;
|
||||||
|
type_definition* ParamType = GetTypeDefinition(ParamTypeHandle, Meta.TypeTable);
|
||||||
|
WriteF(CallNodeProcGen, "(%.*s*)NodeData", StringExpand(ParamType->Identifier));
|
||||||
|
if (j + 1 < Decl->Function.Parameters.Used)
|
||||||
|
{
|
||||||
|
WriteF(CallNodeProcGen, ", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WriteF(CallNodeProcGen, ");\n");
|
||||||
|
WriteF(CallNodeProcGen, " } break;\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WriteF(CallNodeProcGen, " }\n");
|
||||||
|
WriteF(CallNodeProcGen, "}\n\n");
|
||||||
|
|
||||||
|
FinishEnumGeneration(NodeTypeGen);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int ArgCount, char* Args[])
|
int main(int ArgCount, char* Args[])
|
||||||
{
|
{
|
||||||
if (ArgCount <= 1)
|
if (ArgCount <= 1)
|
||||||
|
@ -24,39 +80,10 @@ int main(int ArgCount, char* Args[])
|
||||||
FinishGeneratingTypes(&TypeGenerator);
|
FinishGeneratingTypes(&TypeGenerator);
|
||||||
|
|
||||||
gsm_code_generator NodeTypeGen = BeginEnumGeneration("node_type", "NodeType", false, true);
|
gsm_code_generator NodeTypeGen = BeginEnumGeneration("node_type", "NodeType", false, true);
|
||||||
// TODO(Peter): Create a FilterTypesByTag function to create a contiguous array
|
string_builder CallNodeProcGen = {0};
|
||||||
// of type_definition**
|
GenerateNodeMetaInfo(&NodeTypeGen, &CallNodeProcGen, Meta);
|
||||||
printf("\n\n");
|
|
||||||
for (u32 b = 0; b < Meta.TypeTable.TypeBucketsCount; b++)
|
|
||||||
{
|
|
||||||
type_table_hash_bucket Bucket = Meta.TypeTable.Types[b];
|
|
||||||
for (u32 i = 0; i < TYPE_TABLE_BUCKET_MAX; i++)
|
|
||||||
{
|
|
||||||
if (!Bucket.Keys[i] == 0) { continue; }
|
|
||||||
|
|
||||||
type_definition* Decl = Bucket.Values + i;
|
|
||||||
if (HasTag(MakeStringLiteral("node_proc"), Decl->MetaTags) &&
|
|
||||||
Decl->Type == TypeDef_Function)
|
|
||||||
{
|
|
||||||
AddEnumElement(&NodeTypeGen, Decl->Identifier);
|
|
||||||
|
|
||||||
type_table_handle ReturnTypeHandle = Decl->Function.ReturnTypeHandle;
|
|
||||||
type_definition* ReturnType = GetTypeDefinition(ReturnTypeHandle, Meta.TypeTable);
|
|
||||||
printf("%.*s %.*s(\n", StringExpand(ReturnType->Identifier), StringExpand(Decl->Identifier));
|
|
||||||
for (u32 j = 0; j < Decl->Function.Parameters.Used; j++)
|
|
||||||
{
|
|
||||||
variable_decl* Param = Decl->Function.Parameters.GetElementAtIndex(j);
|
|
||||||
type_table_handle ParamTypeHandle = Param->TypeHandle;
|
|
||||||
type_definition* ParamType = GetTypeDefinition(ParamTypeHandle, Meta.TypeTable);
|
|
||||||
printf(" %.*s %.*s,\n", StringExpand(ParamType->Identifier), StringExpand(Param->Identifier));
|
|
||||||
}
|
|
||||||
printf(");\n\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("\n\n");
|
|
||||||
|
|
||||||
FinishEnumGeneration(&NodeTypeGen);
|
string_builder PanelInfoGen = {0};
|
||||||
|
|
||||||
FILE* TypeInfoH = fopen("C:\\projects\\foldhaus\\src\\generated\\gs_meta_generated_typeinfo.h", "w");
|
FILE* TypeInfoH = fopen("C:\\projects\\foldhaus\\src\\generated\\gs_meta_generated_typeinfo.h", "w");
|
||||||
if (TypeInfoH)
|
if (TypeInfoH)
|
||||||
|
@ -71,10 +98,12 @@ int main(int ArgCount, char* Args[])
|
||||||
if (NodeInfoH)
|
if (NodeInfoH)
|
||||||
{
|
{
|
||||||
WriteStringBuilderToFile(*NodeTypeGen.Builder, NodeInfoH);
|
WriteStringBuilderToFile(*NodeTypeGen.Builder, NodeInfoH);
|
||||||
|
WriteStringBuilderToFile(CallNodeProcGen, NodeInfoH);
|
||||||
fclose(NodeInfoH);
|
fclose(NodeInfoH);
|
||||||
}
|
}
|
||||||
|
|
||||||
FinishMetaprogram(&Meta);
|
FinishMetaprogram(&Meta);
|
||||||
|
|
||||||
//__debugbreak();
|
//__debugbreak();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,18 @@ enum type_definition_type
|
||||||
TypeDef_Count,
|
TypeDef_Count,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char* TypeDefinitionTypeStrings[] = {
|
||||||
|
"TypeDef_Invalid",
|
||||||
|
"TypeDef_Unknown",
|
||||||
|
"TypeDef_Enum",
|
||||||
|
"TypeDef_Struct",
|
||||||
|
"TypeDef_Union",
|
||||||
|
"TypeDef_BasicType",
|
||||||
|
"TypeDef_FunctionPointer",
|
||||||
|
"TypeDef_Function",
|
||||||
|
"TypeDef_Count",
|
||||||
|
};
|
||||||
|
|
||||||
struct type_table_handle
|
struct type_table_handle
|
||||||
{
|
{
|
||||||
s32 BucketIndex;
|
s32 BucketIndex;
|
||||||
|
@ -100,7 +112,7 @@ struct type_definition
|
||||||
b32 Pointer;
|
b32 Pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TYPE_TABLE_BUCKET_MAX 1024
|
#define TYPE_TABLE_BUCKET_MAX 1023
|
||||||
struct type_table_hash_bucket
|
struct type_table_hash_bucket
|
||||||
{
|
{
|
||||||
u32* Keys;
|
u32* Keys;
|
||||||
|
@ -171,11 +183,9 @@ HashIdentifier(string Identifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal type_table_handle
|
internal type_table_handle
|
||||||
PushTypeOnHashTable(type_definition TypeDef, type_table* TypeTable)
|
FindSlotForTypeIdentifier(u32 IdentHash, type_table* TypeTable)
|
||||||
{
|
{
|
||||||
type_table_handle Result = InvalidTypeTableHandle;
|
type_table_handle Result = InvalidTypeTableHandle;
|
||||||
|
|
||||||
u32 IdentHash = HashIdentifier(TypeDef.Identifier);
|
|
||||||
u32 Index = IdentHash % TYPE_TABLE_BUCKET_MAX;
|
u32 Index = IdentHash % TYPE_TABLE_BUCKET_MAX;
|
||||||
|
|
||||||
for (u32 b = 0; b < TypeTable->TypeBucketsCount; b++)
|
for (u32 b = 0; b < TypeTable->TypeBucketsCount; b++)
|
||||||
|
@ -183,11 +193,9 @@ PushTypeOnHashTable(type_definition TypeDef, type_table* TypeTable)
|
||||||
type_table_hash_bucket* Bucket = TypeTable->Types + b;
|
type_table_hash_bucket* Bucket = TypeTable->Types + b;
|
||||||
if (Bucket->Keys[Index] == 0)
|
if (Bucket->Keys[Index] == 0)
|
||||||
{
|
{
|
||||||
Bucket->Keys[Index] = IdentHash;
|
|
||||||
Bucket->Values[Index] = TypeDef;
|
|
||||||
|
|
||||||
Result.BucketIndex = b;
|
Result.BucketIndex = b;
|
||||||
Result.IndexInBucket = Index;
|
Result.IndexInBucket = Index;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,13 +212,32 @@ PushTypeOnHashTable(type_definition TypeDef, type_table* TypeTable)
|
||||||
GSZeroMemory((u8*)NewBucket->Keys, sizeof(u32) * TYPE_TABLE_BUCKET_MAX);
|
GSZeroMemory((u8*)NewBucket->Keys, sizeof(u32) * TYPE_TABLE_BUCKET_MAX);
|
||||||
GSZeroMemory((u8*)NewBucket->Values, sizeof(type_definition) * TYPE_TABLE_BUCKET_MAX);
|
GSZeroMemory((u8*)NewBucket->Values, sizeof(type_definition) * TYPE_TABLE_BUCKET_MAX);
|
||||||
|
|
||||||
NewBucket->Keys[Index] = IdentHash;
|
|
||||||
NewBucket->Values[Index] = TypeDef;
|
|
||||||
|
|
||||||
Result.BucketIndex = NewTypeBucketIndex;
|
Result.BucketIndex = NewTypeBucketIndex;
|
||||||
Result.IndexInBucket = Index;
|
Result.IndexInBucket = Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(Peter): Because we are growing the hashtable, this should never be an invalid
|
||||||
|
// type handle
|
||||||
|
Assert(TypeHandleIsValid(Result));
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal type_table_handle
|
||||||
|
PushTypeOnHashTable(type_definition TypeDef, type_table* TypeTable)
|
||||||
|
{
|
||||||
|
u32 IdentHash = HashIdentifier(TypeDef.Identifier);
|
||||||
|
type_table_handle Result = FindSlotForTypeIdentifier(IdentHash, TypeTable);
|
||||||
|
|
||||||
|
type_table_hash_bucket* Bucket = TypeTable->Types + Result.BucketIndex;
|
||||||
|
Bucket->Keys[Result.IndexInBucket] = IdentHash;
|
||||||
|
Bucket->Values[Result.IndexInBucket] = TypeDef;
|
||||||
|
|
||||||
|
#if PRINT_DIAGNOSTIC_INFO
|
||||||
|
printf("Registering Type\n");
|
||||||
|
printf(" %.*s\n", StringExpand(TypeDef.Identifier));
|
||||||
|
printf(" Type: %s\n\n", TypeDefinitionTypeStrings[TypeDef.Type]);
|
||||||
|
#endif
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,5 +621,119 @@ PopulateTableWithDefaultCPPTypes(type_table* TypeTable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
PrintTypeDefinition(type_definition TypeDef, type_table TypeTable)
|
||||||
|
{
|
||||||
|
printf("Type: %.*s\n", StringExpand(TypeDef.Identifier));
|
||||||
|
printf(" Size: %d\n", TypeDef.Size);
|
||||||
|
|
||||||
|
printf(" Meta Tags: ");
|
||||||
|
for (u32 m = 0; m < TypeDef.MetaTags.Used; m++)
|
||||||
|
{
|
||||||
|
meta_tag* Tag = TypeDef.MetaTags.GetElementAtIndex(m);
|
||||||
|
printf("%.*s ", StringExpand(Tag->Identifier));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
printf(" Type: %s\n", TypeDefinitionTypeStrings[TypeDef.Type]);
|
||||||
|
|
||||||
|
switch(TypeDef.Type)
|
||||||
|
{
|
||||||
|
case TypeDef_Unknown:
|
||||||
|
{
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_Enum:
|
||||||
|
{
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_Struct:
|
||||||
|
{
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_Union:
|
||||||
|
{
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_BasicType:
|
||||||
|
{
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_FunctionPointer:
|
||||||
|
{
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_Function:
|
||||||
|
{
|
||||||
|
type_definition* ReturnType = GetTypeDefinition(TypeDef.Function.ReturnTypeHandle, TypeTable);
|
||||||
|
printf(" Returns: %.*s\n", StringExpand(ReturnType->Identifier));
|
||||||
|
|
||||||
|
printf(" Parameters: ");
|
||||||
|
for (u32 p = 0; p < TypeDef.Function.Parameters.Used; p++)
|
||||||
|
{
|
||||||
|
variable_decl* Param = TypeDef.Function.Parameters.GetElementAtIndex(p);
|
||||||
|
type_definition* ParamType = GetTypeDefinition(Param->TypeHandle, TypeTable);
|
||||||
|
printf("%.*s %.*s, ", StringExpand(ParamType->Identifier), StringExpand(Param->Identifier));
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TypeDef_Invalid:
|
||||||
|
case TypeDef_Count:
|
||||||
|
{
|
||||||
|
printf("???\n");
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
PrintTypeTable(type_table TypeTable)
|
||||||
|
{
|
||||||
|
for (u32 b = 0; b < TypeTable.TypeBucketsCount; b++)
|
||||||
|
{
|
||||||
|
type_table_hash_bucket Bucket = TypeTable.Types[b];
|
||||||
|
for (u32 i = 0; i < TYPE_TABLE_BUCKET_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Bucket.Keys[i] != 0)
|
||||||
|
{
|
||||||
|
PrintTypeDefinition(Bucket.Values[i], TypeTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
DEBUGPrintTypeTableMembership(type_table TypeTable)
|
||||||
|
{
|
||||||
|
printf("\n--- Type Table Membership --\n");
|
||||||
|
u32 SlotsAvailable = 0;
|
||||||
|
u32 SlotsFilled = 0;
|
||||||
|
u32 TotalSlots = TypeTable.TypeBucketsCount * TYPE_TABLE_BUCKET_MAX;
|
||||||
|
for (u32 b = 0; b < TypeTable.TypeBucketsCount; b++)
|
||||||
|
{
|
||||||
|
type_table_hash_bucket Bucket = TypeTable.Types[b];
|
||||||
|
for (u32 i = 0; i < TYPE_TABLE_BUCKET_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Bucket.Keys[i] != 0)
|
||||||
|
{
|
||||||
|
SlotsFilled++;
|
||||||
|
printf("[x] ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SlotsAvailable++;
|
||||||
|
printf("[ ] ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
r32 PercentUsed = (r32)SlotsFilled / (r32)TotalSlots;
|
||||||
|
printf("Slots Available: %d\n", SlotsAvailable);
|
||||||
|
printf("Slots Filled: %d\n", SlotsFilled);
|
||||||
|
printf("Total Slots: %d\n", TotalSlots);
|
||||||
|
printf("Percent Used: %f\n", PercentUsed);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
#define FOLDHAUS_META_TYPE_TABLE_H
|
#define FOLDHAUS_META_TYPE_TABLE_H
|
||||||
#endif // FOLDHAUS_META_TYPE_TABLE_H
|
#endif // FOLDHAUS_META_TYPE_TABLE_H
|
|
@ -15,7 +15,7 @@ blacklist_patterns = {
|
||||||
load_paths_base = {
|
load_paths_base = {
|
||||||
{ "src", .relative = true, .recursive = true, },
|
{ "src", .relative = true, .recursive = true, },
|
||||||
{ "meta", .relative = true, .recursive = true, },
|
{ "meta", .relative = true, .recursive = true, },
|
||||||
{ "C:\programs-dev\gs_libs\src", .relative = false, .recursive = true, }
|
{ "gs_libs", .relative = true, .recursive = true, },
|
||||||
};
|
};
|
||||||
load_paths = {
|
load_paths = {
|
||||||
{ load_paths_base, .os = "win", },
|
{ load_paths_base, .os = "win", },
|
||||||
|
|
|
@ -233,6 +233,17 @@ typedef PANEL_CLEANUP_PROC(panel_cleanup_proc);
|
||||||
#define PANEL_RENDER_PROC(name) void name(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
#define PANEL_RENDER_PROC(name) void name(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
typedef PANEL_RENDER_PROC(panel_render_proc);
|
typedef PANEL_RENDER_PROC(panel_render_proc);
|
||||||
|
|
||||||
|
// NOTE(Peter): This is used by the meta system to generate panel type info
|
||||||
|
struct panel_definition
|
||||||
|
{
|
||||||
|
char* PanelName;
|
||||||
|
s32 PanelNameLength;
|
||||||
|
panel_init_proc* Init;
|
||||||
|
panel_cleanup_proc* Cleanup;
|
||||||
|
panel_render_proc* Render;
|
||||||
|
input_command* InputCommands;
|
||||||
|
};
|
||||||
|
|
||||||
#include "panels/foldhaus_panel_sculpture_view.h"
|
#include "panels/foldhaus_panel_sculpture_view.h"
|
||||||
#include "panels/foldhaus_panel_profiler.h"
|
#include "panels/foldhaus_panel_profiler.h"
|
||||||
#include "panels/foldhaus_panel_dmx_view.h"
|
#include "panels/foldhaus_panel_dmx_view.h"
|
||||||
|
@ -241,6 +252,7 @@ typedef PANEL_RENDER_PROC(panel_render_proc);
|
||||||
#include "panels/foldhaus_panel_node_graph.h"
|
#include "panels/foldhaus_panel_node_graph.h"
|
||||||
|
|
||||||
#include "generated/foldhaus_panels_generated.h"
|
#include "generated/foldhaus_panels_generated.h"
|
||||||
|
#include "generated/foldhaus_nodes_generated.h"
|
||||||
|
|
||||||
#include "foldhaus_interface.cpp"
|
#include "foldhaus_interface.cpp"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,26 @@
|
||||||
enum node_type
|
enum node_type
|
||||||
{
|
{
|
||||||
|
NodeType_RevolvingDiscs,
|
||||||
|
NodeType_VerticalColorFadeProc,
|
||||||
|
NodeType_SolidColorProc,
|
||||||
NodeType_Count,
|
NodeType_Count,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void CallNodeProc(node_type Type, u8* NodeData)
|
||||||
|
{
|
||||||
|
switch(Type) {
|
||||||
|
case NodeType_RevolvingDiscs:
|
||||||
|
{
|
||||||
|
RevolvingDiscs((revolving_discs_data*)NodeData);
|
||||||
|
} break;
|
||||||
|
case NodeType_VerticalColorFadeProc:
|
||||||
|
{
|
||||||
|
VerticalColorFadeProc((vertical_color_fade_data*)NodeData);
|
||||||
|
} break;
|
||||||
|
case NodeType_SolidColorProc:
|
||||||
|
{
|
||||||
|
SolidColorProc((solid_color_data*)NodeData);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,3 @@
|
||||||
struct panel_definition
|
|
||||||
{
|
|
||||||
char* PanelName;
|
|
||||||
s32 PanelNameLength;
|
|
||||||
panel_init_proc* Init;
|
|
||||||
panel_cleanup_proc* Cleanup;
|
|
||||||
panel_render_proc* Render;
|
|
||||||
input_command* InputCommands;
|
|
||||||
};
|
|
||||||
|
|
||||||
global_variable s32 GlobalPanelDefsCount = 6;
|
global_variable s32 GlobalPanelDefsCount = 6;
|
||||||
global_variable panel_definition GlobalPanelDefs[] = {
|
global_variable panel_definition GlobalPanelDefs[] = {
|
||||||
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands},
|
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands},
|
||||||
|
|
|
@ -17,7 +17,8 @@ struct node_lister_operation_state
|
||||||
v2 ListPosition;
|
v2 ListPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderNodeLister)
|
internal void
|
||||||
|
RenderNodeLister(panel Panel, rect PanelBounds, render_command_buffer* RenderBufer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
node_lister_operation_state* OpState = (node_lister_operation_state*)Operation.OpStateMemory;
|
node_lister_operation_state* OpState = (node_lister_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
|
@ -132,7 +133,8 @@ FOLDHAUS_INPUT_COMMAND_PROC(CloseColorPickerCommand)
|
||||||
CloseColorPicker(State);
|
CloseColorPicker(State);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderColorPicker)
|
internal void
|
||||||
|
RenderColorPicker(panel Panel, rect PanelBounds, render_command_buffer* RenderBufer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
color_picker_operation_state* OpState = (color_picker_operation_state*)Operation.OpStateMemory;
|
color_picker_operation_state* OpState = (color_picker_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
|
@ -200,7 +202,8 @@ struct drag_node_port_operation_state
|
||||||
node_interaction Interaction;
|
node_interaction Interaction;
|
||||||
};
|
};
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderDraggingNodePort)
|
internal void
|
||||||
|
RenderDraggingNodePort(panel Panel, rect PanelBounds, render_command_buffer* RenderBufer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
drag_node_port_operation_state* OpState = (drag_node_port_operation_state*)Operation.OpStateMemory;
|
drag_node_port_operation_state* OpState = (drag_node_port_operation_state*)Operation.OpStateMemory;
|
||||||
UpdateDraggingNodePort(Mouse.Pos, OpState->Interaction, State->NodeList,
|
UpdateDraggingNodePort(Mouse.Pos, OpState->Interaction, State->NodeList,
|
||||||
|
@ -239,7 +242,8 @@ BeginDraggingNodePort(app_state* State, node_interaction Interaction)
|
||||||
//
|
//
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderDragNodeField)
|
internal void
|
||||||
|
RenderDragNodeField(panel Panel, rect PanelBounds, render_command_buffer* RenderBufer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
// TODO(Peter):
|
// TODO(Peter):
|
||||||
//UpdateDraggingNodeValue(Mouse.Pos, Mouse.OldPos, OpState->Interaction, State->NodeList, State->NodeRenderSettings, State);
|
//UpdateDraggingNodeValue(Mouse.Pos, Mouse.OldPos, OpState->Interaction, State->NodeList, State->NodeRenderSettings, State);
|
||||||
|
@ -262,7 +266,8 @@ struct drag_node_operation_state
|
||||||
node_interaction Interaction;
|
node_interaction Interaction;
|
||||||
};
|
};
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderDraggingNode)
|
internal void
|
||||||
|
RenderDraggingNode(panel Panel, rect PanelBounds, render_command_buffer* RenderBufer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
drag_node_operation_state* OpState = GetCurrentOperationState(State->Modes, drag_node_operation_state);
|
drag_node_operation_state* OpState = GetCurrentOperationState(State->Modes, drag_node_operation_state);
|
||||||
UpdateDraggingNode(Mouse.Pos, OpState->Interaction, State->NodeList,
|
UpdateDraggingNode(Mouse.Pos, OpState->Interaction, State->NodeList,
|
||||||
|
@ -363,7 +368,8 @@ FOLDHAUS_INPUT_COMMAND_PROC(NodeViewBeginMouseSelectInteraction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderNodeView)
|
internal void
|
||||||
|
RenderNodeView(panel Panel, rect PanelBounds, render_command_buffer* RenderBufer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
node_view_operation_state* OpState = (node_view_operation_state*)Operation.OpStateMemory;
|
node_view_operation_state* OpState = (node_view_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
|
|
|
@ -213,12 +213,17 @@ input_command AnimationTimeline_Commands[] = {
|
||||||
{ KeyCode_A, KeyCode_Invalid, Command_Began, AddAnimationBlockCommand },
|
{ KeyCode_A, KeyCode_Invalid, Command_Began, AddAnimationBlockCommand },
|
||||||
};
|
};
|
||||||
|
|
||||||
PANEL_INIT_PROC(AnimationTimeline_Init)
|
|
||||||
|
GSMetaTag(panel_init);
|
||||||
|
internal void
|
||||||
|
AnimationTimeline_Init(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_CLEANUP_PROC(AnimationTimeline_Cleanup)
|
GSMetaTag(panel_cleanup);
|
||||||
|
internal void
|
||||||
|
AnimationTimeline_Cleanup(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -419,7 +424,9 @@ DrawAnimationClipsList(rect PanelBounds, mouse_state Mouse, render_command_buffe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_RENDER_PROC(AnimationTimeline_Render)
|
GSMetaTag(panel_render);
|
||||||
|
internal void
|
||||||
|
AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
gs_list_handle SelectedBlockHandle = State->SelectedAnimationBlockHandle;
|
gs_list_handle SelectedBlockHandle = State->SelectedAnimationBlockHandle;
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,23 @@
|
||||||
//
|
//
|
||||||
#ifndef FOLDHAUS_PANEL_DMX_VIEW_H
|
#ifndef FOLDHAUS_PANEL_DMX_VIEW_H
|
||||||
|
|
||||||
PANEL_INIT_PROC(DMXView_Init)
|
GSMetaTag(panel_init);
|
||||||
|
internal void
|
||||||
|
DMXView_Init(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_CLEANUP_PROC(DMXView_Cleanup)
|
GSMetaTag(panel_cleanup);
|
||||||
|
internal void
|
||||||
|
DMXView_Cleanup(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_RENDER_PROC(DMXView_Render)
|
GSMetaTag(panel_render);
|
||||||
|
internal void
|
||||||
|
DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
DEBUG_TRACK_SCOPE(DrawUniverseOutputDisplay);
|
DEBUG_TRACK_SCOPE(DrawUniverseOutputDisplay);
|
||||||
|
|
|
@ -5,17 +5,23 @@
|
||||||
//
|
//
|
||||||
#ifndef FOLDHAUS_PANEL_HIERARCHY_H
|
#ifndef FOLDHAUS_PANEL_HIERARCHY_H
|
||||||
|
|
||||||
PANEL_INIT_PROC(HierarchyView_Init)
|
GSMetaTag(panel_init)
|
||||||
|
internal void
|
||||||
|
HierarchyView_Init(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_CLEANUP_PROC(HierarchyView_Cleanup)
|
GSMetaTag(panel_cleanup);
|
||||||
|
internal void
|
||||||
|
HierarchyView_Cleanup(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_RENDER_PROC(HierarchyView_Render)
|
GSMetaTag(panel_render);
|
||||||
|
internal void
|
||||||
|
HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
r32 PanelWidth = PanelBounds.Max.x - PanelBounds.Min.x;
|
r32 PanelWidth = PanelBounds.Max.x - PanelBounds.Min.x;
|
||||||
r32 PanelHeight = PanelBounds.Max.y - PanelBounds.Min.y;
|
r32 PanelHeight = PanelBounds.Max.y - PanelBounds.Min.y;
|
||||||
|
|
|
@ -172,7 +172,9 @@ input_command NodeGraph_Commands[] = {
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
PANEL_INIT_PROC(NodeGraph_Init)
|
GSMetaTag(panel_init);
|
||||||
|
internal void
|
||||||
|
NodeGraph_Init(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
// TODO(Peter): We aren't able to free this memory. We need a system for
|
// TODO(Peter): We aren't able to free this memory. We need a system for
|
||||||
// taking fixed size chunks off the Memory stack and then reusing them. THis
|
// taking fixed size chunks off the Memory stack and then reusing them. THis
|
||||||
|
@ -182,7 +184,9 @@ PANEL_INIT_PROC(NodeGraph_Init)
|
||||||
GraphState->LayoutIsDirty = true;
|
GraphState->LayoutIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_CLEANUP_PROC(NodeGraph_Cleanup)
|
GSMetaTag(panel_cleanup);
|
||||||
|
internal void
|
||||||
|
NodeGraph_Cleanup(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
node_graph_state* GraphState = (node_graph_state*)Panel->PanelStateMemory;
|
node_graph_state* GraphState = (node_graph_state*)Panel->PanelStateMemory;
|
||||||
FreeMemoryArena(&GraphState->LayoutMemory);
|
FreeMemoryArena(&GraphState->LayoutMemory);
|
||||||
|
@ -389,8 +393,9 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal
|
GSMetaTag(panel_render);
|
||||||
PANEL_RENDER_PROC(NodeGraph_Render)
|
internal void
|
||||||
|
NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
node_graph_state* GraphState = (node_graph_state*)Panel.PanelStateMemory;
|
node_graph_state* GraphState = (node_graph_state*)Panel.PanelStateMemory;
|
||||||
b32 MouseHandled = false;
|
b32 MouseHandled = false;
|
||||||
|
|
|
@ -5,12 +5,16 @@
|
||||||
//
|
//
|
||||||
#ifndef FOLDHAUS_PANEL_PROFILER_H
|
#ifndef FOLDHAUS_PANEL_PROFILER_H
|
||||||
|
|
||||||
PANEL_INIT_PROC(ProfilerView_Init)
|
GSMetaTag(panel_init);
|
||||||
|
internal void
|
||||||
|
ProfilerView_Init(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_CLEANUP_PROC(ProfilerView_Cleanup)
|
GSMetaTag(panel_cleanup);
|
||||||
|
internal void
|
||||||
|
ProfilerView_Cleanup(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,7 +118,9 @@ RenderProfiler_ListVisualization(render_command_buffer* RenderBuffer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_RENDER_PROC(ProfilerView_Render)
|
GSMetaTag(panel_render);
|
||||||
|
internal void
|
||||||
|
ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
memory_arena* Memory = &State->Transient;
|
memory_arena* Memory = &State->Transient;
|
||||||
string String = InitializeEmptyString(PushArray(Memory, char, 256), 256);
|
string String = InitializeEmptyString(PushArray(Memory, char, 256), 256);
|
||||||
|
|
|
@ -49,12 +49,14 @@ input_command SculptureView_Commands[] = {
|
||||||
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Began, Begin3DViewMouseRotate },
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Began, Begin3DViewMouseRotate },
|
||||||
};
|
};
|
||||||
|
|
||||||
PANEL_INIT_PROC(SculptureView_Init)
|
internal void
|
||||||
|
SculptureView_Init(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_CLEANUP_PROC(SculptureView_Cleanup)
|
internal void
|
||||||
|
SculptureView_Cleanup(panel* Panel, app_state* State)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,7 +124,8 @@ DrawLEDsInBufferRangeJob (s32 ThreadID, void* JobData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_RENDER_PROC(SculptureView_Render)
|
internal void
|
||||||
|
SculptureView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
DEBUG_TRACK_SCOPE(RenderSculpture);
|
DEBUG_TRACK_SCOPE(RenderSculpture);
|
||||||
|
|
||||||
|
|
11
todo.txt
11
todo.txt
|
@ -2,10 +2,15 @@ TODO FOLDHAUS
|
||||||
|
|
||||||
Ground Up Reengineering
|
Ground Up Reengineering
|
||||||
- Metaprogramming
|
- Metaprogramming
|
||||||
- refactor for speed
|
x refactor for speed
|
||||||
- use #include statements to crawl through the codebase
|
x use #include statements to crawl through the codebase
|
||||||
- generalize the system
|
x generalize the system
|
||||||
- panels metaprogramming
|
- panels metaprogramming
|
||||||
|
- fix memory layout (remeber to profile before and after)
|
||||||
|
|
||||||
|
- Buckets & Lists
|
||||||
|
- Allow them to use memory arenas
|
||||||
|
- Zero is initialization
|
||||||
|
|
||||||
- Rendering
|
- Rendering
|
||||||
- OpenGL 3
|
- OpenGL 3
|
||||||
|
|
Loading…
Reference in New Issue