cleaned up unneeded fields in animation_frame

This commit is contained in:
PS 2020-11-14 13:48:17 -08:00
parent 5e6ac25490
commit e51188398d
2 changed files with 11 additions and 27 deletions

View File

@ -102,13 +102,6 @@ struct animation_frame
{
animation_layer_frame* Layers;
u32 LayersCount;
// NOTE(pjs): These are all parallel arrays of equal length
animation_block* Blocks;
b8* BlocksFilled;
u32 BlocksCountMax;
u32 BlocksCount;
};
#define ANIMATION_SYSTEM_LAYERS_MAX 128
@ -442,12 +435,7 @@ AnimationSystem_CalculateAnimationFrame(animation_system* System, gs_memory_aren
animation_frame Result = {0};
Result.LayersCount = ActiveAnim->Layers.Count;
Result.Layers = PushArray(Arena, animation_layer_frame, Result.LayersCount);
ZeroArray(Result.Layers, animation_frame, Result.LayersCount);
Result.BlocksCountMax = ActiveAnim->Layers.Count;
Result.Blocks = PushArray(Arena, animation_block, Result.BlocksCountMax);
Result.BlocksFilled = PushArray(Arena, b8, Result.BlocksCountMax);
ZeroArray(Result.BlocksFilled, b8, Result.BlocksCountMax);
ZeroArray(Result.Layers, animation_layer_frame, Result.LayersCount);
for (u32 i = 0; i < ActiveAnim->Blocks_.Count; i++)
{
@ -486,11 +474,6 @@ AnimationSystem_CalculateAnimationFrame(animation_system* System, gs_memory_aren
Layer->HotOpacity = 1.0f;
Layer->HasHot = true;
}
// TODO(pjs): Get rid of these fields, they're redundant now
Result.BlocksFilled[Block.Layer] = true;
Result.Blocks[Block.Layer] = Block;
Result.BlocksCount++;
}
}

View File

@ -179,17 +179,18 @@ AnimationSystem_RenderToLedBuffers(animation_system* System, assembly_array Asse
// Consolidate Temp Buffers
// We do this in reverse order so that they go from top to bottom
for (u32 Layer = 0; Layer < CurrFrame.BlocksCountMax; Layer++)
for (u32 Layer = 0; Layer < CurrFrame.LayersCount; Layer++)
{
if (!CurrFrame.BlocksFilled[Layer]) { continue; }
led_blend_proc* Blend = LedBlend_GetProc(ActiveAnim->Layers.Values[Layer].BlendMode);
Assert(Blend != 0);
for (u32 LED = 0; LED < AssemblyLedBuffer->LedCount; LED++)
if (CurrFrame.Layers[Layer].HasHot)
{
pixel A = AssemblyLedBuffer->Colors[LED];
pixel B = LayerBuffers[Layer].HotBuffer.Colors[LED];
AssemblyLedBuffer->Colors[LED] = Blend(A, B);
led_blend_proc* Blend = LedBlend_GetProc(ActiveAnim->Layers.Values[Layer].BlendMode);
Assert(Blend != 0);
for (u32 LED = 0; LED < AssemblyLedBuffer->LedCount; LED++)
{
pixel A = AssemblyLedBuffer->Colors[LED];
pixel B = LayerBuffers[Layer].HotBuffer.Colors[LED];
AssemblyLedBuffer->Colors[LED] = Blend(A, B);
}
}
}
}