summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 42c07a9..7cc4745 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -329,7 +329,7 @@ GL_Test(const ImDrawList* parent_list, const ImDrawCmd* cmd)
GL_UpdateTexture2(&MSBuffer2, NULL, A[2], A[3], RenderData->BytesPerPixel, 0);
glBindFramebuffer(GL_FRAMEBUFFER, MSBuffer.FramebufferObject);
glBindTexture(GL_TEXTURE_2D, 0);
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClearColor(RenderData->BGColor.r, RenderData->BGColor.g, RenderData->BGColor.b, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(DefaultShaderProgram);
@@ -565,7 +565,7 @@ LayerIterate_TestSelection(project_state *State, memory *Memory, uint32 Principa
// finding the inverse transform-- i.e. transforming the layers locally rather
// than transforming them in comp space.
static void
-LayerIterate(project_state *State, memory *Memory, uint32 CompIndex, layer_transforms ExtraT, v2 Center,
+LayerIterate(project_state *State, memory *Memory, uint32 CompIndex, interact_transform Interact_Transform, layer_transforms ExtraT, v2 Center,
sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray)
{
block_composition *Comp = (block_composition *)Memory_Block_AddressAtIndex(Memory, F_Precomps, CompIndex);
@@ -585,14 +585,14 @@ LayerIterate(project_state *State, memory *Memory, uint32 CompIndex, layer_trans
v2 NewCenter = T_CompPosToLayerPos(NewExtraT, Comp->Width, Comp->Height, Width, Height, Center.x, Center.y);
NewExtraT.rotation = ExtraT.rotation - NewExtraT.rotation;
NewExtraT.scale = ExtraT.scale / NewExtraT.scale;
- LayerIterate(State, Memory, Layer->Block_Source_Index, NewExtraT, NewCenter, SortedCompArray, SortedLayerArray);
+ LayerIterate(State, Memory, Layer->Block_Source_Index, Interact_Transform, NewExtraT, NewCenter, SortedCompArray, SortedLayerArray);
}
if (Layer->IsSelected & 0x01) {
#if DEBUG
if (Layer->IsPrecomp)
PostMsg(State, "DEBUG: Precomp transformed!");
#endif
- v2 Position = State->Interact_Transform.Position;
+ v2 Position = Interact_Transform.Position;
real32 Rad = (ExtraT.rotation * (PI / 180));
v2 XAxis = Position.x * ExtraT.scale * V2(cos(Rad), sin(Rad));
v2 YAxis = Position.y * -ExtraT.scale * V2(sin(Rad), -cos(Rad));
@@ -602,7 +602,7 @@ LayerIterate(project_state *State, memory *Memory, uint32 CompIndex, layer_trans
History_Action_Swap(Memory, F_Layers, sizeof(Layer->y.CurrentValue), &Layer->y.CurrentValue);
History_Action_Swap(Memory, F_Layers, sizeof(Layer->scale.CurrentValue), &Layer->scale.CurrentValue);
History_Action_Swap(Memory, F_Layers, sizeof(Layer->rotation.CurrentValue), &Layer->rotation.CurrentValue);
- Transform_ApplyLocal(State->Interact_Transform, Position, Center,
+ Transform_ApplyLocal(Interact_Transform, Position, Center,
&Layer->x.CurrentValue, &Layer->y.CurrentValue, &Layer->rotation.CurrentValue, &Layer->scale.CurrentValue);
}
}
@@ -1242,6 +1242,8 @@ int main(int argc, char *argv[]) {
File->Comp_Count = 1;
+ File->UI.BGColor= V4(0.1, 0.1, 0.1, 0.0);
+
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
SDL_AudioSpec Audio = {0};
@@ -1508,8 +1510,25 @@ int main(int argc, char *argv[]) {
State->Interact_Active = interact_type_viewport_duplicate;
sorted_file Sorted = File_Sort_Push(File, State, &Memory);
History_Entry_Commit(&Memory, "Duplicate layers");
- v2 Offset = V2(State->Interact_Dup_Previous[0], State->Interact_Dup_Previous[1]);
- Project_Layer_Duplicate(File, State, &Memory, Sorted.CompArray, Sorted.LayerArray, Offset, io.KeyCtrl);
+ Project_Layer_Duplicate(File, State, &Memory, Sorted.CompArray, Sorted.LayerArray, V2(0, 0), 0);
+ if (!io.KeyCtrl)
+ {
+ interact_transform Interact = State->Interact_Transform_Prev;
+ v2 BoxLength = Interact.Max - Interact.Min;
+ v2 Center = Interact.Max - (BoxLength/2);
+ if (Interact.RadianOffset != 0.0f) {
+ v2 LocalCenter = Interact.NewCenter;
+ real32 Rad = Interact.RadianOffset;
+ real32 Point0X = Center.x - Interact.OGCenter.x;
+ real32 Point0Y = Center.y - Interact.OGCenter.y;
+ v2 XAxis = (Point0X * 1.0f)*V2(cos(Rad), sin(Rad));
+ v2 YAxis = (Point0Y * 1.0f)*V2(sin(Rad), -cos(Rad));
+ Center = Interact.OGCenter + XAxis + YAxis;
+ }
+ layer_transforms T = {};
+ T.scale = 1.0f;
+ LayerIterate(State, &Memory, File->PrincipalCompIndex, Interact, T, Center, Sorted.CompArray, Sorted.LayerArray);
+ }
State->Interact_Transform = {};
History_Entry_End(&Memory);
File_Sort_Pop(&Memory, Sorted.Layer_SortSize, Sorted.Property_SortSize, Sorted.Source_SortSize);