Updated todo list. Enforced execution order of animation blocks - they now execute in layer order, from top to bottom.

This commit is contained in:
Peter Slattery 2020-03-07 16:29:07 -08:00
parent de1a9474f0
commit f1936a016c
5 changed files with 74 additions and 20 deletions

View File

@ -83,20 +83,26 @@ Win32StringLength(char* String)
}
internal s32
Win32ConcatStrings(s32 ALen, char* A, s32 BLen, char* B, s32 DestLen, char* Dest)
Win32ConcatStrings(s32 ALength, char* A, s32 BLength, char* B, s32 DestLength, char* Dest)
{
char* Dst = Dest;
char* AAt = A;
for (s32 a = 0; a < ALen; a++)
int ALengthToCopy = ALength < DestLength ? ALength : DestLength;
for (s32 a = 0; a < ALength; a++)
{
*Dst++ = *AAt++;
}
char* BAt = B;
for (s32 b = 0; b < BLen; b++)
int DestLengthRemaining = DestLength - (Dst - Dest);
int BLengthToCopy = BLength < DestLengthRemaining ? BLength : DestLength;
for (s32 b = 0; b < BLengthToCopy; b++)
{
*Dst++ = *BAt++;
}
return Dst - Dest;
int DestLengthOut = Dst - Dest;
int NullTermIndex = DestLengthOut < DestLength ? DestLengthOut : DestLength;
Dest[NullTermIndex] = 0;
return DestLengthOut;
}
///

View File

@ -341,13 +341,25 @@ UPDATE_AND_RENDER(UpdateAndRender)
State->AnimationSystem.LastUpdatedFrame = CurrentFrame;
r32 FrameTime = CurrentFrame * State->AnimationSystem.SecondsPerFrame;
u32 CurrentBlocksMax = State->AnimationSystem.LayersCount;
b8* CurrentBlocksFilled = PushArray(&State->Transient, b8, CurrentBlocksMax);
GSZeroArray(CurrentBlocksFilled, b8, CurrentBlocksMax);
animation_block* CurrentBlocks = PushArray(&State->Transient, animation_block, CurrentBlocksMax);
for (u32 i = 0; i < State->AnimationSystem.Blocks.Used; i++)
{
gs_list_entry<animation_block>* BlockEntry = State->AnimationSystem.Blocks.GetEntryAtIndex(i);
if (EntryIsFree(BlockEntry)) { continue; }
animation_block Block = BlockEntry->Value;
if (CurrentFrame < Block.Range.Min || CurrentFrame > Block.Range.Max) { continue; }
CurrentBlocksFilled[Block.Layer] = true;
CurrentBlocks[Block.Layer] = Block;
}
for (s32 Layer = CurrentBlocksMax - 1; Layer >= 0; Layer--)
{
if (!CurrentBlocksFilled[Layer]) { continue; }
animation_block Block = CurrentBlocks[Layer];
for (u32 j = 0; j < State->ActiveAssemblyIndecies.Used; j++)
{
gs_list_handle AssemblyHandle = *State->ActiveAssemblyIndecies.GetElementAtIndex(j);

View File

@ -151,12 +151,12 @@ TestPatternTwo(assembly* Assembly, r32 Time)
}
else
{
Assembly->Colors[LED.Index] = {};
//Assembly->Colors[LED.Index] = {};
}
}
else
{
Assembly->Colors[LED.Index] = {};
//Assembly->Colors[LED.Index] = {};
}
}
}

View File

@ -14,13 +14,44 @@ struct win32_dll_refresh
FILETIME LastWriteTime;
HMODULE DLL;
b32 IsValid;
bool IsValid;
char SourceDLLPath[MAX_PATH];
char WorkingDLLPath[MAX_PATH];
char LockFilePath[MAX_PATH];
};
internal int
Win32DLLStringLength(char* String)
{
char* At = String;
while (*At) { At++; };
return At - String;
}
internal int
Win32DLLConcatStrings(int ALength, char* A, int BLength, char* B, int DestLength, char* Dest)
{
char* Dst = Dest;
char* AAt = A;
int ALengthToCopy = ALength < DestLength ? ALength : DestLength;
for (s32 a = 0; a < ALength; a++)
{
*Dst++ = *AAt++;
}
char* BAt = B;
int DestLengthRemaining = DestLength - (Dst - Dest);
int BLengthToCopy = BLength < DestLengthRemaining ? BLength : DestLength;
for (s32 b = 0; b < BLengthToCopy; b++)
{
*Dst++ = *BAt++;
}
int DestLengthOut = Dst - Dest;
int NullTermIndex = DestLengthOut < DestLength ? DestLengthOut : DestLength;
Dest[NullTermIndex] = 0;
return DestLengthOut;
}
internal void
GetApplicationPath(system_path* Result)
{
@ -81,14 +112,14 @@ InitializeDLLHotReloading(char* SourceDLLName,
ExePath.Path = (char*)VirtualAlloc(NULL, ExePath.PathLength, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
GetApplicationPath(&ExePath);
Win32ConcatStrings(ExePath.IndexOfLastSlash, ExePath.Path,
Win32StringLength(SourceDLLName), SourceDLLName,
Win32DLLConcatStrings(ExePath.IndexOfLastSlash, ExePath.Path,
Win32DLLStringLength(SourceDLLName), SourceDLLName,
MAX_PATH, Result.SourceDLLPath);
Win32ConcatStrings(ExePath.IndexOfLastSlash, ExePath.Path,
Win32StringLength(WorkingDLLFileName), WorkingDLLFileName,
Win32DLLConcatStrings(ExePath.IndexOfLastSlash, ExePath.Path,
Win32DLLStringLength(WorkingDLLFileName), WorkingDLLFileName,
MAX_PATH, Result.WorkingDLLPath);
Win32ConcatStrings(ExePath.IndexOfLastSlash, ExePath.Path,
Win32StringLength(LockFileName), LockFileName,
Win32DLLConcatStrings(ExePath.IndexOfLastSlash, ExePath.Path,
Win32DLLStringLength(LockFileName), LockFileName,
MAX_PATH, Result.LockFilePath);
Win32Free((u8*)ExePath.Path, ExePath.PathLength);

View File

@ -75,10 +75,15 @@ Ground Up Reengineering
x zoom in and out
- blending between animation
- layers
- display more than one layer
- add/remove layers
x display more than one layer
x add/remove layers
- layer masks by sculpture
- blend modes
- blend modes - create a copy of the led's per layer, handle blending outside of patterns
- interface for animation system
- add/remove layers
- select blend modes
- change which layer an animation is on
-
- setting start and end of timeline (how long is a loop)
- clips can have parameters that drive them?