Began generating panel info via the meta program

This commit is contained in:
Peter Slattery 2020-02-29 14:23:46 -08:00
parent 09e6d4d15b
commit 67d3dd1e26
17 changed files with 612 additions and 167 deletions

View File

@ -26,7 +26,7 @@ GenerateNodeMetaInfo (gsm_code_generator* NodeTypeGen, string_builder* NodeSpeci
if (Bucket.Keys[i] == 0) { continue; }
type_definition* Decl = Bucket.Values + i;
if (HasTag(MakeStringLiteral("node_proc"), Decl->MetaTags) &&
if (HasTag(MakeStringLiteral("node_proc"), Decl->MetaTags, Meta.TypeTable) &&
Decl->Type == TypeDef_Function)
{
if (Decl->Function.Parameters.Used > 1)
@ -68,6 +68,192 @@ GenerateNodeMetaInfo (gsm_code_generator* NodeTypeGen, string_builder* NodeSpeci
FinishEnumGeneration(NodeTypeGen);
}
struct panel_elements
{
string PanelIdentifier;
type_table_handle InitProcDecl;
type_table_handle CleanupProcDecl;
type_table_handle RenderProcDecl;
type_table_handle PanelCommandsStruct;
};
internal b32
StringIsPrefixedBy (string Prefix, string TestString)
{
b32 Result = false;
if (TestString.Length >= Prefix.Length)
{
Result = true;
for (s32 i = 0; i < Prefix.Length; i++)
{
if (Prefix.Memory[i] != TestString.Memory[i])
{
Result = false;
break;
}
}
}
return Result;
}
internal void
AttemptPlacePanelProc(type_table_handle ProcHandle, type_table TypeTable, gs_bucket<panel_elements>* Panels)
{
string InitProcTag = MakeStringLiteral("panel_init");
string CleanupProcTag = MakeStringLiteral("panel_cleanup");
string RenderProcTag = MakeStringLiteral("panel_render");
string PanelTypePrefix = MakeStringLiteral("panel_type_");
type_definition* Decl = GetTypeDefinition(ProcHandle, TypeTable);
meta_tag* PanelTypeTag = 0;
for (u32 i = 0; i < Decl->MetaTags.Used; i++)
{
type_table_handle MetaTagHandle = *Decl->MetaTags.GetElementAtIndex(i);
meta_tag* MetaTag = GetMetaTag(MetaTagHandle, TypeTable);
if (StringIsPrefixedBy(PanelTypePrefix, MetaTag->Identifier))
{
PanelTypeTag = MetaTag;
break;
}
}
if (PanelTypeTag != 0)
{
s32 PanelIndex = -1;
for (u32 i = 0; i < Panels->Used; i++)
{
panel_elements* Panel = Panels->GetElementAtIndex(i);
if (StringsEqual(Panel->PanelIdentifier, PanelTypeTag->Identifier))
{
PanelIndex = (s32)i;
break;
}
}
if (PanelIndex < 0)
{
panel_elements NewPanel = {0};
NewPanel.PanelIdentifier = PanelTypeTag->Identifier;
PanelIndex = Panels->PushElementOnBucket(NewPanel);
}
Assert(PanelIndex >= 0);
panel_elements* PanelElements = Panels->GetElementAtIndex(PanelIndex);
if (HasTag(InitProcTag, Decl->MetaTags, TypeTable))
{
PanelElements->InitProcDecl = ProcHandle;
}
else if (HasTag(CleanupProcTag, Decl->MetaTags, TypeTable))
{
PanelElements->CleanupProcDecl = ProcHandle;
}
else if (HasTag(RenderProcTag, Decl->MetaTags, TypeTable))
{
PanelElements->RenderProcDecl = ProcHandle;
}
}
}
internal void
AttemptPlacePanelCommands(type_table_handle StructHandle, type_table TypeTable, gs_bucket<panel_elements>* Panels)
{
string CommandsTag = MakeStringLiteral("panel_commands");
type_definition* Decl = GetTypeDefinition(StructHandle, TypeTable);
if (HasTag(CommandsTag, Decl->MetaTags, TypeTable))
{
for (u32 i = 0; i < Decl->MetaTags.Used; i++)
{
type_table_handle MetaTagHandle = *Decl->MetaTags.GetElementAtIndex(i);
meta_tag* MetaTag = GetMetaTag(MetaTagHandle, TypeTable);
printf("%.*s, ", StringExpand(MetaTag->Identifier));
}
printf("\n");
}
}
internal void
MakeReadableIdentifier(string* Identifier)
{
for (s32 i = 0; i < Identifier->Length; i++)
{
char At = Identifier->Memory[i];
if (At == '_')
{
Identifier->Memory[i] = ' ';
}
else if (IsAlpha(At) && (i == 0 || IsWhitespace(Identifier->Memory[i - 1])))
{
Identifier->Memory[i] = ToUpper(At);
}
}
}
internal void
GeneratePanelMetaInfo(gs_meta_preprocessor Meta, string_builder* PanelCodeGen)
{
gs_bucket<panel_elements> Panels = {0};
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_table_handle DeclHandle = {(s32)b, i};
type_definition* Decl = Bucket.Values + i;
if (Decl->Type == TypeDef_Function)
{
AttemptPlacePanelProc(DeclHandle, Meta.TypeTable, &Panels);
}
else if (Decl->Type == TypeDef_Struct)
{
AttemptPlacePanelCommands(DeclHandle, Meta.TypeTable, &Panels);
}
}
}
WriteF(PanelCodeGen, "global_variable s32 GlobalPanelDefsCount = %d;\n", Panels.Used);
WriteF(PanelCodeGen, "global_variable panel_definition GlobalPanelDefs[] = {\n");
for (u32 i = 0; i < Panels.Used; i++)
{
panel_elements* Panel = Panels.GetElementAtIndex(i);
string PanelIdentifier = {0};
PanelIdentifier.Max = Panel->PanelIdentifier.Length;
PanelIdentifier.Memory = (char*)malloc(sizeof(char) * PanelIdentifier.Max);
CopyStringTo(Substring(Panel->PanelIdentifier, 11), &PanelIdentifier);
MakeReadableIdentifier(&PanelIdentifier);
type_definition* InitDecl = GetTypeDefinition(Panel->InitProcDecl, Meta.TypeTable);
type_definition* CleanupDecl = GetTypeDefinition(Panel->CleanupProcDecl, Meta.TypeTable);
type_definition* RenderDecl = GetTypeDefinition(Panel->RenderProcDecl, Meta.TypeTable);
WriteF(PanelCodeGen, "{ \"%S\", %d, ", PanelIdentifier, PanelIdentifier.Length);
WriteF(PanelCodeGen, "%S, ", InitDecl->Identifier);
WriteF(PanelCodeGen, "%S, ", CleanupDecl->Identifier);
WriteF(PanelCodeGen, "%S, ", RenderDecl->Identifier);
// TODO(Peter): This is a shortcut cause I'm being lazy. We arent' putting arrays into the
// AST when we parse our codebase so there's no way to tag the array of Commands for each
// panel for use here. Instead, I'm just requiring that the array be of the form
// <panel_name_base>_Commands where panel_name_base is whatever the Init function is called
// minus _Input. So for example, if you have ScupltureView_Init, then the panel_name_base is
// SculptureView and the commands array must be called SculptureView_Commands.
// Ideally we actually go through and parse these arrays.
string InitSuffix = MakeStringLiteral("_Init");
string PanelNameBase = Substring(InitDecl->Identifier, 0, InitDecl->Identifier.Length - InitSuffix.Length);
WriteF(PanelCodeGen, "%S_Commands, ", PanelNameBase);
WriteF(PanelCodeGen, "%S_CommandsCount ", PanelNameBase);
WriteF(PanelCodeGen, "},\n");
}
WriteF(PanelCodeGen, "};\n");
}
int main(int ArgCount, char* Args[])
{
if (ArgCount <= 1)
@ -79,6 +265,7 @@ int main(int ArgCount, char* Args[])
gs_meta_preprocessor Meta = PreprocessProgram(Args[1]);
typeinfo_generator TypeGenerator = InitTypeInfoGenerator(Meta.TypeTable);
GenerateMetaTagList(Meta.TypeTable, &TypeGenerator);
GenerateFilteredTypeInfo(MakeStringLiteral("node_struct"), Meta.TypeTable, &TypeGenerator);
GenerateFilteredTypeInfo(MakeStringLiteral("gen_type_info"), Meta.TypeTable, &TypeGenerator);
FinishGeneratingTypes(&TypeGenerator);
@ -88,11 +275,14 @@ int main(int ArgCount, char* Args[])
string_builder CallNodeProcGen = {0};
GenerateNodeMetaInfo(&NodeTypeGen, &NodeSpecificationGen, &CallNodeProcGen, Meta);
string_builder PanelInfoGen = {0};
string_builder PanelCodeGen = {0};
GeneratePanelMetaInfo(Meta, &PanelCodeGen);
FILE* TypeInfoH = fopen("C:\\projects\\foldhaus\\src\\generated\\gs_meta_generated_typeinfo.h", "w");
if (TypeInfoH)
{
WriteStringBuilderToFile(TypeGenerator.MetaTagEnum, TypeInfoH);
WriteStringBuilderToFile(TypeGenerator.MetaTagString, TypeInfoH);
WriteStringBuilderToFile(*TypeGenerator.TypeList.Builder, TypeInfoH);
WriteStringBuilderToFile(TypeGenerator.StructMembers, TypeInfoH);
WriteStringBuilderToFile(TypeGenerator.TypeDefinitions, TypeInfoH);
@ -108,6 +298,13 @@ int main(int ArgCount, char* Args[])
fclose(NodeInfoH);
}
FILE* PanelInfoH = fopen("C:\\projects\\foldhaus\\src\\generated\\foldhaus_panels_generated.h", "w");
if (PanelInfoH)
{
WriteStringBuilderToFile(PanelCodeGen, PanelInfoH);
fclose(PanelInfoH);
}
FinishMetaprogram(&Meta);
//__debugbreak();

View File

@ -88,7 +88,7 @@ struct gs_meta_preprocessor
gs_bucket<source_code_file> SourceFiles;
gs_bucket<token> Tokens;
gs_bucket<token> TagList;
gs_bucket<type_table_handle> TagList;
type_table TypeTable;
@ -500,19 +500,28 @@ ParseMetaTag(token_iter* Iter, gs_meta_preprocessor* Meta)
token MetaIdentifier = {0};
if (TokenAtEquals(Iter, Token_Identifier, &MetaIdentifier))
{
Meta->TagList.PushElementOnBucket(MetaIdentifier);
if (StringsEqual(MetaIdentifier.Text, MakeStringLiteral("breakpoint")))
{
// NOTE(Peter): This is not a temporary breakpoint. It is
// used to be able to break the meta program at specific points
// throughout execution
__debugbreak();
}
if (TokenAtEquals(Iter, ")") &&
TokenAtEquals(Iter, ";"))
{
Result = true;
type_table_handle MetaTagHandle = GetMetaTagHandle(MetaIdentifier.Text, Meta->TypeTable);
if (!TypeHandleIsValid(MetaTagHandle))
{
meta_tag Tag = {0};
Tag.Identifier = MetaIdentifier.Text;
MetaTagHandle = PushMetaTagOnTable(Tag, &Meta->TypeTable);
}
Assert(TypeHandleIsValid(MetaTagHandle));
Meta->TagList.PushElementOnBucket(MetaTagHandle);
if (StringsEqual(MetaIdentifier.Text, MakeStringLiteral("breakpoint")))
{
// NOTE(Peter): This is not a temporary breakpoint. It is
// used to be able to break the meta program at specific points
// throughout execution
__debugbreak();
}
}
}
}

26
meta/gs_meta_include.cpp Normal file
View File

@ -0,0 +1,26 @@
//
// File: gs_meta_include.cpp
// Author: Peter Slattery
// Creation Date: 2020-02-22
//
#ifndef GS_META_INCLUDE_CPP
static gsm_s32
gsm_GetMetaTagIndex(gsm_s32 Needle, gsm_meta_tag_type* Tags, gsm_u32 TagCount)
{
gsm_s32 Result = -1;
for (gsm_u32 i = 0; i < TagCount; i++)
{
if (Needle == Tags[i])
{
Result = (gsm_s32)i;
break;
}
}
return Result;
}
#define GS_META_INCLUDE_CPP
#endif // GS_META_INCLUDE_CPP

View File

@ -15,6 +15,7 @@
typedef int gsm_s32;
typedef unsigned int gsm_u32;
typedef unsigned long long int gsm_u64;
typedef enum gsm_meta_tag_type gsm_meta_tag_type;
typedef enum gsm_struct_type gsm_struct_type;
#define GSMetaTag(ident, ...)
@ -31,7 +32,10 @@ struct gsm_struct_member_type_info
gsm_u32 IdentifierLength;
gsm_u64 Offset;
gsm_meta_tag* Tags;
// NOTE(Peter): There's no reason that this is 5 other than that its more tags
// than I need at the moment of writing. It does need to be a static array size
// because theres no way to statically initialize a pointer to an array
gsm_meta_tag_type Tags[5];
gsm_u32 TagsCount;
};
@ -77,20 +81,7 @@ gsm_CharArraysEqual(char* A, char* B)
return Result;
}
static gsm_s32
gsm_GetMetaTagIndex(char* Tag, gsm_meta_tag* Tags, gsm_u32 TagCount)
{
gsm_s32 Result = -1;
for (gsm_u32 i = 0; i < TagCount; i++)
{
if (gsm_CharArraysEqual(Tag, Tags[i].Tag))
{
Result = (gsm_s32)i;
break;
}
}
return Result;
}
static gsm_s32 gsm_GetMetaTagIndex(gsm_s32 Needle, gsm_meta_tag_type* Tags, gsm_u32 TagsCount);
#define FOLDHAUS_META_INCLUDE_H
#endif // FOLDHAUS_META_INCLUDE_H

View File

@ -33,12 +33,25 @@ char* TypeDefinitionTypeStrings[] = {
"TypeDef_Count",
};
#define InvalidTypeTableHandle type_table_handle{0, 0}
struct type_table_handle
{
s32 BucketIndex;
u32 IndexInBucket;
};
// #define TypeHandleIsValid(handle) (!((handle).BucketIndex == 0) && ((handle).IndexInBucket == 0))
inline b32 TypeHandleIsValid(type_table_handle A)
{
b32 FirstBucket = (A.BucketIndex == 0);
b32 FirstIndex = (A.IndexInBucket == 0);
b32 Both = FirstBucket && FirstIndex;
return !Both;
}
#define TypeHandlesEqual(a, b) (((a).BucketIndex == (b).BucketIndex) && ((a).IndexInBucket == (b).IndexInBucket))
struct meta_tag
{
string Identifier;
@ -59,7 +72,7 @@ struct variable_decl
u32 ArrayCount;
// :SmallAllocationsAllOver
gs_bucket<meta_tag> MetaTags;
gs_bucket<type_table_handle> MetaTags;
};
struct struct_decl
@ -99,7 +112,7 @@ struct type_definition
string Identifier;
s32 Size;
gs_bucket<meta_tag> MetaTags;
gs_bucket<type_table_handle> MetaTags;
type_definition_type Type;
union
@ -112,62 +125,36 @@ struct type_definition
b32 Pointer;
};
#define TYPE_TABLE_BUCKET_MAX 1023
#define TYPE_TABLE_BUCKET_MAX 1024
struct type_table_hash_bucket
{
u32* Keys;
type_definition* Values;
};
#define META_TAG_BUCKET_MAX 1024
struct meta_tag_hash_bucket
{
u32* Keys;
meta_tag* Values;
};
struct type_table
{
type_table_hash_bucket* Types;
u32 TypeBucketsCount;
meta_tag_hash_bucket* MetaTags;
u32 MetaTagBucketsCount;
};
internal b32
HasTag(string Needle, gs_bucket<meta_tag> Tags)
HandlesAreEqual(type_table_handle A, type_table_handle B)
{
b32 Result = false;
for (u32 i = 0; i < Tags.Used; i++)
{
meta_tag* Tag = Tags.GetElementAtIndex(i);
if (StringsEqual(Tag->Identifier, Needle))
{
Result = true;
}
}
b32 Result = ((A.BucketIndex == B.BucketIndex) && (A.IndexInBucket == B.IndexInBucket));
return Result;
}
internal void
CopyMetaTagsAndClear(gs_bucket<token>* Source, gs_bucket<meta_tag>* Dest)
{
for (u32 i = 0; i < Source->Used; i++)
{
token* TagToken = Source->GetElementAtIndex(i);
meta_tag TagDest = {0};
TagDest.Identifier = TagToken->Text;
Dest->PushElementOnBucket(TagDest);
}
Source->Used = 0;
}
#define InvalidTypeTableHandle type_table_handle{0, 0}
// #define TypeHandleIsValid(handle) (!((handle).BucketIndex == 0) && ((handle).IndexInBucket == 0))
inline b32 TypeHandleIsValid(type_table_handle A)
{
b32 FirstBucket = (A.BucketIndex == 0);
b32 FirstIndex = (A.IndexInBucket == 0);
b32 Both = FirstBucket && FirstIndex;
return !Both;
}
#define TypeHandlesEqual(a, b) (((a).BucketIndex == (b).BucketIndex) && ((a).IndexInBucket == (b).IndexInBucket))
internal u32
HashIdentifier(string Identifier)
{
@ -182,6 +169,104 @@ HashIdentifier(string Identifier)
return IdentHash;
}
internal type_table_handle
GetTypeHandle (string Identifier, type_table TypeTable)
{
type_table_handle Result = InvalidTypeTableHandle;
u32 IdentHash = HashIdentifier(Identifier);
u32 Index = IdentHash % TYPE_TABLE_BUCKET_MAX;
for (u32 b = 0; b < TypeTable.TypeBucketsCount; b++)
{
type_table_hash_bucket Bucket = TypeTable.Types[b];
if (Bucket.Keys[Index] == IdentHash)
{
Result.BucketIndex = b;
Result.IndexInBucket = Index;
break;
}
}
return Result;
}
internal type_table_handle
GetMetaTagHandle(string Identifier, type_table TypeTable)
{
type_table_handle Result = InvalidTypeTableHandle;
u32 IdentHash = HashIdentifier(Identifier);
u32 Index = IdentHash % TYPE_TABLE_BUCKET_MAX;
for (u32 b = 0; b < TypeTable.MetaTagBucketsCount; b++)
{
meta_tag_hash_bucket Bucket = TypeTable.MetaTags[b];
if (Bucket.Keys[Index] == IdentHash)
{
Result.BucketIndex = b;
Result.IndexInBucket = Index;
break;
}
}
return Result;
}
internal type_table_handle
GetMetaTagHandleWithIdentifier(string Identifier, type_table TypeTable)
{
type_table_handle Result = InvalidTypeTableHandle;
u32 IdentHash = HashIdentifier(Identifier);
u32 Index = IdentHash % META_TAG_BUCKET_MAX;
for (u32 b = 0; b < TypeTable.MetaTagBucketsCount; b++)
{
meta_tag_hash_bucket* Bucket = TypeTable.MetaTags + b;
if (Bucket->Keys[Index] == IdentHash)
{
Result.BucketIndex = b;
Result.IndexInBucket = Index;
break;
}
}
return Result;
}
internal b32
HasTag(string Needle, gs_bucket<type_table_handle> Tags, type_table TypeTable)
{
b32 Result = false;
type_table_handle NeedleTagHandle = GetMetaTagHandleWithIdentifier(Needle, TypeTable);
if (TypeHandleIsValid(NeedleTagHandle))
{
for (u32 i = 0; i < Tags.Used; i++)
{
type_table_handle* TagHandle = Tags.GetElementAtIndex(i);
if (HandlesAreEqual(*TagHandle, NeedleTagHandle))
{
Result = true;
break;
}
}
}
return Result;
}
internal void
CopyMetaTagsAndClear(gs_bucket<type_table_handle>* Source, gs_bucket<type_table_handle>* Dest)
{
for (u32 i = 0; i < Source->Used; i++)
{
type_table_handle* TagToken = Source->GetElementAtIndex(i);
Dest->PushElementOnBucket(*TagToken);
}
Source->Used = 0;
}
internal type_table_handle
FindSlotForTypeIdentifier(u32 IdentHash, type_table* TypeTable)
{
@ -222,6 +307,42 @@ FindSlotForTypeIdentifier(u32 IdentHash, type_table* TypeTable)
return Result;
}
internal type_table_handle
FindSlotForMetaTag(u32 IdentHash, type_table* TypeTable)
{
type_table_handle Result = InvalidTypeTableHandle;
u32 Index = IdentHash % TYPE_TABLE_BUCKET_MAX;
for (u32 b = 0; b < TypeTable->MetaTagBucketsCount; b++)
{
meta_tag_hash_bucket* Bucket = TypeTable->MetaTags + b;
if (Bucket->Keys[Index] == 0)
{
Result.BucketIndex = b;
Result.IndexInBucket = Index;
break;
}
}
if (!TypeHandleIsValid(Result))
{
u32 NewMetaBucketIndex = TypeTable->MetaTagBucketsCount++;
u32 NewMetaBucketListSize = TypeTable->MetaTagBucketsCount * sizeof(meta_tag_hash_bucket);
TypeTable->MetaTags = (meta_tag_hash_bucket*)realloc(TypeTable->MetaTags, NewMetaBucketListSize);
meta_tag_hash_bucket* NewBucket = TypeTable->MetaTags + NewMetaBucketIndex;
NewBucket->Keys = (u32*)malloc(sizeof(u32) * TYPE_TABLE_BUCKET_MAX);
NewBucket->Values = (meta_tag*)malloc(sizeof(meta_tag) * TYPE_TABLE_BUCKET_MAX);
GSZeroMemory((u8*)NewBucket->Keys, sizeof(u32) * TYPE_TABLE_BUCKET_MAX);
GSZeroMemory((u8*)NewBucket->Values, sizeof(meta_tag) * TYPE_TABLE_BUCKET_MAX);
Result.BucketIndex = NewMetaBucketIndex;
Result.IndexInBucket = Index;
}
return Result;
}
internal type_table_handle
PushTypeOnHashTable(type_definition TypeDef, type_table* TypeTable)
{
@ -252,23 +373,19 @@ PushUndeclaredType (string Identifier, type_table* TypeTable)
}
internal type_table_handle
GetTypeHandle (string Identifier, type_table TypeTable)
PushMetaTagOnTable(meta_tag Tag, type_table* TypeTable)
{
type_table_handle Result = InvalidTypeTableHandle;
u32 TagIdentifierHash = HashIdentifier(Tag.Identifier);
type_table_handle Result = FindSlotForMetaTag(TagIdentifierHash, TypeTable);
u32 IdentHash = HashIdentifier(Identifier);
u32 Index = IdentHash % TYPE_TABLE_BUCKET_MAX;
meta_tag_hash_bucket* Bucket = TypeTable->MetaTags + Result.BucketIndex;
Bucket->Keys[Result.IndexInBucket] = TagIdentifierHash;
Bucket->Values[Result.IndexInBucket] = Tag;
for (u32 b = 0; b < TypeTable.TypeBucketsCount; b++)
{
type_table_hash_bucket Bucket = TypeTable.Types[b];
if (Bucket.Keys[Index] == IdentHash)
{
Result.BucketIndex = b;
Result.IndexInBucket = Index;
break;
}
}
#if PRINT_DIAGNOSTIC_INFO
printf("Registering Meta Tag\n");
printf(" %.*s\n\n", StringExpand(Tag.Identifier));
#endif
return Result;
}
@ -298,6 +415,17 @@ GetTypeDefinitionUnsafe(type_table_handle Handle, type_table TypeTable)
return Result;
}
internal meta_tag*
GetMetaTag(type_table_handle Handle, type_table TypeTable)
{
meta_tag* Result = 0;
if (TypeTable.MetaTags[Handle.BucketIndex].Keys != 0)
{
Result = TypeTable.MetaTags[Handle.BucketIndex].Values + Handle.IndexInBucket;
}
return Result;
}
internal type_definition*
GetTypeDefinition(string Identifier, type_table TypeTable)
{
@ -516,7 +644,7 @@ FixUpStructSize (type_table_handle TypeHandle, type_table TypeTable, errors* Err
type_definition* Struct = GetTypeDefinition(TypeHandle, TypeTable);
Assert(Struct->Type == TypeDef_Struct);
if (HasTag(MakeStringLiteral("breakpoint"), Struct->MetaTags))
if (HasTag(MakeStringLiteral("breakpoint"), Struct->MetaTags, TypeTable))
{
__debugbreak();
}
@ -630,7 +758,8 @@ PrintTypeDefinition(type_definition TypeDef, type_table TypeTable)
printf(" Meta Tags: ");
for (u32 m = 0; m < TypeDef.MetaTags.Used; m++)
{
meta_tag* Tag = TypeDef.MetaTags.GetElementAtIndex(m);
type_table_handle TagHandle = *TypeDef.MetaTags.GetElementAtIndex(m);
meta_tag* Tag = GetMetaTag(TagHandle, TypeTable);
printf("%.*s ", StringExpand(Tag->Identifier));
}
printf("\n");

View File

@ -16,6 +16,9 @@
struct typeinfo_generator
{
string_builder MetaTagString;
string_builder MetaTagEnum;
string_builder TypeListString;
gsm_code_generator TypeList;
string_builder StructMembers;
@ -54,17 +57,14 @@ FinishGeneratingTypes(typeinfo_generator* Generator)
}
internal void
GenerateMetaTagInfo (gs_bucket<meta_tag> Tags, string_builder* Builder)
GenerateMetaTagInfo (gs_bucket<type_table_handle> Tags, type_table TypeTable, string_builder* Builder)
{
WriteF(Builder, "{");
for (u32 t = 0; t < Tags.Used; t++)
{
meta_tag* Tag = Tags.GetElementAtIndex(t);
WriteF(Builder, "{ \"%S\", %d }", Tag->Identifier, Tag->Identifier.Length);
if ((t + 1) < Tags.Used)
{
WriteF(Builder, ", ");
}
type_table_handle TagHandle = *Tags.GetElementAtIndex(t);
meta_tag* Tag = GetMetaTag(TagHandle, TypeTable);
WriteF(Builder, "MetaTag_%S, ", Tag->Identifier);
}
WriteF(Builder, "}, %d", Tags.Used);
}
@ -73,7 +73,8 @@ internal void
GenerateStructMemberInfo (variable_decl* Member, string StructIdentifier, type_table TypeTable, typeinfo_generator* Gen)
{
WriteF(&Gen->StructMembers, "{ \"%S\", %d, ", Member->Identifier, Member->Identifier.Length);
WriteF(&Gen->StructMembers, "(u64)&((%S*)0)->%S ", StructIdentifier, Member->Identifier);
WriteF(&Gen->StructMembers, "(u64)&((%S*)0)->%S, ", StructIdentifier, Member->Identifier);
GenerateMetaTagInfo(Member->MetaTags, TypeTable, &Gen->StructMembers);
WriteF(&Gen->StructMembers, "},\n");
}
@ -180,7 +181,7 @@ GenerateFilteredTypeInfo (string MetaTagFilter, type_table TypeTable, typeinfo_g
type_definition* Type = GetTypeDefinitionUnsafe(TypeHandle, TypeTable);
if (Type)
{
if (HasTag(MetaTagFilter, Type->MetaTags))
if (HasTag(MetaTagFilter, Type->MetaTags, TypeTable))
{
GenerateTypeInfo(Type, TypeHandle, TypeTable, Generator);
}
@ -189,7 +190,29 @@ GenerateFilteredTypeInfo (string MetaTagFilter, type_table TypeTable, typeinfo_g
}
}
internal void
GenerateMetaTagList(type_table TypeTable, typeinfo_generator* Generator)
{
WriteF(&Generator->MetaTagString, "gsm_meta_tag MetaTagStrings[] = {\n");
WriteF(&Generator->MetaTagEnum, "enum gsm_meta_tag_type\n{\n");
for (u32 b = 0; b < TypeTable.MetaTagBucketsCount; b++)
{
meta_tag_hash_bucket Bucket = TypeTable.MetaTags[b];
for (u32 i = 0; i < META_TAG_BUCKET_MAX; i++)
{
if (Bucket.Keys[i] != 0)
{
string MetaTagIdentifier = Bucket.Values[i].Identifier;
WriteF(&Generator->MetaTagString, "{ \"%S\", %d },\n", MetaTagIdentifier, MetaTagIdentifier.Length);
WriteF(&Generator->MetaTagEnum, "MetaTag_%S,\n", MetaTagIdentifier);
}
}
}
WriteF(&Generator->MetaTagString, "};\n");
WriteF(&Generator->MetaTagEnum, "};\n");
}
#define GS_META_TYPEINFO_GENERATOR_H
#endif // GS_META_TYPEINFO_GENERATOR_H

View File

@ -203,6 +203,10 @@ TestPatternThree(assembly* Assembly, r32 Time)
#include "foldhaus_default_nodes.h"
#include "./generated/gs_meta_generated_typeinfo.h"
#include "generated/foldhaus_nodes_generated.h"
#include "foldhaus_node.cpp"
FOLDHAUS_INPUT_COMMAND_PROC(EndCurrentOperationMode)
@ -228,9 +232,8 @@ struct panel_definition
panel_cleanup_proc* Cleanup;
panel_render_proc* Render;
input_command* InputCommands;
s32 InputCommandsCount;
};
#include "./generated/gs_meta_generated_typeinfo.h"
#include "generated/foldhaus_nodes_generated.h"
#include "panels/foldhaus_panel_sculpture_view.h"
#include "panels/foldhaus_panel_profiler.h"
@ -243,6 +246,7 @@ struct panel_definition
#include "foldhaus_interface.cpp"
#include "../meta/gs_meta_include.cpp"
#define FOLDHAUS_APP_H
#endif // FOLDHAUS_APP_H

View File

@ -8,14 +8,14 @@
internal b32
MemberIsInput(gsm_struct_member_type_info Member)
{
b32 Result = (0 <= gsm_GetMetaTagIndex("node_input", Member.Tags, Member.TagsCount));
b32 Result = (0 <= gsm_GetMetaTagIndex(MetaTag_node_input, Member.Tags, Member.TagsCount));
return Result;
}
internal b32
MemberIsOutput(gsm_struct_member_type_info Member)
{
b32 Result = (0 <= gsm_GetMetaTagIndex("node_output", Member.Tags, Member.TagsCount));
b32 Result = (0 <= gsm_GetMetaTagIndex(MetaTag_node_output, Member.Tags, Member.TagsCount));
return Result;
}

View File

@ -1,15 +1,15 @@
enum node_type
{
NodeType_RevolvingDiscs,
NodeType_VerticalColorFadeProc,
NodeType_SolidColorProc,
NodeType_VerticalColorFadeProc,
NodeType_Count,
};
static node_specification_ NodeSpecifications[] = {
{ NodeType_RevolvingDiscs, {"RevolvingDiscs", 14}, gsm_StructType_revolving_discs_data },
{ NodeType_VerticalColorFadeProc, {"VerticalColorFadeProc", 21}, gsm_StructType_vertical_color_fade_data },
{ NodeType_SolidColorProc, {"SolidColorProc", 14}, gsm_StructType_solid_color_data },
{ NodeType_VerticalColorFadeProc, {"VerticalColorFadeProc", 21}, gsm_StructType_vertical_color_fade_data },
};
void CallNodeProc(node_type Type, u8* NodeData)
@ -19,14 +19,14 @@ void CallNodeProc(node_type Type, u8* NodeData)
{
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;
case NodeType_VerticalColorFadeProc:
{
VerticalColorFadeProc((vertical_color_fade_data*)NodeData);
} break;
}
}

View File

@ -1,9 +1,9 @@
global_variable s32 GlobalPanelDefsCount = 6;
global_variable panel_definition GlobalPanelDefs[] = {
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands},
{ "Animation Timeline", 18, AnimationTimeline_Init, AnimationTimeline_Cleanup, AnimationTimeline_Render, AnimationTimeline_Commands },
{ "DMX View", 8, DMXView_Init, DMXView_Cleanup, DMXView_Render, 0 },
{ "Profiler", 8, ProfilerView_Init, ProfilerView_Cleanup, ProfilerView_Render, 0 },
{ "Hierarchy", 9, HierarchyView_Init, HierarchyView_Cleanup, HierarchyView_Render, 0 },
{ "Node Graph", 10, NodeGraph_Init, NodeGraph_Cleanup, NodeGraph_Render, NodeGraph_Commands },
};
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands, SculptureView_CommandsCount },
{ "Animation Timeline", 18, AnimationTimeline_Init, AnimationTimeline_Cleanup, AnimationTimeline_Render, AnimationTimeline_Commands, AnimationTimeline_CommandsCount },
{ "Dmx View", 8, DMXView_Init, DMXView_Cleanup, DMXView_Render, DMXView_Commands, DMXView_CommandsCount },
{ "Hierarchy", 9, HierarchyView_Init, HierarchyView_Cleanup, HierarchyView_Render, HierarchyView_Commands, HierarchyView_CommandsCount },
{ "Node Graph", 10, NodeGraph_Init, NodeGraph_Cleanup, NodeGraph_Render, NodeGraph_Commands, NodeGraph_CommandsCount },
{ "Profiler", 8, ProfilerView_Init, ProfilerView_Cleanup, ProfilerView_Render, ProfilerView_Commands, ProfilerView_CommandsCount },
};

