incenter day 1

This commit is contained in:
Cameron Tacklind 2022-08-28 17:08:45 -07:00
parent 41a143b445
commit 7d54794c1f
15 changed files with 487 additions and 320 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@ struct Socket_Handle { u64 value; };
typedef s32 Socket_Error;
enum {
SocketError_Invalid,
SocketError_NOERROR,
SocketError_EAGAIN,
SocketError_EBADF,
@ -16,6 +17,21 @@ enum {
SocketError_ENOMEM,
SocketError_ENOTCONN,
SocketError_ENOTSOCK,
SocketError_Count,
};
global char* socket_error_strings[] = {
"Invalid",
"SocketError_NOERROR",
"SocketError_EAGAIN",
"SocketError_EBADF",
"SocketError_ECONNREFUSED",
"SocketError_EFAULT",
"SocketError_EINTR",
"SocketError_EINVAL",
"SocketError_ENOMEM",
"SocketError_ENOTCONN",
"SocketError_ENOTSOCK",
};
u16 endian_swap_u16(u16 v);

View File

@ -105,7 +105,7 @@ assembly_add_led(
}
void
assembly_strip_create_leds(
assembly_strip_append_leds(
Assembly_Array* a,
Assembly_Handle h,
Assembly_Strip* strip,

View File

@ -29,6 +29,22 @@ pm_smoothstep_v3(v3 p)
return result;
}
r32
pm_easein_cubic_r32(r32 v)
{
assert(v >= 0 && v <= 1);
return 4 * v * v * v;
}
r32
pm_easeout_cubic_r32(r32 v)
{
assert(v >= 0 && v <= 1);
r32 a = -2 * v + 2;
r32 a3 = a * a * a;
return 1 - a3 / 2;
}
r32
pm_easeinout_cubic_r32(r32 v)
{

View File

@ -1,5 +1,8 @@
// NOTE: This file is autogenerated by csv_to_cstruct.js
// NOTE: These are values for Incenter_City_Id
#define BLACK_ROCK_LED_FIRST 90
#define BLACK_ROCK_LED_OPL 140
enum {
city_black_rock = 0,
@ -566,7 +569,7 @@ global Incenter_City_Desc city_descs[] = {
.id = city_black_rock,
.lat = -90.0f,
.lon = 0,
.sacn_universe = city_black_rock,
.sacn_universe = 29,
},
[city_secondary_lagos] = {
.id = city_secondary_lagos,

View File

@ -46,11 +46,24 @@ incenter_interface_connection_thread_proc(u8* user_data)
ins->interface_socket = os_socket_create(AF_INET, SOCK_DGRAM, 0);
}
if (err == SocketError_EINTR) {
printf("Recvfrom returned EINTR, trying again\n");
continue; // retry the same operation, as it was interrupted
}
if (err == SocketError_NOERROR) {
next_msg->base[next_msg->size] = 0;
// write_next isn't incremented until here because the message
// is not ready to be read until this point
ins->interface_messages_write_next = (ins->interface_messages_write_next + 1) % INTERFACE_MESSAGES_CAP;
} else {
char* errstr = (char*)"Invalid";
if (err > SocketError_Invalid && err < SocketError_Count) {
errstr = socket_error_strings[err];
}
// TODO: if you hit an EFAULT, go check how big the buffer
// recvfrom was trying to write into
printf("Socket Error: %s - code: %d\n", errstr, (s32)err);
}
}
@ -115,6 +128,7 @@ incenter_handle_sliding_scale_msg(Incenter_State* ins, Incenter_Scene scene, cha
case 'C': {
live_answers_input_r32(ins, scene, ins->input_pct);
ins->scene_mode = Incenter_SceneMode_Passive;
ins->scene_time = 0;
} break;
}
@ -143,6 +157,7 @@ incenter_handle_yes_no_msg(Incenter_State* ins, Incenter_Scene scene, char msg)
live_answers_input_u32(ins, scene, ins->input_option);
ins->scene_mode = Incenter_SceneMode_Passive;
ins->scene_time = 0;
}
internal void
@ -159,6 +174,7 @@ incenter_handle_three_option_msg(Incenter_State* ins, Incenter_Scene scene, char
live_answers_input_u32(ins, scene, ins->input_option);
ins->scene_mode = Incenter_SceneMode_Passive;
ins->scene_time = 0;
}
internal void

View File

@ -148,9 +148,17 @@ live_answers_save(Live_Answers_File file, Live_Answers_File_Bucket* new_bucket)
os_file_close(fh);
}
#if 0
# define MAYBE_SKIP_SAVING_INPUT
#else
# define MAYBE_SKIP_SAVING_INPUT return
#endif
internal void
live_answers_input_u32(Incenter_State* ins, Incenter_Scene scene, u32 value)
{
MAYBE_SKIP_SAVING_INPUT;
scratch_get(scratch);
Live_Answers_File file = live_answers_load(scene, scratch.a);
if (file.header == 0) {
@ -186,6 +194,8 @@ live_answers_input_u32(Incenter_State* ins, Incenter_Scene scene, u32 value)
internal void
live_answers_input_r32(Incenter_State* ins, Incenter_Scene scene, r32 value)
{
MAYBE_SKIP_SAVING_INPUT;
scratch_get(scratch);
Live_Answers_File file = live_answers_load(scene, scratch.a);
if (file.header == 0) {

View File

@ -975,7 +975,7 @@ pattern_add_bar_chart(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array strips,
u32 led_index = strip.pixels[led_i];
// Bar Chart
r32 pct = 1 - ((r32)led_i / (r32)strip.pixels_len);
r32 pct = ((r32)led_i / (r32)strip.pixels_len);
if (pct < row.prop) {
r32 cpct = pct / row.prop;
Assembly_Pixel p = color_ramp_eval_pixel(color_ramp, cpct);
@ -1048,6 +1048,48 @@ pattern_bar_chart_over_time(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array s
pattern_add_bar_chart(pixels, strips, ins, scene, year_at, month_at, xray_ramp);
}
void
pattern_scene_input_pulse(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array strips, Incenter_State* ins)
{
r32 pulse_duration = 1;
if (ins->scene_time > pulse_duration) return;
r32 pulse_pct = min(ins->scene_time / pulse_duration, 1);
r32 height = (pm_easeout_cubic_r32(pulse_pct) * 1.4f) - 0.2f;
r32 brightness = 1 - pulse_pct;
r32 strip_len = (r32)(BLACK_ROCK_LED_OPL - BLACK_ROCK_LED_FIRST);
Assembly_Strip brc_strip = strips.strips[city_black_rock];
for (u32 i = BLACK_ROCK_LED_FIRST; i < BLACK_ROCK_LED_OPL; i++)
{
u32 led_i = brc_strip.pixels[i];
r32 pct_i = (r32)i / (r32)strip_len;
pct_i = 1 - pct_i;
r32 pct_d = fabsf(pct_i - height);
r32 b = max(0, 0.1f - pct_d) / 0.1f;
pixels.pixels[led_i] = color_v3_to_assembly_pixel_faded((v3){0, 0, 1}, b * brightness);
}
}
////////////////////////////////////////
// ANYBODY HOME?
void
pattern_anybody_home(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array strips, Incenter_State* ins)
{
pattern_color(pixels, strips, 0, 0, 0);
Assembly_Strip strip = strips.strips[city_black_rock];
for (u32 i = BLACK_ROCK_LED_FIRST; i < BLACK_ROCK_LED_OPL; i++)
{
u32 led_i = strip.pixels[i];
pixels.pixels[led_i] = color_v3_to_assembly_pixel((v3){0, 0, 1});
}
}
////////////////////////////////////////
// Felt Isolated
@ -1085,14 +1127,16 @@ void
pattern_felt_isolated_passive(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array strips, Incenter_State* ins)
{
Incenter_Scene scene = ins->scenes[ins->scene_at];
r32 scene_time = ins->scene_time;
r32 scene_speed = 4;
r32 scene_time = ins->scene_time * scene_speed;
pattern_color(pixels, strips, 0, 0, 0);
pattern_scene_input_pulse(pixels, strips, ins);
for (u32 row_i = 0; row_i < scene.data_len; row_i++)
{
Incenter_Data_Row row = scene.data[row_i];
Assembly_Strip strip = strips.strips[row.id];
u32 pixel_start = row.prop * strip.pixels_len;
u32 pixel_start = strip.pixels_len - (row.prop * strip.pixels_len);
r32 row_offset = (.1439f * row_i);
r32 b = pm_sinf_01(ins->scene_time + row_offset);
@ -1141,7 +1185,8 @@ pattern_bar_chart_bubbly_intro(Assembly_Pixel_Buffer pixels, Assembly_Strip_Arra
if (!scene.data) return;
pattern_color(pixels, strips, 0, 0, 0);
r32 scene_time = ins->scene_time;
r32 scene_speed = 3;
r32 scene_time = ins->scene_time * scene_speed;
for (u32 row_i = 0; row_i < scene.data_len; row_i++)
{
@ -1230,7 +1275,7 @@ pattern_bar_chart_random_fill(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array
Assembly_Pixel color = color_v3_to_assembly_pixel((v3){1, .9f, 0});
assert(color.r != 1);
r32 scene_time = ins->scene_time;
r32 scene_time = ins->scene_time * 8;
r32 dots_per_second = 5;
u32 iter_cap = scene_time * dots_per_second;
for (u32 row_i = 0; row_i < scene.data_len; row_i++)
@ -1387,13 +1432,19 @@ pattern_sun_transition_shrink(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array
{
r32 radius_start = INCENTER_FEET(15);
r32 radius_end = INCENTER_FEET(0);
pattern_sun_transition(pixels, strips, ins, radius_start, radius_end, Incenter_SceneMode_Passive);
u32 scene_mode = Incenter_SceneMode_Passive;
pattern_sun_transition(pixels, strips, ins, radius_start, radius_end, scene_mode);
}
void
pattern_sun_transition_grow(Assembly_Pixel_Buffer pixels, Assembly_Strip_Array strips, Incenter_State* ins)
{
r32 radius_start = INCENTER_FEET(0);
r32 radius_end = INCENTER_FEET(15);
pattern_sun_transition(pixels, strips, ins, radius_start, radius_end, Incenter_SceneMode_Input);
r32 radius_end = INCENTER_FEET(40);
u32 scene_mode = Incenter_SceneMode_Input;
if (ins->scene_at == Incenter_Scene_WelcomeHome ||
ins->scene_at == Incenter_Scene_AnyoneHome) {
scene_mode = Incenter_SceneMode_Passive;
}
pattern_sun_transition(pixels, strips, ins, radius_start, radius_end, scene_mode);
}

View File

@ -0,0 +1,289 @@
internal void
incenter_scene_descs_init()
{
incenter_scene_descs[Incenter_Scene_AnyoneHome] = (Incenter_Scene){
.name = "AnyoneHome",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_anybody_home,
[Incenter_SceneMode_Passive] = pattern_anybody_home,
},
.kind = Incenter_SceneKind_Information,
};
incenter_scene_descs[Incenter_Scene_WelcomeHome] = (Incenter_Scene){
.name = "WelcomeHome",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_sun_passive,
[Incenter_SceneMode_Passive] = pattern_sun_passive,
},
.kind = Incenter_SceneKind_Information,
};
incenter_scene_descs[Incenter_Scene_Question_FeltIsolated] = (Incenter_Scene){
.name = "FeltIsolated",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_felt_isolated_intro,
[Incenter_SceneMode_Passive] = pattern_felt_isolated_passive,
},
.data = question_1_data,
.data_len = question_1_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_FeltFearAnxiety] = (Incenter_Scene){
.name = "FeltFearAnxiety",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_felt_isolated_intro,
[Incenter_SceneMode_Passive] = pattern_felt_isolated_passive,
},
.data = question_2_data,
.data_len = question_2_len,
.kind = Incenter_SceneKind_ThreeOption,
};
incenter_scene_descs[Incenter_Scene_Question_FeltPowerless] = (Incenter_Scene){
.name = "FeltPowerless",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_felt_isolated_intro,
[Incenter_SceneMode_Passive] = pattern_felt_isolated_passive,
},
.data = question_5_data,
.data_len = question_5_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_LostAccessToResources] = (Incenter_Scene){
.name = "LostAccessToResources",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_3_data,
.data_len = question_3_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_LostLovedOne] = (Incenter_Scene){
.name = "LostLovedOne",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_over_time,
[Incenter_SceneMode_Passive] = pattern_bar_chart_over_time,
},
.data = question_4_data,
.data_len = question_4_len,
.kind = Incenter_SceneKind_YesOrNo,
};
// TODO: We need an animation that communicates healing / connection
// grow out from the person's answer into the entire planet
incenter_scene_descs[Incenter_Scene_Question_BegunToHeal] = (Incenter_Scene){
.name = "BegunToHeal",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_bubbly_intro,
[Incenter_SceneMode_Passive] = pattern_bar_chart_bubbly_passive,
},
// no data .data = question_6_data,
// no data .data_len = question_6_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_OnPlayaResources] = (Incenter_Scene){
.name = "OnPlayaResources",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.kind = Incenter_SceneKind_Information,
};
incenter_scene_descs[Incenter_Scene_Question_RelationshipCommunitySupport] = (Incenter_Scene){
.name = "RelationshipCommunitySupport",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_with_connections,
[Incenter_SceneMode_Passive] = pattern_bar_chart_with_connections,
},
.data = question_7_data,
.data_len = question_7_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_ConnectionFriendsFamily] = (Incenter_Scene){
.name = "ConnectionFriendsFamily",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_with_connections,
[Incenter_SceneMode_Passive] = pattern_bar_chart_with_connections,
},
.data = question_8_data,
.data_len = question_8_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_ValueConnections] = (Incenter_Scene){
.name = "ValueConnections",
.patterns = {
#if 0
[Incenter_SceneMode_Intro] = pattern_bar_chart_with_connections,
[Incenter_SceneMode_Passive] = pattern_bar_chart_with_connections,
#endif
[Incenter_SceneMode_Intro] = pattern_bar_chart_random_fill,
[Incenter_SceneMode_Passive] = pattern_bar_chart_random_fill,
},
.data = question_9_data,
.data_len = question_9_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_FindHappiness] = (Incenter_Scene){
.name = "FindHappiness",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_10_data,
.data_len = question_10_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_FeltExcludedIdentity] = (Incenter_Scene){
.name = "FeltExcludedIdentity",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_13_data,
.data_len = question_13_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_RepresentedByLeadership] = (Incenter_Scene){
.name = "RepresentedByLeadership",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_14_data,
.data_len = question_14_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_LearningOpenMinded] = (Incenter_Scene){
.name = "LearningOpenMinded",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_12_data,
.data_len = question_12_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_ProtectOurEarth] = (Incenter_Scene){
.name = "ProtectOurEarth",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_18_data,
.data_len = question_18_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_BelieveScienceRenewableTech] = (Incenter_Scene){
.name = "BelieveScienceRenewableTech",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_random_fill,
[Incenter_SceneMode_Passive] = pattern_bar_chart_random_fill,
},
.data = question_19_data,
.data_len = question_19_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_StriveMoreEcoFriendly] = (Incenter_Scene){
.name = "StriveMoreEcoFriendly",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
// .data = question_22_data,
// .data_len = question_22_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_ActionToHelpPlanet] = (Incenter_Scene){
.name = "ActionToHelpPlanet",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_20_data,
.data_len = question_20_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_HowYouFaceChallenges] = (Incenter_Scene){
.name = "HowYouFaceChallenges",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_6_data,
.data_len = question_6_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_InspiredToHelpOthers] = (Incenter_Scene){
.name = "InspiredToHelpOthers",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_11_data,
.data_len = question_11_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_PracticeChangeHopeFor] = (Incenter_Scene){
.name = "PracticeChangeHopeFor",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_17_data,
.data_len = question_17_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_PracticeRadicalInclusion] = (Incenter_Scene){
.name = "PracticeRadicalInclusion",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_16_data,
.data_len = question_16_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_CommunityFeelBelong] = (Incenter_Scene){
.name = "CommunityFeelBelong",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_15_data,
.data_len = question_15_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Credits] = (Incenter_Scene){
.name = "Credits",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.kind = Incenter_SceneKind_Information,
};
}

View File

@ -39,294 +39,6 @@ enum {
global Incenter_Scene incenter_scene_descs[Incenter_Scene_Count];
internal void
incenter_scene_descs_init()
{
incenter_scene_descs[Incenter_Scene_AnyoneHome] = (Incenter_Scene){
.name = "AnyoneHome",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_sun_passive,
[Incenter_SceneMode_Passive] = pattern_sun_passive,
},
.kind = Incenter_SceneKind_Information,
};
incenter_scene_descs[Incenter_Scene_WelcomeHome] = (Incenter_Scene){
.name = "WelcomeHome",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_rainbow,
[Incenter_SceneMode_Passive] = pattern_rainbow,
},
.kind = Incenter_SceneKind_Information,
};
incenter_scene_descs[Incenter_Scene_Question_FeltIsolated] = (Incenter_Scene){
.name = "FeltIsolated",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_felt_isolated_intro,
[Incenter_SceneMode_Passive] = pattern_felt_isolated_passive,
},
.data = question_1_data,
.data_len = question_1_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_FeltFearAnxiety] = (Incenter_Scene){
.name = "FeltFearAnxiety",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_felt_isolated_intro,
[Incenter_SceneMode_Passive] = pattern_felt_isolated_passive,
},
.data = question_2_data,
.data_len = question_2_len,
.kind = Incenter_SceneKind_ThreeOption,
};
incenter_scene_descs[Incenter_Scene_Question_FeltPowerless] = (Incenter_Scene){
.name = "FeltPowerless",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_felt_isolated_intro,
[Incenter_SceneMode_Passive] = pattern_felt_isolated_passive,
},
.data = question_5_data,
.data_len = question_5_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_LostAccessToResources] = (Incenter_Scene){
.name = "LostAccessToResources",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_3_data,
.data_len = question_3_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_LostLovedOne] = (Incenter_Scene){
.name = "LostLovedOne",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_over_time,
[Incenter_SceneMode_Passive] = pattern_bar_chart_over_time,
},
.data = question_4_data,
.data_len = question_4_len,
.kind = Incenter_SceneKind_YesOrNo,
};
// TODO: We need an animation that communicates healing / connection
// grow out from the person's answer into the entire planet
incenter_scene_descs[Incenter_Scene_Question_BegunToHeal] = (Incenter_Scene){
.name = "BegunToHeal",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_bubbly_intro,
[Incenter_SceneMode_Passive] = pattern_bar_chart_bubbly_passive,
},
// no data .data = question_6_data,
// no data .data_len = question_6_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_OnPlayaResources] = (Incenter_Scene){
.name = "OnPlayaResources",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.kind = Incenter_SceneKind_Information,
};
incenter_scene_descs[Incenter_Scene_Question_RelationshipCommunitySupport] = (Incenter_Scene){
.name = "RelationshipCommunitySupport",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_with_connections,
[Incenter_SceneMode_Passive] = pattern_bar_chart_with_connections,
},
.data = question_7_data,
.data_len = question_7_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_ConnectionFriendsFamily] = (Incenter_Scene){
.name = "ConnectionFriendsFamily",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_with_connections,
[Incenter_SceneMode_Passive] = pattern_bar_chart_with_connections,
},
.data = question_8_data,
.data_len = question_8_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_ValueConnections] = (Incenter_Scene){
.name = "ValueConnections",
.patterns = {
#if 0
[Incenter_SceneMode_Intro] = pattern_bar_chart_with_connections,
[Incenter_SceneMode_Passive] = pattern_bar_chart_with_connections,
#endif
[Incenter_SceneMode_Intro] = pattern_bar_chart_random_fill,
[Incenter_SceneMode_Passive] = pattern_bar_chart_random_fill,
},
.data = question_9_data,
.data_len = question_9_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_FindHappiness] = (Incenter_Scene){
.name = "FindHappiness",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_10_data,
.data_len = question_10_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_FeltExcludedIdentity] = (Incenter_Scene){
.name = "FeltExcludedIdentity",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_13_data,
.data_len = question_13_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_RepresentedByLeadership] = (Incenter_Scene){
.name = "RepresentedByLeadership",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_14_data,
.data_len = question_14_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_LearningOpenMinded] = (Incenter_Scene){
.name = "LearningOpenMinded",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_12_data,
.data_len = question_12_len,
.kind = Incenter_SceneKind_SlidingScale,
};
incenter_scene_descs[Incenter_Scene_Question_ProtectOurEarth] = (Incenter_Scene){
.name = "ProtectOurEarth",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_18_data,
.data_len = question_18_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_BelieveScienceRenewableTech] = (Incenter_Scene){
.name = "BelieveScienceRenewableTech",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart_random_fill,
[Incenter_SceneMode_Passive] = pattern_bar_chart_random_fill,
},
.data = question_19_data,
.data_len = question_19_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_StriveMoreEcoFriendly] = (Incenter_Scene){
.name = "StriveMoreEcoFriendly",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
// .data = question_22_data,
// .data_len = question_22_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_ActionToHelpPlanet] = (Incenter_Scene){
.name = "ActionToHelpPlanet",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_20_data,
.data_len = question_20_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_HowYouFaceChallenges] = (Incenter_Scene){
.name = "HowYouFaceChallenges",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_6_data,
.data_len = question_6_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_InspiredToHelpOthers] = (Incenter_Scene){
.name = "InspiredToHelpOthers",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_11_data,
.data_len = question_11_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_PracticeChangeHopeFor] = (Incenter_Scene){
.name = "PracticeChangeHopeFor",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_17_data,
.data_len = question_17_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_PracticeRadicalInclusion] = (Incenter_Scene){
.name = "PracticeRadicalInclusion",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_16_data,
.data_len = question_16_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Question_CommunityFeelBelong] = (Incenter_Scene){
.name = "CommunityFeelBelong",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.data = question_15_data,
.data_len = question_15_len,
.kind = Incenter_SceneKind_YesOrNo,
};
incenter_scene_descs[Incenter_Scene_Credits] = (Incenter_Scene){
.name = "Credits",
.patterns = {
[Incenter_SceneMode_Intro] = pattern_bar_chart,
[Incenter_SceneMode_Passive] = pattern_bar_chart,
},
.kind = Incenter_SceneKind_Information,
};
}
internal void incenter_scene_descs_init();
#endif //INCENTER_SCENES_H

