summaryrefslogtreecommitdiff
path: root/createcalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'createcalls.cpp')
-rw-r--r--createcalls.cpp87
1 files changed, 86 insertions, 1 deletions
diff --git a/createcalls.cpp b/createcalls.cpp
index b6ce7e1..4d9ea1e 100644
--- a/createcalls.cpp
+++ b/createcalls.cpp
@@ -117,7 +117,16 @@ File_SaveAs(project_data *File, project_state *State, memory *Memory, char *File
return 1;
}
-
+static void
+Playhead_Increment(int32 *Frame_Current, int32 Frame_Start, int32 Frame_End, int32 Increment)
+{
+ *Frame_Current += Increment;
+ if (*Frame_Current >= Frame_End) {
+ *Frame_Current = Frame_Start;
+ }
+ // if (*Frame_Current < Frame_Start) {
+ // }
+}
static uint16
Source_Generate_Blank(project_data *File, project_state *State, memory *Memory, uint16 Width, uint16 Height, uint16 BytesPerPixel)
@@ -251,6 +260,10 @@ Bezier_Add(memory *Memory, property_channel *Property, bezier_point PointData)
}
}
+// static void
+// Property_InitFloat(char *Name, real32 Val, real32 ScrubVal, real32 MinVal = PROPERTY_REAL_MIN, real32 MaxVal = PROPERTY_REAL_MAX, bool32 AlwaysInteger = 0) {
+// {
+// }
static property_channel
Property_InitFloat(char *Name, real32 Val, real32 ScrubVal, real32 MinVal = PROPERTY_REAL_MIN, real32 MaxVal = PROPERTY_REAL_MAX, bool32 AlwaysInteger = 0) {
@@ -312,6 +325,78 @@ Layer_Interact_Evaluate(memory *Memory, project_state *State, uint16 Layer_Index
}
}
+static uint32
+Effect_Init(project_state *State, memory *Memory, uint32 EffectEntryIndex, int EffectCount)
+{
+ uint16 EffectAddressIndex = Memory_Block_AllocateNew(Memory, F_Effects);
+ block_effect *Effect = (block_effect *)Memory_Block_AddressAtIndex(Memory, F_Effects, EffectAddressIndex, 0);
+ Effect->Occupied = true;
+ header_effect *EffectHeader = &State->Effect[EffectEntryIndex];
+ String_Copy(Effect->ID, EffectHeader->ID, 8);
+ Effect->IsToggled = true;
+ Effect->Index = EffectCount;
+ for (int e = 0; e < EffectHeader->Property_Count; e++) {
+ Effect->Block_Property_Index[e] = Memory_Block_AllocateNew(Memory, F_Properties);
+ property_channel *Property = (property_channel *)Memory_Block_AddressAtIndex(Memory, F_Properties, Effect->Block_Property_Index[e], 0);
+ Property->Occupied = true;
+ header_property PropertyHeader = State->Property[EffectHeader->PropertyStartIndex + e];
+ Property->Name = PropertyHeader.Name;
+ Property->CurrentValue = PropertyHeader.DefaultValue;
+ Property->MinVal = PropertyHeader.MinVal;
+ Property->MaxVal = PropertyHeader.MaxVal;
+ }
+ return EffectAddressIndex;
+}
+
+
+static void
+Layer_UpdateMasksEffects(project_state *State, block_layer *Layer, memory *Memory, void *EffectBitmapAddress,
+ int Width, int Height, int BytesPerPixel)
+{
+ uint64 Size = Width*Height*BytesPerPixel;
+
+ // We need two of these: one with multisampling enabled and a
+ // non-multisampled one that we can blit to.
+ gl_effect_layer TestL = {};
+ gl_effect_layer TestM = {};
+
+ GL_UpdateTexture(&TestL, EffectBitmapAddress, Width, Height, BytesPerPixel, 0);
+ GL_UpdateTexture(&TestM, EffectBitmapAddress, Width, Height, BytesPerPixel, 1);
+
+ for (int i = 0; i < Layer->Block_Effect_Count; i++)
+ {
+ block_effect Effect = *(block_effect *)Memory_Block_AddressAtIndex(Memory, F_Effects, Layer->Block_Effect_Index[i]);
+ header_effect *EffectEntry = Effect_EntryFromID(State, Effect.ID);
+
+ if (Effect.IsToggled) {
+ real32 *Data = (real32 *)Memory_PushScratch(Memory, sizeof(real32) * 50);
+ for (int c = 0; c < EffectEntry->Property_Count; c++) {
+ property_channel *Property = (property_channel *)Memory_Block_AddressAtIndex(Memory, F_Properties, Effect.Block_Property_Index[c]);
+ Data[c] = Property->CurrentValue;
+ }
+ EffectEntry->func(Data, Width, Height, BytesPerPixel, EffectBitmapAddress, EffectEntry->GLShaderIndex);
+ Memory_PopScratch(Memory, sizeof(real32) * 50);
+ }
+ }
+ /*
+ if (Layer->NumberOfMasks) {
+ for (int i = 0; i < Layer->NumberOfMasks; i++) {
+ file_mask_header *MaskHeader = (file_mask_header *)((uint8 *)Layer + sizeof(file_layer) + MaskOffset);
+ if (MaskHeader->IsClosed && MaskHeader->IsToggled) {
+ mask_point *Point = (mask_point *)((uint8 *)MaskHeader + sizeof(file_mask_header));
+ Mask_TriangulateAndRasterize(TestM, TestL, Memory, MaskHeader, Point, Source->Width, Source->Height, Source->BytesPerPixel, EffectBitmapAddress);
+ }
+ }
+ Bitmap_StencilAlpha(SourceBitmapAddress, EffectBitmapAddress, Source->BytesPerPixel, Size);
+ }
+
+ Layer->OutputBitmapLocation = EffectBitmapAddress;
+ */
+
+ GL_DeleteHWBuffer(&TestL);
+ GL_DeleteHWBuffer(&TestM);
+}
+
static void
Layer_ToggleChannel(project_data *File, memory *Memory, int32 a)
{