Refactored rect functionality of gs_vector_matrix to make it not conflict with windows headers (just added gs_ to all functions). refactored Profiler interface code to use the new interface layout system.

This commit is contained in:
Peter Slattery 2020-03-21 22:44:44 -07:00
parent 5922a4bf27
commit b843937295
12 changed files with 2643 additions and 2579 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,10 +11,10 @@
static r32 GSCos (r32 Theta) { return sin(Theta); } static r32 GSCos (r32 Theta) { return sin(Theta); }
static r32 GSSin (r32 Theta) { return cos(Theta); } static r32 GSSin (r32 Theta) { return cos(Theta); }
static r32 GSSqrt(r32 V) static r32 GSSqrt(r32 V)
{ {
r32 Result = _mm_cvtss_f32(_mm_sqrt_ss(_mm_set_ss(V))); r32 Result = _mm_cvtss_f32(_mm_sqrt_ss(_mm_set_ss(V)));
return Result; return Result;
} }
#else // Linux and MacOS #else // Linux and MacOS
@ -43,14 +43,14 @@ union v3
struct struct
{ {
float x; float x;
float y; float y;
float z; float z;
}; };
struct struct
{ {
float R; float R;
float G; float G;
float B; float B;
}; };
@ -61,17 +61,17 @@ union v4
{ {
struct struct
{ {
float x; float x;
float y; float y;
float z; float z;
float w; float w;
}; };
struct struct
{ {
float r; float r;
float g; float g;
float b; float b;
float a; float a;
}; };
@ -255,7 +255,7 @@ bool operator== (v2 A, v2 B)
{ {
if (GSAbs(A.E[i] - B.E[i]) > 0.0001f) { Result = false; break; } if (GSAbs(A.E[i] - B.E[i]) > 0.0001f) { Result = false; break; }
} }
return Result; return Result;
} }
@ -623,7 +623,7 @@ v4 HSVToRGB (v4 In)
}break; }break;
} }
return Result; return Result;
} }
static bool static bool
@ -663,14 +663,14 @@ PointToPercentRange (v2 P, v2 Min, v2 Max)
// NOTE(Peter): This is useful when you have a function that has a call signature like: // NOTE(Peter): This is useful when you have a function that has a call signature like:
// void Foo(v2 Min, v2 Max) // void Foo(v2 Min, v2 Max)
// because instead of having to do: // because instead of having to do:
// Foo(MyRect.Min, MyRect.Max) // Foo(MyRect.Min, MyRect.Max)
// you can just do: // you can just do:
// Foo(RectExpand(MyRect)) // Foo(RectExpand(MyRect))
// which makes refactoring easier as you only have to change the identifier in one place // which makes refactoring easier as you only have to change the identifier in one place
#define RectExpand(r) (r).Min, (r).Max #define gs_RectExpand(r) (r).Min, (r).Max
static rect static rect
MakeRectMinWidth(v2 Min, v2 Width) gs_MakeRectMinWidth(v2 Min, v2 Width)
{ {
rect Rect = {0}; rect Rect = {0};
Rect.Min = Min; Rect.Min = Min;
@ -679,21 +679,21 @@ MakeRectMinWidth(v2 Min, v2 Width)
} }
inline float inline float
Width (rect Rect) gs_Width (rect Rect)
{ {
float Result = Rect.Max.x - Rect.Min.x; float Result = Rect.Max.x - Rect.Min.x;
return Result; return Result;
} }
inline float inline float
Height (rect Rect) gs_Height (rect Rect)
{ {
float Result = Rect.Max.y - Rect.Min.y; float Result = Rect.Max.y - Rect.Min.y;
return Result; return Result;
} }
inline v2 inline v2
TopLeft(rect Rect) gs_TopLeft(rect Rect)
{ {
v2 Result = {0}; v2 Result = {0};
Result.x = Rect.Min.x; Result.x = Rect.Min.x;
@ -702,19 +702,19 @@ TopLeft(rect Rect)
} }
inline v2 inline v2
TopRight(rect Rect) gs_TopRight(rect Rect)
{ {
return Rect.Max; return Rect.Max;
} }
inline v2 inline v2
BottomLeft(rect Rect) gs_BottomLeft(rect Rect)
{ {
return Rect.Min; return Rect.Min;
} }
inline v2 inline v2
BottomRight(rect Rect) gs_BottomRight(rect Rect)
{ {
v2 Result = {0}; v2 Result = {0};
Result.x = Rect.Max.x; Result.x = Rect.Max.x;
@ -723,21 +723,21 @@ BottomRight(rect Rect)
} }
inline float inline float
AspectRatio (rect Rect) gs_AspectRatio (rect Rect)
{ {
float Result = Width(Rect) / Height(Rect); float Result = gs_Width(Rect) / gs_Height(Rect);
return Result; return Result;
} }
inline v2 inline v2
CalculateRectCenter (rect Rect) gs_CalculateRectCenter (rect Rect)
{ {
v2 Result = (Rect.Min + Rect.Max) / 2.0f; v2 Result = (Rect.Min + Rect.Max) / 2.0f;
return Result; return Result;
} }
inline b32 inline b32
PointIsInRect (v2 Point, rect Rect) gs_PointIsInRect (v2 Point, rect Rect)
{ {
b32 Result = ((Point.x >= Rect.Min.x && Point.x <= Rect.Max.x) && b32 Result = ((Point.x >= Rect.Min.x && Point.x <= Rect.Max.x) &&
(Point.y >= Rect.Min.y && Point.y <= Rect.Max.y)); (Point.y >= Rect.Min.y && Point.y <= Rect.Max.y));
@ -745,7 +745,7 @@ PointIsInRect (v2 Point, rect Rect)
} }
inline rect inline rect
RectOffsetByVector(rect R, v2 V) gs_RectOffsetByVector(rect R, v2 V)
{ {
rect Result = R; rect Result = R;
Result.Min += V; Result.Min += V;
@ -754,7 +754,7 @@ RectOffsetByVector(rect R, v2 V)
} }
static void static void
HSplitRectAtValue(rect Bounds, r32 YValue, rect* Top, rect* Bottom) gs_HSplitRectAtValue(rect Bounds, r32 YValue, rect* Top, rect* Bottom)
{ {
if (YValue <= Bounds.Min.y) if (YValue <= Bounds.Min.y)
{ {
@ -776,29 +776,28 @@ HSplitRectAtValue(rect Bounds, r32 YValue, rect* Top, rect* Bottom)
} }
static void static void
HSplitRectAtDistanceFromTop(rect Bounds, r32 YDist, rect* Top, rect* Bottom) gs_HSplitRectAtDistanceFromTop(rect Bounds, r32 YDist, rect* Top, rect* Bottom)
{ {
r32 YValue = Bounds.Max.y - YDist; r32 YValue = Bounds.Max.y - YDist;
HSplitRectAtValue(Bounds, YValue, Top, Bottom); gs_HSplitRectAtValue(Bounds, YValue, Top, Bottom);
} }
static void static void
HSplitRectAtDistanceFromBottom(rect Bounds, r32 YDist, rect* Top, rect* Bottom) gs_HSplitRectAtDistanceFromBottom(rect Bounds, r32 YDist, rect* Top, rect* Bottom)
{ {
r32 YValue = Bounds.Min.y + YDist; r32 YValue = Bounds.Min.y + YDist;
HSplitRectAtValue(Bounds, YValue, Top, Bottom); gs_HSplitRectAtValue(Bounds, YValue, Top, Bottom);
} }
static void static void
HSplitRectAtPercent(rect Bounds, r32 YPercent, rect* Top, rect* Bottom) gs_HSplitRectAtPercent(rect Bounds, r32 YPercent, rect* Top, rect* Bottom)
{ {
r32 YValue = GSLerp(Bounds.Min.y, Bounds.Max.y, YPercent); r32 YValue = GSLerp(Bounds.Min.y, Bounds.Max.y, YPercent);
HSplitRectAtValue(Bounds, YValue, Top, Bottom); gs_HSplitRectAtValue(Bounds, YValue, Top, Bottom);
} }
static void static void
VSplitRectAtValue(rect Bounds, r32 XValue, rect* Left, rect* Right) gs_VSplitRectAtValue(rect Bounds, r32 XValue, rect* Left, rect* Right)
{ {
if (XValue <= Bounds.Min.x) if (XValue <= Bounds.Min.x)
{ {
@ -820,30 +819,46 @@ VSplitRectAtValue(rect Bounds, r32 XValue, rect* Left, rect* Right)
} }
static void static void
VSplitRectAtDistanceFromRight(rect Bounds, r32 XDist, rect* Left, rect* Right) gs_VSplitRectAtDistanceFromRight(rect Bounds, r32 XDist, rect* Left, rect* Right)
{ {
r32 XValue = Bounds.Max.x - XDist; r32 XValue = Bounds.Max.x - XDist;
VSplitRectAtValue(Bounds, XValue, Left, Right); gs_VSplitRectAtValue(Bounds, XValue, Left, Right);
} }
static void static void
VSplitRectAtDistanceFromLeft(rect Bounds, r32 XDist, rect* Left, rect* Right) gs_VSplitRectAtDistanceFromLeft(rect Bounds, r32 XDist, rect* Left, rect* Right)
{ {
r32 XValue = Bounds.Min.x + XDist; r32 XValue = Bounds.Min.x + XDist;
VSplitRectAtValue(Bounds, XValue, Left, Right); gs_VSplitRectAtValue(Bounds, XValue, Left, Right);
} }
static void static void
VSplitRectAtPercent(rect Bounds, r32 XPercent, rect* Left, rect* Right) gs_VSplitRectAtPercent(rect Bounds, r32 XPercent, rect* Left, rect* Right)
{ {
r32 XValue = GSLerp(Bounds.Min.x, Bounds.Max.x, XPercent); r32 XValue = GSLerp(Bounds.Min.x, Bounds.Max.x, XPercent);
VSplitRectAtValue(Bounds, XValue, Left, Right); gs_VSplitRectAtValue(Bounds, XValue, Left, Right);
} }
#define TranslateRectX(r, d) TranslateRect((r), v2{(d), 0})
#define TranslateRectY(r, d) TranslateRect((r), v2{0, (d)})
static rect static rect
TranslateRect(rect R, v2 Delta) gs_InsetRect(rect Rect, v2 Amount)
{
rect Result = {0};
Result.Min = Rect.Min + Amount;
Result.Max = Rect.Max - Amount;
return Result;
}
static rect
gs_InsetRect(rect Rect, float Amount)
{
rect Result = gs_InsetRect(Rect, v2{Amount, Amount});
return Result;
}
#define gs_TranslateRectX(r, d) gs_TranslateRect((r), v2{(d), 0})
#define gs_TranslateRectY(r, d) gs_TranslateRect((r), v2{0, (d)})
static rect
gs_TranslateRect(rect R, v2 Delta)
{ {
rect Result = R; rect Result = R;
Result.Min += Delta; Result.Min += Delta;
@ -851,6 +866,13 @@ TranslateRect(rect R, v2 Delta)
return Result; return Result;
} }
static v2
gs_TransformPointIntoRectSpace(v2 Point, rect Rect)
{
v2 Result = Point - Rect.Min;
return Point;
}
////////////////////////////////////// //////////////////////////////////////
// MATRIX // MATRIX
////////////////////////////////////// //////////////////////////////////////
@ -868,8 +890,8 @@ M33(float a, float b, float c,
} }
static m44 static m44
M44(float a, float b, float c, float d, M44(float a, float b, float c, float d,
float e, float f, float g, float h, float e, float f, float g, float h,
float i, float j, float k, float l, float i, float j, float k, float l,
float m, float n, float o, float p) float m, float n, float o, float p)
{ {
@ -967,7 +989,7 @@ GetZRotation (float Angle)
} }
static m33 static m33
Transpose (m33 M) Transpose (m33 M)
{ {
m33 Result = {}; m33 Result = {};
@ -983,7 +1005,7 @@ Transpose (m33 M)
return Result; return Result;
} }
inline m44 inline m44
Transpose (m44 M) Transpose (m44 M)
{ {
DEBUG_TRACK_SCOPE(Transpose); DEBUG_TRACK_SCOPE(Transpose);
@ -1149,7 +1171,7 @@ v3 operator* (m33 M, v3 V)
Result.E[y] = 0; Result.E[y] = 0;
for (int x = 0; x < 3; x++) for (int x = 0; x < 3; x++)
{ {
Result.E[y] += M.E[(y * 3) + x] * V.E[x]; Result.E[y] += M.E[(y * 3) + x] * V.E[x];
} }
} }
return Result; return Result;
@ -1169,7 +1191,7 @@ v4 operator* (m44 M, v4 V)
Result.E[y] = 0; Result.E[y] = 0;
for (int x = 0; x < 4; x++) for (int x = 0; x < 4; x++)
{ {
Result.E[y] += M.E[(y * 4) + x] * V.E[x]; Result.E[y] += M.E[(y * 4) + x] * V.E[x];
} }
} }
#endif #endif
@ -1242,7 +1264,7 @@ static m44
GetLookAtMatrix (v4 Position, v4 Target) GetLookAtMatrix (v4 Position, v4 Target)
{ {
// Forward // Forward
v4 Forward = Normalize(Target - Position); v4 Forward = Normalize(Target - Position);
// Right // Right
v4 Right = Normalize(Cross(v4{0, 1, 0, 0}, Forward)); v4 Right = Normalize(Cross(v4{0, 1, 0, 0}, Forward));
// Up // Up
@ -1265,116 +1287,116 @@ b32 Inverse(m44 M_In, m44* M_Out)
s32 i; s32 i;
M_Out->E[0] = M_In.E[5] * M_In.E[10] * M_In.E[15] - M_Out->E[0] = M_In.E[5] * M_In.E[10] * M_In.E[15] -
M_In.E[5] * M_In.E[11] * M_In.E[14] - M_In.E[5] * M_In.E[11] * M_In.E[14] -
M_In.E[9] * M_In.E[6] * M_In.E[15] + M_In.E[9] * M_In.E[6] * M_In.E[15] +
M_In.E[9] * M_In.E[7] * M_In.E[14] + M_In.E[9] * M_In.E[7] * M_In.E[14] +
M_In.E[13] * M_In.E[6] * M_In.E[11] - M_In.E[13] * M_In.E[6] * M_In.E[11] -
M_In.E[13] * M_In.E[7] * M_In.E[10]; M_In.E[13] * M_In.E[7] * M_In.E[10];
M_Out->E[4] = -M_In.E[4] * M_In.E[10] * M_In.E[15] + M_Out->E[4] = -M_In.E[4] * M_In.E[10] * M_In.E[15] +
M_In.E[4] * M_In.E[11] * M_In.E[14] + M_In.E[4] * M_In.E[11] * M_In.E[14] +
M_In.E[8] * M_In.E[6] * M_In.E[15] - M_In.E[8] * M_In.E[6] * M_In.E[15] -
M_In.E[8] * M_In.E[7] * M_In.E[14] - M_In.E[8] * M_In.E[7] * M_In.E[14] -
M_In.E[12] * M_In.E[6] * M_In.E[11] + M_In.E[12] * M_In.E[6] * M_In.E[11] +
M_In.E[12] * M_In.E[7] * M_In.E[10]; M_In.E[12] * M_In.E[7] * M_In.E[10];
M_Out->E[8] = M_In.E[4] * M_In.E[9] * M_In.E[15] - M_Out->E[8] = M_In.E[4] * M_In.E[9] * M_In.E[15] -
M_In.E[4] * M_In.E[11] * M_In.E[13] - M_In.E[4] * M_In.E[11] * M_In.E[13] -
M_In.E[8] * M_In.E[5] * M_In.E[15] + M_In.E[8] * M_In.E[5] * M_In.E[15] +
M_In.E[8] * M_In.E[7] * M_In.E[13] + M_In.E[8] * M_In.E[7] * M_In.E[13] +
M_In.E[12] * M_In.E[5] * M_In.E[11] - M_In.E[12] * M_In.E[5] * M_In.E[11] -
M_In.E[12] * M_In.E[7] * M_In.E[9]; M_In.E[12] * M_In.E[7] * M_In.E[9];
M_Out->E[12] = -M_In.E[4] * M_In.E[9] * M_In.E[14] + M_Out->E[12] = -M_In.E[4] * M_In.E[9] * M_In.E[14] +
M_In.E[4] * M_In.E[10] * M_In.E[13] + M_In.E[4] * M_In.E[10] * M_In.E[13] +
M_In.E[8] * M_In.E[5] * M_In.E[14] - M_In.E[8] * M_In.E[5] * M_In.E[14] -
M_In.E[8] * M_In.E[6] * M_In.E[13] - M_In.E[8] * M_In.E[6] * M_In.E[13] -
M_In.E[12] * M_In.E[5] * M_In.E[10] + M_In.E[12] * M_In.E[5] * M_In.E[10] +
M_In.E[12] * M_In.E[6] * M_In.E[9]; M_In.E[12] * M_In.E[6] * M_In.E[9];
M_Out->E[1] = -M_In.E[1] * M_In.E[10] * M_In.E[15] + M_Out->E[1] = -M_In.E[1] * M_In.E[10] * M_In.E[15] +
M_In.E[1] * M_In.E[11] * M_In.E[14] + M_In.E[1] * M_In.E[11] * M_In.E[14] +
M_In.E[9] * M_In.E[2] * M_In.E[15] - M_In.E[9] * M_In.E[2] * M_In.E[15] -
M_In.E[9] * M_In.E[3] * M_In.E[14] - M_In.E[9] * M_In.E[3] * M_In.E[14] -
M_In.E[13] * M_In.E[2] * M_In.E[11] + M_In.E[13] * M_In.E[2] * M_In.E[11] +
M_In.E[13] * M_In.E[3] * M_In.E[10]; M_In.E[13] * M_In.E[3] * M_In.E[10];
M_Out->E[5] = M_In.E[0] * M_In.E[10] * M_In.E[15] - M_Out->E[5] = M_In.E[0] * M_In.E[10] * M_In.E[15] -
M_In.E[0] * M_In.E[11] * M_In.E[14] - M_In.E[0] * M_In.E[11] * M_In.E[14] -
M_In.E[8] * M_In.E[2] * M_In.E[15] + M_In.E[8] * M_In.E[2] * M_In.E[15] +
M_In.E[8] * M_In.E[3] * M_In.E[14] + M_In.E[8] * M_In.E[3] * M_In.E[14] +
M_In.E[12] * M_In.E[2] * M_In.E[11] - M_In.E[12] * M_In.E[2] * M_In.E[11] -
M_In.E[12] * M_In.E[3] * M_In.E[10]; M_In.E[12] * M_In.E[3] * M_In.E[10];
M_Out->E[9] = -M_In.E[0] * M_In.E[9] * M_In.E[15] + M_Out->E[9] = -M_In.E[0] * M_In.E[9] * M_In.E[15] +
M_In.E[0] * M_In.E[11] * M_In.E[13] + M_In.E[0] * M_In.E[11] * M_In.E[13] +
M_In.E[8] * M_In.E[1] * M_In.E[15] - M_In.E[8] * M_In.E[1] * M_In.E[15] -
M_In.E[8] * M_In.E[3] * M_In.E[13] - M_In.E[8] * M_In.E[3] * M_In.E[13] -
M_In.E[12] * M_In.E[1] * M_In.E[11] + M_In.E[12] * M_In.E[1] * M_In.E[11] +
M_In.E[12] * M_In.E[3] * M_In.E[9]; M_In.E[12] * M_In.E[3] * M_In.E[9];
M_Out->E[13] = M_In.E[0] * M_In.E[9] * M_In.E[14] - M_Out->E[13] = M_In.E[0] * M_In.E[9] * M_In.E[14] -
M_In.E[0] * M_In.E[10] * M_In.E[13] - M_In.E[0] * M_In.E[10] * M_In.E[13] -
M_In.E[8] * M_In.E[1] * M_In.E[14] + M_In.E[8] * M_In.E[1] * M_In.E[14] +
M_In.E[8] * M_In.E[2] * M_In.E[13] + M_In.E[8] * M_In.E[2] * M_In.E[13] +
M_In.E[12] * M_In.E[1] * M_In.E[10] - M_In.E[12] * M_In.E[1] * M_In.E[10] -
M_In.E[12] * M_In.E[2] * M_In.E[9]; M_In.E[12] * M_In.E[2] * M_In.E[9];
M_Out->E[2] = M_In.E[1] * M_In.E[6] * M_In.E[15] - M_Out->E[2] = M_In.E[1] * M_In.E[6] * M_In.E[15] -
M_In.E[1] * M_In.E[7] * M_In.E[14] - M_In.E[1] * M_In.E[7] * M_In.E[14] -
M_In.E[5] * M_In.E[2] * M_In.E[15] + M_In.E[5] * M_In.E[2] * M_In.E[15] +
M_In.E[5] * M_In.E[3] * M_In.E[14] + M_In.E[5] * M_In.E[3] * M_In.E[14] +
M_In.E[13] * M_In.E[2] * M_In.E[7] - M_In.E[13] * M_In.E[2] * M_In.E[7] -
M_In.E[13] * M_In.E[3] * M_In.E[6]; M_In.E[13] * M_In.E[3] * M_In.E[6];
M_Out->E[6] = -M_In.E[0] * M_In.E[6] * M_In.E[15] + M_Out->E[6] = -M_In.E[0] * M_In.E[6] * M_In.E[15] +
M_In.E[0] * M_In.E[7] * M_In.E[14] + M_In.E[0] * M_In.E[7] * M_In.E[14] +
M_In.E[4] * M_In.E[2] * M_In.E[15] - M_In.E[4] * M_In.E[2] * M_In.E[15] -
M_In.E[4] * M_In.E[3] * M_In.E[14] - M_In.E[4] * M_In.E[3] * M_In.E[14] -
M_In.E[12] * M_In.E[2] * M_In.E[7] + M_In.E[12] * M_In.E[2] * M_In.E[7] +
M_In.E[12] * M_In.E[3] * M_In.E[6]; M_In.E[12] * M_In.E[3] * M_In.E[6];
M_Out->E[10] = M_In.E[0] * M_In.E[5] * M_In.E[15] - M_Out->E[10] = M_In.E[0] * M_In.E[5] * M_In.E[15] -
M_In.E[0] * M_In.E[7] * M_In.E[13] - M_In.E[0] * M_In.E[7] * M_In.E[13] -
M_In.E[4] * M_In.E[1] * M_In.E[15] + M_In.E[4] * M_In.E[1] * M_In.E[15] +
M_In.E[4] * M_In.E[3] * M_In.E[13] + M_In.E[4] * M_In.E[3] * M_In.E[13] +
M_In.E[12] * M_In.E[1] * M_In.E[7] - M_In.E[12] * M_In.E[1] * M_In.E[7] -
M_In.E[12] * M_In.E[3] * M_In.E[5]; M_In.E[12] * M_In.E[3] * M_In.E[5];
M_Out->E[14] = -M_In.E[0] * M_In.E[5] * M_In.E[14] + M_Out->E[14] = -M_In.E[0] * M_In.E[5] * M_In.E[14] +
M_In.E[0] * M_In.E[6] * M_In.E[13] + M_In.E[0] * M_In.E[6] * M_In.E[13] +
M_In.E[4] * M_In.E[1] * M_In.E[14] - M_In.E[4] * M_In.E[1] * M_In.E[14] -
M_In.E[4] * M_In.E[2] * M_In.E[13] - M_In.E[4] * M_In.E[2] * M_In.E[13] -
M_In.E[12] * M_In.E[1] * M_In.E[6] + M_In.E[12] * M_In.E[1] * M_In.E[6] +
M_In.E[12] * M_In.E[2] * M_In.E[5]; M_In.E[12] * M_In.E[2] * M_In.E[5];
M_Out->E[3] = -M_In.E[1] * M_In.E[6] * M_In.E[11] + M_Out->E[3] = -M_In.E[1] * M_In.E[6] * M_In.E[11] +
M_In.E[1] * M_In.E[7] * M_In.E[10] + M_In.E[1] * M_In.E[7] * M_In.E[10] +
M_In.E[5] * M_In.E[2] * M_In.E[11] - M_In.E[5] * M_In.E[2] * M_In.E[11] -
M_In.E[5] * M_In.E[3] * M_In.E[10] - M_In.E[5] * M_In.E[3] * M_In.E[10] -
M_In.E[9] * M_In.E[2] * M_In.E[7] + M_In.E[9] * M_In.E[2] * M_In.E[7] +
M_In.E[9] * M_In.E[3] * M_In.E[6]; M_In.E[9] * M_In.E[3] * M_In.E[6];
M_Out->E[7] = M_In.E[0] * M_In.E[6] * M_In.E[11] - M_Out->E[7] = M_In.E[0] * M_In.E[6] * M_In.E[11] -
M_In.E[0] * M_In.E[7] * M_In.E[10] - M_In.E[0] * M_In.E[7] * M_In.E[10] -
M_In.E[4] * M_In.E[2] * M_In.E[11] + M_In.E[4] * M_In.E[2] * M_In.E[11] +
M_In.E[4] * M_In.E[3] * M_In.E[10] + M_In.E[4] * M_In.E[3] * M_In.E[10] +
M_In.E[8] * M_In.E[2] * M_In.E[7] - M_In.E[8] * M_In.E[2] * M_In.E[7] -
M_In.E[8] * M_In.E[3] * M_In.E[6]; M_In.E[8] * M_In.E[3] * M_In.E[6];
M_Out->E[11] = -M_In.E[0] * M_In.E[5] * M_In.E[11] + M_Out->E[11] = -M_In.E[0] * M_In.E[5] * M_In.E[11] +
M_In.E[0] * M_In.E[7] * M_In.E[9] + M_In.E[0] * M_In.E[7] * M_In.E[9] +
M_In.E[4] * M_In.E[1] * M_In.E[11] - M_In.E[4] * M_In.E[1] * M_In.E[11] -
M_In.E[4] * M_In.E[3] * M_In.E[9] - M_In.E[4] * M_In.E[3] * M_In.E[9] -
M_In.E[8] * M_In.E[1] * M_In.E[7] + M_In.E[8] * M_In.E[1] * M_In.E[7] +
M_In.E[8] * M_In.E[3] * M_In.E[5]; M_In.E[8] * M_In.E[3] * M_In.E[5];
M_Out->E[15] = M_In.E[0] * M_In.E[5] * M_In.E[10] - M_Out->E[15] = M_In.E[0] * M_In.E[5] * M_In.E[10] -
M_In.E[0] * M_In.E[6] * M_In.E[9] - M_In.E[0] * M_In.E[6] * M_In.E[9] -
M_In.E[4] * M_In.E[1] * M_In.E[10] + M_In.E[4] * M_In.E[1] * M_In.E[10] +
M_In.E[4] * M_In.E[2] * M_In.E[9] + M_In.E[4] * M_In.E[2] * M_In.E[9] +
M_In.E[8] * M_In.E[1] * M_In.E[6] - M_In.E[8] * M_In.E[1] * M_In.E[6] -
M_In.E[8] * M_In.E[2] * M_In.E[5]; M_In.E[8] * M_In.E[2] * M_In.E[5];
det = M_In.E[0] * M_Out->E[0] + M_In.E[1] * M_Out->E[4] + M_In.E[2] * M_Out->E[8] + M_In.E[3] * M_Out->E[12]; det = M_In.E[0] * M_Out->E[0] + M_In.E[1] * M_Out->E[4] + M_In.E[2] * M_Out->E[8] + M_In.E[3] * M_Out->E[12];
@ -1476,13 +1498,13 @@ void TestVectorMatrixMultiplication ()
TestClean(((TestV2 * TestV2) == v2{TestV2.x * TestV2.x, TestV2.y * TestV2.y}), "V2 Piecewise Mult"); TestClean(((TestV2 * TestV2) == v2{TestV2.x * TestV2.x, TestV2.y * TestV2.y}), "V2 Piecewise Mult");
TestClean(((TestV3 * TestV3) == v3{ TestClean(((TestV3 * TestV3) == v3{
TestV3.x * TestV3.x, TestV3.x * TestV3.x,
TestV3.y * TestV3.y, TestV3.y * TestV3.y,
TestV3.z * TestV3.z}), "V3 Piecewise Mult"); TestV3.z * TestV3.z}), "V3 Piecewise Mult");
TestClean(((TestV4 * TestV4) == v4{ TestClean(((TestV4 * TestV4) == v4{
TestV4.x * TestV4.x, TestV4.x * TestV4.x,
TestV4.y * TestV4.y, TestV4.y * TestV4.y,
TestV4.z * TestV4.z, TestV4.z * TestV4.z,
TestV4.w * TestV4.w}), "V4 Piecewise Mult"); TestV4.w * TestV4.w}), "V4 Piecewise Mult");
@ -1492,13 +1514,13 @@ void TestVectorMatrixMultiplication ()
TestClean(((TestV2 / TestV2) == v2{TestV2.x / TestV2.x, TestV2.y / TestV2.y}), "V2 Piecewise Div"); TestClean(((TestV2 / TestV2) == v2{TestV2.x / TestV2.x, TestV2.y / TestV2.y}), "V2 Piecewise Div");
TestClean(((TestV3 / TestV3) == v3{ TestClean(((TestV3 / TestV3) == v3{
TestV3.x / TestV3.x, TestV3.x / TestV3.x,
TestV3.y / TestV3.y, TestV3.y / TestV3.y,
TestV3.z / TestV3.z}), "V3 Piecewise Div"); TestV3.z / TestV3.z}), "V3 Piecewise Div");
TestClean(((TestV4 / TestV4) == v4{ TestClean(((TestV4 / TestV4) == v4{
TestV4.x / TestV4.x, TestV4.x / TestV4.x,
TestV4.y / TestV4.y, TestV4.y / TestV4.y,
TestV4.z / TestV4.z, TestV4.z / TestV4.z,
TestV4.w / TestV4.w}), "V4 Piecewise Div"); TestV4.w / TestV4.w}), "V4 Piecewise Div");
TestClean(((MagSqr(V2Unit) == 1) && (MagSqr(TestV2) == TestV2MagSq)), "V2 Square Mag"); TestClean(((MagSqr(V2Unit) == 1) && (MagSqr(TestV2) == TestV2MagSq)), "V2 Square Mag");
@ -1519,8 +1541,8 @@ void TestVectorMatrixMultiplication ()
TestClean((Normalize(TestV3) == TestV3Norm), "V3 Normalize"); TestClean((Normalize(TestV3) == TestV3Norm), "V3 Normalize");
TestClean((Normalize(TestV4) == TestV4Norm), "V4 Normalize"); TestClean((Normalize(TestV4) == TestV4Norm), "V4 Normalize");
TestClean(((Dot(V2Unit, V2Unit) == 1) && (Dot(TestV2, V2Unit) == TestV2DotR)), "V2 Dot"); TestClean(((Dot(V2Unit, V2Unit) == 1) && (Dot(TestV2, V2Unit) == TestV2DotR)), "V2 Dot");
TestClean(((Dot(V3Unit, V3Unit) == 1) && (Dot(TestV3, V3Unit) == TestV3DotR)), "V3 Dot"); TestClean(((Dot(V3Unit, V3Unit) == 1) && (Dot(TestV3, V3Unit) == TestV3DotR)), "V3 Dot");
TestClean(((Dot(V4Unit, V4Unit) == 1) && (Dot(TestV4, V4Unit) == TestV4DotR)), "V4 Dot"); TestClean(((Dot(V4Unit, V4Unit) == 1) && (Dot(TestV4, V4Unit) == TestV4DotR)), "V4 Dot");
// Skipping Cross For Now // Skipping Cross For Now
@ -1583,9 +1605,9 @@ void TestVectorMatrixMultiplication ()
m44 TestM44Squared = m44{ m44 TestM44Squared = m44{
56, 62, 68, 74, 56, 62, 68, 74,
152, 174, 196, 218, 152, 174, 196, 218,
248, 286, 324, 362, 248, 286, 324, 362,
344, 398, 452, 506, 344, 398, 452, 506,
}; };
TestClean(((IdentityM33 == IdentityM33) && (TestM33 == EqualityM33)), "M33 Equality"); TestClean(((IdentityM33 == IdentityM33) && (TestM33 == EqualityM33)), "M33 Equality");
@ -1642,8 +1664,8 @@ void TestVectorMatrixMultiplication ()
m44 MTest = m44{ m44 MTest = m44{
50, 40, 60, 50, 50, 40, 60, 50,
138, 112, 156, 130, 138, 112, 156, 130,
109, 94, 99, 84, 109, 94, 99, 84,
116, 94, 132, 110 116, 94, 132, 110
}; };
TestClean(((B * C) == MTest), "M44 Mult Test 2"); TestClean(((B * C) == MTest), "M44 Mult Test 2");

View File

@ -5,7 +5,6 @@
// //
#ifndef ASSEMBLY_PARSER_CPP #ifndef ASSEMBLY_PARSER_CPP
internal assembly_token internal assembly_token
ParseToken (tokenizer* Tokenizer) ParseToken (tokenizer* Tokenizer)
{ {
@ -129,7 +128,7 @@ ParseLEDStrip (tokenizer* Tokenizer)
Result.StartChannel = ParseSignedIntUnsafe(StartChannelToken.Token).SignedIntValue; Result.StartChannel = ParseSignedIntUnsafe(StartChannelToken.Token).SignedIntValue;
// Strip Type // Strip Type
// TODO(Peter): This is unused for now, and would be a branch point for parsing // TODO(Peter): This is unused for now, and would be a branch point for parsing
// the rest of the info. Fix this. // the rest of the info. Fix this.
EatPastCharacter(Tokenizer, ','); EatPastCharacter(Tokenizer, ',');
EatWhitespace(Tokenizer); EatWhitespace(Tokenizer);

View File

@ -12,8 +12,8 @@ internal v4
MouseToWorldRay(r32 MouseX, r32 MouseY, camera* Camera, rect WindowBounds) MouseToWorldRay(r32 MouseX, r32 MouseY, camera* Camera, rect WindowBounds)
{ {
DEBUG_TRACK_SCOPE(MouseToWorldRay); DEBUG_TRACK_SCOPE(MouseToWorldRay);
r32 X = ((2.0f * MouseX) / Width(WindowBounds)) - 1; r32 X = ((2.0f * MouseX) / gs_Width(WindowBounds)) - 1;
r32 Y = ((2.0f * MouseY) / Height(WindowBounds)) - 1; r32 Y = ((2.0f * MouseY) / gs_Height(WindowBounds)) - 1;
v4 ScreenPos = v4{X, Y, -1, 1}; v4 ScreenPos = v4{X, Y, -1, 1};
@ -82,8 +82,8 @@ INITIALIZE_APPLICATION(InitializeApplication)
*State->GlobalLog = {0}; *State->GlobalLog = {0};
s32 CommandQueueSize = 32; s32 CommandQueueSize = 32;
command_queue_entry* CommandQueueMemory = PushArray(&State->Permanent, command_queue_entry* CommandQueueMemory = PushArray(&State->Permanent,
command_queue_entry, command_queue_entry,
CommandQueueSize); CommandQueueSize);
State->CommandQueue = InitializeCommandQueue(CommandQueueMemory, CommandQueueSize); State->CommandQueue = InitializeCommandQueue(CommandQueueMemory, CommandQueueSize);
@ -127,9 +127,9 @@ INITIALIZE_APPLICATION(InitializeApplication)
u32 CodepointW, CodepointH; u32 CodepointW, CodepointH;
Context.PlatformDrawFontCodepoint( Context.PlatformDrawFontCodepoint(
Font->BitmapMemory, Font->BitmapMemory,
Font->BitmapWidth, Font->BitmapWidth,
Font->BitmapHeight, Font->BitmapHeight,
CodepointX, CodepointY, CodepointX, CodepointY,
Codepoint, FontInfo, Codepoint, FontInfo,
&CodepointW, &CodepointH); &CodepointW, &CodepointH);
@ -138,10 +138,10 @@ INITIALIZE_APPLICATION(InitializeApplication)
State->Interface.Font = Font; State->Interface.Font = Font;
Font->BitmapTextureHandle = Context.PlatformGetGPUTextureHandle(Font->BitmapMemory, Font->BitmapTextureHandle = Context.PlatformGetGPUTextureHandle(Font->BitmapMemory,
Font->BitmapWidth, Font->BitmapHeight); Font->BitmapWidth, Font->BitmapHeight);
} }
else else
{ {
LogError(State->GlobalLog, "Unable to load font"); LogError(State->GlobalLog, "Unable to load font");
} }
@ -169,7 +169,7 @@ INITIALIZE_APPLICATION(InitializeApplication)
State->NetworkProtocolHeaderSize = STREAM_HEADER_SIZE; State->NetworkProtocolHeaderSize = STREAM_HEADER_SIZE;
State->Camera.FieldOfView = DegreesToRadians(45.0f); State->Camera.FieldOfView = DegreesToRadians(45.0f);
State->Camera.AspectRatio = AspectRatio(State->WindowBounds); State->Camera.AspectRatio = gs_AspectRatio(State->WindowBounds);
State->Camera.Near = 1.0f; State->Camera.Near = 1.0f;
State->Camera.Far = 100.0f; State->Camera.Far = 100.0f;
State->Camera.Position = v3{0, 0, -250}; State->Camera.Position = v3{0, 0, -250};
@ -242,20 +242,20 @@ HandleInput (app_state* State, rect WindowBounds, input_queue InputQueue, mouse_
{ {
input_entry Event = InputQueue.Entries[EventIdx]; input_entry Event = InputQueue.Entries[EventIdx];
// NOTE(Peter): These are in the order Down, Up, Held because we want to privalege // NOTE(Peter): These are in the order Down, Up, Held because we want to privalege
// Down and Up over Held. In other words, we don't want to call a Held command on the // Down and Up over Held. In other words, we don't want to call a Held command on the
// frame when the button was released, even if the command is registered to both events // frame when the button was released, even if the command is registered to both events
if (KeyTransitionedDown(Event)) if (KeyTransitionedDown(Event))
{ {
FindAndPushExistingCommand(ActiveCommands, Event, Command_Began, &State->CommandQueue); FindAndPushExistingCommand(ActiveCommands, Event, Command_Began, &State->CommandQueue);
} }
else if (KeyTransitionedUp(Event)) else if (KeyTransitionedUp(Event))
{ {
FindAndPushExistingCommand(ActiveCommands, Event, Command_Ended, &State->CommandQueue); FindAndPushExistingCommand(ActiveCommands, Event, Command_Ended, &State->CommandQueue);
} }
else if (KeyHeldDown(Event)) else if (KeyHeldDown(Event))
{ {
FindAndPushExistingCommand(ActiveCommands, Event, Command_Held, &State->CommandQueue); FindAndPushExistingCommand(ActiveCommands, Event, Command_Held, &State->CommandQueue);
} }
} }
} }
@ -292,8 +292,8 @@ CreateDMXBuffers(assembly Assembly, s32 BufferHeaderSize, memory_arena* Arena)
NewBuffer->Next = 0; NewBuffer->Next = 0;
// Append // Append
if (!Result) { if (!Result) {
Result = NewBuffer; Result = NewBuffer;
Head = Result; Head = Result;
} }
Head->Next = NewBuffer; Head->Next = NewBuffer;
@ -325,21 +325,21 @@ UPDATE_AND_RENDER(UpdateAndRender)
// NOTE(Peter): We do this at the beginning because all the render commands are stored in Transient, // NOTE(Peter): We do this at the beginning because all the render commands are stored in Transient,
// and need to persist beyond the end of the UpdateAndRender call. In the release version, we won't // and need to persist beyond the end of the UpdateAndRender call. In the release version, we won't
// zero the Transient arena when we clear it so it wouldn't be a problem, but it is technically // zero the Transient arena when we clear it so it wouldn't be a problem, but it is technically
// incorrect to clear the arena, and then access the memory later. // incorrect to clear the arena, and then access the memory later.
ClearArena(&State->Transient); ClearArena(&State->Transient);
Context->Mouse.CursorType = CursorType_Arrow; Context->Mouse.CursorType = CursorType_Arrow;
HandleInput(State, State->WindowBounds, InputQueue, Context->Mouse); HandleInput(State, State->WindowBounds, InputQueue, Context->Mouse);
if (State->AnimationSystem.TimelineShouldAdvance) { if (State->AnimationSystem.TimelineShouldAdvance) {
// TODO(Peter): Revisit this. This implies that the framerate of the animation system // TODO(Peter): Revisit this. This implies that the framerate of the animation system
// is tied to the framerate of the simulation. That seems correct to me, but I'm not sure // is tied to the framerate of the simulation. That seems correct to me, but I'm not sure
State->AnimationSystem.CurrentFrame += 1; State->AnimationSystem.CurrentFrame += 1;
// Loop back to the beginning // Loop back to the beginning
if (State->AnimationSystem.CurrentFrame > State->AnimationSystem.PlayableRange.Max) if (State->AnimationSystem.CurrentFrame > State->AnimationSystem.PlayableRange.Max)
{ {
State->AnimationSystem.CurrentFrame = 0; State->AnimationSystem.CurrentFrame = 0;
} }
} }
@ -386,9 +386,9 @@ UPDATE_AND_RENDER(UpdateAndRender)
// TODO(Peter): Temporary // TODO(Peter): Temporary
switch(Block.AnimationProcHandle) switch(Block.AnimationProcHandle)
{ {
case 1: case 1:
{ {
TestPatternOne(&LayerLEDBuffers[Layer], SecondsIntoBlock); TestPatternOne(&LayerLEDBuffers[Layer], SecondsIntoBlock);
}break; }break;
case 2: case 2:
@ -498,7 +498,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
} }
} }
PushRenderOrthographic(RenderBuffer, 0, 0, Width(State->WindowBounds), Height(State->WindowBounds)); PushRenderOrthographic(RenderBuffer, 0, 0, gs_Width(State->WindowBounds), gs_Height(State->WindowBounds));
PushRenderClearScreen(RenderBuffer); PushRenderClearScreen(RenderBuffer);
State->WindowBounds = Context->WindowBounds; State->WindowBounds = Context->WindowBounds;

View File

@ -123,7 +123,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndDragPanelBorderOperation)
} }
else else
{ {
Panel->SplitPercent = (NewSplitY - PanelBounds.Min.y) / Height(PanelBounds); Panel->SplitPercent = (NewSplitY - PanelBounds.Min.y) / gs_Height(PanelBounds);
} }
} }
else if (Panel->SplitDirection == PanelSplit_Vertical) else if (Panel->SplitDirection == PanelSplit_Vertical)
@ -139,7 +139,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndDragPanelBorderOperation)
} }
else else
{ {
Panel->SplitPercent = (NewSplitX - PanelBounds.Min.x) / Width(PanelBounds); Panel->SplitPercent = (NewSplitX - PanelBounds.Min.x) / gs_Width(PanelBounds);
} }
} }
} }
@ -241,12 +241,12 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndSplitPanelOperation)
if (XDistance > YDistance) if (XDistance > YDistance)
{ {
r32 XPercent = (Mouse.Pos.x - PanelBounds.Min.x) / Width(PanelBounds); r32 XPercent = (Mouse.Pos.x - PanelBounds.Min.x) / gs_Width(PanelBounds);
SplitPanelVertically(Panel, XPercent, PanelBounds, &State->PanelSystem); SplitPanelVertically(Panel, XPercent, PanelBounds, &State->PanelSystem);
} }
else else
{ {
r32 YPercent = (Mouse.Pos.y - PanelBounds.Min.y) / Height(PanelBounds); r32 YPercent = (Mouse.Pos.y - PanelBounds.Min.y) / gs_Height(PanelBounds);
SplitPanelHorizontally(Panel, YPercent, PanelBounds, &State->PanelSystem); SplitPanelHorizontally(Panel, YPercent, PanelBounds, &State->PanelSystem);
} }
@ -301,11 +301,11 @@ HandleMouseDownPanelInteractionOrRecurse(panel* Panel, panel_edit_mode PanelEdit
{ {
rect TopPanelBounds = GetTopPanelBounds(Panel, PanelBounds); rect TopPanelBounds = GetTopPanelBounds(Panel, PanelBounds);
rect BottomPanelBounds = GetBottomPanelBounds(Panel, PanelBounds); rect BottomPanelBounds = GetBottomPanelBounds(Panel, PanelBounds);
if (PointIsInRect(Mouse.DownPos, BottomPanelBounds)) if (gs_PointIsInRect(Mouse.DownPos, BottomPanelBounds))
{ {
HandleMouseDownPanelInteractionOrRecurse(&Panel->Bottom->Panel, PanelEditMode, BottomPanelBounds, Mouse, State); HandleMouseDownPanelInteractionOrRecurse(&Panel->Bottom->Panel, PanelEditMode, BottomPanelBounds, Mouse, State);
} }
if (PointIsInRect(Mouse.DownPos, TopPanelBounds)) if (gs_PointIsInRect(Mouse.DownPos, TopPanelBounds))
{ {
HandleMouseDownPanelInteractionOrRecurse(&Panel->Top->Panel, PanelEditMode, TopPanelBounds, Mouse, State); HandleMouseDownPanelInteractionOrRecurse(&Panel->Top->Panel, PanelEditMode, TopPanelBounds, Mouse, State);
} }
@ -324,11 +324,11 @@ HandleMouseDownPanelInteractionOrRecurse(panel* Panel, panel_edit_mode PanelEdit
{ {
rect LeftPanelBounds = GetLeftPanelBounds(Panel, PanelBounds); rect LeftPanelBounds = GetLeftPanelBounds(Panel, PanelBounds);
rect RightPanelBounds = GetRightPanelBounds(Panel, PanelBounds); rect RightPanelBounds = GetRightPanelBounds(Panel, PanelBounds);
if (PointIsInRect(Mouse.DownPos, LeftPanelBounds)) if (gs_PointIsInRect(Mouse.DownPos, LeftPanelBounds))
{ {
HandleMouseDownPanelInteractionOrRecurse(&Panel->Left->Panel, PanelEditMode, LeftPanelBounds, Mouse, State); HandleMouseDownPanelInteractionOrRecurse(&Panel->Left->Panel, PanelEditMode, LeftPanelBounds, Mouse, State);
} }
if (PointIsInRect(Mouse.DownPos, RightPanelBounds)) if (gs_PointIsInRect(Mouse.DownPos, RightPanelBounds))
{ {
HandleMouseDownPanelInteractionOrRecurse(&Panel->Right->Panel, PanelEditMode, RightPanelBounds, Mouse, State); HandleMouseDownPanelInteractionOrRecurse(&Panel->Right->Panel, PanelEditMode, RightPanelBounds, Mouse, State);
} }
@ -403,14 +403,14 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect FooterBo
PushRenderQuad2D(RenderBuffer, FooterBounds.Min, v2{FooterBounds.Max.x, FooterBounds.Min.y + 25}, v4{.5f, .5f, .5f, 1.f}); PushRenderQuad2D(RenderBuffer, FooterBounds.Min, v2{FooterBounds.Max.x, FooterBounds.Min.y + 25}, v4{.5f, .5f, .5f, 1.f});
PushRenderQuad2D(RenderBuffer, FooterBounds.Min, FooterBounds.Min + v2{25, 25}, WhiteV4); PushRenderQuad2D(RenderBuffer, FooterBounds.Min, FooterBounds.Min + v2{25, 25}, WhiteV4);
rect PanelSelectBtnBounds = MakeRectMinWidth(FooterBounds.Min + v2{30, 1}, v2{100, 23}); rect PanelSelectBtnBounds = gs_MakeRectMinWidth(FooterBounds.Min + v2{30, 1}, v2{100, 23});
if (Panel->PanelSelectionMenuOpen) if (Panel->PanelSelectionMenuOpen)
{ {
rect ButtonBounds = MakeRectMinWidth(v2{ PanelSelectBtnBounds.Min.x, FooterBounds.Max.y }, v2{ 100, 25 }); rect ButtonBounds = gs_MakeRectMinWidth(v2{ PanelSelectBtnBounds.Min.x, FooterBounds.Max.y }, v2{ 100, 25 });
v2 MenuMin = ButtonBounds.Min; v2 MenuMin = ButtonBounds.Min;
v2 MenuMax = v2{ButtonBounds.Min.x + Width(ButtonBounds), ButtonBounds.Min.y + (Height(ButtonBounds) * GlobalPanelDefsCount)}; v2 MenuMax = v2{ButtonBounds.Min.x + gs_Width(ButtonBounds), ButtonBounds.Min.y + (gs_Height(ButtonBounds) * GlobalPanelDefsCount)};
if (MouseButtonTransitionedDown(Mouse.LeftButtonState) if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
&& !PointIsInRange(Mouse.DownPos, MenuMin, MenuMax)) && !PointIsInRange(Mouse.DownPos, MenuMin, MenuMax))
{ {
@ -428,7 +428,7 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect FooterBo
Panel->PanelSelectionMenuOpen = false; Panel->PanelSelectionMenuOpen = false;
} }
ButtonBounds = TranslateRectY(ButtonBounds, Height(ButtonBounds)); ButtonBounds = gs_TranslateRectY(ButtonBounds, gs_Height(ButtonBounds));
} }
} }

View File

@ -207,8 +207,9 @@ struct ui_layout
r32 RowYAt; r32 RowYAt;
b32 DrawHorizontal; b32 DrawHorizontal;
u32 RowDivisions; u32 ColumnsMax;
u32 RowElementsCount; r32* ColumnWidths;
u32 ColumnsCount;
}; };
struct ui_interface struct ui_interface
@ -230,11 +231,12 @@ ui_CreateLayout(ui_interface Interface, rect Bounds)
} }
static void static void
ui_StartRow(ui_layout* Layout, u32 RowDivisions) ui_StartRow(ui_layout* Layout, u32 ColumnsMax)
{ {
Layout->DrawHorizontal = true; Layout->DrawHorizontal = true;
Layout->RowDivisions = RowDivisions; Layout->ColumnsMax = ColumnsMax;
Layout->RowElementsCount = 0; Layout->ColumnWidths = 0;
Layout->ColumnsCount = 0;
} }
static void static void
@ -243,10 +245,21 @@ ui_StartRow(ui_layout* Layout)
ui_StartRow(Layout, 0); ui_StartRow(Layout, 0);
} }
static void
ui_StartRow(ui_layout* Layout, u32 ColumnsMax, r32* ColumnWidths)
{
Layout->DrawHorizontal = true;
Layout->ColumnsMax = ColumnsMax;
Layout->ColumnWidths = ColumnWidths;
Layout->ColumnsCount = 0;
}
static void static void
ui_EndRow(ui_layout* Layout) ui_EndRow(ui_layout* Layout)
{ {
Layout->DrawHorizontal = false; Layout->DrawHorizontal = false;
Layout->ColumnWidths = 0;
Layout->RowYAt -= Layout->RowHeight;
} }
static b32 static b32
@ -261,19 +274,32 @@ ui_TryReserveElementBounds(ui_layout* Layout, rect* Bounds)
} }
else else
{ {
if (Layout->RowDivisions > 0) if (Layout->ColumnsMax > 0)
{ {
Assert(Layout->RowElementsCount < Layout->RowDivisions); Assert(Layout->ColumnsCount < Layout->ColumnsMax);
r32 ElementWidth = Width(Layout->Bounds) / Layout->RowDivisions; if (Layout->ColumnWidths != 0)
Bounds->Min = { {
Layout->Bounds.Min.x + (ElementWidth * Layout->RowElementsCount) + Layout->Margin.x, v2 Min = { Layout->Bounds.Min.x, Layout->RowYAt };
Layout->RowYAt for (u32 i = 0; i < Layout->ColumnsCount; i++)
}; {
Bounds->Max = { Min.x += Layout->ColumnWidths[i];
Bounds->Min.x + ElementWidth - Layout->Margin.x, }
Bounds->Min.y + Layout->RowHeight Bounds->Min = Min;
}; Bounds->Max = Bounds->Min + v2{ Layout->ColumnWidths[Layout->ColumnsCount], Layout->RowHeight };
Layout->RowElementsCount++; }
else
{
r32 ElementWidth = gs_Width(Layout->Bounds) / Layout->ColumnsMax;
Bounds->Min = {
Layout->Bounds.Min.x + (ElementWidth * Layout->ColumnsCount) + Layout->Margin.x,
Layout->RowYAt
};
Bounds->Max = {
Bounds->Min.x + ElementWidth - Layout->Margin.x,
Bounds->Min.y + Layout->RowHeight
};
}
Layout->ColumnsCount++;
} }
else else
{ {
@ -302,6 +328,17 @@ ui_ReserveElementBounds(ui_layout* Layout)
return Bounds; return Bounds;
} }
static rect
ui_LayoutRemaining(ui_layout Layout)
{
rect Result = Layout.Bounds;
Result.Max.y = Layout.RowYAt;
if (Layout.DrawHorizontal)
{
Result.Max.y -= Layout.RowHeight;
}
return Result;
}
// //
// Drawing Functions // Drawing Functions
// //
@ -309,7 +346,7 @@ ui_ReserveElementBounds(ui_layout* Layout)
static void static void
ui_FillRect(ui_interface* Interface, rect Bounds, v4 Color) ui_FillRect(ui_interface* Interface, rect Bounds, v4 Color)
{ {
PushRenderQuad2D(Interface->RenderBuffer, RectExpand(Bounds), Color); PushRenderQuad2D(Interface->RenderBuffer, gs_RectExpand(Bounds), Color);
} }
static void static void
@ -371,7 +408,7 @@ ui_Button(ui_interface* Interface, string Text, rect Bounds, v4 InactiveColor, v
{ {
b32 Pressed = false; b32 Pressed = false;
v4 ButtonBG = InactiveColor; v4 ButtonBG = InactiveColor;
if (PointIsInRect(Interface->Mouse.Pos, Bounds)) if (gs_PointIsInRect(Interface->Mouse.Pos, Bounds))
{ {
ButtonBG = HoverColor; ButtonBG = HoverColor;
if (MouseButtonTransitionedDown(Interface->Mouse.LeftButtonState)) if (MouseButtonTransitionedDown(Interface->Mouse.LeftButtonState))

View File

@ -27,7 +27,7 @@ inline s32
GetXPositionFromFrameInAnimationPanel (u32 Frame, rect PanelBounds, frame_range VisibleRange) GetXPositionFromFrameInAnimationPanel (u32 Frame, rect PanelBounds, frame_range VisibleRange)
{ {
r32 PercentOfTimeline = (r32)(Frame - VisibleRange.Min) / (r32)GetFrameCount(VisibleRange); r32 PercentOfTimeline = (r32)(Frame - VisibleRange.Min) / (r32)GetFrameCount(VisibleRange);
s32 XPositionAtFrame = (PercentOfTimeline * Width(PanelBounds)) + PanelBounds.Min.x; s32 XPositionAtFrame = (PercentOfTimeline * gs_Width(PanelBounds)) + PanelBounds.Min.x;
return XPositionAtFrame; return XPositionAtFrame;
} }
@ -295,14 +295,14 @@ DrawFrameBar (animation_system* AnimationSystem, render_command_buffer* RenderBu
s32 VisibleFrameCount = VisibleFrames.Max - VisibleFrames.Min; s32 VisibleFrameCount = VisibleFrames.Max - VisibleFrames.Min;
r32 BarHeight = Height(BarBounds); r32 BarHeight = gs_Height(BarBounds);
r32 BarWidth = Width(BarBounds); r32 BarWidth = gs_Width(BarBounds);
PushRenderQuad2D(RenderBuffer, RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f}); PushRenderQuad2D(RenderBuffer, gs_RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f});
// Mouse clicked inside frame nubmer bar -> change current frame on timeline // Mouse clicked inside frame nubmer bar -> change current frame on timeline
if (MouseButtonTransitionedDown(Mouse.LeftButtonState) && if (MouseButtonTransitionedDown(Mouse.LeftButtonState) &&
PointIsInRange(Mouse.DownPos, RectExpand(BarBounds))) PointIsInRange(Mouse.DownPos, gs_RectExpand(BarBounds)))
{ {
StartDragTimeMarker(BarBounds, VisibleFrames, State); StartDragTimeMarker(BarBounds, VisibleFrames, State);
} }
@ -344,9 +344,9 @@ DrawTimelineRangeBar (animation_system* AnimationSystem, animation_timeline_stat
{ {
frame_range Result = {0}; frame_range Result = {0};
r32 BarHeight = Height(BarBounds); r32 BarHeight = gs_Height(BarBounds);
r32 BarWidth = Width(BarBounds); r32 BarWidth = gs_Width(BarBounds);
PushRenderQuad2D(RenderBuffer, RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f}); PushRenderQuad2D(RenderBuffer, gs_RectExpand(BarBounds), v4{.16f, .16f, .16f, 1.f});
r32 PlayableFrames = (r32)GetFrameCount(AnimationSystem->PlayableRange); r32 PlayableFrames = (r32)GetFrameCount(AnimationSystem->PlayableRange);
v2 SliderBarDim = v2{25, BarHeight}; v2 SliderBarDim = v2{25, BarHeight};
@ -354,8 +354,8 @@ DrawTimelineRangeBar (animation_system* AnimationSystem, animation_timeline_stat
// Convert Frames To Pixels // Convert Frames To Pixels
r32 VisibleMinPercentPlayable = FrameToPercentRange(TimelineState->VisibleRange.Min, AnimationSystem->PlayableRange); r32 VisibleMinPercentPlayable = FrameToPercentRange(TimelineState->VisibleRange.Min, AnimationSystem->PlayableRange);
r32 VisibleMaxPercentPlayable = FrameToPercentRange(TimelineState->VisibleRange.Max, AnimationSystem->PlayableRange); r32 VisibleMaxPercentPlayable = FrameToPercentRange(TimelineState->VisibleRange.Max, AnimationSystem->PlayableRange);
v2 RangeMinSliderMin = v2{BarBounds.Min.x + (VisibleMinPercentPlayable * Width(BarBounds)), BarBounds.Min.y}; v2 RangeMinSliderMin = v2{BarBounds.Min.x + (VisibleMinPercentPlayable * gs_Width(BarBounds)), BarBounds.Min.y};
v2 RangeMaxSliderMin = v2{BarBounds.Min.x + (VisibleMaxPercentPlayable * Width(BarBounds)) - 25, BarBounds.Min.y}; v2 RangeMaxSliderMin = v2{BarBounds.Min.x + (VisibleMaxPercentPlayable * gs_Width(BarBounds)) - 25, BarBounds.Min.y};
if (MouseButtonHeldDown(Mouse.LeftButtonState) || if (MouseButtonHeldDown(Mouse.LeftButtonState) ||
MouseButtonTransitionedUp(Mouse.LeftButtonState)) MouseButtonTransitionedUp(Mouse.LeftButtonState))
@ -398,7 +398,7 @@ DrawTimelineRangeBar (animation_system* AnimationSystem, animation_timeline_stat
internal void internal void
DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_buffer* RenderBuffer, app_state* State, mouse_state Mouse) DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_buffer* RenderBuffer, app_state* State, mouse_state Mouse)
{ {
v2 LayerDim = { Width(PanelDim), LAYER_HEIGHT }; v2 LayerDim = { gs_Width(PanelDim), LAYER_HEIGHT };
v2 LayerListMin = PanelDim.Min + v2{0, 24}; v2 LayerListMin = PanelDim.Min + v2{0, 24};
for (u32 LayerIndex = 0; LayerIndex < AnimationSystem->LayersCount; LayerIndex++) for (u32 LayerIndex = 0; LayerIndex < AnimationSystem->LayersCount; LayerIndex++)
{ {
@ -408,7 +408,7 @@ DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_b
LayerBounds.Max = LayerBounds.Min + LayerDim; LayerBounds.Max = LayerBounds.Min + LayerDim;
if (MouseButtonTransitionedDown(Mouse.LeftButtonState) && if (MouseButtonTransitionedDown(Mouse.LeftButtonState) &&
PointIsInRect(Mouse.Pos, LayerBounds)) gs_PointIsInRect(Mouse.Pos, LayerBounds))
{ {
State->SelectedAnimationLayer = LayerIndex; State->SelectedAnimationLayer = LayerIndex;
} }
@ -416,7 +416,7 @@ DrawLayerMenu(animation_system* AnimationSystem, rect PanelDim, render_command_b
v2 LayerTextPos = { LayerBounds.Min.x + 6, LayerBounds.Max.y - 16}; v2 LayerTextPos = { LayerBounds.Min.x + 6, LayerBounds.Max.y - 16};
if (State->SelectedAnimationLayer == LayerIndex) if (State->SelectedAnimationLayer == LayerIndex)
{ {
PushRenderBoundingBox2D(RenderBuffer, RectExpand(LayerBounds), 1, WhiteV4); PushRenderBoundingBox2D(RenderBuffer, gs_RectExpand(LayerBounds), 1, WhiteV4);
} }
DrawString(RenderBuffer, Layer->Name, State->Interface.Font, LayerTextPos, WhiteV4); DrawString(RenderBuffer, Layer->Name, State->Interface.Font, LayerTextPos, WhiteV4);
} }
@ -427,7 +427,7 @@ DrawAnimationBlock (animation_block AnimationBlock, v4 BlockColor, frame_range V
{ {
rect BlockBounds = {}; rect BlockBounds = {};
r32 TimelineWidth = Width(TimelineBounds); r32 TimelineWidth = gs_Width(TimelineBounds);
u32 ClampedBlockStartFrame = ClampFrameToRange(AnimationBlock.Range.Min, VisibleFrames); u32 ClampedBlockStartFrame = ClampFrameToRange(AnimationBlock.Range.Min, VisibleFrames);
r32 StartFramePercent = FrameToPercentRange(ClampedBlockStartFrame, VisibleFrames); r32 StartFramePercent = FrameToPercentRange(ClampedBlockStartFrame, VisibleFrames);
@ -454,12 +454,12 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
gs_list_handle Result = SelectedBlockHandle; gs_list_handle Result = SelectedBlockHandle;
rect LayerMenuBounds, TimelineBounds; rect LayerMenuBounds, TimelineBounds;
VSplitRectAtDistanceFromLeft(PanelBounds, 256, &LayerMenuBounds, &TimelineBounds); gs_VSplitRectAtDistanceFromLeft(PanelBounds, 256, &LayerMenuBounds, &TimelineBounds);
// In Top To Bottom Order // In Top To Bottom Order
rect TimelineFrameBarBounds, TimelineBlockDisplayBounds, TimelineRangeBarBounds; rect TimelineFrameBarBounds, TimelineBlockDisplayBounds, TimelineRangeBarBounds;
HSplitRectAtDistanceFromTop(TimelineBounds, 32, &TimelineFrameBarBounds, &TimelineBounds); gs_HSplitRectAtDistanceFromTop(TimelineBounds, 32, &TimelineFrameBarBounds, &TimelineBounds);
HSplitRectAtDistanceFromBottom(TimelineBounds, 24, &TimelineBlockDisplayBounds, &TimelineRangeBarBounds); gs_HSplitRectAtDistanceFromBottom(TimelineBounds, 24, &TimelineBlockDisplayBounds, &TimelineRangeBarBounds);
// TODO(Peter): Clean Up // TODO(Peter): Clean Up
DrawLayerMenu(AnimationSystem, LayerMenuBounds, Interface->RenderBuffer, State, Interface->Mouse); DrawLayerMenu(AnimationSystem, LayerMenuBounds, Interface->RenderBuffer, State, Interface->Mouse);
@ -501,7 +501,7 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
} }
// TODO(Peter): Clean Up // TODO(Peter): Clean Up
rect BlockBounds = DrawAnimationBlock(AnimationBlockAt, BlockColor, AdjustedViewRange, TimelineBounds, Interface->RenderBuffer); rect BlockBounds = DrawAnimationBlock(AnimationBlockAt, BlockColor, AdjustedViewRange, TimelineBounds, Interface->RenderBuffer);
if (PointIsInRect(Interface->Mouse.Pos, BlockBounds)) if (gs_PointIsInRect(Interface->Mouse.Pos, BlockBounds))
{ {
DragBlockHandle = CurrentBlockHandle; DragBlockHandle = CurrentBlockHandle;
} }
@ -531,7 +531,7 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta
ui_OutlineRect(Interface, TimelineFrameBarBounds, 1.f, RedV4); ui_OutlineRect(Interface, TimelineFrameBarBounds, 1.f, RedV4);
ui_OutlineRect(Interface, TimelineBlockDisplayBounds, 1.f, RedV4); ui_OutlineRect(Interface, TimelineBlockDisplayBounds, 1.f, RedV4);
if (MouseDownAndNotHandled && PointIsInRect(Interface->Mouse.Pos, TimelineBounds)) if (MouseDownAndNotHandled && gs_PointIsInRect(Interface->Mouse.Pos, TimelineBounds))
{ {
DeselectCurrentAnimationBlock(State); DeselectCurrentAnimationBlock(State);
} }
@ -581,9 +581,9 @@ AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* R
animation_system* AnimationSystem = &State->AnimationSystem; animation_system* AnimationSystem = &State->AnimationSystem;
rect TitleBarBounds, PanelContentsBounds; rect TitleBarBounds, PanelContentsBounds;
HSplitRectAtDistanceFromTop(PanelBounds, Interface->Style.RowHeight, &TitleBarBounds, &PanelContentsBounds); gs_HSplitRectAtDistanceFromTop(PanelBounds, Interface->Style.RowHeight, &TitleBarBounds, &PanelContentsBounds);
rect AnimationListBounds, TimelineBounds; rect AnimationListBounds, TimelineBounds;
VSplitRectAtDistanceFromLeft(PanelContentsBounds, 300, &AnimationListBounds, &TimelineBounds); gs_VSplitRectAtDistanceFromLeft(PanelContentsBounds, 300, &AnimationListBounds, &TimelineBounds);
ui_FillRect(Interface, TitleBarBounds, Interface->Style.PanelBGColors[0]); ui_FillRect(Interface, TitleBarBounds, Interface->Style.PanelBGColors[0]);
ui_layout TitleBarLayout = ui_CreateLayout(*Interface, TitleBarBounds); ui_layout TitleBarLayout = ui_CreateLayout(*Interface, TitleBarBounds);
@ -605,7 +605,7 @@ AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* R
} }
ui_EndRow(&TitleBarLayout); ui_EndRow(&TitleBarLayout);
if (Height(TimelineBounds) > 0) if (gs_Height(TimelineBounds) > 0)
{ {
SelectedBlockHandle = DrawAnimationTimeline(AnimationSystem, TimelineState, TimelineBounds, SelectedBlockHandle, Interface, State); SelectedBlockHandle = DrawAnimationTimeline(AnimationSystem, TimelineState, TimelineBounds, SelectedBlockHandle, Interface, State);
DrawAnimationClipsList(AnimationListBounds, Interface, State->SelectedAnimationLayer, &State->AnimationSystem); DrawAnimationClipsList(AnimationListBounds, Interface, State->SelectedAnimationLayer, &State->AnimationSystem);

View File

@ -44,10 +44,10 @@ FileView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuff
rect ListBounds = {0}; rect ListBounds = {0};
ListBounds.Min = PanelBounds.Min; ListBounds.Min = PanelBounds.Min;
ListBounds.Max = BottomRight(HeaderBounds); ListBounds.Max = gs_BottomRight(HeaderBounds);
PushRenderQuad2D(RenderBuffer, RectExpand(HeaderBounds), PinkV4); PushRenderQuad2D(RenderBuffer, gs_RectExpand(HeaderBounds), PinkV4);
PushRenderQuad2D(RenderBuffer, RectExpand(ListBounds), RedV4); PushRenderQuad2D(RenderBuffer, gs_RectExpand(ListBounds), RedV4);
} }

View File

@ -35,7 +35,7 @@ HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* Rende
string TempString = MakeString(PushArray(&State->Transient, char, 256), 0, 256); string TempString = MakeString(PushArray(&State->Transient, char, 256), 0, 256);
u32 LineCount = (u32)(Height(PanelBounds) / Layout.RowHeight) + 1; u32 LineCount = (u32)(gs_Height(PanelBounds) / Layout.RowHeight) + 1;
u32 LinesDrawn = 0; u32 LinesDrawn = 0;
u32 AssembliesToDraw = GSMin(LineCount, State->ActiveAssemblyIndecies.Used); u32 AssembliesToDraw = GSMin(LineCount, State->ActiveAssemblyIndecies.Used);
for (; LinesDrawn < AssembliesToDraw; LinesDrawn++) for (; LinesDrawn < AssembliesToDraw; LinesDrawn++)

View File

@ -71,7 +71,7 @@ OPERATION_STATE_DEF(pan_node_graph_operation_state)
{ {
v2 InitialViewOffset; v2 InitialViewOffset;
// TODO(Peter): I DON"T LIKE THIS!!!! // TODO(Peter): I DON"T LIKE THIS!!!!
// We should have a way to access the panel that created an operation mode or something // We should have a way to access the panel that created an operation mode or something
v2* ViewOffset; v2* ViewOffset;
}; };
@ -128,8 +128,8 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndConnectNodesOperation)
for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++) for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++)
{ {
visual_port VisualPort = GraphState->Layout.VisualPorts[p]; visual_port VisualPort = GraphState->Layout.VisualPorts[p];
rect ViewAdjustedBounds = RectOffsetByVector(VisualPort.PortBounds, GraphState->ViewOffset); rect ViewAdjustedBounds = gs_RectOffsetByVector(VisualPort.PortBounds, GraphState->ViewOffset);
if (PointIsInRect(Mouse.Pos, ViewAdjustedBounds)) if (gs_PointIsInRect(Mouse.Pos, ViewAdjustedBounds))
{ {
visual_port UpstreamPort = (OpState->IsInput & IsInputMember) ? VisualPort : OpState->VisualPort; visual_port UpstreamPort = (OpState->IsInput & IsInputMember) ? VisualPort : OpState->VisualPort;
visual_port DownstreamPort = (OpState->IsInput & IsInputMember) ? OpState->VisualPort : VisualPort; visual_port DownstreamPort = (OpState->IsInput & IsInputMember) ? OpState->VisualPort : VisualPort;
@ -161,7 +161,7 @@ BeginConnectNodesOperation(visual_port VisualPort, u32 VisualPortIndex, mouse_st
node_graph_state* GraphState = (node_graph_state*)NodeGraphPanel.Panel->PanelStateMemory; node_graph_state* GraphState = (node_graph_state*)NodeGraphPanel.Panel->PanelStateMemory;
GraphState->Layout.ConnectionIsInProgress = true; GraphState->Layout.ConnectionIsInProgress = true;
GraphState->Layout.InProgressConnectionStart = CalculateRectCenter(VisualPort.PortBounds); GraphState->Layout.InProgressConnectionStart = gs_CalculateRectCenter(VisualPort.PortBounds);
} }
// //
@ -177,8 +177,8 @@ GSMetaTag(panel_type_node_graph);
internal void internal void
NodeGraph_Init(panel* Panel, app_state* State) NodeGraph_Init(panel* Panel, app_state* State)
{ {
// TODO(Peter): We aren't able to free this memory. We need a system for // TODO(Peter): We aren't able to free this memory. We need a system for
// taking fixed size chunks off the Memory stack and then reusing them. THis // taking fixed size chunks off the Memory stack and then reusing them. THis
// should probably live outside the paneling system. // should probably live outside the paneling system.
// TODO: :FreePanelMemory // TODO: :FreePanelMemory
Panel->PanelStateMemory = (u8*)PushStruct(&State->Permanent, node_graph_state); Panel->PanelStateMemory = (u8*)PushStruct(&State->Permanent, node_graph_state);
@ -242,7 +242,7 @@ DrawNodePorts(gsm_struct_type_info NodeDataTypeInfo, b32 InputMask, v2 Position,
gsm_struct_member_type_info Member = NodeDataTypeInfo.Members[i]; gsm_struct_member_type_info Member = NodeDataTypeInfo.Members[i];
if (MemberIsInput(Member)) if (MemberIsInput(Member))
{ {
// TODO(Peter): Can we make this rely on the same data that we use to // TODO(Peter): Can we make this rely on the same data that we use to
// render the actual connection points? // render the actual connection points?
string MemberName = MakeString(Member.Identifier, Member.IdentifierLength); string MemberName = MakeString(Member.Identifier, Member.IdentifierLength);
DrawString(RenderBuffer, MemberName, Interface.Font, LinePosition + TextOffset, WhiteV4, TextAlign); DrawString(RenderBuffer, MemberName, Interface.Font, LinePosition + TextOffset, WhiteV4, TextAlign);
@ -267,7 +267,7 @@ DrawNode (v2 Position, node_specification_ NodeSpecification, gs_list_handle Nod
u32 LineCount = 1 + GSMax(InputMembers, OutputMembers); u32 LineCount = 1 + GSMax(InputMembers, OutputMembers);
v2 NodeDim = v2{ v2 NodeDim = v2{
NodeWidth, NodeWidth,
(LineHeight * LineCount) + Interface.Margin.y, (LineHeight * LineCount) + Interface.Margin.y,
}; };
rect NodeBounds = rect{ rect NodeBounds = rect{
@ -295,7 +295,7 @@ DrawNode (v2 Position, node_specification_ NodeSpecification, gs_list_handle Nod
gsm_struct_member_type_info Member = NodeDataTypeInfo.Members[i]; gsm_struct_member_type_info Member = NodeDataTypeInfo.Members[i];
string MemberName = MakeString(Member.Identifier, Member.IdentifierLength); string MemberName = MakeString(Member.Identifier, Member.IdentifierLength);
// TODO(Peter): Can we make this rely on the same data that we use to // TODO(Peter): Can we make this rely on the same data that we use to
// render the actual connection points? // render the actual connection points?
if (MemberIsInput(Member)) if (MemberIsInput(Member))
{ {
@ -364,10 +364,10 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
visual_node* VisualNode = Result.VisualNodes + n; visual_node* VisualNode = Result.VisualNodes + n;
VisualNode->Spec = Spec; VisualNode->Spec = Spec;
VisualNode->Position = v2{(1.5f * NodeWidth) * n, 0}; VisualNode->Position = v2{(1.5f * NodeWidth) * n, 0};
// NOTE(Peter): These start at 2 to account for the offset past the node title // NOTE(Peter): These start at 2 to account for the offset past the node title
s32 InputsCount = 2; s32 InputsCount = 2;
s32 OutputsCount = 2; s32 OutputsCount = 2;
for (u32 p = 0; p < NodeDataTypeInfo.MembersCount; p++) for (u32 p = 0; p < NodeDataTypeInfo.MembersCount; p++)
{ {
@ -375,7 +375,7 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
rect PortBounds = {0}; rect PortBounds = {0};
v2 PortDim = v2{8, 8}; v2 PortDim = v2{8, 8};
PortBounds.Min = VisualNode->Position + v2{0, PortDim.y / 2}; PortBounds.Min = VisualNode->Position + v2{0, PortDim.y / 2};
if (MemberIsInput(Member)) if (MemberIsInput(Member))
{ {
PortBounds.Min.y -= LineHeight * InputsCount++; PortBounds.Min.y -= LineHeight * InputsCount++;
@ -410,8 +410,8 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance,
visual_port UpstreamPort = Result.VisualPorts[VisualConnection->UpstreamVisualPortIndex]; visual_port UpstreamPort = Result.VisualPorts[VisualConnection->UpstreamVisualPortIndex];
visual_port DownstreamPort = Result.VisualPorts[VisualConnection->DownstreamVisualPortIndex]; visual_port DownstreamPort = Result.VisualPorts[VisualConnection->DownstreamVisualPortIndex];
VisualConnection->UpstreamPosition = CalculateRectCenter(UpstreamPort.PortBounds); VisualConnection->UpstreamPosition = gs_CalculateRectCenter(UpstreamPort.PortBounds);
VisualConnection->DownstreamPosition = CalculateRectCenter(DownstreamPort.PortBounds); VisualConnection->DownstreamPosition = gs_CalculateRectCenter(DownstreamPort.PortBounds);
} }
return Result; return Result;
@ -467,8 +467,8 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
if (GraphState->Layout.ConnectionIsInProgress) if (GraphState->Layout.ConnectionIsInProgress)
{ {
PushRenderLine2D(RenderBuffer, PushRenderLine2D(RenderBuffer,
GraphState->Layout.InProgressConnectionStart, GraphState->Layout.InProgressConnectionStart,
GraphState->Layout.InProgressConnectionEnd, GraphState->Layout.InProgressConnectionEnd,
1.5f, WhiteV4); 1.5f, WhiteV4);
} }
@ -513,7 +513,7 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
List.TextColor = WhiteV4; List.TextColor = WhiteV4;
List.ListBounds = NodeSelectionWindowBounds; List.ListBounds = NodeSelectionWindowBounds;
List.ListElementDimensions = v2{ List.ListElementDimensions = v2{
Width(NodeSelectionWindowBounds), gs_Width(NodeSelectionWindowBounds),
(r32)(State->Interface.Font->PixelHeight + 8), (r32)(State->Interface.Font->PixelHeight + 8),
}; };
List.ElementLabelIndent = v2{10, 4}; List.ElementLabelIndent = v2{10, 4};
@ -526,8 +526,8 @@ NodeGraph_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuf
node_specification_ Spec = NodeSpecifications[i]; node_specification_ Spec = NodeSpecifications[i];
rect ElementBounds = DrawListElement(Spec.Identifier, &List, Mouse, RenderBuffer, State->Interface); rect ElementBounds = DrawListElement(Spec.Identifier, &List, Mouse, RenderBuffer, State->Interface);
if (MouseButtonTransitionedDown(Mouse.LeftButtonState) if (MouseButtonTransitionedDown(Mouse.LeftButtonState)
&& PointIsInRect(Mouse.DownPos, ElementBounds)) && gs_PointIsInRect(Mouse.DownPos, ElementBounds))
{ {
PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient); PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient);
GraphState->LayoutIsDirty = true; GraphState->LayoutIsDirty = true;

View File

@ -25,10 +25,7 @@ ProfilerView_Cleanup(panel* Panel, app_state* State)
} }
internal void internal void
RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer, RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_layout Layout, debug_frame* VisibleFrame, memory_arena* Memory)
interface_config Interface, mouse_state Mouse,
v2 Min, v2 Max,
debug_frame* VisibleFrame, memory_arena* Memory)
{ {
v4 ThreadColors[] = { v4 ThreadColors[] = {
v4{.73f, .33f, .83f, 1}, v4{.73f, .33f, .83f, 1},
@ -38,7 +35,8 @@ RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
v4{.74f, .40f, .25f, 1}, v4{.74f, .40f, .25f, 1},
}; };
r32 Width = Max.x - Min.x; rect Bounds = ui_LayoutRemaining(Layout);
r32 Width = gs_Width(Bounds);
r32 DepthHeight = 64; r32 DepthHeight = 64;
s64 FrameStartCycles = VisibleFrame->FrameStartCycles; s64 FrameStartCycles = VisibleFrame->FrameStartCycles;
@ -47,6 +45,9 @@ RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
debug_scope_record_list* ThreadScopeCalls = GetScopeListForThreadInFrame(GlobalDebugServices, debug_scope_record_list* ThreadScopeCalls = GetScopeListForThreadInFrame(GlobalDebugServices,
VisibleFrame); VisibleFrame);
scope_record* HotRecord = 0;
scope_name* HotRecordName = 0;
MakeStringBuffer(String, 256); MakeStringBuffer(String, 256);
for (s32 i = 0; i < ThreadScopeCalls->Count; i++) for (s32 i = 0; i < ThreadScopeCalls->Count; i++)
{ {
@ -55,44 +56,50 @@ RenderProfiler_ScopeVisualization(render_command_buffer* RenderBuffer,
r32 PercentStart = (r32)(Record->StartCycles - FrameStartCycles) / (r32)FrameTotalCycles; r32 PercentStart = (r32)(Record->StartCycles - FrameStartCycles) / (r32)FrameTotalCycles;
r32 PercentEnd = (r32)(Record->EndCycles - FrameStartCycles) / (r32)FrameTotalCycles; r32 PercentEnd = (r32)(Record->EndCycles - FrameStartCycles) / (r32)FrameTotalCycles;
v2 ScopeMin = v2{Min.x + (Width * PercentStart), Max.y - ((Record->CallDepth + 1) * DepthHeight)}; r32 PixelStart = Bounds.Min.x + (Width * PercentStart);
v2 ScopeMax = v2{Min.x + (Width * PercentEnd), ScopeMin.y + (DepthHeight - 4)}; r32 PixelEnd = Bounds.Min.x + (Width * PercentEnd);
r32 MinY = Bounds.Max.y - ((Record->CallDepth + 1) * DepthHeight);
if ((ScopeMax.x - ScopeMin.x) >= 1) rect ScopeBounds = {
v2{ PixelStart, MinY },
v2{ PixelEnd, MinY + (DepthHeight - 4) }
};
if (gs_Width(ScopeBounds) >= 1)
{ {
v4 Color = ThreadColors[0]; v4 Color = ThreadColors[0];
if (PointIsInRange(Mouse.Pos, ScopeMin, ScopeMax)) if (gs_PointIsInRect(Interface->Mouse.Pos, ScopeBounds))
{ {
Color = GreenV4; Color = GreenV4;
HotRecord = Record;
HotRecordName = Name;
} }
PushRenderQuad2D(RenderBuffer, ScopeMin, ScopeMax, Color); ui_FillRect(Interface, ScopeBounds, Color);
PushRenderBoundingBox2D(RenderBuffer, ScopeMin, ScopeMax, 1, BlackV4); ui_OutlineRect(Interface, ScopeBounds, 1, BlackV4);
if (PointIsInRange(Mouse.Pos, ScopeMin, ScopeMax))
{
PushRenderQuad2D(RenderBuffer, Mouse.Pos, Mouse.Pos + v2{256, 32}, BlackV4);
PrintF(&String, "%.*s : %d - %d", Name->Name.Length, Name->Name.Memory, Record->StartCycles, Record->EndCycles);
DrawString(RenderBuffer, String, Interface.Font, Mouse.Pos, WhiteV4);
}
} }
} }
if (HotRecord != 0)
{
PrintF(&String, "%S : %d - %d", HotRecordName->Name, HotRecord->StartCycles, HotRecord->EndCycles);
ui_TextBox(Interface, gs_MakeRectMinWidth(Interface->Mouse.Pos, v2{256, 32}), String, BlackV4, WhiteV4);
}
} }
internal void internal void
RenderProfiler_ListVisualization(render_command_buffer* RenderBuffer, RenderProfiler_ListVisualization(ui_interface* Interface, ui_layout Layout, debug_frame* VisibleFrame, memory_arena* Memory)
interface_config Interface, mouse_state Mouse,
v2 Min, v2 Max,
debug_frame* VisibleFrame, memory_arena* Memory)
{ {
MakeStringBuffer(String, 256); MakeStringBuffer(String, 256);
r32 YAt = Max.y - Interface.Font->PixelHeight; r32 ColumnWidths[] = {256, 128, 128, 128, 128};
r32 Column0X = Min.x; ui_StartRow(&Layout, 5, &ColumnWidths[0]);
r32 Column1X = Column0X + 256; {
r32 Column2X = Column1X + 128; ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Procedure"), Interface->Style.TextColor);
r32 Column3X = Column2X + 128; ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("% Frame"), Interface->Style.TextColor);
r32 Column4X = Column3X + 100; ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Seconds"), Interface->Style.TextColor);
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Cycles"), Interface->Style.TextColor);
ui_LayoutDrawString(Interface, &Layout, MakeStringLiteral("Calls"), Interface->Style.TextColor);
}
ui_EndRow(&Layout);
for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++) for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++)
{ {
@ -101,24 +108,24 @@ RenderProfiler_ListVisualization(render_command_buffer* RenderBuffer,
{ {
collated_scope_record* CollatedRecord = VisibleFrame->CollatedScopes + n; collated_scope_record* CollatedRecord = VisibleFrame->CollatedScopes + n;
PrintF(&String, "%.*s", NameEntry.Name.Length, NameEntry.Name.Memory); ui_StartRow(&Layout, 5, &ColumnWidths[0]);
DrawString(RenderBuffer, String, Interface.Font, v2{Column0X, YAt}, WhiteV4); {
PrintF(&String, "%S", NameEntry.Name);
PrintF(&String, "%f", CollatedRecord->PercentFrameTime); ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
DrawString(RenderBuffer, String, Interface.Font, v2{Column1X, YAt}, WhiteV4);
PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime);
PrintF(&String, "%fs", CollatedRecord->TotalSeconds); ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
DrawString(RenderBuffer, String, Interface.Font, v2{Column2X, YAt}, WhiteV4);
PrintF(&String, "%fs", CollatedRecord->TotalSeconds);
PrintF(&String, "%dcy", CollatedRecord->TotalCycles); ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
DrawString(RenderBuffer, String, Interface.Font, v2{Column3X, YAt}, WhiteV4);
PrintF(&String, "%dcy", CollatedRecord->TotalCycles);
PrintF(&String, "%d calls", CollatedRecord->CallCount); ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
DrawString(RenderBuffer, String, Interface.Font, v2{Column4X, YAt}, WhiteV4);
PrintF(&String, "%d", CollatedRecord->CallCount);
YAt -= Interface.Font->PixelHeight + 4; ui_LayoutDrawString(Interface, &Layout, String, Interface->Style.TextColor);
}
if (YAt < Min.y) { break; } ui_EndRow(&Layout);
} }
} }
} }
@ -134,23 +141,18 @@ ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* Render
v4 FrameColors[] = { GreenV4, YellowV4, RedV4, WhiteV4 }; v4 FrameColors[] = { GreenV4, YellowV4, RedV4, WhiteV4 };
r32 FrameListHeight = 64; r32 FrameListHeight = 64;
v2 FrameListMin = v2{PanelBounds.Min.x + 16, PanelBounds.Max.y - (16 + FrameListHeight)}; rect FrameListBounds, ProcListBounds;
v2 FrameListMax = v2{PanelBounds.Max.x - 16, PanelBounds.Max.y - 16}; gs_HSplitRectAtDistanceFromTop(PanelBounds, FrameListHeight, &FrameListBounds, &ProcListBounds);
rect FrameListInner = gs_InsetRect(FrameListBounds, 4);
r32 FrameListPadding = 4; r32 SingleFrameStep = gs_Width(FrameListInner) / DEBUG_FRAME_COUNT;
r32 FrameListInnerWidth = (FrameListMax.x - FrameListMin.x) - (FrameListPadding * 2);
r32 SingleFrameStep = FrameListInnerWidth / DEBUG_FRAME_COUNT;
r32 SingleFrameWidth = (r32)((s32)SingleFrameStep - 2); r32 SingleFrameWidth = (r32)((s32)SingleFrameStep - 2);
PushRenderBoundingBox2D(RenderBuffer, FrameListMin, FrameListMax, 2, WhiteV4); ui_OutlineRect(&State->Interface_, FrameListBounds, 2, WhiteV4);
if (gs_PointIsInRect(Mouse.Pos, FrameListBounds) && MouseButtonHeldDown(Mouse.LeftButtonState))
if (PointIsInRange(Mouse.Pos, FrameListMin, FrameListMax) &&
MouseButtonHeldDown(Mouse.LeftButtonState))
{ {
r32 LocalMouseX = (Mouse.Pos.x - FrameListMin.x) + FrameListPadding; v2 LocalMouse = gs_TransformPointIntoRectSpace(Mouse.Pos, FrameListBounds);
s32 ClosestFrameIndex = (LocalMouseX / SingleFrameStep); s32 ClosestFrameIndex = (LocalMouse.x / SingleFrameStep);
if (ClosestFrameIndex >= 0 && ClosestFrameIndex < DEBUG_FRAME_COUNT) if (ClosestFrameIndex >= 0 && ClosestFrameIndex < DEBUG_FRAME_COUNT)
{ {
GlobalDebugServices->RecordFrames = false; GlobalDebugServices->RecordFrames = false;
@ -158,60 +160,61 @@ ProfilerView_Render(panel Panel, rect PanelBounds, render_command_buffer* Render
} }
} }
rect FrameBounds = gs_MakeRectMinWidth(FrameListInner.Min, v2{SingleFrameWidth, gs_Height(FrameListInner)});
for (s32 F = 0; F < DEBUG_FRAME_COUNT; F++) for (s32 F = 0; F < DEBUG_FRAME_COUNT; F++)
{ {
v2 Min = v2{FrameListMin.x + FrameListPadding + (F * SingleFrameStep), FrameListMin.y + 4}; rect PositionedFrameBounds = gs_TranslateRectX(FrameBounds, F * SingleFrameStep);
v2 Max = v2{Min.x + SingleFrameWidth, FrameListMax.y - 4};
s32 FramesAgo = (GlobalDebugServices->CurrentDebugFrame - F); s32 FramesAgo = (GlobalDebugServices->CurrentDebugFrame - F);
if (FramesAgo < 0) { FramesAgo += DEBUG_FRAME_COUNT; } if (FramesAgo < 0) { FramesAgo += DEBUG_FRAME_COUNT; }
v4 Color = FrameColors[GSClamp(0, FramesAgo, 3)]; v4 Color = FrameColors[GSClamp(0, FramesAgo, 3)];
PushRenderQuad2D(RenderBuffer, Min, Max, Color); ui_FillRect(&State->Interface_, PositionedFrameBounds, Color);
} }
debug_frame* VisibleFrame = GetLastDebugFrame(GlobalDebugServices); debug_frame* VisibleFrame = GetLastDebugFrame(GlobalDebugServices);
s64 FrameStartCycles = VisibleFrame->FrameStartCycles;
s64 FrameTotalCycles = VisibleFrame->FrameEndCycles - VisibleFrame->FrameStartCycles;
PrintF(&String, "Frame %d - Total Cycles: %lld", ui_layout Layout = ui_CreateLayout(State->Interface_, ProcListBounds);
GlobalDebugServices->CurrentDebugFrame - 1, ui_StartRow(&Layout, 4);
FrameTotalCycles);
DrawString(RenderBuffer, String, State->Interface.Font, FrameListMin - v2{0, 32}, WhiteV4);
rect ResumeRecordingBtnBounds = MakeRectMinWidth(v2{ FrameListMax.x - 128, FrameListMin.y - 32 }, v2{ 128, 28 });
if (ui_Button(&State->Interface_, MakeString("Resume Recording"), ResumeRecordingBtnBounds))
{ {
GlobalDebugServices->RecordFrames = true; s64 FrameStartCycles = VisibleFrame->FrameStartCycles;
s64 FrameTotalCycles = VisibleFrame->FrameEndCycles - VisibleFrame->FrameStartCycles;
u32 CurrentDebugFrame = GlobalDebugServices->CurrentDebugFrame - 1;
PrintF(&String, "Frame %d", CurrentDebugFrame);
ui_LayoutDrawString(&State->Interface_, &Layout, String, WhiteV4);
PrintF(&String, "Total Cycles: %lld", FrameTotalCycles);
ui_LayoutDrawString(&State->Interface_, &Layout, String, WhiteV4);
// NOTE(NAME): Skipping a space for aesthetic reasons, not functional, and could
// be removed, or used for something else
ui_ReserveElementBounds(&Layout);
if (ui_LayoutButton(&State->Interface_, &Layout, MakeString("Resume Recording")))
{
GlobalDebugServices->RecordFrames = true;
}
} }
ui_EndRow(&Layout);
rect ScopeViewBtnBounds = { ui_StartRow(&Layout, 8);
v2{ FrameListMin.x, FrameListMin.y - 60 },
v2{ FrameListMin.x + 128, FrameListMin.y - 42 }
};
if (ui_Button(&State->Interface_, MakeString("Scope View"), ScopeViewBtnBounds))
{ {
GlobalDebugServices->Interface.FrameView = FRAME_VIEW_PROFILER; if (ui_LayoutButton(&State->Interface_, &Layout, MakeString("Scope View")))
{
GlobalDebugServices->Interface.FrameView = FRAME_VIEW_PROFILER;
}
if (ui_LayoutButton(&State->Interface_, &Layout, MakeString("List View")))
{
GlobalDebugServices->Interface.FrameView = FRAME_VIEW_SCOPE_LIST;
}
} }
ui_EndRow(&Layout);
rect ListViewBtnBounds = TranslateRectX(ScopeViewBtnBounds, 152);
if (ui_Button(&State->Interface_, MakeString("List View"), ListViewBtnBounds))
{
GlobalDebugServices->Interface.FrameView = FRAME_VIEW_SCOPE_LIST;
}
rect ViewModeBounds = {
v2{ FrameListMin.x, PanelBounds.Min.y },
v2{ FrameListMax.x, FrameListMin.y - 96 }
};
if (GlobalDebugServices->Interface.FrameView == FRAME_VIEW_PROFILER) if (GlobalDebugServices->Interface.FrameView == FRAME_VIEW_PROFILER)
{ {
RenderProfiler_ScopeVisualization(RenderBuffer, State->Interface, Mouse, RectExpand(ViewModeBounds), RenderProfiler_ScopeVisualization(&State->Interface_, Layout, VisibleFrame, Memory);
VisibleFrame, Memory);
} }
else else
{ {
RenderProfiler_ListVisualization(RenderBuffer, State->Interface, Mouse, RectExpand(ViewModeBounds), RenderProfiler_ListVisualization(&State->Interface_, Layout, VisibleFrame, Memory);
VisibleFrame, Memory);
} }
} }

View File

@ -1,33 +1,22 @@
TODO FOLDHAUS TODO FOLDHAUS
STREAM #0: Metaprogramming
- Metaprogramming - Metaprogramming
- fix memory layout (remeber to profile before and after) - fix memory layout (remeber to profile before and after)
- Make everything truly platform agnostic
- Application DLL
- math.h: present for trig functions (though this is part of the c-std lib, so it should be everywhere)
- windows.h: only thing left is InterlockedIncrement and InterlockedAdd
- Meta Layer
- ???
- Make the DLL truly platform agnostic STREAM #1: 3D Overhaul
- math.h: present for trig functions (though this is part of the c-std lib, so it should be everywhere)
- windows.h: only thing left is InterlockedIncrement and InterlockedAdd
- Win32 Platform Layer
- Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h)
- Internal Log File
NOTE: This should not be a part of the debug system
- Save output log to a file continuously
- Have a window where we can view the log within the app
- Create a bar that displays the most recent error message
- :ErrorLogging
- Make sure it works without building in Debug Mode
- Buckets & Lists
- On second thought, I just really don't like these. Lets get rid of them, and put custom structures in place
- Rendering (Working on this elsewhere) - Rendering (Working on this elsewhere)
- OpenGL 3 - OpenGL 3
- Vertex Buffers - Vertex Buffers
- Clipping in shaders
- Layers - Layers
- Lighting - Lighting
- Clipping (with error checking)
- Camera - Camera
- pan - pan
@ -43,28 +32,22 @@ TODO FOLDHAUS
- led groups & subgroups - defined in file - led groups & subgroups - defined in file
- motion - motion
- Network
- Handle Error Cases
- Handle connecting a sculpture after launch
- Artnet
- Universe offsets (per sculpture)
- Interface
- Layout functionality
- styling
- text input
- lister with icon options
- panel system: destroy panel by extending it beyond its max, not just its min
- Asset Loading
- Need to figure out which textures are currently in graphics memory and which need to be resubmitted
- images
- icon system - integrate with interface
- Sculpture View - Sculpture View
- mouse spatial interaction - handles, and hover for info - mouse spatial interaction - handles, and hover for info
- debug capabilities (toggle strip/led/universe colors) - debug capabilities (toggle strip/led/universe colors)
STREAM #2: Memory
- Buckets & Lists
- On second thought, I just really don't like these. Lets get rid of them, and put custom structures in place
- Internal Log File
NOTE: This should not be a part of the debug system
- Save output log to a file continuously
- Have a window where we can view the log within the app
- Create a bar that displays the most recent error message
- :ErrorLogging
STREAM #3: Nodes
- Animation System - Animation System
- blending between animation - blending between animation
- layers - layers
@ -91,11 +74,32 @@ TODO FOLDHAUS
- saving animation timelines - saving animation timelines
- saving projects - saving projects
- Settings STRAM #4: Completeness
- Win32 Platform Layer
- Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h)
- Platform Layer - Platform Layer
- Mac Platform Layer - Mac Platform Layer
- Make sure it works without building in Debug Mode
- Network
- Handle Error Cases
- Handle connecting a sculpture after launch
- Artnet
- Universe offsets (per sculpture)
- Interface
- text input
- lister with icon options
- Asset Loading
- Need to figure out which textures are currently in graphics memory and which need to be resubmitted
- images
- icon system - integrate with interface
- Settings
Assembly -> SACN interface Assembly -> SACN interface
- need to create a data structure in CreateDMXBuffers that prevents duplication of DMXBuffers. - need to create a data structure in CreateDMXBuffers that prevents duplication of DMXBuffers.
- - thinking about a dictionary. Key is Universe, length is 256, create parallel arrays as necessary - - thinking about a dictionary. Key is Universe, length is 256, create parallel arrays as necessary
@ -120,7 +124,7 @@ Switch To Nodes
- - create separate files: foldhaus_node_engine, foldhaus_node_gui - - create separate files: foldhaus_node_engine, foldhaus_node_gui
- - store interface_nodes in binary tree - - store interface_nodes in binary tree
- - allow panning and zooming around the node canvas - - allow panning and zooming around the node canvas
- - Investigate why we're giving nodes bounds :NodesDontNeedToKnowTheirBounds - - Investigate why we're giving nodes bounds :NodesDontNeedToKnowTheirBounds
- selector node (has a list of connections that it can switch between) - selector node (has a list of connections that it can switch between)
- evaluation step (one node at a time) - evaluation step (one node at a time)