View File

@ -1,11 +1,12 @@
#define SECONDARY_CITY_CAP 32
#define SECONDARY_CITY_CAP 50
u32 secondary_strips_len = 0;
Assembly_Strip* secondary_city_strips[SECONDARY_CITY_CAP];
#include "incenter_scenes.h"
#include "../user_space/incenter_patterns.c"
#include "../user_space/incenter_secondary_patterns.c"
#include "incenter_scenes.h"
#include "incenter_scenes.c"
#include "incenter_live_answers.c"
////////////////////////////////////////////////
@ -21,12 +22,40 @@ incenter_scenes_init(Incenter_State* ins, u32 cap, Allocator* a)
//Incenter_Scene_Question_LostAccessToResources;
}
internal void
incenter_reset_inputs(Incenter_State* ins)
{
// reset inputs
ins->input_pct = 0.5f;
ins->input_option = 0;
ins->input_advance = false;
}
internal void
incenter_go_to_transitioning_in(Incenter_State* ins)
{
if (ins->scene_next != Incenter_Scene_WelcomeHome ||
ins->scene_at != Incenter_Scene_AnyoneHome) {
ins->transition_time = 0;
ins->scene_mode = Incenter_SceneMode_TransitioningIn;
ins->scene_time = 0;
} else {
ins->scene_mode = Incenter_SceneMode_Passive;
}
ins->scene_at = ins->scene_next;
incenter_reset_inputs(ins);
}
internal void
incenter_scene_go_to(Incenter_State* ins, u32 index)
{
ins->transition_time = 0;
ins->scene_next = index % ins->scenes_cap;
ins->scene_mode = Incenter_SceneMode_TransitioningOut;
if (ins->scene_at == Incenter_Scene_WelcomeHome) {
incenter_go_to_transitioning_in(ins);
}
printf("Switching To: %d:%s\n", ins->scene_next, ins->scenes[ins->scene_next].name);
}
@ -58,17 +87,13 @@ incenter_scene_render(App_State* state, Incenter_State* ins)
// Update the transition if necessary
if (ins->transition_time >= INCENTER_TRANSITION_DURATION) {
if (ins->scene_mode == Incenter_SceneMode_TransitioningOut) {
ins->transition_time = 0;
ins->scene_mode = Incenter_SceneMode_TransitioningIn;
ins->scene_at = ins->scene_next;
ins->scene_time = 0;
// reset inputs
ins->input_pct = 0.5f;
ins->input_option = 0;
ins->input_advance = false;
incenter_go_to_transitioning_in(ins);
} else {
ins->scene_mode = Incenter_SceneMode_Input;
if (ins->scene_next == Incenter_Scene_WelcomeHome ||
ins->scene_next == Incenter_Scene_AnyoneHome) {
ins->scene_mode = Incenter_SceneMode_Passive;
}
}
}
}
@ -154,19 +179,31 @@ incenter_init(App_State* state)
v3 start_p = (v3){0, 0, 0};
Assembly_Strip* vertical_strip = assembly_add_strip(&state->assemblies, ah, 123);
assembly_strip_create_leds(
Assembly_Strip* brc = assembly_add_strip(&state->assemblies, ah, 140);
brc->output_kind = OutputData_NetworkSACN;
brc->sacn_universe = city_descs[city_black_rock].sacn_universe;
// Arctic
assembly_strip_append_leds(
&state->assemblies,
ah,
vertical_strip,
brc,
(v3){0, INCENTER_RADIUS, 0},
start_p,
90
);
// BRC
assembly_strip_append_leds(
&state->assemblies,
ah,
brc,
start_p,
(v3){0, INCENTER_FEET(-4.5f), 0},
123
50
);
// ADDING PRIMARY CITIES
r32 radius = INCENTER_RADIUS;
for (u32 i = 0; i < city_count; i++)
for (u32 i = 1; i < city_count; i++)
{
Incenter_City_Desc city = city_descs[i];
if (city.sacn_universe == 0) {
@ -180,7 +217,7 @@ incenter_init(App_State* state)
strip->output_kind = OutputData_NetworkSACN;
strip->sacn_universe = city.sacn_universe;
assembly_strip_create_leds(&state->assemblies, ah, strip, end_p, start_p, 88);
assembly_strip_append_leds(&state->assemblies, ah, strip, end_p, start_p, 88);
}
#define USING_ON_PLAYA_SECONDARY_CITIES 1
@ -320,7 +357,7 @@ incenter_frame(App_State* state)
incenter_interface_connection_frame(state, ins);
ins->scene_time += state->target_seconds_per_frame * 0.2f;
ins->scene_time += state->target_seconds_per_frame * 0.5f;
ins->transition_time += state->target_seconds_per_frame;
incenter_scene_render(state, ins);

View File

@ -1,3 +1,20 @@
- arctic - what do we want to do?
- (waiting) EFAULT error on receiving a message from the interface
- FILE IO bugs
x Timeout to idle
- kids love this thing "THATS THE COOLEST"
- conversation about "People probably haven't talked about their covid experience yet, this is really good."
- "This is the most peaceful I've felt in a long time"
- "Where are you from" - "I'm from the one that's full of light"
- Rando: "Hey close the door, its way better."
- "A whole new world"
- "Want to do it with me?" (goes on to correctly explain the piece without us having told her)
- "So you're inside the globe, that's why it's inside out, THAT'S SO COOL!"
- "So that question was about feeling represented in government." "OH WOW - holy shit brazil!" (chorus)
- "Come do the thing!" "Wait, in front of everybody?"
- "It's kind of temple-y, with the writing and atmosphere and stuff"
TODO: