From 02870398a99fab6351182fba407d7d733affa5a1 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Fri, 17 Feb 2023 17:20:18 -0500 Subject: blend mode rendering halfway implemented --- src/include/all.h | 29 +++++++++++++++++++++-------- src/include/gl_calls.h | 5 ++++- src/include/main.h | 15 ++++++++++++--- 3 files changed, 37 insertions(+), 12 deletions(-) (limited to 'src/include') diff --git a/src/include/all.h b/src/include/all.h index 8117437..603ba1d 100644 --- a/src/include/all.h +++ b/src/include/all.h @@ -10,21 +10,29 @@ Bezier_Shape_Sort(memory *Memory, shape_layer *Shape, bezier_point *PointData, project_state *State, layer_transforms T, int Width, int Height, int CompWidth, int CompHeight, real32 Radius, bool32 Interact); -static bezier_point * -Bezier_LookupAddress(memory *Memory, uint16 *Block_Bezier_Index, uint16 Index, bool32 AssertExists = 1); +static void +Property_AddKeyframe_AllSelected(project_data *File, project_state *State, memory *Memory, + memory_table_list TableName, sorted_layer_array *SortedLayerArray, sorted_comp_array *SortedCompArray, uint16 *SortedKeyframeArray, + uint16 Idx, int Frame); + +static int32 +Bezier_CheckSameX(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 KeyframeCount, uint16 *ArrayLocation, real32 ValX); + +static void +Property_AddKeyframe(memory *Memory, memory_table_list TableName, uint16 *ArrayLocation, property_channel *Property, int Frame); static bezier_point * -Bezier_LookupAddress(memory *Memory, property_channel *Property, uint16 Index, bool32 AssertExists = 1); +Bezier_LookupAddress(memory *Memory, uint16 *Block_Bezier_Index, uint16 Index, bool32 AssertExists = 1); static void Bezier_Interact_Evaluate(project_state *State, bezier_point *PointAddress, v2 *Pos, real32 GraphZoomHeight = 1, real32 Y_Increment = 1); static void -Bezier_Add(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *Block_Bezier_Count, - uint16 *PointCount, bezier_point PointData); +Bezier_Delete(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *PointCount, uint16 *ArrayLocation); static void -Bezier_Add(memory *Memory, memory_table_list TableName, property_channel *Property, bezier_point PointData, uint16 *ArrayLocation); +Bezier_Add(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *Block_Bezier_Count, + uint16 *PointCount, bezier_point PointData); // return all points static void Bezier_CubicCalcPointsCasteljauStep(void *Data, uint32 Size, uint32 *Increment, real32 x1, real32 y1, real32 x2, real32 y2, real32 x3, real32 y3, real32 x4, real32 y4, real32 tess_tol, int level); @@ -51,6 +59,9 @@ static void Bezier_CubicMinMaxCasteljauStep(v2 *p_min, v2 *p_max, real32 x1, rea real32 Bezier_CubicRatioOfPoint(v2 p1, v2 p2, v2 p3, v2 p4, v2 p); +static void +File_LoadDirectory(project_data *File, project_state *State, memory *Memory, char *DirString); + static bool32 File_Open(project_data *File, project_state *State, memory *Memory, char *Filename); @@ -74,7 +85,9 @@ Source_Generate(project_data *File, project_state *State, memory *Memory, void * static void -Property_AddKeyframe(memory *Memory, memory_table_list TableName, property_channel *Property, int Frame, uint16 *ArrayLocation); +Property_AddKeyframe_AllSelected(project_data *File, project_state *State, memory *Memory, + memory_table_list TableName, sorted_layer_array *SortedLayerArray, sorted_comp_array *SortedCompArray, uint16 *SortedKeyframeArray, + uint16 Idx, int Frame); static block_composition * Precomp_Init(project_data *File, memory *Memory, block_composition *DupeComp = NULL); @@ -119,7 +132,7 @@ static void Project_Layer_Delete(project_data *File, project_state *State, memory *Memory); static bool32 -Property_IsGraphSelected(memory *Memory, property_channel *Property, uint16 *ArrayLocation); +Property_IsGraphSelected(memory *Memory, uint16 *Block_Bezier_Index, uint16 *ArrayLocation, uint16 KeyframeCount); static void Project_Layer_Duplicate(project_data *File, project_state *State, memory *Memory, diff --git a/src/include/gl_calls.h b/src/include/gl_calls.h index 3c2bef0..3bc85fb 100644 --- a/src/include/gl_calls.h +++ b/src/include/gl_calls.h @@ -13,8 +13,11 @@ static default_gl_vertex_object DefaultVerts; static default_gl_vertex_object ShapeVerts; static gl_vertex_shader GL_DefaultVertexObjects; static uint32 DefaultVertexShader; +static uint32 DefaultFragmentShader; // unused static uint32 DefaultShaderProgram; -static uint32 MaskShaderProgram; +static uint32 BlendVertexShader; +static uint32 BlendFragmentShader; +static uint32 BlendShaderProgram; float GL_DefaultVertices[] = { 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, diff --git a/src/include/main.h b/src/include/main.h index ac1118d..46aed98 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -218,6 +218,7 @@ enum focused_window struct sorted_property_array { + uint32 KeyframeCount; uint32 MinYIndex; uint32 MaxYIndex; }; @@ -239,6 +240,7 @@ struct sorted_layer_array uint16 Sorted_Effect_Index[MAX_EFFECTS]; uint16 SortedPropertyStart; uint16 SortedKeyframeStart; + real32 Interact_Offset[4]; }; struct sorted_file @@ -402,7 +404,9 @@ enum gl_shape_renderflags { gl_renderflag_fill = 1 << 0, gl_renderflag_stroke = 1 << 1, - gl_renderflag_convex = 1 << 2 + gl_renderflag_convex = 1 << 2, + gl_renderflag_texture = 1 << 3, + gl_renderflag_blend = 1 << 4 }; struct gl_data @@ -417,7 +421,11 @@ struct gl_data layer_transforms T; real32 Width; real32 Height; + void *BitmapData; int RenderMode; + + v2 BlendMin; + v2 BlendMax; }; struct gl_viewport_data @@ -478,8 +486,8 @@ struct project_state bool32 UpdateScreen = 1; // refreshes entire UI; influenced by raw key/mouse input bool32 DebugDisableCache = 1; + // TODO(fox): Group inconsequential state UI into one thing? bool32 ShapeMode = 0; - bool32 ViewportEnabled = 0; bool32 SelectionMode = 1; @@ -710,7 +718,8 @@ struct property_channel { uint8 Occupied; uint16 Block_Bezier_Index[MAX_KEYFRAME_BLOCKS]; uint16 Block_Bezier_Count; - uint16 Keyframe_Count; + // NOTE(fox): Don't use this in sorted circumstances; use the one in sorted_property_array instead! + uint16 Keyframe_Count; int32 Identifier; -- cgit v1.2.3