Primary Hue Pattern
This commit is contained in:
parent
7a95861bf8
commit
4130d50c1b
|
@ -87,6 +87,6 @@ blocks:{
|
||||||
max: 179;
|
max: 179;
|
||||||
};
|
};
|
||||||
layer_index: 1;
|
layer_index: 1;
|
||||||
animation_name: "Pattern_Rainbow";
|
animation_name: "Pattern_StemSolid";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,6 +52,32 @@ Pattern_HueShift(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r3
|
||||||
r32 CycleProgress = FractR32(Time / CycleLength);
|
r32 CycleProgress = FractR32(Time / CycleLength);
|
||||||
r32 CycleBlend = (SinR32(Time) * .5f) + .5f;
|
r32 CycleBlend = (SinR32(Time) * .5f) + .5f;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
phrase_hue Hue = BLState->AssemblyColors[Assembly.AssemblyIndex % 3];
|
||||||
|
v4 C0 = RGBFromPhraseHue(Hue.Hue0);
|
||||||
|
v4 C1 = RGBFromPhraseHue(Hue.Hue1);
|
||||||
|
v4 C2 = RGBFromPhraseHue(Hue.Hue2);
|
||||||
|
|
||||||
|
v4 HSV = {};
|
||||||
|
if (CycleProgress < .25f)
|
||||||
|
{
|
||||||
|
r32 P = CycleProgress * 4;
|
||||||
|
HSV = V4Lerp(C0,
|
||||||
|
}
|
||||||
|
else if (CycleProgress >= .25f && CycleProgress < .5f)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (CycleProgress >= .5f && CycleProgress < .75f)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (CycleProgress >= .75f)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
v4 HSV = { CycleProgress * 360, 1, 1, 1 };
|
v4 HSV = { CycleProgress * 360, 1, 1, 1 };
|
||||||
v4 RGB = HSVToRGB(HSV);
|
v4 RGB = HSVToRGB(HSV);
|
||||||
|
|
||||||
|
@ -630,5 +656,49 @@ Pattern_VoicePattern(led_buffer* Leds, led_buffer_range Range, assembly Assembly
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
Pattern_StemSolid(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Time, gs_memory_arena* Transient, u8* UserData)
|
||||||
|
{
|
||||||
|
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||||
|
Time = Time * BLState->PatternSpeed;
|
||||||
|
|
||||||
|
phrase_hue Hue = BlumenLumen_GetCurrentHue(BLState, Assembly);
|
||||||
|
v4 C0 = RGBFromPhraseHue(Hue.Hue0);
|
||||||
|
v4 C1 = RGBFromPhraseHue(Hue.Hue1);
|
||||||
|
v4 C2 = RGBFromPhraseHue(Hue.Hue2);
|
||||||
|
|
||||||
|
pixel WhiteMask = V4ToRGBPixel(WhiteV4);
|
||||||
|
|
||||||
|
led_strip_list Stem = BLState->StemStrips[Assembly.AssemblyIndex];
|
||||||
|
for (u32 s = 0; s < Stem.Count; s++)
|
||||||
|
{
|
||||||
|
u32 StripIndex = Stem.StripIndices[s];
|
||||||
|
v2_strip Strip = Assembly.Strips[StripIndex];
|
||||||
|
for (u32 i = 0; i < Strip.LedCount; i++)
|
||||||
|
{
|
||||||
|
v4 P = Leds->Positions[i];
|
||||||
|
Leds->Colors[i] = WhiteMask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
Pattern_PrimaryHue(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Time, gs_memory_arena* Transient, u8* UserData)
|
||||||
|
{
|
||||||
|
blumen_lumen_state* BLState = (blumen_lumen_state*)UserData;
|
||||||
|
Time = Time * BLState->PatternSpeed;
|
||||||
|
|
||||||
|
phrase_hue Hue = BlumenLumen_GetCurrentHue(BLState, Assembly);
|
||||||
|
v4 C0 = RGBFromPhraseHue(Hue.Hue0);
|
||||||
|
v4 C1 = RGBFromPhraseHue(Hue.Hue1);
|
||||||
|
v4 C2 = RGBFromPhraseHue(Hue.Hue2);
|
||||||
|
|
||||||
|
pixel HueOut = V4ToRGBPixel(C0);
|
||||||
|
for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++)
|
||||||
|
{
|
||||||
|
Leds->Colors[LedIndex] = HueOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define BLUMEN_PATTERNS_H
|
#define BLUMEN_PATTERNS_H
|
||||||
#endif // BLUMEN_PATTERNS_H
|
#endif // BLUMEN_PATTERNS_H
|
|
@ -214,6 +214,9 @@ BlumenLumen_LoadPatterns(app_state* State)
|
||||||
Patterns_PushPattern(Patterns, Pattern_AllOnMask, PATTERN_MULTITHREADED);
|
Patterns_PushPattern(Patterns, Pattern_AllOnMask, PATTERN_MULTITHREADED);
|
||||||
Patterns_PushPattern(Patterns, Pattern_BulbMask, PATTERN_MULTITHREADED);
|
Patterns_PushPattern(Patterns, Pattern_BulbMask, PATTERN_MULTITHREADED);
|
||||||
Patterns_PushPattern(Patterns, Pattern_VoicePattern, PATTERN_MULTITHREADED);
|
Patterns_PushPattern(Patterns, Pattern_VoicePattern, PATTERN_MULTITHREADED);
|
||||||
|
|
||||||
|
Patterns_PushPattern(Patterns, Pattern_StemSolid, PATTERN_MULTITHREADED);
|
||||||
|
Patterns_PushPattern(Patterns, Pattern_PrimaryHue, PATTERN_MULTITHREADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -351,6 +354,12 @@ BlumenLumen_CustomInit(app_state* State, context Context)
|
||||||
assembly* Flower1 = LoadAssembly(Flower1AssemblyPath, State, Context);
|
assembly* Flower1 = LoadAssembly(Flower1AssemblyPath, State, Context);
|
||||||
assembly* Flower2 = LoadAssembly(Flower2AssemblyPath, State, Context);
|
assembly* Flower2 = LoadAssembly(Flower2AssemblyPath, State, Context);
|
||||||
|
|
||||||
|
for (u32 i = 0; i < BL_FLOWER_COUNT; i++)
|
||||||
|
{
|
||||||
|
assembly Assembly = State->Assemblies.Values[i];
|
||||||
|
BLState->StemStrips[i] = AssemblyStripsGetWithTagValue(Assembly, ConstString("section"), ConstString("stem"), &State->Permanent);
|
||||||
|
}
|
||||||
|
|
||||||
BLState->AssemblyNameToClearCoreMapCount = 3;
|
BLState->AssemblyNameToClearCoreMapCount = 3;
|
||||||
BLState->AssemblyNameToClearCore_Names = PushArray(&State->Permanent,
|
BLState->AssemblyNameToClearCore_Names = PushArray(&State->Permanent,
|
||||||
u64,
|
u64,
|
||||||
|
|
|
@ -139,6 +139,8 @@ struct blumen_lumen_state
|
||||||
|
|
||||||
temp_job_req JobReq;
|
temp_job_req JobReq;
|
||||||
|
|
||||||
|
led_strip_list StemStrips[BL_FLOWER_COUNT];
|
||||||
|
|
||||||
platform_thread_handle MicListenThread;
|
platform_thread_handle MicListenThread;
|
||||||
mic_listen_job_data MicListenJobData;
|
mic_listen_job_data MicListenJobData;
|
||||||
|
|
||||||
|
|
|
@ -2751,6 +2751,7 @@ PushSize_(gs_memory_arena* Arena, u64 Size, char* Location)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Assert(CursorEntry != 0);
|
Assert(CursorEntry != 0);
|
||||||
|
Assert(CursorHasRoom(CursorEntry->Cursor, Size));
|
||||||
Result = PushSizeOnCursor_(&CursorEntry->Cursor, Size, Location);
|
Result = PushSizeOnCursor_(&CursorEntry->Cursor, Size, Location);
|
||||||
Assert(Result.Memory != 0);
|
Assert(Result.Memory != 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue