Whatever I was doing last time + made leds always be camera facing. Probably could use some speed up later on.
This commit is contained in:
parent
e3d7a90a13
commit
266f42c4f6
|
@ -135,7 +135,7 @@ RemoveAnimationBlock(gs_list_handle AnimationBlockHandle, animation_system* Anim
|
||||||
internal u32
|
internal u32
|
||||||
AddLayer (string Name, animation_system* AnimationSystem, blend_mode BlendMode = BlendMode_Overwrite)
|
AddLayer (string Name, animation_system* AnimationSystem, blend_mode BlendMode = BlendMode_Overwrite)
|
||||||
{
|
{
|
||||||
// TODO(Peter): If this assert fires its time to make the layer buffer system
|
// NOTE(Peter): If this assert fires its time to make the layer buffer system
|
||||||
// resizable.
|
// resizable.
|
||||||
Assert(AnimationSystem->LayersCount < AnimationSystem->LayersMax);
|
Assert(AnimationSystem->LayersCount < AnimationSystem->LayersMax);
|
||||||
|
|
||||||
|
|
|
@ -500,6 +500,8 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PushRenderOrthographic(RenderBuffer, 0, 0, gs_Width(State->WindowBounds), gs_Height(State->WindowBounds));
|
PushRenderOrthographic(RenderBuffer, 0, 0, gs_Width(State->WindowBounds), gs_Height(State->WindowBounds));
|
||||||
PushRenderClearScreen(RenderBuffer);
|
PushRenderClearScreen(RenderBuffer);
|
||||||
|
|
||||||
|
|
|
@ -221,8 +221,7 @@ typedef PANEL_INIT_PROC(panel_init_proc);
|
||||||
#define PANEL_CLEANUP_PROC(name) void name(panel* Panel, app_state* State)
|
#define PANEL_CLEANUP_PROC(name) void name(panel* Panel, app_state* State)
|
||||||
typedef PANEL_CLEANUP_PROC(panel_cleanup_proc);
|
typedef PANEL_CLEANUP_PROC(panel_cleanup_proc);
|
||||||
|
|
||||||
// TODO(Peter): Should be able to take the mouse out of this
|
#define PANEL_RENDER_PROC(name) void name(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
#define PANEL_RENDER_PROC(name) void name(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
|
||||||
typedef PANEL_RENDER_PROC(panel_render_proc);
|
typedef PANEL_RENDER_PROC(panel_render_proc);
|
||||||
|
|
||||||
// NOTE(Peter): This is used by the meta system to generate panel type info
|
// NOTE(Peter): This is used by the meta system to generate panel type info
|
||||||
|
|
|
@ -114,9 +114,9 @@ internal void
|
||||||
LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, memory_arena* Scratch, context Context, string Path, event_log* GlobalLog)
|
LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, memory_arena* Scratch, context Context, string Path, event_log* GlobalLog)
|
||||||
{
|
{
|
||||||
platform_memory_result AssemblyFile = ReadEntireFile(Context, Path);
|
platform_memory_result AssemblyFile = ReadEntireFile(Context, Path);
|
||||||
if (AssemblyFile.Error == PlatformMemory_NoError && AssemblyFile.Size > 0)
|
if (AssemblyFile.Error == PlatformMemory_NoError && AssemblyFile.Data.Size > 0)
|
||||||
{
|
{
|
||||||
string AssemblyFileText = MakeString((char*)AssemblyFile.Base);
|
string AssemblyFileText = MakeString((char*)AssemblyFile.Data.Base);
|
||||||
|
|
||||||
Assert(Assemblies->Count < Assemblies->CountMax);
|
Assert(Assemblies->Count < Assemblies->CountMax);
|
||||||
assembly* NewAssembly = &Assemblies->Values[Assemblies->Count++];
|
assembly* NewAssembly = &Assemblies->Values[Assemblies->Count++];
|
||||||
|
@ -129,7 +129,7 @@ LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, memory_arena* S
|
||||||
{
|
{
|
||||||
v4 Offset = TempAssemblyOffsets[Assemblies->Count % TempAssemblyOffsetsCount];
|
v4 Offset = TempAssemblyOffsets[Assemblies->Count % TempAssemblyOffsetsCount];
|
||||||
ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, LedSystem);
|
ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, LedSystem);
|
||||||
PlatformFree(Context.PlatformMemory, AssemblyFile.Base, AssemblyFile.Size);
|
PlatformFree(Context.PlatformMemory, AssemblyFile.Data.Base, AssemblyFile.Data.Size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -454,7 +454,7 @@ RenderPanel(panel* Panel, rect PanelBounds, rect WindowBounds, render_command_bu
|
||||||
};
|
};
|
||||||
|
|
||||||
panel_definition Definition = GlobalPanelDefs[Panel->PanelDefinitionIndex];
|
panel_definition Definition = GlobalPanelDefs[Panel->PanelDefinitionIndex];
|
||||||
Definition.Render(*Panel, PanelViewBounds, RenderBuffer, State, Context, Mouse);
|
Definition.Render(*Panel, PanelViewBounds, RenderBuffer, State, Context);
|
||||||
|
|
||||||
PushRenderOrthographic(RenderBuffer, WindowBounds.Min.x, WindowBounds.Min.y, WindowBounds.Max.x, WindowBounds.Max.y);
|
PushRenderOrthographic(RenderBuffer, WindowBounds.Min.x, WindowBounds.Min.y, WindowBounds.Max.x, WindowBounds.Max.y);
|
||||||
DrawPanelFooter(Panel, RenderBuffer, FooterBounds, Mouse, State);
|
DrawPanelFooter(Panel, RenderBuffer, FooterBounds, Mouse, State);
|
||||||
|
|
|
@ -63,12 +63,15 @@ enum platform_memory_error
|
||||||
PlatformMemory_UnknownError, // You should implement handling this when you see it
|
PlatformMemory_UnknownError, // You should implement handling this when you see it
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(Peter): Change this to just be data
|
struct data
|
||||||
// - Base, and Size
|
|
||||||
struct platform_memory_result
|
|
||||||
{
|
{
|
||||||
u8* Base;
|
u8* Base;
|
||||||
s32 Size;
|
u64 Size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct platform_memory_result
|
||||||
|
{
|
||||||
|
data Data;
|
||||||
platform_memory_error Error;
|
platform_memory_error Error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,15 +135,6 @@ typedef PLATFORM_SEND_TO(platform_send_to);
|
||||||
#define PLATFORM_CLOSE_SOCKET(name) void name(platform_socket_handle SocketHandle)
|
#define PLATFORM_CLOSE_SOCKET(name) void name(platform_socket_handle SocketHandle)
|
||||||
typedef PLATFORM_CLOSE_SOCKET(platform_close_socket);
|
typedef PLATFORM_CLOSE_SOCKET(platform_close_socket);
|
||||||
|
|
||||||
// File IO
|
|
||||||
|
|
||||||
// TODO(Peter):
|
|
||||||
struct directory_listing
|
|
||||||
{
|
|
||||||
string Path;
|
|
||||||
directory_listing* Next;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
struct platform_font_info
|
struct platform_font_info
|
||||||
{
|
{
|
||||||
|
@ -285,7 +279,6 @@ ReadEntireFile(context Context, string Path)
|
||||||
internal b32
|
internal b32
|
||||||
WriteEntireFile(platform_file_handler FileHandler, string Path, u8* Contents, u32 Size)
|
WriteEntireFile(platform_file_handler FileHandler, string Path, u8* Contents, u32 Size)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Overload to take a data struct instead of Contents And Size
|
|
||||||
b32 Result = FileHandler.WriteEntireFile(Path, Contents, Size);
|
b32 Result = FileHandler.WriteEntireFile(Path, Contents, Size);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ inline m44
|
||||||
GetCameraModelViewMatrix (camera Camera)
|
GetCameraModelViewMatrix (camera Camera)
|
||||||
{
|
{
|
||||||
// Forward
|
// Forward
|
||||||
v4 CamForward = V4(Normalize(Camera.Position - Camera.LookAt), 0);
|
v4 CamForward = V4(Normalize(Camera.Position - Camera.LookAt), 0);
|
||||||
// Right
|
// Right
|
||||||
v4 CamRight = Normalize(Cross(v4{0, 1, 0, 0}, CamForward));
|
v4 CamRight = Normalize(Cross(v4{0, 1, 0, 0}, CamForward));
|
||||||
// Up
|
// Up
|
||||||
|
@ -64,7 +64,7 @@ GetCameraPerspectiveProjectionMatrix(camera Camera)
|
||||||
r32 E = ((2 * Camera.Near) / (Right - Left));
|
r32 E = ((2 * Camera.Near) / (Right - Left));
|
||||||
r32 F = ((2 * Camera.Near) / (Top - Bottom));
|
r32 F = ((2 * Camera.Near) / (Top - Bottom));
|
||||||
|
|
||||||
m44 PerspectiveProjectionMatrix =
|
m44 PerspectiveProjectionMatrix =
|
||||||
{
|
{
|
||||||
E, 0, A, 0,
|
E, 0, A, 0,
|
||||||
0, F, B, 0,
|
0, F, B, 0,
|
||||||
|
@ -254,7 +254,7 @@ ResizeBufferIfNecessary(render_command_buffer* Buffer, s32 DataSize)
|
||||||
s32 SpaceNeeded = DataSize - SpaceAvailable; // This is known to be positive at this point
|
s32 SpaceNeeded = DataSize - SpaceAvailable; // This is known to be positive at this point
|
||||||
s32 AdditionSize = GSMax(SpaceNeeded, COMMAND_BUFFER_MIN_GROW_SIZE);
|
s32 AdditionSize = GSMax(SpaceNeeded, COMMAND_BUFFER_MIN_GROW_SIZE);
|
||||||
s32 NewSize = Buffer->CommandMemorySize + AdditionSize;
|
s32 NewSize = Buffer->CommandMemorySize + AdditionSize;
|
||||||
Buffer->CommandMemory = Buffer->Realloc(Buffer->CommandMemory,
|
Buffer->CommandMemory = Buffer->Realloc(Buffer->CommandMemory,
|
||||||
Buffer->CommandMemorySize,
|
Buffer->CommandMemorySize,
|
||||||
NewSize);
|
NewSize);
|
||||||
Buffer->CommandMemorySize = NewSize;
|
Buffer->CommandMemorySize = NewSize;
|
||||||
|
@ -297,10 +297,10 @@ internal s32
|
||||||
ThreadSafeIncrementQuadConstructorCount (render_quad_batch_constructor* Constructor)
|
ThreadSafeIncrementQuadConstructorCount (render_quad_batch_constructor* Constructor)
|
||||||
{
|
{
|
||||||
s32 Result = InterlockedIncrement((long*)&Constructor->Count);
|
s32 Result = InterlockedIncrement((long*)&Constructor->Count);
|
||||||
// NOTE(Peter): Have to decrement the value by one.
|
// NOTE(Peter): Have to decrement the value by one.
|
||||||
// Interlocked Increment acts as (++Constructor->Count), not (Constructor->Count++) which
|
// Interlocked Increment acts as (++Constructor->Count), not (Constructor->Count++) which
|
||||||
// is what we wanted;
|
// is what we wanted;
|
||||||
// This was causing the first triangle to be garbage data.
|
// This was causing the first triangle to be garbage data.
|
||||||
Result -= 1;
|
Result -= 1;
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
@ -322,8 +322,8 @@ ThreadSafeReserveRangeInQuadConstructor(render_quad_batch_constructor* Construct
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
SetTri3DInBatch (render_quad_batch_constructor* Constructor, s32 TriIndex,
|
SetTri3DInBatch (render_quad_batch_constructor* Constructor, s32 TriIndex,
|
||||||
v4 P0, v4 P1, v4 P2,
|
v4 P0, v4 P1, v4 P2,
|
||||||
v2 UV0, v2 UV1, v2 UV2,
|
v2 UV0, v2 UV1, v2 UV2,
|
||||||
v4 C0, v4 C1, v4 C2)
|
v4 C0, v4 C1, v4 C2)
|
||||||
{
|
{
|
||||||
// Vertecies
|
// Vertecies
|
||||||
|
@ -342,10 +342,11 @@ SetTri3DInBatch (render_quad_batch_constructor* Constructor, s32 TriIndex,
|
||||||
Constructor->ColorsV[BATCH_3D_COLOR_INDEX(TriIndex, 2)] = C2;
|
Constructor->ColorsV[BATCH_3D_COLOR_INDEX(TriIndex, 2)] = C2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
PushTri3DOnBatch (render_quad_batch_constructor* Constructor,
|
PushTri3DOnBatch (render_quad_batch_constructor* Constructor,
|
||||||
v4 P0, v4 P1, v4 P2,
|
v4 P0, v4 P1, v4 P2,
|
||||||
v2 UV0, v2 UV1, v2 UV2,
|
v2 UV0, v2 UV1, v2 UV2,
|
||||||
v4 C0, v4 C1, v4 C2)
|
v4 C0, v4 C1, v4 C2)
|
||||||
{
|
{
|
||||||
DEBUG_TRACK_FUNCTION;
|
DEBUG_TRACK_FUNCTION;
|
||||||
|
@ -362,9 +363,9 @@ PushQuad3DOnBatch (render_quad_batch_constructor* Constructor, v4 P0, v4 P1, v4
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
PushQuad3DOnBatch (render_quad_batch_constructor* Constructor,
|
PushQuad3DOnBatch (render_quad_batch_constructor* Constructor,
|
||||||
v4 P0, v4 P1, v4 P2, v4 P3,
|
v4 P0, v4 P1, v4 P2, v4 P3,
|
||||||
v2 UV0, v2 UV1, v2 UV2, v2 UV3,
|
v2 UV0, v2 UV1, v2 UV2, v2 UV3,
|
||||||
v4 C0, v4 C1, v4 C2, v4 C3)
|
v4 C0, v4 C1, v4 C2, v4 C3)
|
||||||
{
|
{
|
||||||
Assert(Constructor->Count < Constructor->Max);
|
Assert(Constructor->Count < Constructor->Max);
|
||||||
|
@ -379,8 +380,8 @@ PushQuad3DOnBatch (render_quad_batch_constructor* Constructor, v4 P0, v4 P1, v4
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
PushQuad2DOnBatch (render_quad_batch_constructor* Constructor,
|
PushQuad2DOnBatch (render_quad_batch_constructor* Constructor,
|
||||||
v2 P0, v2 P1, v2 P2, v2 P3,
|
v2 P0, v2 P1, v2 P2, v2 P3,
|
||||||
v2 UV0, v2 UV1, v2 UV2, v2 UV3,
|
v2 UV0, v2 UV1, v2 UV2, v2 UV3,
|
||||||
v4 C0, v4 C1, v4 C2, v4 C3)
|
v4 C0, v4 C1, v4 C2, v4 C3)
|
||||||
{
|
{
|
||||||
|
@ -610,7 +611,7 @@ PushRenderCameraFacingQuad (render_command_buffer* Buffer, v4 Center, v2 Dimensi
|
||||||
}
|
}
|
||||||
|
|
||||||
internal render_quad_batch_constructor
|
internal render_quad_batch_constructor
|
||||||
PushRenderTexture2DBatch(render_command_buffer* Buffer, s32 QuadCount,
|
PushRenderTexture2DBatch(render_command_buffer* Buffer, s32 QuadCount,
|
||||||
render_texture Texture)
|
render_texture Texture)
|
||||||
{
|
{
|
||||||
s32 DataSize = BATCH_2D_SIZE(QuadCount);
|
s32 DataSize = BATCH_2D_SIZE(QuadCount);
|
||||||
|
@ -628,15 +629,15 @@ PushRenderTexture2DBatch(render_command_buffer* Buffer, s32 QuadCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal render_quad_batch_constructor
|
internal render_quad_batch_constructor
|
||||||
PushRenderTexture2DBatch (render_command_buffer* Buffer, s32 QuadCount,
|
PushRenderTexture2DBatch (render_command_buffer* Buffer, s32 QuadCount,
|
||||||
u8* TextureMemory, s32 TextureHandle, s32 TextureWidth, s32 TextureHeight,
|
u8* TextureMemory, s32 TextureHandle, s32 TextureWidth, s32 TextureHeight,
|
||||||
s32 TextureBytesPerPixel, s32 TextureStride)
|
s32 TextureBytesPerPixel, s32 TextureStride)
|
||||||
{
|
{
|
||||||
render_texture Texture = render_texture{
|
render_texture Texture = render_texture{
|
||||||
TextureMemory,
|
TextureMemory,
|
||||||
TextureHandle,
|
TextureHandle,
|
||||||
TextureWidth,
|
TextureWidth,
|
||||||
TextureHeight,
|
TextureHeight,
|
||||||
TextureBytesPerPixel,
|
TextureBytesPerPixel,
|
||||||
TextureStride};
|
TextureStride};
|
||||||
return PushRenderTexture2DBatch(Buffer, QuadCount, Texture);
|
return PushRenderTexture2DBatch(Buffer, QuadCount, Texture);
|
||||||
|
|
|
@ -59,6 +59,10 @@ static gsm_struct_member_type_info StructMembers_v4[] = {
|
||||||
{ "g", 1, (u64)&((v4*)0)->g, {}, 0},
|
{ "g", 1, (u64)&((v4*)0)->g, {}, 0},
|
||||||
{ "b", 1, (u64)&((v4*)0)->b, {}, 0},
|
{ "b", 1, (u64)&((v4*)0)->b, {}, 0},
|
||||||
{ "a", 1, (u64)&((v4*)0)->a, {}, 0},
|
{ "a", 1, (u64)&((v4*)0)->a, {}, 0},
|
||||||
|
{ "xy", 2, (u64)&((v4*)0)->xy, {}, 0},
|
||||||
|
{ "yz", 2, (u64)&((v4*)0)->yz, {}, 0},
|
||||||
|
{ "xyz", 3, (u64)&((v4*)0)->xyz, {}, 0},
|
||||||
|
{ "z", 1, (u64)&((v4*)0)->z, {}, 0},
|
||||||
{ "E", 1, (u64)&((v4*)0)->E, {}, 0},
|
{ "E", 1, (u64)&((v4*)0)->E, {}, 0},
|
||||||
};
|
};
|
||||||
static gsm_struct_member_type_info StructMembers_pixel[] = {
|
static gsm_struct_member_type_info StructMembers_pixel[] = {
|
||||||
|
@ -107,7 +111,7 @@ static gsm_struct_member_type_info StructMembers_multiply_patterns_data[] = {
|
||||||
|
|
||||||
static gsm_struct_type_info StructTypes[] = {
|
static gsm_struct_type_info StructTypes[] = {
|
||||||
{ gsm_StructType_solid_color_data, "solid_color_data", 16, 36, 0, 0, StructMembers_solid_color_data, 2 },
|
{ gsm_StructType_solid_color_data, "solid_color_data", 16, 36, 0, 0, StructMembers_solid_color_data, 2 },
|
||||||
{ gsm_StructType_v4, "v4", 2, 16, 0, 0, StructMembers_v4, 3 },
|
{ gsm_StructType_v4, "v4", 2, 16, 0, 0, StructMembers_v4, 5 },
|
||||||
{ gsm_StructType_float, "float", 5, 4, 0, 0, 0, 0 },
|
{ gsm_StructType_float, "float", 5, 4, 0, 0, 0, 0 },
|
||||||
{ gsm_StructType_color_buffer, "color_buffer", 12, 20, 0, 0, StructMembers_color_buffer, 3 },
|
{ gsm_StructType_color_buffer, "color_buffer", 12, 20, 0, 0, StructMembers_color_buffer, 3 },
|
||||||
{ gsm_StructType_pixel, "pixel", 5, 3, 0, 0, StructMembers_pixel, 2 },
|
{ gsm_StructType_pixel, "pixel", 5, 3, 0, 0, StructMembers_pixel, 2 },
|
||||||
|
|
|
@ -572,7 +572,7 @@ DrawAnimationClipsList(rect PanelBounds, ui_interface* Interface, u32 SelectedAn
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_animation_timeline);
|
GSMetaTag(panel_type_animation_timeline);
|
||||||
internal void
|
internal void
|
||||||
AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
animation_timeline_state* TimelineState = (animation_timeline_state*)Panel.PanelStateMemory;
|
animation_timeline_state* TimelineState = (animation_timeline_state*)Panel.PanelStateMemory;
|
||||||
gs_list_handle SelectedBlockHandle = State->SelectedAnimationBlockHandle;
|
gs_list_handle SelectedBlockHandle = State->SelectedAnimationBlockHandle;
|
||||||
|
|
|
@ -37,7 +37,7 @@ DMXView_Cleanup(panel* Panel, app_state* State)
|
||||||
// This won't actually function
|
// This won't actually function
|
||||||
// :NoLongerFunctionalSACNCodeButThatsOk
|
// :NoLongerFunctionalSACNCodeButThatsOk
|
||||||
internal void
|
internal void
|
||||||
DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw,
|
DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw,
|
||||||
v2 TopLeft, v2 Dimension)
|
v2 TopLeft, v2 Dimension)
|
||||||
{
|
{
|
||||||
Assert(ToDraw);
|
Assert(ToDraw);
|
||||||
|
@ -69,12 +69,12 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr
|
||||||
++PixelsDrawn;
|
++PixelsDrawn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_dmx_view);
|
GSMetaTag(panel_type_dmx_view);
|
||||||
internal void
|
internal void
|
||||||
DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// :NoLongerFunctionalSACNCodeButThatsOk
|
// :NoLongerFunctionalSACNCodeButThatsOk
|
||||||
|
@ -121,7 +121,7 @@ DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffe
|
||||||
{
|
{
|
||||||
v2 TitleDisplayStart = UniverseDisplayTopLeft + v2{0, 12};
|
v2 TitleDisplayStart = UniverseDisplayTopLeft + v2{0, 12};
|
||||||
PrintF(&TitleBarString, "Universe %d", Universe->Universe);
|
PrintF(&TitleBarString, "Universe %d", Universe->Universe);
|
||||||
DrawString(RenderBuffer, TitleBarString, State->Interface.Font,
|
DrawString(RenderBuffer, TitleBarString, State->Interface.Font,
|
||||||
TitleDisplayStart, WhiteV4);
|
TitleDisplayStart, WhiteV4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ FileView_Cleanup(panel* Panel, app_state* State)
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_file_view);
|
GSMetaTag(panel_type_file_view);
|
||||||
internal void
|
internal void
|
||||||
FileView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
FileView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
rect HeaderBounds = {0};
|
rect HeaderBounds = {0};
|
||||||
HeaderBounds.Min = {PanelBounds.Min.x, PanelBounds.Max.y - 32};
|
HeaderBounds.Min = {PanelBounds.Min.x, PanelBounds.Max.y - 32};
|
||||||
|
|
|
@ -27,7 +27,7 @@ HierarchyView_Cleanup(panel* Panel, app_state* State)
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_hierarchy);
|
GSMetaTag(panel_type_hierarchy);
|
||||||
internal void
|
internal void
|
||||||
HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
||||||
string TempString = PushString(&State->Transient, 256);
|
string TempString = PushString(&State->Transient, 256);
|
||||||
|
|
|
@ -420,7 +420,7 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_node_graph);
|
GSMetaTag(panel_type_node_graph);
|
||||||
internal void
|
internal void
|
||||||
NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
node_graph_state* GraphState = (node_graph_state*)Panel.PanelStateMemory;
|
node_graph_state* GraphState = (node_graph_state*)Panel.PanelStateMemory;
|
||||||
b32 MouseHandled = false;
|
b32 MouseHandled = false;
|
||||||
|
@ -477,7 +477,7 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
|
||||||
{
|
{
|
||||||
visual_node VisualNode = GraphState->Layout.VisualNodes[i];
|
visual_node VisualNode = GraphState->Layout.VisualNodes[i];
|
||||||
gs_list_handle NodeHandle = State->NodeWorkspace.SortedNodeHandles[i];
|
gs_list_handle NodeHandle = State->NodeWorkspace.SortedNodeHandles[i];
|
||||||
DrawNode(VisualNode.Position + GraphState->ViewOffset, VisualNode.Spec, NodeHandle, NodeWidth, LineHeight, State->Interface.Style, RenderBuffer, Mouse, &State->Transient);
|
DrawNode(VisualNode.Position + GraphState->ViewOffset, VisualNode.Spec, NodeHandle, NodeWidth, LineHeight, State->Interface.Style, RenderBuffer, Context.Mouse, &State->Transient);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++)
|
for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++)
|
||||||
|
@ -487,12 +487,12 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
|
||||||
VisualPort.PortBounds.Max += GraphState->ViewOffset;
|
VisualPort.PortBounds.Max += GraphState->ViewOffset;
|
||||||
|
|
||||||
v4 PortColor = WhiteV4;
|
v4 PortColor = WhiteV4;
|
||||||
if (PointIsInRange(Mouse.Pos, VisualPort.PortBounds.Min, VisualPort.PortBounds.Max))
|
if (PointIsInRange(Context.Mouse.Pos, VisualPort.PortBounds.Min, VisualPort.PortBounds.Max))
|
||||||
{
|
{
|
||||||
PortColor = PinkV4;
|
PortColor = PinkV4;
|
||||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState))
|
if (MouseButtonTransitionedDown(Context.Mouse.LeftButtonState))
|
||||||
{
|
{
|
||||||
BeginConnectNodesOperation(VisualPort, p, Mouse, State);
|
BeginConnectNodesOperation(VisualPort, p, Context.Mouse, State);
|
||||||
MouseHandled = true;
|
MouseHandled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,15 +519,15 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
|
||||||
List.ElementLabelIndent = v2{10, 4};
|
List.ElementLabelIndent = v2{10, 4};
|
||||||
|
|
||||||
string TitleString = MakeStringLiteral("Available Nodes");
|
string TitleString = MakeStringLiteral("Available Nodes");
|
||||||
DrawListElement(TitleString, &List, Mouse, RenderBuffer, State->Interface.Style);
|
DrawListElement(TitleString, &List, Context.Mouse, RenderBuffer, State->Interface.Style);
|
||||||
|
|
||||||
for (u32 i = 0; i < NodeType_Count; i++)
|
for (u32 i = 0; i < NodeType_Count; i++)
|
||||||
{
|
{
|
||||||
node_specification_ Spec = NodeSpecifications[i];
|
node_specification_ Spec = NodeSpecifications[i];
|
||||||
rect ElementBounds = DrawListElement(Spec.Identifier, &List, Mouse, RenderBuffer, State->Interface.Style);
|
rect ElementBounds = DrawListElement(Spec.Identifier, &List, Context.Mouse, RenderBuffer, State->Interface.Style);
|
||||||
|
|
||||||
if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
|
if (MouseButtonTransitionedDown(Context.Mouse.LeftButtonState)
|
||||||
&& gs_PointIsInRect(Mouse.DownPos, ElementBounds))
|
&& gs_PointIsInRect(Context.Mouse.DownPos, ElementBounds))
|
||||||
{
|
{
|
||||||
PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient);
|
PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient);
|
||||||
GraphState->LayoutIsDirty = true;
|
GraphState->LayoutIsDirty = true;
|
||||||
|
@ -535,9 +535,9 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MouseHandled && MouseButtonTransitionedDown(Mouse.LeftButtonState))
|
if (!MouseHandled && MouseButtonTransitionedDown(Context.Mouse.LeftButtonState))
|
||||||
{
|
{
|
||||||
BeginPanNodeGraph(State, {}, Mouse);
|
BeginPanNodeGraph(State, {}, Context.Mouse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_layout Layout, debu
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_profiler);
|
GSMetaTag(panel_type_profiler);
|
||||||
internal void
|
internal void
|
||||||
ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
memory_arena* Memory = &State->Transient;
|
memory_arena* Memory = &State->Transient;
|
||||||
string String = InitializeEmptyString(PushArray(Memory, char, 256), 256);
|
string String = InitializeEmptyString(PushArray(Memory, char, 256), 256);
|
||||||
|
@ -149,9 +149,9 @@ ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* Render
|
||||||
r32 SingleFrameWidth = (r32)((s32)SingleFrameStep - 2);
|
r32 SingleFrameWidth = (r32)((s32)SingleFrameStep - 2);
|
||||||
|
|
||||||
ui_OutlineRect(&State->Interface, FrameListBounds, 2, WhiteV4);
|
ui_OutlineRect(&State->Interface, FrameListBounds, 2, WhiteV4);
|
||||||
if (gs_PointIsInRect(Mouse.Pos, FrameListBounds) && MouseButtonHeldDown(Mouse.LeftButtonState))
|
if (gs_PointIsInRect(Context.Mouse.Pos, FrameListBounds) && MouseButtonHeldDown(Context.Mouse.LeftButtonState))
|
||||||
{
|
{
|
||||||
v2 LocalMouse = gs_TransformPointIntoRectSpace(Mouse.Pos, FrameListBounds);
|
v2 LocalMouse = gs_TransformPointIntoRectSpace(Context.Mouse.Pos, FrameListBounds);
|
||||||
s32 ClosestFrameIndex = (LocalMouse.x / SingleFrameStep);
|
s32 ClosestFrameIndex = (LocalMouse.x / SingleFrameStep);
|
||||||
if (ClosestFrameIndex >= 0 && ClosestFrameIndex < DEBUG_FRAME_COUNT)
|
if (ClosestFrameIndex >= 0 && ClosestFrameIndex < DEBUG_FRAME_COUNT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,6 +71,7 @@ SculptureView_Cleanup(panel* Panel, app_state* State)
|
||||||
|
|
||||||
struct draw_leds_job_data
|
struct draw_leds_job_data
|
||||||
{
|
{
|
||||||
|
v4 CameraPosition;
|
||||||
v4* Positions;
|
v4* Positions;
|
||||||
pixel* Colors;
|
pixel* Colors;
|
||||||
s32 StartIndex;
|
s32 StartIndex;
|
||||||
|
@ -107,18 +108,19 @@ DrawLEDsInBufferRangeJob (s32 ThreadID, void* JobData)
|
||||||
v2 UV2 = v2{1, 1};
|
v2 UV2 = v2{1, 1};
|
||||||
v2 UV3 = v2{0, 1};
|
v2 UV3 = v2{0, 1};
|
||||||
|
|
||||||
|
|
||||||
for (s32 LedIndex = 0; LedIndex < LEDCount; LedIndex++)
|
for (s32 LedIndex = 0; LedIndex < LEDCount; LedIndex++)
|
||||||
{
|
{
|
||||||
pixel PixelColor = Data->Colors[LedIndex];
|
pixel PixelColor = Data->Colors[LedIndex];
|
||||||
v4 Color = v4{PixelColor.R / 255.f, PixelColor.G / 255.f, PixelColor.B / 255.f, 1.0f};
|
v4 Color = v4{PixelColor.R / 255.f, PixelColor.G / 255.f, PixelColor.B / 255.f, 1.0f};
|
||||||
|
|
||||||
v4 V4Position = Data->Positions[Data->StartIndex + LedIndex];
|
v4 Position = Data->Positions[Data->StartIndex + LedIndex];
|
||||||
V4Position.w = 0;
|
m44 FaceCameraMatrix = GetLookAtMatrix(Position, Data->CameraPosition);
|
||||||
v4 P0 = P0_In + V4Position;
|
v4 PositionOffset = V4(Position.xyz, 0); // Ensure PositionOffset is a vector, not a point
|
||||||
v4 P1 = P1_In + V4Position;
|
|
||||||
v4 P2 = P2_In + V4Position;
|
v4 P0 = (FaceCameraMatrix * P0_In) + PositionOffset;
|
||||||
v4 P3 = P3_In + V4Position;
|
v4 P1 = (FaceCameraMatrix * P1_In) + PositionOffset;
|
||||||
|
v4 P2 = (FaceCameraMatrix * P2_In) + PositionOffset;
|
||||||
|
v4 P3 = (FaceCameraMatrix * P3_In) + PositionOffset;
|
||||||
|
|
||||||
SetTri3DInBatch(Data->Batch, BatchReservedRange.Start + TrisUsed++,
|
SetTri3DInBatch(Data->Batch, BatchReservedRange.Start + TrisUsed++,
|
||||||
P0, P1, P2, UV0, UV1, UV2, Color, Color, Color);
|
P0, P1, P2, UV0, UV1, UV2, Color, Color, Color);
|
||||||
|
@ -130,7 +132,7 @@ DrawLEDsInBufferRangeJob (s32 ThreadID, void* JobData)
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_sculpture_view);
|
GSMetaTag(panel_type_sculpture_view);
|
||||||
internal void
|
internal void
|
||||||
SculptureView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
SculptureView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
DEBUG_TRACK_SCOPE(RenderSculpture);
|
DEBUG_TRACK_SCOPE(RenderSculpture);
|
||||||
|
|
||||||
|
@ -145,9 +147,7 @@ SculptureView_Render(panel Panel, rect PanelBounds, render_command_buffer* Rende
|
||||||
|
|
||||||
PushRenderPerspective(RenderBuffer, PanelBounds.Min.x, PanelBounds.Min.y, PanelWidth, PanelHeight, State->Camera);
|
PushRenderPerspective(RenderBuffer, PanelBounds.Min.x, PanelBounds.Min.y, PanelWidth, PanelHeight, State->Camera);
|
||||||
|
|
||||||
// TODO(Peter): Pretty sure this isn't working right now
|
|
||||||
m44 FaceCameraMatrix = GetLookAtMatrix(v4{0, 0, 0, 1}, V4(State->Camera.Position, 1));
|
m44 FaceCameraMatrix = GetLookAtMatrix(v4{0, 0, 0, 1}, V4(State->Camera.Position, 1));
|
||||||
FaceCameraMatrix = FaceCameraMatrix;
|
|
||||||
|
|
||||||
u32 MaxLEDsPerJob = 2048;
|
u32 MaxLEDsPerJob = 2048;
|
||||||
render_quad_batch_constructor RenderLEDsBatch = PushRenderQuad3DBatch(RenderBuffer, State->LedSystem.LedsCountTotal);
|
render_quad_batch_constructor RenderLEDsBatch = PushRenderQuad3DBatch(RenderBuffer, State->LedSystem.LedsCountTotal);
|
||||||
|
@ -166,13 +166,19 @@ SculptureView_Render(panel Panel, rect PanelBounds, render_command_buffer* Rende
|
||||||
JobData->StartIndex = Job * MaxLEDsPerJob;
|
JobData->StartIndex = Job * MaxLEDsPerJob;
|
||||||
JobData->OnePastLastIndex = GSMin(JobData->StartIndex + MaxLEDsPerJob, LedBuffer->LedCount);
|
JobData->OnePastLastIndex = GSMin(JobData->StartIndex + MaxLEDsPerJob, LedBuffer->LedCount);
|
||||||
JobData->Batch = &RenderLEDsBatch;
|
JobData->Batch = &RenderLEDsBatch;
|
||||||
JobData->FaceCameraMatrix;
|
//JobData->FaceCameraMatrix = FaceCameraMatrix;
|
||||||
JobData->ModelViewMatrix = ModelViewMatrix;
|
JobData->ModelViewMatrix = ModelViewMatrix;
|
||||||
JobData->LEDHalfWidth = LEDHalfWidth;
|
JobData->LEDHalfWidth = LEDHalfWidth;
|
||||||
|
|
||||||
|
JobData->CameraPosition = V4(State->Camera.Position, 1);
|
||||||
|
|
||||||
Context.GeneralWorkQueue->PushWorkOnQueue(Context.GeneralWorkQueue, DrawLEDsInBufferRangeJob, JobData, "Sculpture Draw LEDS");
|
Context.GeneralWorkQueue->PushWorkOnQueue(Context.GeneralWorkQueue, DrawLEDsInBufferRangeJob, JobData, "Sculpture Draw LEDS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Context.GeneralWorkQueue->DoQueueWorkUntilDone(Context.GeneralWorkQueue, 0);
|
Context.GeneralWorkQueue->DoQueueWorkUntilDone(Context.GeneralWorkQueue, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,30 +19,33 @@ PLATFORM_READ_ENTIRE_FILE(Win32ReadEntireFile)
|
||||||
if (FileHandle != INVALID_HANDLE_VALUE)
|
if (FileHandle != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DWORD FileSize = GetFileSize(FileHandle, NULL);
|
DWORD FileSize = GetFileSize(FileHandle, NULL);
|
||||||
Result.Base = (u8*)VirtualAlloc(NULL, FileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
Result.Data.Base = (u8*)VirtualAlloc(NULL, FileSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||||
if (Result.Base)
|
if (Result.Data.Base)
|
||||||
{
|
{
|
||||||
Result.Size = FileSize;
|
Result.Data.Size = FileSize;
|
||||||
|
|
||||||
s32 BytesRead = 0;
|
s32 BytesRead = 0;
|
||||||
if (ReadFile(FileHandle, (LPVOID)Result.Base, FileSize, (LPDWORD)(&BytesRead), NULL))
|
if (ReadFile(FileHandle, (LPVOID)Result.Data.Base, FileSize, (LPDWORD)(&BytesRead), NULL))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u32 Error = GetLastError();
|
u32 Error = GetLastError();
|
||||||
// TODO(Peter): :ErrorLogging
|
VirtualFree(Result.Data.Base, 0, MEM_RELEASE);
|
||||||
Result.Size = 0;
|
Result.Data.Size = 0;
|
||||||
Result.Error = PlatformMemory_UnknownError;
|
Result.Error = PlatformMemory_UnknownError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Result.Error = PlatformMemory_UnknownError;
|
||||||
|
}
|
||||||
CloseHandle(FileHandle);
|
CloseHandle(FileHandle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Result.Error = PlatformMemory_FileNotFound;
|
Result.Error = PlatformMemory_FileNotFound;
|
||||||
// TODO(Peter): :ErrorLogging
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
@ -138,13 +141,5 @@ PLATFORM_GET_FILE_PATH(Win32SystemDialogueOpenFile)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal directory_listing
|
|
||||||
EnumerateDirectory(char* Path, memory_arena* Storage)
|
|
||||||
{
|
|
||||||
directory_listing Result = {};
|
|
||||||
// TODO(Peter):
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WIN32_FOLDHAUS_FILEIO_H
|
#define WIN32_FOLDHAUS_FILEIO_H
|
||||||
#endif // WIN32_FOLDHAUS_FILEIO_H
|
#endif // WIN32_FOLDHAUS_FILEIO_H
|
|
@ -75,6 +75,18 @@ union v4
|
||||||
float a;
|
float a;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
v2 xy;
|
||||||
|
v2 yz;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
v3 xyz;
|
||||||
|
float z;
|
||||||
|
};
|
||||||
|
|
||||||
float E[4];
|
float E[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1271,11 +1283,10 @@ GetLookAtMatrix (v4 Position, v4 Target)
|
||||||
v4 Up = Normalize(Cross(Forward, Right));
|
v4 Up = Normalize(Cross(Forward, Right));
|
||||||
|
|
||||||
m44 RotationMatrix = M44(
|
m44 RotationMatrix = M44(
|
||||||
Right.x, Up.x, Forward.x, 0,
|
Right.x, Right.y, Right.z, 0,
|
||||||
Right.y, Up.y, Forward.y, 0,
|
Up.x, Up.y, Up.z, 0,
|
||||||
Right.z, Up.z, Forward.z, 0,
|
Forward.x, Forward.y, Forward.z, 0,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
|
||||||
return RotationMatrix;
|
return RotationMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue