You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS/device including version:
2020 Mac Mini
macOS Big Sur
Issue description:
Basically, calling draw_set_transform() outside a loop causes buggy rendering compared to inside the loop, even when it shouldn't make any difference.
In this example scene I have a Polygon2D, a Light2D, and a Node2D (called CircleRenderer). CircleRenderer has the following script which should simply draw a green circle over every point on the Polygon2D. Note that the polygon is positioned at (500, 500), while CircleRenderer is at the origin.
extends Node2D
tool
func _process(delta):
update()
func _draw():
var poly = $"../Polygon2D"
#draw_set_transform(poly.global_position, 0, Vector2.ONE)
for point in poly.polygon:
draw_set_transform(poly.global_position, 0, Vector2.ONE)
draw_circle(point, 50, Color.seagreen)
As it is, this code works as expected.
Now suppose I swap the call to draw_set_transform() with the commented out one. This should have the same effect, except for maybe being more efficient. When I do this however, the circles still draw in the correct positions, but weird things happen with all the circles after the first: the Light2D ceases to interact correctly with them, and also, the circles will suddenly disappear if the editor is zoomed in close enough and/or moved far enough. Both behaviors are shown here:
Screen.Recording.2021-05-27.at.5.56.33.PM.mov
Also, for some reason, this only seems to happen if the polygon's position is positive.
The rendering at runtime is the same. Issue is present in both GLES2 and 3, with or without batching.
Simpler reproduction project, the poly and the texture rect aren't needed. Just move the 2d light and you get the light going off prematurely as you move it down: djrain_DrawSetTransformBug.zip
if (found_xform) {
r = xf.xform(r);
found_xform = false;
}
This is a loop where it goes through the commands to find the bounding rect. The problem is that is only applying the transform to the first command, then sets found_xform back to false, which is incorrect, because the transform also applies to later commands. The fix will probably be to just remove this line. I'll do some testing and see if this works.
Godot version:
3.3.2 stable
OS/device including version:
2020 Mac Mini
macOS Big Sur
Issue description:
Basically, calling draw_set_transform() outside a loop causes buggy rendering compared to inside the loop, even when it shouldn't make any difference.
In this example scene I have a Polygon2D, a Light2D, and a Node2D (called CircleRenderer). CircleRenderer has the following script which should simply draw a green circle over every point on the Polygon2D. Note that the polygon is positioned at (500, 500), while CircleRenderer is at the origin.
As it is, this code works as expected.
Now suppose I swap the call to draw_set_transform() with the commented out one. This should have the same effect, except for maybe being more efficient. When I do this however, the circles still draw in the correct positions, but weird things happen with all the circles after the first: the Light2D ceases to interact correctly with them, and also, the circles will suddenly disappear if the editor is zoomed in close enough and/or moved far enough. Both behaviors are shown here:
Screen.Recording.2021-05-27.at.5.56.33.PM.mov
Also, for some reason, this only seems to happen if the polygon's position is positive.
The rendering at runtime is the same. Issue is present in both GLES2 and 3, with or without batching.
Steps to reproduce:
Play with MRP example scene
Minimal reproduction project:
DrawSetTransformBug.zip
The text was updated successfully, but these errors were encountered: