diff --git a/src/Shaders/Effects/Rotation/SmearRotxel.gdshader b/src/Shaders/Effects/Rotation/SmearRotxel.gdshader index cd3caa4e0..d06debab4 100644 --- a/src/Shaders/Effects/Rotation/SmearRotxel.gdshader +++ b/src/Shaders/Effects/Rotation/SmearRotxel.gdshader @@ -26,15 +26,13 @@ vec4 rotate(sampler2D tex, vec2 uv, vec2 tex_pixel_size) { float dir; float mag; float init_angle = initial_angle < ending_angle ? initial_angle : ending_angle; - for (float angle = ending_angle; angle >= init_angle && color.a == 0.0; angle -= 1.0) { - float ang = angle*3.1416/180.0; - + for (float angle = ending_angle; angle >= init_angle && color.a <= 0.0001; angle -= 0.0174) { for (int k = 0; k < 9; k++) { int i = -1 + int(k % 3); int j = -1 + k / 3; dir = atan(float(dy + j), float(dx + i)); mag = sqrt(pow(float(dx + i), 2.0) + pow(float(dy + j), 2.0)); - dir -= ang; + dir -= angle; ox = int(round(3.0 * center.x + 1.0 + mag * cos(dir))); oy = int(round(3.0 * center.y + 1.0 + mag * sin(dir))); @@ -125,15 +123,13 @@ vec4 rotate_uniform(sampler2D tex, vec2 uv, vec2 tex_pixel_size) { float dir; float mag; float init_angle = initial_angle < ending_angle ? initial_angle : ending_angle; - for (float angle = ending_angle; angle >= init_angle && color.a == 0.0; angle -= 1.0) { - float ang = angle*3.1416/180.0; - + for (float angle = ending_angle; angle >= init_angle && color.a <= 0.0001; angle -= 0.0174) { for (int k = 0; k < 9; k++) { int i = -1 + int(k % 3); int j = -1 + k / 3; dir = atan(float(dy + j), float(dx + i)); mag = sqrt(pow(float(dx + i), 2.0) + pow(float(dy + j), 2.0)); - dir -= ang; + dir -= angle; ox = int(round(3.0 * center.x + 1.0 + mag * cos(dir))); oy = int(round(3.0 * center.y + 1.0 + mag * sin(dir))); diff --git a/src/UI/Dialogs/ImageEffects/RotateImage.gd b/src/UI/Dialogs/ImageEffects/RotateImage.gd index 9ceb3f06f..57e68cc94 100644 --- a/src/UI/Dialogs/ImageEffects/RotateImage.gd +++ b/src/UI/Dialogs/ImageEffects/RotateImage.gd @@ -1,7 +1,7 @@ extends ImageEffect enum { ROTXEL_SMEAR, CLEANEDGE, OMNISCALE, NNS, NN, ROTXEL, URD } -enum Animate { ANGLE, INITIAL_ANGLE } +enum Animate { ANGLE, INIT_ANGLE } var rotxel_shader := preload("res://src/Shaders/Effects/Rotation/SmearRotxel.gdshader") var nn_shader := preload("res://src/Shaders/Effects/Rotation/NearestNeighbour.gdshader") @@ -79,7 +79,7 @@ func _calculate_pivot() -> void: func commit_action(cel: Image, _project := Global.current_project) -> void: var angle := deg_to_rad(animate_panel.get_animated_value(commit_idx, Animate.ANGLE)) - var init_angle := animate_panel.get_animated_value(commit_idx, Animate.INITIAL_ANGLE) + var init_angle := deg_to_rad(animate_panel.get_animated_value(commit_idx, Animate.INIT_ANGLE)) var selection_tex: ImageTexture var image := Image.new() @@ -105,7 +105,7 @@ func commit_action(cel: Image, _project := Global.current_project) -> void: ROTXEL_SMEAR: params = { "initial_angle": init_angle, - "ending_angle": rad_to_deg(angle), + "ending_angle": angle, "tolerance": tolerance_slider.value, "selection_tex": selection_tex, "origin": pivot / Vector2(cel.get_size()),