2019-07-19 20:56:21 +00:00
|
|
|
#include "../meta/gs_meta_lexer.h"
|
|
|
|
|
|
|
|
#include "gs_font.h"
|
|
|
|
#include "interface.h"
|
|
|
|
|
|
|
|
#include "foldhaus_network_ordering.h"
|
2019-11-23 00:07:25 +00:00
|
|
|
#include "dmx/dmx.h"
|
|
|
|
#include "sacn/sacn.h"
|
2019-07-19 20:56:21 +00:00
|
|
|
|
2019-11-23 00:07:25 +00:00
|
|
|
#include "foldhaus_assembly.h"
|
2019-07-19 20:56:21 +00:00
|
|
|
|
|
|
|
#include "assembly_parser.h"
|
|
|
|
#include "foldhaus_node.h"
|
|
|
|
#include "assembly_parser.cpp"
|
|
|
|
#include "test_patterns.h"
|
|
|
|
#include "foldhaus_interface.h"
|
|
|
|
|
|
|
|
typedef struct app_state app_state;
|
|
|
|
|
|
|
|
#include "foldhaus_command_dispatch.h"
|
2019-11-02 17:29:51 +00:00
|
|
|
#include "foldhaus_command_dispatch.cpp"
|
2019-11-01 11:17:46 +00:00
|
|
|
#include "foldhaus_operation_mode.h"
|
2019-09-02 06:03:38 +00:00
|
|
|
|
2019-12-26 16:11:48 +00:00
|
|
|
#include "animation/foldhaus_animation.h"
|
|
|
|
|
2019-08-18 12:56:18 +00:00
|
|
|
#include "foldhaus_text_entry.h"
|
|
|
|
|
2019-09-21 20:19:02 +00:00
|
|
|
#include "foldhaus_search_lister.h"
|
2019-07-19 20:56:21 +00:00
|
|
|
|
2019-11-23 00:07:25 +00:00
|
|
|
enum network_protocol
|
|
|
|
{
|
|
|
|
NetworkProtocol_SACN,
|
|
|
|
NetworkProtocol_ArtNet,
|
|
|
|
|
|
|
|
NetworkProtocol_Count,
|
|
|
|
};
|
|
|
|
|
2019-07-19 20:56:21 +00:00
|
|
|
struct app_state
|
|
|
|
{
|
2019-12-23 01:47:26 +00:00
|
|
|
memory_arena Permanent;
|
|
|
|
memory_arena Transient;
|
2019-07-19 20:56:21 +00:00
|
|
|
|
2019-11-23 00:07:25 +00:00
|
|
|
s32 NetworkProtocolHeaderSize;
|
|
|
|
network_protocol NetworkProtocol;
|
|
|
|
|
2019-11-03 21:12:25 +00:00
|
|
|
streaming_acn SACN;
|
2019-11-23 00:07:25 +00:00
|
|
|
|
2019-11-03 21:12:25 +00:00
|
|
|
s32 TotalLEDsCount;
|
2019-11-23 00:07:25 +00:00
|
|
|
|
2019-11-29 05:12:57 +00:00
|
|
|
assembly_array AssemblyList;
|
|
|
|
array_entry_handle_contiguous_array ActiveAssemblyIndecies;
|
2019-11-03 21:12:25 +00:00
|
|
|
|
2019-07-19 20:56:21 +00:00
|
|
|
camera Camera;
|
2019-11-03 21:12:25 +00:00
|
|
|
r32 PixelsToWorldScale;
|
2019-07-19 20:56:21 +00:00
|
|
|
|
2019-11-01 11:17:46 +00:00
|
|
|
operation_mode_system Modes;
|
2019-11-02 17:29:51 +00:00
|
|
|
input_command_registry DefaultInputCommandRegistry;
|
2019-10-30 14:28:02 +00:00
|
|
|
input_command_queue CommandQueue;
|
2019-09-21 20:19:02 +00:00
|
|
|
text_entry ActiveTextEntry;
|
2019-07-19 20:56:21 +00:00
|
|
|
|
2019-11-03 21:12:25 +00:00
|
|
|
bitmap_font* Font;
|
|
|
|
interface_config Interface;
|
2019-12-04 06:40:22 +00:00
|
|
|
|
2019-12-26 16:11:48 +00:00
|
|
|
animation_system AnimationSystem;
|
|
|
|
animation_block_handle SelectedAnimationBlockHandle;
|
2019-07-19 20:56:21 +00:00
|
|
|
};
|
|
|
|
|
2019-11-01 13:46:06 +00:00
|
|
|
internal void OpenColorPicker(app_state* State, v4* Address);
|
|
|
|
|
2019-12-26 16:11:48 +00:00
|
|
|
// BEGIN TEMPORARY PATTERNS
|
|
|
|
internal void
|
|
|
|
TestPatternOne(app_state* State, r32 Time)
|
|
|
|
{
|
|
|
|
array_entry_handle TestAssemblyHandle = *GetElementAtIndex(0, State->ActiveAssemblyIndecies);
|
|
|
|
assembly TestAssembly = *GetElementWithHandle(TestAssemblyHandle, State->AssemblyList);
|
|
|
|
for (s32 Range = 0; Range < TestAssembly.LEDUniverseMapCount; Range++)
|
|
|
|
{
|
|
|
|
leds_in_universe_range LEDUniverseRange = TestAssembly.LEDUniverseMap[Range];
|
|
|
|
for (s32 LEDIdx = LEDUniverseRange.RangeStart;
|
|
|
|
LEDIdx < LEDUniverseRange.RangeOnePastLast;
|
|
|
|
LEDIdx++)
|
|
|
|
{
|
|
|
|
led LED = TestAssembly.LEDs[LEDIdx];
|
|
|
|
TestAssembly.Colors[LED.Index].R = 255;
|
|
|
|
TestAssembly.Colors[LED.Index].B = 255;
|
|
|
|
TestAssembly.Colors[LED.Index].G = 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void
|
|
|
|
TestPatternTwo(app_state* State, r32 Time)
|
|
|
|
{
|
|
|
|
if (Time > 2 * PI * 100) { Time = 0; }
|
|
|
|
r32 SinAdjusted = 0.5f + (GSSin(Time * 0.01f) * .5f);
|
|
|
|
u8 Brightness = (u8)(GSClamp01(SinAdjusted) * 255);
|
|
|
|
|
|
|
|
array_entry_handle TestAssemblyHandle = *GetElementAtIndex(0, State->ActiveAssemblyIndecies);
|
|
|
|
assembly TestAssembly = *GetElementWithHandle(TestAssemblyHandle, State->AssemblyList);
|
|
|
|
for (s32 Range = 0; Range < TestAssembly.LEDUniverseMapCount; Range++)
|
|
|
|
{
|
|
|
|
leds_in_universe_range LEDUniverseRange = TestAssembly.LEDUniverseMap[Range];
|
|
|
|
for (s32 LEDIdx = LEDUniverseRange.RangeStart;
|
|
|
|
LEDIdx < LEDUniverseRange.RangeOnePastLast;
|
|
|
|
LEDIdx++)
|
|
|
|
{
|
|
|
|
led LED = TestAssembly.LEDs[LEDIdx];
|
|
|
|
TestAssembly.Colors[LED.Index].R = Brightness;
|
|
|
|
TestAssembly.Colors[LED.Index].B = 0;
|
|
|
|
TestAssembly.Colors[LED.Index].G = Brightness;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void
|
|
|
|
TestPatternThree(app_state* State, r32 Time)
|
|
|
|
{
|
|
|
|
r32 GreenSize = 20.0f;
|
|
|
|
r32 BlueSize = 25.0f;
|
|
|
|
r32 RedSize = 25.0f;
|
|
|
|
|
|
|
|
r32 GreenPosition = -GreenSize + (Time * 45);
|
|
|
|
r32 BluePosition = -BlueSize + (Time * 25);
|
|
|
|
r32 RedPosition = (100 + RedSize) + (Time * -35);
|
|
|
|
|
|
|
|
array_entry_handle TestAssemblyHandle = *GetElementAtIndex(0, State->ActiveAssemblyIndecies);
|
|
|
|
assembly TestAssembly = *GetElementWithHandle(TestAssemblyHandle, State->AssemblyList);
|
|
|
|
for (s32 Range = 0; Range < TestAssembly.LEDUniverseMapCount; Range++)
|
|
|
|
{
|
|
|
|
leds_in_universe_range LEDUniverseRange = TestAssembly.LEDUniverseMap[Range];
|
|
|
|
for (s32 LEDIdx = LEDUniverseRange.RangeStart;
|
|
|
|
LEDIdx < LEDUniverseRange.RangeOnePastLast;
|
|
|
|
LEDIdx++)
|
|
|
|
{
|
|
|
|
led LED = TestAssembly.LEDs[LEDIdx];
|
|
|
|
u8 Red = 0;
|
|
|
|
u8 Green = 0;
|
|
|
|
u8 Blue = 0;
|
|
|
|
|
|
|
|
r32 GreenDistance = GSAbs(LED.Position.z - GreenPosition);
|
|
|
|
r32 GreenBrightness = GSClamp(0.0f, GreenSize - GreenDistance, GreenSize) / GreenSize;
|
|
|
|
Green = (u8)(GreenBrightness * 255);
|
|
|
|
|
|
|
|
r32 BlueDistance = GSAbs(LED.Position.z - BluePosition);
|
|
|
|
r32 BlueBrightness = GSClamp(0.0f, BlueSize - BlueDistance, BlueSize) / BlueSize;
|
|
|
|
Blue = (u8)(BlueBrightness * 255);
|
|
|
|
|
|
|
|
r32 RedDistance = GSAbs(LED.Position.z - RedPosition);
|
|
|
|
r32 RedBrightness = GSClamp(0.0f, RedSize - RedDistance, RedSize) / RedSize;
|
|
|
|
Red = (u8)(RedBrightness * 255);
|
|
|
|
|
|
|
|
TestAssembly.Colors[LED.Index].R = Red;
|
|
|
|
TestAssembly.Colors[LED.Index].B = Blue;
|
|
|
|
TestAssembly.Colors[LED.Index].G = Green;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// END TEMPORARY PATTERNS
|
|
|
|
|
2019-11-23 00:07:25 +00:00
|
|
|
#include "foldhaus_assembly.cpp"
|
2019-11-23 11:05:25 +00:00
|
|
|
|
2019-09-21 20:19:02 +00:00
|
|
|
#include "foldhaus_debug_visuals.h"
|
2019-11-23 00:07:25 +00:00
|
|
|
//#include "foldhaus_sacn_view.cpp"
|
2019-08-18 12:56:18 +00:00
|
|
|
#include "foldhaus_text_entry.cpp"
|
2019-11-01 12:46:40 +00:00
|
|
|
#include "foldhaus_search_lister.cpp"
|
|
|
|
|
2019-12-26 16:11:48 +00:00
|
|
|
#include "foldhaus_interface.cpp"
|
|
|
|
#include "animation/foldhaus_animation_interface.h"
|