added assembly_center field to assembly files and used it to place assemblies at construction time
This commit is contained in:
parent
44486acca4
commit
cc41442923
|
@ -12,6 +12,8 @@ global v4 TimeSliderColor = v4{.36f, .52f, .78f, 1.f};
|
||||||
struct animation_timeline_state
|
struct animation_timeline_state
|
||||||
{
|
{
|
||||||
frame_range VisibleRange;
|
frame_range VisibleRange;
|
||||||
|
gs_list_handle SelectedAnimationBlockHandle;
|
||||||
|
u32 SelectedAnimationLayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline u32
|
inline u32
|
||||||
|
@ -510,7 +512,6 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
|
||||||
if (MouseDownAndNotHandled && ListHandleIsValid(DragBlockHandle))
|
if (MouseDownAndNotHandled && ListHandleIsValid(DragBlockHandle))
|
||||||
{
|
{
|
||||||
MouseDownAndNotHandled = false;
|
MouseDownAndNotHandled = false;
|
||||||
// TODO(Peter): Why are we passing state around?
|
|
||||||
SelectAndBeginDragAnimationBlock(DragBlockHandle, AdjustedViewRange, TimelineBounds, State);
|
SelectAndBeginDragAnimationBlock(DragBlockHandle, AdjustedViewRange, TimelineBounds, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ enum assembly_field
|
||||||
{
|
{
|
||||||
AssemblyField_AssemblyName,
|
AssemblyField_AssemblyName,
|
||||||
AssemblyField_AssemblyScale,
|
AssemblyField_AssemblyScale,
|
||||||
|
AssemblyField_AssemblyCenter,
|
||||||
AssemblyField_LedStripCount,
|
AssemblyField_LedStripCount,
|
||||||
|
|
||||||
AssemblyField_LedStrip,
|
AssemblyField_LedStrip,
|
||||||
|
@ -31,6 +32,7 @@ enum assembly_field
|
||||||
global char* AssemblyFieldIdentifiers[] = {
|
global char* AssemblyFieldIdentifiers[] = {
|
||||||
"assembly_name", // AssemblyField_AssemblyName
|
"assembly_name", // AssemblyField_AssemblyName
|
||||||
"assembly_scale", // AssemblyField_AssemblyScale
|
"assembly_scale", // AssemblyField_AssemblyScale
|
||||||
|
"assembly_center", // AssemblyField_AssemblyCenter
|
||||||
"led_strip_count", // AssemblyField_LedStripCount
|
"led_strip_count", // AssemblyField_LedStripCount
|
||||||
|
|
||||||
"led_strip", // AssemblyField_LedStrip
|
"led_strip", // AssemblyField_LedStrip
|
||||||
|
@ -384,6 +386,7 @@ ParseAssemblyFile(assembly* Assembly, gs_const_string FileName, gs_string FileTe
|
||||||
|
|
||||||
Assembly->Name = ReadStringField(AssemblyField_AssemblyName, &Tokenizer, &Assembly->Arena);
|
Assembly->Name = ReadStringField(AssemblyField_AssemblyName, &Tokenizer, &Assembly->Arena);
|
||||||
Assembly->Scale = ReadFloatField(AssemblyField_AssemblyScale, &Tokenizer);
|
Assembly->Scale = ReadFloatField(AssemblyField_AssemblyScale, &Tokenizer);
|
||||||
|
Assembly->Center = ReadV3Field(AssemblyField_AssemblyCenter, &Tokenizer);
|
||||||
|
|
||||||
Assembly->StripCount = ReadIntField(AssemblyField_LedStripCount, &Tokenizer);
|
Assembly->StripCount = ReadIntField(AssemblyField_LedStripCount, &Tokenizer);
|
||||||
Assembly->Strips = PushArray(&Assembly->Arena, v2_strip, Assembly->StripCount);
|
Assembly->Strips = PushArray(&Assembly->Arena, v2_strip, Assembly->StripCount);
|
||||||
|
|
|
@ -77,11 +77,13 @@ LedBufferSetLed(led_buffer* Buffer, u32 Led, v4 Position)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
ConstructAssemblyFromDefinition (assembly* Assembly, gs_const_string AssemblyName, v4 RootPosition, led_system* LedSystem)
|
ConstructAssemblyFromDefinition (assembly* Assembly, gs_const_string AssemblyName, led_system* LedSystem)
|
||||||
{
|
{
|
||||||
Assembly->LedBufferIndex = LedSystemTakeFreeBuffer(LedSystem, Assembly->LedCountTotal);
|
Assembly->LedBufferIndex = LedSystemTakeFreeBuffer(LedSystem, Assembly->LedCountTotal);
|
||||||
led_buffer* LedBuffer = LedSystemGetBuffer(LedSystem, Assembly->LedBufferIndex);
|
led_buffer* LedBuffer = LedSystemGetBuffer(LedSystem, Assembly->LedBufferIndex);
|
||||||
|
|
||||||
|
v4 RootPosition = ToV4Vec(Assembly->Center);
|
||||||
|
|
||||||
// Add Leds
|
// Add Leds
|
||||||
u32 LedsAdded = 0;
|
u32 LedsAdded = 0;
|
||||||
for (u32 StripIdx = 0; StripIdx < Assembly->StripCount; StripIdx++)
|
for (u32 StripIdx = 0; StripIdx < Assembly->StripCount; StripIdx++)
|
||||||
|
@ -127,8 +129,7 @@ LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, gs_memory_arena
|
||||||
NewAssembly->Arena = CreateMemoryArena(Context.ThreadContext.Allocator);
|
NewAssembly->Arena = CreateMemoryArena(Context.ThreadContext.Allocator);
|
||||||
if (ParseAssemblyFile(NewAssembly, FileName, AssemblyFileText, Scratch))
|
if (ParseAssemblyFile(NewAssembly, FileName, AssemblyFileText, Scratch))
|
||||||
{
|
{
|
||||||
v4 Offset = v4{0,0,0,0}; //TempAssemblyOffsets[Assemblies->Count % TempAssemblyOffsetsCount];
|
ConstructAssemblyFromDefinition(NewAssembly, FileName, LedSystem);
|
||||||
ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, LedSystem);
|
|
||||||
AllocatorFree(Context.ThreadContext.Allocator, AssemblyFile.Memory, AssemblyFile.Size);
|
AllocatorFree(Context.ThreadContext.Allocator, AssemblyFile.Memory, AssemblyFile.Size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -75,6 +75,7 @@ struct assembly
|
||||||
gs_string FilePath;
|
gs_string FilePath;
|
||||||
|
|
||||||
r32 Scale;
|
r32 Scale;
|
||||||
|
v3 Center;
|
||||||
s32 LedCountTotal;
|
s32 LedCountTotal;
|
||||||
u32 LedBufferIndex;
|
u32 LedBufferIndex;
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,8 @@ STREAM #1: 3D Overhaul
|
||||||
- leds always face camera
|
- leds always face camera
|
||||||
|
|
||||||
- Sculptures
|
- Sculptures
|
||||||
- store scale in the assembly definition file
|
|
||||||
- cache led vertex buffers
|
- cache led vertex buffers
|
||||||
- custom sculpture update functions (for motion)
|
- custom sculpture update functions (for motion)
|
||||||
- placing sculptures
|
|
||||||
- editing sculpture files (change universe output)
|
- editing sculpture files (change universe output)
|
||||||
- motion
|
- motion
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue