A bit more cleanup around sacn and assemblies.
This commit is contained in:
parent
9c432a3807
commit
23c9dabfbb
|
@ -182,7 +182,7 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
|||
|
||||
#if 1
|
||||
string SculpturePath = MakeStringLiteral("data/blumen_lumen_v2.fold");
|
||||
LoadAssembly(State, Context, SculpturePath);
|
||||
LoadAssembly(&State->Assemblies, &State->LedSystem, &State->Transient, Context, SculpturePath, State->GlobalLog);
|
||||
#endif
|
||||
|
||||
State->PixelsToWorldScale = .01f;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
//
|
||||
#ifndef FOLDHAUS_ASSEMBLY_CPP
|
||||
|
||||
// Led System
|
||||
|
||||
internal led_system
|
||||
LedSystemInitialize(platform_memory_handler PlatformMemory, u32 BuffersMax)
|
||||
{
|
||||
|
@ -78,8 +76,6 @@ LedBufferSetLed(led_buffer* Buffer, u32 Led, v4 Position)
|
|||
Buffer->Positions[Led] = Position;
|
||||
}
|
||||
|
||||
// Assembly
|
||||
|
||||
internal void
|
||||
ConstructAssemblyFromDefinition (assembly* Assembly, string AssemblyName, v4 RootPosition, led_system* LedSystem)
|
||||
{
|
||||
|
@ -114,37 +110,36 @@ ConstructAssemblyFromDefinition (assembly* Assembly, string AssemblyName, v4 Roo
|
|||
static v4 TempAssemblyOffsets[] = { v4{0, 0, 0, 0}, v4{250, 0, 75, 0}, v4{-250, 0, 75, 0} };
|
||||
s32 TempAssemblyOffsetsCount = 3;
|
||||
|
||||
// TODO(Peter): Don't reference State, pull back to the Led buffer and Assembly Array
|
||||
internal void
|
||||
LoadAssembly (app_state* State, context Context, string Path)
|
||||
LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, memory_arena* Scratch, context Context, string Path, event_log* GlobalLog)
|
||||
{
|
||||
platform_memory_result AssemblyFile = ReadEntireFile(Context, Path);
|
||||
if (AssemblyFile.Error == PlatformMemory_NoError && AssemblyFile.Size > 0)
|
||||
{
|
||||
string AssemblyFileText = MakeString((char*)AssemblyFile.Base);
|
||||
|
||||
Assert(State->Assemblies.Count < State->Assemblies.CountMax);
|
||||
assembly* NewAssembly = &State->Assemblies.Values[State->Assemblies.Count++];
|
||||
Assert(Assemblies->Count < Assemblies->CountMax);
|
||||
assembly* NewAssembly = &Assemblies->Values[Assemblies->Count++];
|
||||
|
||||
s32 IndexOfLastSlash = FastLastIndexOfCharInCharArray(Path.Memory, Path.Length, '\\');
|
||||
string FileName = Substring(Path, IndexOfLastSlash + 1);
|
||||
|
||||
NewAssembly->Arena.PlatformMemory = Context.PlatformMemory;
|
||||
if (ParseAssemblyFile(NewAssembly, AssemblyFileText, &State->Transient))
|
||||
if (ParseAssemblyFile(NewAssembly, AssemblyFileText, Scratch))
|
||||
{
|
||||
v4 Offset = TempAssemblyOffsets[State->Assemblies.Count % TempAssemblyOffsetsCount];
|
||||
ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, &State->LedSystem);
|
||||
v4 Offset = TempAssemblyOffsets[Assemblies->Count % TempAssemblyOffsetsCount];
|
||||
ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, LedSystem);
|
||||
PlatformFree(Context.PlatformMemory, AssemblyFile.Base, AssemblyFile.Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeMemoryArena(&NewAssembly->Arena);
|
||||
State->Assemblies.Count -= 1;
|
||||
Assemblies->Count -= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError(State->GlobalLog, "Unable to load assembly file");
|
||||
LogError(GlobalLog, "Unable to load assembly file");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -477,6 +477,5 @@ DrawAllPanels(panel_layout PanelLayout, render_command_buffer* RenderBuffer, mou
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define FOLDHAUS_INTERFACE_CPP
|
||||
#endif // FOLDHAUS_INTERFACE_CPP
|
|
@ -71,7 +71,7 @@ HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* Rende
|
|||
b32 Success = GetFilePath(Context, &FilePath, "Foldhaus Files\0*.fold\0\0");
|
||||
if (Success)
|
||||
{
|
||||
LoadAssembly(State, Context, FilePath);
|
||||
LoadAssembly(&State->Assemblies, &State->LedSystem, &State->Transient, Context, FilePath, State->GlobalLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ InitStreamHeader (u8* Buffer, s32 BufferSize,
|
|||
//
|
||||
|
||||
internal streaming_acn
|
||||
InitializeSACN ( context Context)
|
||||
InitializeSACN (context Context)
|
||||
{
|
||||
streaming_acn SACN = {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue