Patterns, Debug Mode, and Phrase Mapping
This commit is contained in:
parent
c4769bd53c
commit
c27cd4052b
|
@ -106,12 +106,14 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
|
|||
State->AssemblyDebugState.TargetChannel = FSC(Board, Strip);
|
||||
}break;
|
||||
|
||||
case ADS_Override_AllOff:
|
||||
case ADS_Override_AllRed:
|
||||
case ADS_Override_AllGreen:
|
||||
case ADS_Override_AllBlue:
|
||||
case ADS_Override_AllWhite:
|
||||
{
|
||||
State->AssemblyDebugState.Brightness = (u8)ui_LabeledRangeSlider(Interface, MakeString("Brightness"), (r32)State->AssemblyDebugState.Brightness, 0, 255);
|
||||
State->AssemblyDebugState.TargetAssembly = ui_LabeledTextEntryU64(Interface, MakeString("Assembly"), State->AssemblyDebugState.TargetAssembly);
|
||||
}break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1006,21 +1006,15 @@ Pattern_BasicFlowers(led_buffer* Leds, led_buffer_range Range, assembly Assembly
|
|||
}
|
||||
TLastFrame = Time;
|
||||
|
||||
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||
phrase_hue Hue = BLState->AssemblyColors[Assembly.AssemblyIndex % 3];
|
||||
v4 C0 = HSVToRGB({Hue.Hue0, 1, 1, 1});
|
||||
v4 C1 = HSVToRGB({Hue.Hue1, 1, 1, 1});
|
||||
v4 C2 = HSVToRGB({Hue.Hue2, 1, 1, 1});
|
||||
|
||||
for (u32 StripIndex = 0; StripIndex < Assembly.StripCount; StripIndex++)
|
||||
{
|
||||
v2_strip Strip = Assembly.Strips[StripIndex];
|
||||
|
||||
// Each flower different
|
||||
v4 * Colors = FAC;
|
||||
if (AssemblyStrip_HasTagValueSLOW(Strip, "flower", "center"))
|
||||
{
|
||||
Colors = FBC;
|
||||
}
|
||||
else if (AssemblyStrip_HasTagValueSLOW(Strip, "flower", "right"))
|
||||
{
|
||||
Colors = FCC;
|
||||
}
|
||||
|
||||
r32 CycleT = ModR32(Time, 10) * 20;
|
||||
|
||||
for (u32 i = 0; i < Strip.LedCount; i++)
|
||||
|
@ -1031,7 +1025,15 @@ Pattern_BasicFlowers(led_buffer* Leds, led_buffer_range Range, assembly Assembly
|
|||
r32 T = ModR32(P.y + CycleT, 200) / 200.f;
|
||||
T = Clamp01(T);
|
||||
|
||||
v4 Color = GetColor(Colors, FLOWER_COLORS_COUNT, T);
|
||||
v4 Color = {};
|
||||
if (T < 0.5f)
|
||||
{
|
||||
Color = V4Lerp(T * 2, C0, C1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color = V4Lerp((T - 0.5f) * 2, C1, C2);
|
||||
}
|
||||
Leds->Colors[LedIndex] = V4ToRGBPixel(Color);
|
||||
}
|
||||
}
|
||||
|
@ -1042,6 +1044,11 @@ Pattern_Wavy(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Ti
|
|||
{
|
||||
DEBUG_TRACK_FUNCTION;
|
||||
|
||||
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||
phrase_hue Hue = BLState->AssemblyColors[Assembly.AssemblyIndex % 3];
|
||||
v4 C0 = HSVToRGB({Hue.Hue0, 1, 1, 1});
|
||||
v4 C1 = HSVToRGB({Hue.Hue1, 1, 1, 1});
|
||||
|
||||
for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++)
|
||||
{
|
||||
v4 P = Leds->Positions[LedIndex];
|
||||
|
@ -1056,7 +1063,7 @@ Pattern_Wavy(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Ti
|
|||
v3 BSeed = v3{P.z, P.x, P.y};
|
||||
r32 BNoise = 1.0f; //Fbm3D(BSeed / 50);
|
||||
|
||||
v4 C = GetColor(&FlowerAColors[0], FLOWER_COLORS_COUNT, Noise);
|
||||
v4 C = V4Lerp(BNoise, C0, C1);
|
||||
C = C * BNoise;
|
||||
|
||||
//Leds->Colors[LedIndex] = V4ToRGBPixel(v4{Noise, Noise, Noise, 1});
|
||||
|
@ -1070,6 +1077,11 @@ Pattern_Patchy(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32
|
|||
{
|
||||
DEBUG_TRACK_FUNCTION;
|
||||
|
||||
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||
phrase_hue Hue = BLState->AssemblyColors[Assembly.AssemblyIndex % 3];
|
||||
v4 C0 = HSVToRGB({Hue.Hue0, 1, 1, 1});
|
||||
v4 C1 = HSVToRGB({Hue.Hue1, 1, 1, 1});
|
||||
|
||||
for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++)
|
||||
{
|
||||
v4 P = Leds->Positions[LedIndex];
|
||||
|
@ -1080,12 +1092,12 @@ Pattern_Patchy(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32
|
|||
r32 NoiseA = Noise3D((Pp / 38) + v3{0, 0, Time});
|
||||
NoiseA = PowR32(NoiseA, 3);
|
||||
NoiseA = Smoothstep(NoiseA);
|
||||
v4 CA = v4{1, 0, 1, 1} * NoiseA;
|
||||
v4 CA = C0 * NoiseA;
|
||||
|
||||
r32 NoiseB = Noise3D((Pp / 75) + v3{Time * 0.5f, 0, 0});
|
||||
NoiseB = PowR32(NoiseB, 3);
|
||||
NoiseB = Smoothstep(NoiseB);
|
||||
v4 CB = v4{0, 1, 1, 1} * NoiseB;
|
||||
v4 CB = C1 * NoiseB;
|
||||
|
||||
v4 C = CA + CB;
|
||||
Leds->Colors[LedIndex] = V4ToRGBPixel(C);
|
||||
|
@ -1097,8 +1109,10 @@ Pattern_Leafy(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 T
|
|||
{
|
||||
DEBUG_TRACK_FUNCTION;
|
||||
|
||||
v4* Colors = &FlowerBColors[0];
|
||||
|
||||
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||
phrase_hue Hue = BLState->AssemblyColors[Assembly.AssemblyIndex % 3];
|
||||
v4 C0 = HSVToRGB({Hue.Hue0, 1, 1, 1});
|
||||
v4 C1 = HSVToRGB({Hue.Hue1, 1, 1, 1});
|
||||
|
||||
for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++)
|
||||
{
|
||||
|
@ -1157,6 +1171,10 @@ internal void
|
|||
Pattern_LeafyPatchy(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Time, gs_memory_arena* Transient, u8* UserData)
|
||||
{
|
||||
DEBUG_TRACK_FUNCTION;
|
||||
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||
phrase_hue Hue = BLState->AssemblyColors[Assembly.AssemblyIndex % 3];
|
||||
v4 C0 = HSVToRGB({Hue.Hue0, 1, 1, 1});
|
||||
v4 C1 = HSVToRGB({Hue.Hue1, 1, 1, 1});
|
||||
for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++)
|
||||
{
|
||||
v4 P = Leds->Positions[LedIndex];
|
||||
|
@ -1167,12 +1185,12 @@ Pattern_LeafyPatchy(led_buffer* Leds, led_buffer_range Range, assembly Assembly,
|
|||
r32 NoiseA = Fbm3D((Pp / 35), Time * 0.5f);
|
||||
//NoiseA = PowR32(NoiseA, 3);
|
||||
NoiseA = Smoothstep(NoiseA);
|
||||
v4 CA = v4{1, 0, 1, 1} * NoiseA;
|
||||
v4 CA = C0 * NoiseA;
|
||||
|
||||
r32 NoiseB = Noise3D((Pp / 35) + v3{0, 0, Time * 5});
|
||||
NoiseB = PowR32(NoiseB, 3);
|
||||
NoiseB = Smoothstep(NoiseB);
|
||||
v4 CB = v4{0, 1, 1, 1};
|
||||
v4 CB = C1;
|
||||
|
||||
v4 C = V4Lerp(NoiseB, CA, CB);
|
||||
Leds->Colors[LedIndex] = V4ToRGBPixel(C);
|
||||
|
|
|
@ -574,27 +574,6 @@ WinMain (
|
|||
|
||||
if (!SetWorkingDirectory(HInstance, ThreadContext)) return 1;
|
||||
|
||||
|
||||
gs_file TestFile = ReadEntireFile(ThreadContext.FileHandler, ConstString("data/flower_codes.tsv"));
|
||||
gs_const_string TestFileStr = {};
|
||||
TestFileStr.Str = (char*)TestFile.Memory;
|
||||
TestFileStr.Length = TestFile.Size;
|
||||
gscsv_sheet Sheet = CSV_Parse(TestFileStr, { '\t' }, ThreadContext.Transient);
|
||||
|
||||
gs_string Out = PushString(ThreadContext.Transient, TestFile.Size * 2);
|
||||
|
||||
for (u64 y = 0; y < Sheet.RowCount; y++)
|
||||
{
|
||||
for (u64 x = 0; x < Sheet.ColumnCount; x++)
|
||||
{
|
||||
gs_const_string Cell = CSVSheet_GetCell(Sheet, x, y);
|
||||
AppendPrintF(&Out, "%S\t", Cell);
|
||||
}
|
||||
AppendPrintF(&Out, "\n");
|
||||
}
|
||||
NullTerminate(&Out);
|
||||
OutputDebugStringA(Out.Str);
|
||||
|
||||
MainWindow = Win32CreateWindow (HInstance, "Foldhaus", 1440, 768, HandleWindowEvents);
|
||||
Win32UpdateWindowDimension(&MainWindow);
|
||||
|
||||
|
|
|
@ -278,9 +278,9 @@ BlumenLumen_CustomInit(app_state* State, context Context)
|
|||
BLState->AssemblyNameToClearCore_Names = PushArray(&State->Permanent,
|
||||
u64,
|
||||
BLState->AssemblyNameToClearCoreMapCount);
|
||||
BLState->AssemblyNameToClearCore_Names[0] = HashDJB2ToU64(Flower0->Name);
|
||||
BLState->AssemblyNameToClearCore_Names[1] = HashDJB2ToU64(Flower1->Name);
|
||||
BLState->AssemblyNameToClearCore_Names[2] = HashDJB2ToU64(Flower2->Name);
|
||||
BLState->AssemblyNameToClearCore_Names[0] = HashDJB2ToU32(StringExpand(Flower2->Name));
|
||||
BLState->AssemblyNameToClearCore_Names[1] = HashDJB2ToU32(StringExpand(Flower1->Name));
|
||||
BLState->AssemblyNameToClearCore_Names[2] = HashDJB2ToU32(StringExpand(Flower0->Name));
|
||||
|
||||
gs_file_handler FileHandler = Context.ThreadContext.FileHandler;
|
||||
gs_file ColorPhraseCSVFile = ReadEntireFile(FileHandler, PhraseMapCSVPath);
|
||||
|
@ -292,7 +292,7 @@ BlumenLumen_CustomInit(app_state* State, context Context)
|
|||
BLState->PhraseHueMap = PhraseHueMap_GenFromCSV(ColorPhraseSheet,
|
||||
&State->Permanent);
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
{ // Animation PLAYGROUND
|
||||
animation_desc Desc = {};
|
||||
Desc.NameSize = 256;
|
||||
|
@ -363,25 +363,6 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
|
|||
u32 AssemblyIdx = BLState->LastAssemblyColorSet;
|
||||
BLState->AssemblyColors[AssemblyIdx] = NewHue;
|
||||
}
|
||||
#if 0
|
||||
for (u32 i = 0; i < PhraseToAnimMapCount; i++)
|
||||
{
|
||||
gs_const_string PhraseStr = ConstString(PhraseToAnimMap[i].Phrase);
|
||||
u32 PhraseIndex = PhraseToAnimMap[i].PatternIndex;
|
||||
if (StringEqualsCharArray(PhraseStr, Mic.AnimationFileName, NameLen))
|
||||
{
|
||||
AnimationFadeGroup_FadeTo(&State->AnimationSystem.ActiveFadeGroup,
|
||||
animation_handle{(s32)PhraseIndex},
|
||||
3.0f);
|
||||
|
||||
gs_string T = PushStringF(State->Transient, 256,
|
||||
"Received Animation Packet:\nAnimationIndex: %d\n",
|
||||
PhraseIndex);
|
||||
NullTerminate(&T);
|
||||
OutputDebugStringA(T.Str);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}break;
|
||||
|
||||
case PacketType_MotorState:
|
||||
|
|
|
@ -7,8 +7,8 @@ gs_const_string Flower0AssemblyPath = ConstString("data/ss_blumen_one.fold");
|
|||
gs_const_string Flower1AssemblyPath = ConstString("data/ss_blumen_two.fold");
|
||||
gs_const_string Flower2AssemblyPath = ConstString("data/ss_blumen_three.fold");
|
||||
|
||||
gs_const_string PhraseMapCSVPath = ConstString("data/flower_codes.tsv");
|
||||
char PhraseMapCSVSeparator = '\t';
|
||||
gs_const_string PhraseMapCSVPath = ConstString("data/flower_codes.csv");
|
||||
char PhraseMapCSVSeparator = ',';
|
||||
|
||||
global time_range MotorOpenTimes[] = {
|
||||
{ 00, 30, 00, 40 },
|
||||
|
|
Loading…
Reference in New Issue