Added a way to test hues on the sculpture from the debug panel

This commit is contained in:
PS 2021-04-08 17:42:20 -10:00
parent 2a11fc815b
commit 29a92837a6
6 changed files with 35 additions and 17 deletions

View File

@ -118,6 +118,11 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
State->AssemblyDebugState.TargetAssembly = ui_LabeledTextEntryU64(Interface, MakeString("Assembly"), State->AssemblyDebugState.TargetAssembly); State->AssemblyDebugState.TargetAssembly = ui_LabeledTextEntryU64(Interface, MakeString("Assembly"), State->AssemblyDebugState.TargetAssembly);
}break; }break;
case ADS_Override_AllHue:
{
State->AssemblyDebugState.TargetHue = (u32)ui_LabeledRangeSlider(Interface, MakeString("Hue"), (r32)State->AssemblyDebugState.TargetHue, 0, 360);
}break;
default: default:
{ {
InterfaceAssert(Interface->PerFrameMemory); InterfaceAssert(Interface->PerFrameMemory);

View File

@ -16,6 +16,7 @@ enum override_type
ADS_Override_AllBlue, ADS_Override_AllBlue,
ADS_Override_AllOff, ADS_Override_AllOff,
ADS_Override_AllWhite, ADS_Override_AllWhite,
ADS_Override_AllHue,
ADS_Override_TagWhite, ADS_Override_TagWhite,
ADS_Override_TagStripWhite, ADS_Override_TagStripWhite,
ADS_Override_ChannelWhite, ADS_Override_ChannelWhite,
@ -32,6 +33,7 @@ global gs_const_string OverrideTypeStrings[] = {
LitString("Override_AllBlue" ), LitString("Override_AllBlue" ),
LitString("ADS_Override_AllOff" ), LitString("ADS_Override_AllOff" ),
LitString("ADS_Override_AllWhite" ), LitString("ADS_Override_AllWhite" ),
LitString("ADS_Override_AllHue" ),
LitString("ADS_Override_TagWhite" ), LitString("ADS_Override_TagWhite" ),
LitString("ADS_Override_TagStripWhite" ), LitString("ADS_Override_TagStripWhite" ),
LitString("ADS_Override_ChannelWhite," ), LitString("ADS_Override_ChannelWhite," ),
@ -49,6 +51,7 @@ struct assembly_debug_state
gs_string TagName; gs_string TagName;
gs_string TagValue; gs_string TagValue;
u32 TargetHue;
pixel TargetColor; pixel TargetColor;
u32 TargetChannel; u32 TargetChannel;
@ -158,6 +161,14 @@ AssemblyDebug_OverrideOutputForAssembly(assembly_debug_state State, led_system
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{V, V, V}); AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{V, V, V});
}break; }break;
case ADS_Override_AllHue:
{
v4 HSV = v4{(r32)State.TargetHue, 1, 1, 1};
v4 RGB = HSVToRGB(HSV);
pixel P = V4ToRGBPixel(RGB);
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, P);
}break;
case ADS_Override_TagWhite: case ADS_Override_TagWhite:
{ {
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{0, 0, 0}); AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{0, 0, 0});

View File

@ -18,6 +18,9 @@
#include "engine/foldhaus_network_ordering.h" #include "engine/foldhaus_network_ordering.h"
#include "engine/assembly/foldhaus_assembly.h" #include "engine/assembly/foldhaus_assembly.h"
#include "ss_blumen_lumen/gfx_math.h"
#include "engine/assembly/foldhaus_assembly_parser.cpp" #include "engine/assembly/foldhaus_assembly_parser.cpp"
#include "engine/assembly/foldhaus_assembly_debug.h" #include "engine/assembly/foldhaus_assembly_debug.h"
@ -42,7 +45,6 @@ typedef struct panel panel;
#include "engine/animation/foldhaus_animation_renderer.cpp" #include "engine/animation/foldhaus_animation_renderer.cpp"
#include "engine/user_space.h" #include "engine/user_space.h"
#include "ss_blumen_lumen/gfx_math.h"
#include "ss_blumen_lumen/phrase_hue_map.h" #include "ss_blumen_lumen/phrase_hue_map.h"
#include "ss_blumen_lumen/blumen_lumen.h" #include "ss_blumen_lumen/blumen_lumen.h"

View File

@ -7,20 +7,6 @@
#define FLOWER_COLORS_COUNT 12 #define FLOWER_COLORS_COUNT 12
internal pixel
V4ToRGBPixel(v4 C)
{
C.x = Clamp01(C.x);
C.y = Clamp01(C.y);
C.z = Clamp01(C.z);
pixel Result = {};
Result.R = (u8)(C.x * 255);
Result.G = (u8)(C.y * 255);
Result.B = (u8)(C.z * 255);
return Result;
}
internal void internal void
Pattern_AltBloomMask(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Time, gs_memory_arena* Transient, u8* UserData) Pattern_AltBloomMask(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r32 Time, gs_memory_arena* Transient, u8* UserData)
{ {
@ -647,7 +633,7 @@ Pattern_VoicePattern(led_buffer* Leds, led_buffer_range Range, assembly Assembly
v4 C = {}; v4 C = {};
C += GenPatchyColor(P, Time, C0, C2, {}); C += GenPatchyColor(P, Time, C0, C2, {});
//C = GenVerticalLeaves((P - Assembly.Center) + v3{0, 150, 0}, Time, C0, C1, C2); //C = GenVerticalLeaves((P - Assembly.Center) + v3{0, 150, 0}, Time, C0, C1, C2);
r32 Bands = GenLiquidBands(P, -250, Time); //r32 Bands = GenLiquidBands(P, -250, Time);
//C = V4Lerp(Bands, C * .5f, C1); //C = V4Lerp(Bands, C * .5f, C1);
//C = WhiteV4 * GenDotBands(P - Assembly.Center, Time); //C = WhiteV4 * GenDotBands(P - Assembly.Center, Time);

View File

@ -357,7 +357,7 @@ BlumenLumen_CustomInit(app_state* State, context Context)
for (u32 i = 0; i < BL_FLOWER_COUNT; i++) for (u32 i = 0; i < BL_FLOWER_COUNT; i++)
{ {
assembly Assembly = State->Assemblies.Values[i]; assembly Assembly = State->Assemblies.Values[i];
BLState->StemStrips[i] = AssemblyStripsGetWithTagValue(Assembly, ConstString("section"), ConstString("stem"), &State->Permanent); BLState->StemStrips[Assembly.AssemblyIndex] = AssemblyStripsGetWithTagValue(Assembly, ConstString("section"), ConstString("stem"), &State->Permanent);
} }
BLState->AssemblyNameToClearCoreMapCount = 3; BLState->AssemblyNameToClearCoreMapCount = 3;

View File

@ -443,4 +443,18 @@ while (Hue > 360.0f) { Hue -= 360.0f; }
return Result; return Result;
} }
internal pixel
V4ToRGBPixel(v4 C)
{
C.x = Clamp01(C.x);
C.y = Clamp01(C.y);
C.z = Clamp01(C.z);
pixel Result = {};
Result.R = (u8)(C.x * 255);
Result.G = (u8)(C.y * 255);
Result.B = (u8)(C.z * 255);
return Result;
}
#endif //GFX_MATH_H #endif //GFX_MATH_H