diff --git a/app_run_tree/data/blumen_animations/ambient_patterns/ambient_0.foldanim b/app_run_tree/data/blumen_animations/ambient_patterns/ambient_0.foldanim index 15a653b..b965ed5 100644 --- a/app_run_tree/data/blumen_animations/ambient_patterns/ambient_0.foldanim +++ b/app_run_tree/data/blumen_animations/ambient_patterns/ambient_0.foldanim @@ -87,6 +87,6 @@ blocks:{ max: 179; }; layer_index: 1; - animation_name: "Pattern_Rainbow"; + animation_name: "Pattern_StemSolid"; }; }; diff --git a/src/app/patterns/blumen_patterns.h b/src/app/patterns/blumen_patterns.h index b325d25..bac4015 100644 --- a/src/app/patterns/blumen_patterns.h +++ b/src/app/patterns/blumen_patterns.h @@ -52,6 +52,32 @@ Pattern_HueShift(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r3 r32 CycleProgress = FractR32(Time / CycleLength); 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 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 #endif // BLUMEN_PATTERNS_H \ No newline at end of file diff --git a/src/app/ss_blumen_lumen/blumen_lumen.cpp b/src/app/ss_blumen_lumen/blumen_lumen.cpp index e2b7035..d46c1ec 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.cpp +++ b/src/app/ss_blumen_lumen/blumen_lumen.cpp @@ -214,6 +214,9 @@ BlumenLumen_LoadPatterns(app_state* State) Patterns_PushPattern(Patterns, Pattern_AllOnMask, PATTERN_MULTITHREADED); Patterns_PushPattern(Patterns, Pattern_BulbMask, 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 @@ -351,6 +354,12 @@ BlumenLumen_CustomInit(app_state* State, context Context) assembly* Flower1 = LoadAssembly(Flower1AssemblyPath, 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->AssemblyNameToClearCore_Names = PushArray(&State->Permanent, u64, diff --git a/src/app/ss_blumen_lumen/blumen_lumen.h b/src/app/ss_blumen_lumen/blumen_lumen.h index 5e98557..8b381cf 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.h +++ b/src/app/ss_blumen_lumen/blumen_lumen.h @@ -139,6 +139,8 @@ struct blumen_lumen_state temp_job_req JobReq; + led_strip_list StemStrips[BL_FLOWER_COUNT]; + platform_thread_handle MicListenThread; mic_listen_job_data MicListenJobData; diff --git a/src/gs_libs/gs_types.cpp b/src/gs_libs/gs_types.cpp index 28238c4..bcf9f99 100644 --- a/src/gs_libs/gs_types.cpp +++ b/src/gs_libs/gs_types.cpp @@ -2751,6 +2751,7 @@ PushSize_(gs_memory_arena* Arena, u64 Size, char* Location) } #endif Assert(CursorEntry != 0); + Assert(CursorHasRoom(CursorEntry->Cursor, Size)); Result = PushSizeOnCursor_(&CursorEntry->Cursor, Size, Location); Assert(Result.Memory != 0);