summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-01-04 18:30:56 -0500
committerFox Caminiti <fox@foxcam.net>2023-01-04 18:30:56 -0500
commiteebbdd012b0d156e9e92369585c6ad82ed3de371 (patch)
treebbaeec7569de49f68bf853158a95c095878cf825 /src/include
parenta37ea807e93886e6a6ebc22a878a5649e97f015a (diff)
shapes; remove stencil buffer?
Diffstat (limited to 'src/include')
-rw-r--r--src/include/debug.h2
-rw-r--r--src/include/defines.h3
-rw-r--r--src/include/functions.h6
-rw-r--r--src/include/main.h9
-rw-r--r--src/include/my_math.h10
5 files changed, 14 insertions, 16 deletions
diff --git a/src/include/debug.h b/src/include/debug.h
index 6321679..e1d8ccc 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -37,7 +37,7 @@ struct project_debug
// NOTE(fox): Pixel count isn't thread safe; don't use with multithreading!
uint64 LayerCycleCount[64];
uint32 UndoState = 0;
- uint64 ScratchSize[6];
+ uint64 ScratchSize[32];
uint32 ScratchState = 0;
};
diff --git a/src/include/defines.h b/src/include/defines.h
index 8216f1c..1d4e147 100644
--- a/src/include/defines.h
+++ b/src/include/defines.h
@@ -36,7 +36,8 @@ typedef uint64 ptrsize; // is there a compiler variable for 32 vs 64 bit like
#define MAX_MASKS 8
#define MAX_PROPERTIES_PER_EFFECT 80 // Kinda high since we want to support 8 xy points of Curves data across 5 channels.
#define MAX_KEYFRAME_BLOCKS 64
-#define MAX_KEYFRAMES_PER_BLOCK 32 // max keyframes on a single channel is 2048
+// #define MAX_KEYFRAMES_PER_BLOCK 32 // max keyframes on a single channel is 2048
+#define MAX_KEYFRAMES_PER_BLOCK 2
#define MAX_SELECTED_PROPERTIES 16
diff --git a/src/include/functions.h b/src/include/functions.h
index 53920cb..e7b5e44 100644
--- a/src/include/functions.h
+++ b/src/include/functions.h
@@ -12,15 +12,17 @@ static void Arbitrary_ShiftData(uint8 *Address_Start, uint8 *Address_End, uint64
static real32 Bezier_SolveYForX(v2 Point_P0, v2 Point_P1, v2 Point_P2, v2 Point_P3, real32 TargetX);
static bezier_point * Bezier_LookupAddress(memory *Memory, property_channel *Property, uint16 Index, bool32 AssertExists = 1);
+static bezier_point * Bezier_LookupAddress(memory *Memory, uint16 *Block_Bezier_Index, uint16 Index, bool32 AssertExists);
static void Bezier_Interact_Evaluate(project_state *State, bezier_point *PointAddress, v2 *Pos, real32 GraphZoomHeight = 1, real32 Y_Increment = 1);
// NOTE(fox): GraphZoomHeight and Y_Increment don't have to be specified if the Y value isn't needed, i.e. in Property_SortAll().
static void Bezier_Add(memory *Memory, memory_table_list TableName, property_channel *Property, bezier_point PointData, uint16 *ArrayLocation);
+static void Bezier_Add(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *Block_Bezier_Count, uint16 *PointCount, bezier_point PointData);
uint32 Bezier_CubicCalcPoints(v2 p1, v2 p2, v2 p3, v2 p4, void *Data, uint32 Size);
-void GL_RasterizeShape(gl_effect_layer *TestL, gl_effect_layer *TestM, void *PointData, uint32 GL_PointCount,
- layer_transforms T, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, int L_Width, int L_Height);
+static void GL_RasterizeShape(gl_effect_layer *TestL, gl_effect_layer *TestM, void *StrokeData, void *FillData, uint32 StrokeCount, uint32 FillCount,
+ layer_transforms T, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, int L_Width, int L_Height, v4 Col, int RenderMode);
static void ImGui_ProcessInputs(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_file Sorted);
static void ImGui_PropertiesPanel(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray);
diff --git a/src/include/main.h b/src/include/main.h
index 8590904..a39fe45 100644
--- a/src/include/main.h
+++ b/src/include/main.h
@@ -187,7 +187,7 @@ struct shape_options {
int Visibility;
v4 FillCol = {1, 1, 1, 1};
v4 StrokeCol = {1, 1, 1, 1};
- float StrokeWidth;
+ float StrokeWidth = 50;
};
struct shape_layer {
@@ -195,6 +195,7 @@ struct shape_layer {
uint16 Block_Bezier_Count;
uint16 Point_Count;
bool32 IsClosed;
+ bool32 Contiguous = 1; // No points have been deleted/added, so sorting isn't needed.
int Width;
int Height;
shape_options Opt;
@@ -207,7 +208,6 @@ enum timeline_mode
};
struct pen_state {
- shape_options Opt;
};
struct brush_state
@@ -378,7 +378,6 @@ struct project_state
int32 PreviewSource = -1;
hotkey_input HotkeyInput;
- real32 HotkeyExtra[4]; // bloat?
void *Dump1;
void *Dump2;
@@ -443,7 +442,7 @@ struct project_state
focused_window FocusedWindow; // Convenience for adding window-specific hotkeys.
bool32 SetFocus;
- v2 TempZoomRatio = V2(1, 1);
+ v2 LastClickedPoint = V2(1, 1);
};
// UI info that's saved to the file and is not part of the history tree
@@ -468,6 +467,8 @@ struct ui
bool32 StableEnabled = 0;
#endif
+ shape_layer Shape;
+
ImU32 LayerColors[16] = {
0xff8b1f1f,
0xffc25909,
diff --git a/src/include/my_math.h b/src/include/my_math.h
index 92d43b7..865f11c 100644
--- a/src/include/my_math.h
+++ b/src/include/my_math.h
@@ -66,14 +66,8 @@ inline v2 V2(ImVec2 A)
return(Result);
}
-inline ImVec2 V2(v2 A)
-{
- struct ImVec2 Result;
-
- Result.x = A.x;
- Result.y = A.y;
-
- return(Result);
+inline ImVec2 ImVec2_(v2 f) {
+ return { f.x, f.y };
}
inline v2i V2i(int32 x, int32 y)