View File

@ -1,3 +1,36 @@
enum gsm_meta_tag_type
{
MetaTag_panel_type_node_graph,
MetaTag_node_output,
MetaTag_node_struct,
MetaTag_panel_cleanup,
MetaTag_node_input,
MetaTag_panel_init,
MetaTag_panel_type_animation_timeline,
MetaTag_panel_commands,
MetaTag_panel_type_sculpture_view,
MetaTag_node_proc,
MetaTag_panel_type_hierarchy,
MetaTag_panel_type_profiler,
MetaTag_panel_render,
MetaTag_panel_type_dmx_view,
};
gsm_meta_tag MetaTagStrings[] = {
{ "panel_type_node_graph", 21 },
{ "node_output", 11 },
{ "node_struct", 11 },
{ "panel_cleanup", 13 },
{ "node_input", 10 },
{ "panel_init", 10 },
{ "panel_type_animation_timeline", 29 },
{ "panel_commands", 14 },
{ "panel_type_sculpture_view", 25 },
{ "node_proc", 9 },
{ "panel_type_hierarchy", 20 },
{ "panel_type_profiler", 19 },
{ "panel_render", 12 },
{ "panel_type_dmx_view", 19 },
};
enum gsm_struct_type
{
gsm_StructType_solid_color_data,
@ -8,71 +41,71 @@ enum gsm_struct_type
gsm_StructType_s32,
gsm_StructType_pixel,
gsm_StructType_u8,
gsm_StructType_vertical_color_fade_data,
gsm_StructType_r32,
gsm_StructType_sin_wave_data,
gsm_StructType_multiply_patterns_data,
gsm_StructType_r32,
gsm_StructType_revolving_discs_data,
gsm_StructType_vertical_color_fade_data,
gsm_StructType_multiply_patterns_data,
gsm_StructType_Count,
};
static gsm_struct_member_type_info StructMembers_v4[] = {
{ "x", 1, (u64)&((v4*)0)->x },
{ "y", 1, (u64)&((v4*)0)->y },
{ "z", 1, (u64)&((v4*)0)->z },
{ "w", 1, (u64)&((v4*)0)->w },
{ "r", 1, (u64)&((v4*)0)->r },
{ "g", 1, (u64)&((v4*)0)->g },
{ "b", 1, (u64)&((v4*)0)->b },
{ "a", 1, (u64)&((v4*)0)->a },
{ "E", 1, (u64)&((v4*)0)->E },
{ "x", 1, (u64)&((v4*)0)->x, {}, 0},
{ "y", 1, (u64)&((v4*)0)->y, {}, 0},
{ "z", 1, (u64)&((v4*)0)->z, {}, 0},
{ "w", 1, (u64)&((v4*)0)->w, {}, 0},
{ "r", 1, (u64)&((v4*)0)->r, {}, 0},
{ "g", 1, (u64)&((v4*)0)->g, {}, 0},
{ "b", 1, (u64)&((v4*)0)->b, {}, 0},
{ "a", 1, (u64)&((v4*)0)->a, {}, 0},
{ "E", 1, (u64)&((v4*)0)->E, {}, 0},
};
static gsm_struct_member_type_info StructMembers_led[] = {
{ "Index", 5, (u64)&((led*)0)->Index },
{ "Position", 8, (u64)&((led*)0)->Position },
{ "Index", 5, (u64)&((led*)0)->Index, {}, 0},
{ "Position", 8, (u64)&((led*)0)->Position, {}, 0},
};
static gsm_struct_member_type_info StructMembers_pixel[] = {
{ "R", 1, (u64)&((pixel*)0)->R },
{ "G", 1, (u64)&((pixel*)0)->G },
{ "B", 1, (u64)&((pixel*)0)->B },
{ "Channels", 8, (u64)&((pixel*)0)->Channels },
{ "R", 1, (u64)&((pixel*)0)->R, {}, 0},
{ "G", 1, (u64)&((pixel*)0)->G, {}, 0},
{ "B", 1, (u64)&((pixel*)0)->B, {}, 0},
{ "Channels", 8, (u64)&((pixel*)0)->Channels, {}, 0},
};
static gsm_struct_member_type_info StructMembers_color_buffer[] = {
{ "LEDs", 4, (u64)&((color_buffer*)0)->LEDs },
{ "Colors", 6, (u64)&((color_buffer*)0)->Colors },
{ "LEDCount", 8, (u64)&((color_buffer*)0)->LEDCount },
{ "LEDs", 4, (u64)&((color_buffer*)0)->LEDs, {}, 0},
{ "Colors", 6, (u64)&((color_buffer*)0)->Colors, {}, 0},
{ "LEDCount", 8, (u64)&((color_buffer*)0)->LEDCount, {}, 0},
};
static gsm_struct_member_type_info StructMembers_solid_color_data[] = {
{ "Color", 5, (u64)&((solid_color_data*)0)->Color },
{ "Result", 6, (u64)&((solid_color_data*)0)->Result },
};
static gsm_struct_member_type_info StructMembers_vertical_color_fade_data[] = {
{ "Color", 5, (u64)&((vertical_color_fade_data*)0)->Color },
{ "Min", 3, (u64)&((vertical_color_fade_data*)0)->Min },
{ "Max", 3, (u64)&((vertical_color_fade_data*)0)->Max },
{ "Result", 6, (u64)&((vertical_color_fade_data*)0)->Result },
{ "Color", 5, (u64)&((solid_color_data*)0)->Color, {MetaTag_node_input, }, 1},
{ "Result", 6, (u64)&((solid_color_data*)0)->Result, {MetaTag_node_output, }, 1},
};
static gsm_struct_member_type_info StructMembers_sin_wave_data[] = {
{ "Period", 6, (u64)&((sin_wave_data*)0)->Period },
{ "Min", 3, (u64)&((sin_wave_data*)0)->Min },
{ "Max", 3, (u64)&((sin_wave_data*)0)->Max },
{ "Result", 6, (u64)&((sin_wave_data*)0)->Result },
{ "Accumulator", 11, (u64)&((sin_wave_data*)0)->Accumulator },
};
static gsm_struct_member_type_info StructMembers_multiply_patterns_data[] = {
{ "A", 1, (u64)&((multiply_patterns_data*)0)->A },
{ "B", 1, (u64)&((multiply_patterns_data*)0)->B },
{ "Result", 6, (u64)&((multiply_patterns_data*)0)->Result },
{ "Period", 6, (u64)&((sin_wave_data*)0)->Period, {MetaTag_node_input, }, 1},
{ "Min", 3, (u64)&((sin_wave_data*)0)->Min, {MetaTag_node_input, }, 1},
{ "Max", 3, (u64)&((sin_wave_data*)0)->Max, {MetaTag_node_input, }, 1},
{ "Result", 6, (u64)&((sin_wave_data*)0)->Result, {MetaTag_node_input, }, 1},
{ "Accumulator", 11, (u64)&((sin_wave_data*)0)->Accumulator, {}, 0},
};
static gsm_struct_member_type_info StructMembers_revolving_discs_data[] = {
{ "Rotation", 8, (u64)&((revolving_discs_data*)0)->Rotation },
{ "ThetaZ", 6, (u64)&((revolving_discs_data*)0)->ThetaZ },
{ "ThetaY", 6, (u64)&((revolving_discs_data*)0)->ThetaY },
{ "DiscWidth", 9, (u64)&((revolving_discs_data*)0)->DiscWidth },
{ "InnerRadius", 11, (u64)&((revolving_discs_data*)0)->InnerRadius },
{ "OuterRadius", 11, (u64)&((revolving_discs_data*)0)->OuterRadius },
{ "Color", 5, (u64)&((revolving_discs_data*)0)->Color },
{ "Result", 6, (u64)&((revolving_discs_data*)0)->Result },
{ "Rotation", 8, (u64)&((revolving_discs_data*)0)->Rotation, {MetaTag_node_input, }, 1},
{ "ThetaZ", 6, (u64)&((revolving_discs_data*)0)->ThetaZ, {MetaTag_node_input, }, 1},
{ "ThetaY", 6, (u64)&((revolving_discs_data*)0)->ThetaY, {MetaTag_node_input, }, 1},
{ "DiscWidth", 9, (u64)&((revolving_discs_data*)0)->DiscWidth, {MetaTag_node_input, }, 1},
{ "InnerRadius", 11, (u64)&((revolving_discs_data*)0)->InnerRadius, {MetaTag_node_input, }, 1},
{ "OuterRadius", 11, (u64)&((revolving_discs_data*)0)->OuterRadius, {MetaTag_node_input, }, 1},
{ "Color", 5, (u64)&((revolving_discs_data*)0)->Color, {MetaTag_node_input, }, 1},
{ "Result", 6, (u64)&((revolving_discs_data*)0)->Result, {MetaTag_node_output, }, 1},
};
static gsm_struct_member_type_info StructMembers_vertical_color_fade_data[] = {
{ "Color", 5, (u64)&((vertical_color_fade_data*)0)->Color, {MetaTag_node_input, }, 1},
{ "Min", 3, (u64)&((vertical_color_fade_data*)0)->Min, {MetaTag_node_input, }, 1},
{ "Max", 3, (u64)&((vertical_color_fade_data*)0)->Max, {MetaTag_node_input, }, 1},
{ "Result", 6, (u64)&((vertical_color_fade_data*)0)->Result, {MetaTag_node_output, }, 1},
};
static gsm_struct_member_type_info StructMembers_multiply_patterns_data[] = {
{ "A", 1, (u64)&((multiply_patterns_data*)0)->A, {MetaTag_node_input, }, 1},
{ "B", 1, (u64)&((multiply_patterns_data*)0)->B, {MetaTag_node_input, }, 1},
{ "Result", 6, (u64)&((multiply_patterns_data*)0)->Result, {MetaTag_node_output, }, 1},
};
static gsm_struct_type_info StructTypes[] = {
@ -84,10 +117,10 @@ static gsm_struct_type_info StructTypes[] = {
{ gsm_StructType_s32, "s32", 3, 4, 0, 0, 0, 0 },
{ gsm_StructType_pixel, "pixel", 5, 3, 0, 0, StructMembers_pixel, 2 },
{ gsm_StructType_u8, "u8", 2, 1, 0, 0, 0, 0 },
{ gsm_StructType_vertical_color_fade_data, "vertical_color_fade_data", 24, 44, 0, 0, StructMembers_vertical_color_fade_data, 4 },
{ gsm_StructType_r32, "r32", 3, 4, 0, 0, 0, 0 },
{ gsm_StructType_sin_wave_data, "sin_wave_data", 13, 20, 0, 0, StructMembers_sin_wave_data, 5 },
{ gsm_StructType_multiply_patterns_data, "multiply_patterns_data", 22, 60, 0, 0, StructMembers_multiply_patterns_data, 3 },
{ gsm_StructType_r32, "r32", 3, 4, 0, 0, 0, 0 },
{ gsm_StructType_revolving_discs_data, "revolving_discs_data", 20, 60, 0, 0, StructMembers_revolving_discs_data, 8 },
{ gsm_StructType_vertical_color_fade_data, "vertical_color_fade_data", 24, 44, 0, 0, StructMembers_vertical_color_fade_data, 4 },
{ gsm_StructType_multiply_patterns_data, "multiply_patterns_data", 22, 60, 0, 0, StructMembers_multiply_patterns_data, 3 },
};
static gsm_u32 StructTypesCount = 13;

View File

@ -212,9 +212,10 @@ input_command AnimationTimeline_Commands[] = {
{ KeyCode_X, KeyCode_Invalid, Command_Began, DeleteAnimationBlockCommand },
{ KeyCode_A, KeyCode_Invalid, Command_Began, AddAnimationBlockCommand },
};
s32 AnimationTimeline_CommandsCount = 2;
GSMetaTag(panel_init);
GSMetaTag(panel_type_animation_timeline);
internal void
AnimationTimeline_Init(panel* Panel, app_state* State)
{
@ -222,6 +223,7 @@ AnimationTimeline_Init(panel* Panel, app_state* State)
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_animation_timeline);
internal void
AnimationTimeline_Cleanup(panel* Panel, app_state* State)
{
@ -425,6 +427,7 @@ DrawAnimationClipsList(rect PanelBounds, mouse_state Mouse, render_command_buffe
}
GSMetaTag(panel_render);
GSMetaTag(panel_type_animation_timeline);
internal void
AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{

View File

@ -12,7 +12,11 @@ struct universe_view_operation_state
r32 Zoom;
};
input_command DMXView_Commands[] = {{}};
s32 DMXView_CommandsCount = 0;
GSMetaTag(panel_init);
GSMetaTag(panel_type_dmx_view);
internal void
DMXView_Init(panel* Panel, app_state* State)
{
@ -20,6 +24,7 @@ DMXView_Init(panel* Panel, app_state* State)
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_dmx_view);
internal void
DMXView_Cleanup(panel* Panel, app_state* State)
{
@ -67,6 +72,7 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr
#endif
GSMetaTag(panel_render);
GSMetaTag(panel_type_dmx_view);
internal void
DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{

View File

@ -5,7 +5,11 @@
//
#ifndef FOLDHAUS_PANEL_HIERARCHY_H
GSMetaTag(panel_init)
input_command HierarchyView_Commands[] = {{}};
s32 HierarchyView_CommandsCount = 0;
GSMetaTag(panel_init);
GSMetaTag(panel_type_hierarchy);
internal void
HierarchyView_Init(panel* Panel, app_state* State)
{
@ -13,6 +17,7 @@ HierarchyView_Init(panel* Panel, app_state* State)
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_hierarchy);
internal void
HierarchyView_Cleanup(panel* Panel, app_state* State)
{
@ -20,6 +25,7 @@ HierarchyView_Cleanup(panel* Panel, app_state* State)
}
GSMetaTag(panel_render);
GSMetaTag(panel_type_hierarchy);
internal void
HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{

View File

@ -168,11 +168,12 @@ BeginConnectNodesOperation(visual_port VisualPort, u32 VisualPortIndex, mouse_st
// Node Graph Panel
//
input_command NodeGraph_Commands[] = {
{}
};
GSMetaTag(panel_commands);
input_command NodeGraph_Commands[] = {{}};
s32 NodeGraph_CommandsCount = 0;
GSMetaTag(panel_init);
GSMetaTag(panel_type_node_graph);
internal void
NodeGraph_Init(panel* Panel, app_state* State)
{
@ -185,6 +186,7 @@ NodeGraph_Init(panel* Panel, app_state* State)
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_node_graph);
internal void
NodeGraph_Cleanup(panel* Panel, app_state* State)
{
@ -415,6 +417,7 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
}
GSMetaTag(panel_render);
GSMetaTag(panel_type_node_graph);
internal void
NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{

View File

@ -5,7 +5,11 @@
//
#ifndef FOLDHAUS_PANEL_PROFILER_H
input_command ProfilerView_Commands[] = {{}};
s32 ProfilerView_CommandsCount = 0;
GSMetaTag(panel_init);
GSMetaTag(panel_type_profiler);
internal void
ProfilerView_Init(panel* Panel, app_state* State)
{
@ -13,6 +17,7 @@ ProfilerView_Init(panel* Panel, app_state* State)
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_profiler);
internal void
ProfilerView_Cleanup(panel* Panel, app_state* State)
{
@ -119,6 +124,7 @@ RenderProfiler_ListVisualization(render_command_buffer* RenderBuffer,
}
GSMetaTag(panel_render);
GSMetaTag(panel_type_profiler);
internal void
ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{

View File

@ -45,16 +45,23 @@ FOLDHAUS_INPUT_COMMAND_PROC(Begin3DViewMouseRotate)
// ----------------
input_command SculptureView_Commands[] = {
GSMetaTag(panel_commands);
GSMetaTag(panel_type_sculpture_view);
global_variable input_command SculptureView_Commands[] = {
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Began, Begin3DViewMouseRotate },
};
global_variable s32 SculptureView_CommandsCount = 1;
GSMetaTag(panel_init);
GSMetaTag(panel_type_sculpture_view);
internal void
SculptureView_Init(panel* Panel, app_state* State)
{
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_sculpture_view);
internal void
SculptureView_Cleanup(panel* Panel, app_state* State)
{
@ -124,6 +131,8 @@ DrawLEDsInBufferRangeJob (s32 ThreadID, void* JobData)
}
}
GSMetaTag(panel_render);
GSMetaTag(panel_type_sculpture_view);
internal void
SculptureView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{