diff options
-rw-r--r-- | src/createcalls.cpp | 2 | ||||
-rw-r--r-- | src/gl_calls.cpp | 142 | ||||
-rw-r--r-- | src/imgui_ui_viewport.cpp | 2 | ||||
-rw-r--r-- | src/include/all.h | 4 | ||||
-rw-r--r-- | src/main.cpp | 154 |
5 files changed, 174 insertions, 130 deletions
diff --git a/src/createcalls.cpp b/src/createcalls.cpp index 54dd376..18ab1b7 100644 --- a/src/createcalls.cpp +++ b/src/createcalls.cpp @@ -581,7 +581,7 @@ Layer_Nudge(project_data *File, project_state *State, memory *Memory, sorted_comp_array SortedCompStart = SortedCompArray[File->PrincipalCompIndex]; sorted_layer_array *SortedLayerStart = Sorted_GetLayerStart(SortedLayerArray, SortedCompArray, File->PrincipalCompIndex); State->Interact_Active = interact_type_layer_move; - State->Interact_Offset[0] = 1; + State->Interact_Offset[0] = -1; History_Entry_Commit(Memory, "Move layer stack down"); for (int i = 0; i < SortedCompStart.LayerCount; i++) { diff --git a/src/gl_calls.cpp b/src/gl_calls.cpp index 91dba4f..8bdd7f1 100644 --- a/src/gl_calls.cpp +++ b/src/gl_calls.cpp @@ -180,17 +180,8 @@ static void GL_BlitStencil(gl_effect_layer *TestM, void *StrokeData, void *FillData, uint32 StrokeCount, uint32 FillCount, layer_transforms T, int Width, int Height, int BytesPerPixel, int L_Width, int L_Height,v4 StrokeCol, v4 FillCol, int RenderMode, int Vector, - ImVec2 ViewportSize, ImVec2 UIPos, ImVec2 UIZoom) + ImVec2 ViewportSize, ImVec2 UIPos, ImVec2 UIZoom, int StencilLayer, int Mode) { - // stencil buffer - glEnable(GL_STENCIL_TEST); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilFunc(GL_ALWAYS, 0, 0xFF); - glStencilMask(0xff); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - int Uniform = 0; Uniform = glGetUniformLocation(DefaultShaderProgram, "CompDimensions"); @@ -220,6 +211,11 @@ GL_BlitStencil(gl_effect_layer *TestM, void *StrokeData, void *FillData, uint32 Uniform = glGetUniformLocation(DefaultShaderProgram, "InputCol"); glUniform3f(Uniform, 0, 0, 0); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glBindVertexArray(0); + glStencilFunc(GL_EQUAL, StencilLayer, 0xFF); + glStencilOp(GL_KEEP, GL_KEEP, Mode); + // fill // vertices glBindBuffer(GL_ARRAY_BUFFER, ShapeVerts.VertexBufferObject); @@ -228,13 +224,9 @@ GL_BlitStencil(gl_effect_layer *TestM, void *StrokeData, void *FillData, uint32 glEnableVertexAttribArray(0); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); - // stencil buffer - glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR_WRAP); - glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR_WRAP); - glDisable(GL_CULL_FACE); - glDrawElements(GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_INT, 0); // + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glBindVertexArray(0); @@ -244,18 +236,8 @@ static void GL_RasterizeShape2(gl_effect_layer *TestM, void *StrokeData, void *FillData, uint32 StrokeCount, uint32 FillCount, layer_transforms T, int Width, int Height, int BytesPerPixel, int L_Width, int L_Height,v4 StrokeCol, v4 FillCol, int RenderMode, int Vector, - ImVec2 ViewportSize, ImVec2 UIPos, ImVec2 UIZoom, bool32 KeepStencil) + ImVec2 ViewportSize, ImVec2 UIPos, ImVec2 UIZoom, int StencilLayer) { - // stencil buffer - glEnable(GL_STENCIL_TEST); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - if (!KeepStencil) - glClear(GL_STENCIL_BUFFER_BIT); - glStencilFunc(GL_ALWAYS, 0, 0xFF); - glStencilMask(0xff); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - int Uniform = 0; Uniform = glGetUniformLocation(DefaultShaderProgram, "CompDimensions"); @@ -280,30 +262,34 @@ GL_RasterizeShape2(gl_effect_layer *TestM, void *StrokeData, void *FillData, uin if (RenderMode == 0 || RenderMode == 1) { + // disable color component writing and allow stencil writing using the shape layer's vertices + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glBindVertexArray(0); + glStencilFunc(GL_ALWAYS, 0, 0xFF); + + glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR_WRAP); + glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR_WRAP); Uniform = glGetUniformLocation(DefaultShaderProgram, "VertexMode"); glUniform1i(Uniform, 1); Uniform = glGetUniformLocation(DefaultShaderProgram, "FragmentMode"); glUniform1i(Uniform, 1); - // fill - // vertices - glBindBuffer(GL_ARRAY_BUFFER, ShapeVerts.VertexBufferObject); - glBufferData(GL_ARRAY_BUFFER, sizeof(real32) * 4 * FillCount, FillData, GL_STATIC_DRAW); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0); - glEnableVertexAttribArray(0); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); + glBindBuffer(GL_ARRAY_BUFFER, ShapeVerts.VertexBufferObject); + glBufferData(GL_ARRAY_BUFFER, sizeof(real32) * 4 * FillCount, FillData, GL_STATIC_DRAW); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); - // stencil buffer - glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR_WRAP); - glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR_WRAP); - glDisable(GL_CULL_FACE); + glDrawArrays(GL_TRIANGLE_FAN, 0, FillCount); - glDrawArrays(GL_TRIANGLE_FAN, 0, FillCount); - // + // --- + // allow color component writing glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glBindVertexArray(0); + glStencilFunc(GL_EQUAL, StencilLayer + 1, 0xFF); + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); Uniform = glGetUniformLocation(DefaultShaderProgram, "VertexMode"); glUniform1i(Uniform, 0); @@ -312,33 +298,50 @@ GL_RasterizeShape2(gl_effect_layer *TestM, void *StrokeData, void *FillData, uin Uniform = glGetUniformLocation(DefaultShaderProgram, "InputCol"); glUniform3f(Uniform, FillCol.r, FillCol.g, FillCol.b); - // stencil for fill - // - // vertices - glBindBuffer(GL_ARRAY_BUFFER, DefaultVerts.VertexBufferObject); - glBufferData(GL_ARRAY_BUFFER, sizeof(GL_DefaultVertices), GL_DefaultVertices, GL_STATIC_DRAW); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0); - glEnableVertexAttribArray(0); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float))); - glEnableVertexAttribArray(1); - - // stencil buffer - glStencilFunc(GL_NOTEQUAL, 0, 0xFF); - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); - - glDrawElements(GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_INT, 0); - // + glBindBuffer(GL_ARRAY_BUFFER, DefaultVerts.VertexBufferObject); + glBufferData(GL_ARRAY_BUFFER, sizeof(GL_DefaultVertices), GL_DefaultVertices, GL_STATIC_DRAW); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float))); + glEnableVertexAttribArray(1); + + glDrawElements(GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_INT, 0); + + // --- + + // NOTE(fox): We need to clean up the mask after we draw the colors if + // precomps are involved. + // TODO(fox): If this is the final method, add this optimization: shapes with + // no precomps below them don't have to be drawn twice and can instead + // get cleaned by setting StencilOp to GL_DECR. + + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glBindVertexArray(0); + glStencilFunc(GL_ALWAYS, 0, 0xFF); + + glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR_WRAP); + glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP); + + Uniform = glGetUniformLocation(DefaultShaderProgram, "VertexMode"); + glUniform1i(Uniform, 1); + Uniform = glGetUniformLocation(DefaultShaderProgram, "FragmentMode"); + glUniform1i(Uniform, 1); + + glBindBuffer(GL_ARRAY_BUFFER, ShapeVerts.VertexBufferObject); + glBufferData(GL_ARRAY_BUFFER, sizeof(real32) * 4 * FillCount, FillData, GL_STATIC_DRAW); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); + + glDrawArrays(GL_TRIANGLE_FAN, 0, FillCount); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } else { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } - // stencil buffer not needed - glDisable(GL_STENCIL_TEST); - glStencilMask(0xFF); - glStencilFunc(GL_ALWAYS, 0, 0xFF); - glBindVertexArray(0); + // stroke component if (RenderMode == 0 || RenderMode == 2) { Uniform = glGetUniformLocation(DefaultShaderProgram, "VertexMode"); glUniform1i(Uniform, 1); @@ -347,17 +350,14 @@ GL_RasterizeShape2(gl_effect_layer *TestM, void *StrokeData, void *FillData, uin Uniform = glGetUniformLocation(DefaultShaderProgram, "InputCol"); glUniform3f(Uniform, StrokeCol.r, StrokeCol.g, StrokeCol.b); - // stroke - // - glBindBuffer(GL_ARRAY_BUFFER, ShapeVerts.VertexBufferObject); - glBufferData(GL_ARRAY_BUFFER, sizeof(real32) * 4 * StrokeCount, StrokeData, GL_STATIC_DRAW); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0); - glEnableVertexAttribArray(0); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); - glEnableVertexAttribArray(1); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, StrokeCount); - // + glBindBuffer(GL_ARRAY_BUFFER, ShapeVerts.VertexBufferObject); + glBufferData(GL_ARRAY_BUFFER, sizeof(real32) * 4 * StrokeCount, StrokeData, GL_STATIC_DRAW); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); + glEnableVertexAttribArray(1); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, StrokeCount); } } diff --git a/src/imgui_ui_viewport.cpp b/src/imgui_ui_viewport.cpp index 6503e6f..1fd5bf9 100644 --- a/src/imgui_ui_viewport.cpp +++ b/src/imgui_ui_viewport.cpp @@ -1153,7 +1153,7 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, UI->CompPos, UI->CompZoom, UI->CompZoom.x / Comp->Width, {} }; layer_transforms ExtraT = {}; Render_UI(File, State, Memory, UI, draw_list, Data, RenderData, - SortedCompArray, SortedLayerArray, &ExtraT, + SortedCompArray, SortedLayerArray, ExtraT, SortedPropertyStart, SortedKeyframeArray, File->PrincipalCompIndex, State->Frame_Current); draw_list->AddCallback(GL_Test, (void *)StartAddress); draw_list->AddCallback(ImDrawCallback_ResetRenderState, NULL); diff --git a/src/include/all.h b/src/include/all.h index da7de64..11957af 100644 --- a/src/include/all.h +++ b/src/include/all.h @@ -487,9 +487,9 @@ T_CompUVToLayerUV(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint3 static v2 T_CompPosToLayerPos(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, real32 X, real32 Y); -static void +static uint8 * Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDrawList *draw_list, uint8 *PointBuffer, gl_viewport_data *RenderData, - sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, layer_transforms *ExtraT, + sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, layer_transforms ExtraT, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray, uint32 CompIndex, int32 Frame_Current); static layer_transforms diff --git a/src/main.cpp b/src/main.cpp index 534460e..e5fae1d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -292,24 +292,47 @@ GL_Test(const ImDrawList* parent_list, const ImDrawCmd* cmd) glUseProgram(DefaultShaderProgram); bool32 KeepStencil = false; + int StencilLayer = 0; + + // stencil buffer + glDisable(GL_CULL_FACE); + glEnable(GL_STENCIL_TEST); + glStencilMask(0xff); + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); for (int i = 0; i < RenderData->LayerCount; i++) { gl_data *Data = RenderData->LayerEntry[i]; if (Data->Type == 0) { + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL_RasterizeShape2(&MSBuffer, Data->StrokeData, Data->FillData, Data->StrokeCount, Data->FillCount, + Data->T, RenderData->Width, RenderData->Height, RenderData->BytesPerPixel, + Data->Width, Data->Height, Data->StrokeCol, Data->FillCol, Data->RenderMode, 0, + RenderData->ViewportSize, RenderData->UIPos, RenderData->UIZoom, StencilLayer); + } else if (Data->Type == 1) { + GL_BlitStencil(&MSBuffer, Data->StrokeData, Data->FillData, Data->StrokeCount, Data->FillCount, + Data->T, RenderData->Width, RenderData->Height, RenderData->BytesPerPixel, + Data->Width, Data->Height, Data->StrokeCol, Data->FillCol, Data->RenderMode, 0, + RenderData->ViewportSize, RenderData->UIPos, RenderData->UIZoom, StencilLayer, GL_INCR); + StencilLayer++; + } else if (Data->Type == 2) { + GL_BlitStencil(&MSBuffer, Data->StrokeData, Data->FillData, Data->StrokeCount, Data->FillCount, Data->T, RenderData->Width, RenderData->Height, RenderData->BytesPerPixel, Data->Width, Data->Height, Data->StrokeCol, Data->FillCol, Data->RenderMode, 0, - RenderData->ViewportSize, RenderData->UIPos, RenderData->UIZoom, KeepStencil); + RenderData->ViewportSize, RenderData->UIPos, RenderData->UIZoom, StencilLayer, GL_DECR); + StencilLayer--; } else { - // GL_BlitStencil(&MSBuffer, Data->StrokeData, Data->FillData, Data->StrokeCount, Data->FillCount, - // Data->T, RenderData->Width, RenderData->Height, RenderData->BytesPerPixel, - // Data->Width, Data->Height, Data->StrokeCol, Data->FillCol, Data->RenderMode, 0, - // RenderData->ViewportSize, RenderData->UIPos, RenderData->UIZoom); - // KeepStencil = true; + Assert(0); } } + // stencil buffer testing not needed + glDisable(GL_STENCIL_TEST); + glStencilMask(0xFF); + glStencilFunc(GL_ALWAYS, 0, 0xFF); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, MSBuffer.FramebufferObject); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // The multisample framebuffer allows us to conveniently clip to the comp bounds. @@ -322,9 +345,9 @@ GL_Test(const ImDrawList* parent_list, const ImDrawCmd* cmd) GL_DeleteHWBuffer(&MSBuffer); } -static void +static uint8 * Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDrawList *draw_list, uint8 *PointBuffer, gl_viewport_data *RenderData, - sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, layer_transforms *ExtraT, + sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, layer_transforms ExtraT, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray, uint32 CompIndex, int32 Frame_Current) { block_composition *Comp = (block_composition *)Memory_Block_AddressAtIndex(Memory, F_Precomps, CompIndex); @@ -342,46 +365,6 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr sorted_layer_array SortEntry = SortedLayerStart[i]; uint32 Index_Physical = SortEntry.Block_Layer_Index; block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical); - if (Layer->IsPrecomp) { - *ExtraT = Layer_GetTransforms(Layer); - if (State->Interact_Active == interact_type_viewport_transform && Layer->IsSelected == 1) { - Transform_ApplyInteractive(State->Interact_Transform, &ExtraT->x, &ExtraT->y, &ExtraT->rotation, &ExtraT->scale); - } - if (State->Interact_Active == interact_type_viewport_transform_gizmo && Layer->IsSelected == 1) { - Transform_ApplyInteractive(State->Interact_Transform, &ExtraT->x, &ExtraT->y, &ExtraT->rotation, &ExtraT->scale); - } - if (State->Interact_Active == interact_type_viewport_slide && Layer->IsSelected == 1) { - Assert(0); - // Transform_ApplySlide((v2 *)&State->Interact_Offset[0], &T); - } - if (State->Interact_Active == interact_type_viewport_duplicate && SortEntry.IsFake) { - Assert(Layer->IsSelected); - ExtraT->x += State->Interact_Offset[0]; - ExtraT->y += State->Interact_Offset[1]; - } - gl_data *GL_Data = RenderData->LayerEntry[RenderData->LayerCount] = (gl_data *)PointBuffer; - RenderData->LayerCount++; - PointBuffer += sizeof(gl_data); - int Width = 0, Height = 0; - Layer_GetDimensions(Memory, Layer, &Width, &Height); - GL_Data->Type = 1; - GL_Data->T = *ExtraT; - GL_Data->Width = Width; - GL_Data->Height = Height; - GL_Data->FillData = PointBuffer; - real32 CompVerts[16] = { 0.f, 0.f, 0.f, 0.f, - 0.f, (real32)Height, 0.f, 0.f, - (real32)Width, (real32)Height, 0.f, 0.f, - (real32)Width, 0.f, 0.f, 0.f }; - for (int a = 0; a < 16; a++) { - *(real32 *)PointBuffer = CompVerts[a]; - PointBuffer += sizeof(real32); - } - GL_Data->FillCount = 4; - Render_UI(File, State, Memory, UI, draw_list, PointBuffer, RenderData, - SortedCompArray, SortedLayerArray, ExtraT, - SortedPropertyStart, SortedKeyframeArray, Layer->Block_Source_Index, Frame_Current); - } int32 Frame_Start = Layer->Frame_Start; int32 Frame_End = Layer->Frame_End; int32 Frame_Offset = Layer->Frame_Offset; @@ -394,8 +377,6 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr if (Frame_Start_Abs <= Frame_Current && Frame_End_Abs > Frame_Current && Layer->IsVisible) { - void *Data = PointBuffer; - layer_transforms T = Layer_GetTransforms(Layer); if (State->Interact_Active == interact_type_viewport_transform && Layer->IsSelected == 1) { Transform_ApplyInteractive(State->Interact_Transform, &T.x, &T.y, &T.rotation, &T.scale); @@ -412,11 +393,12 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr T.x += State->Interact_Offset[0]; T.y += State->Interact_Offset[1]; } - if (ExtraT->scale != 0) { - T = Transform_Add(T, *ExtraT, Comp->Width, Comp->Height); + if (ExtraT.scale != 0) { + T = Transform_Add(T, ExtraT, Comp->Width, Comp->Height); } if (Layer->IsShapeLayer) { + void *Data = PointBuffer; shape_layer *Shape = &Layer->Shape; shape_options ShapeOpt = Layer->ShapeOpt; if (ShapeOpt.Visibility == 1 && ShapeOpt.StrokeWidth <= 0.0f) @@ -444,7 +426,68 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr *GL_Data = { 0, Data_Stroke, StrokeCount, ShapeOpt.StrokeCol, Data_Fill, NumberOfVerts, ShapeOpt.FillCol, T, Shape->Width, Shape->Height, Visibility }; - } else if (!Layer->IsPrecomp) { + } else if (Layer->IsPrecomp) { + + layer_transforms NewExtraT = Layer_GetTransforms(Layer); + if (State->Interact_Active == interact_type_viewport_transform && Layer->IsSelected == 1) { + Transform_ApplyInteractive(State->Interact_Transform, &NewExtraT.x, &NewExtraT.y, &NewExtraT.rotation, &NewExtraT.scale); + } + if (State->Interact_Active == interact_type_viewport_transform_gizmo && Layer->IsSelected == 1) { + Transform_ApplyInteractive(State->Interact_Transform, &NewExtraT.x, &NewExtraT.y, &NewExtraT.rotation, &NewExtraT.scale); + } + if (State->Interact_Active == interact_type_viewport_slide && Layer->IsSelected == 1) { + Assert(0); + // Transform_ApplySlide((v2 *)&State->Interact_Offset[0], &T); + } + if (State->Interact_Active == interact_type_viewport_duplicate && SortEntry.IsFake) { + Assert(Layer->IsSelected); + NewExtraT.x += State->Interact_Offset[0]; + NewExtraT.y += State->Interact_Offset[1]; + } + if (ExtraT.scale != 0) { + ExtraT = Transform_Add(NewExtraT, ExtraT, Comp->Width, Comp->Height); + } else { + ExtraT = NewExtraT; + } + gl_data *GL_Data = RenderData->LayerEntry[RenderData->LayerCount] = (gl_data *)PointBuffer; + RenderData->LayerCount++; + PointBuffer += sizeof(gl_data); + int Width = 0, Height = 0; + Layer_GetDimensions(Memory, Layer, &Width, &Height); + GL_Data->Type = 1; + GL_Data->T = ExtraT; + GL_Data->Width = Width; + GL_Data->Height = Height; + GL_Data->FillData = PointBuffer; + real32 CompVerts[16] = { 0.f, 0.f, 0.f, 0.f, + 0.f, (real32)Height, 0.f, 0.f, + (real32)Width, (real32)Height, 0.f, 0.f, + (real32)Width, 0.f, 0.f, 0.f }; + for (int a = 0; a < 16; a++) { + *(real32 *)PointBuffer = CompVerts[a]; + PointBuffer += sizeof(real32); + } + GL_Data->FillCount = 4; + + PointBuffer = Render_UI(File, State, Memory, UI, draw_list, PointBuffer, RenderData, + SortedCompArray, SortedLayerArray, ExtraT, + SortedPropertyStart, SortedKeyframeArray, Layer->Block_Source_Index, Frame_Current); + + GL_Data = RenderData->LayerEntry[RenderData->LayerCount] = (gl_data *)PointBuffer; + RenderData->LayerCount++; + PointBuffer += sizeof(gl_data); + GL_Data->Type = 2; + GL_Data->T = ExtraT; + GL_Data->Width = Width; + GL_Data->Height = Height; + GL_Data->FillData = PointBuffer; + for (int a = 0; a < 16; a++) { + *(real32 *)PointBuffer = CompVerts[a]; + PointBuffer += sizeof(real32); + } + GL_Data->FillCount = 4; + } else { + Assert(0); int Width = 0, Height = 0; Layer_GetDimensions(Memory, Layer, &Width, &Height); @@ -456,13 +499,13 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr GL_Data->Width = Width; GL_Data->Height = Height; GL_Data->T = T; - } else { - } + } } } Assert((PointBuffer - (uint8 *)Memory->Slot[B_PointData].Address) < Memory->Slot[B_PointData].Size); + return PointBuffer; } static void * @@ -950,6 +993,7 @@ int main(int argc, char *argv[]) { State->UpdateFrame = true; State->MostRecentlySelectedLayer = 0; } + #else // uint16 SourceIndex = Source_Generate(File, State, &Memory, (void *)"../asset/yu.webm"); // block_source *Source = (block_source *)Memory_Block_AddressAtIndex(&Memory, F_Sources, SourceIndex); |