mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
Merge pull request #46677 from W4RH4WK/fix-canvas-renderer-line-width
Fix canvas renderer line width
This commit is contained in:
commit
1eabeec680
@ -527,11 +527,11 @@ void RendererCanvasCull::canvas_item_add_line(RID p_item, const Point2 &p_from,
|
|||||||
Item::CommandPrimitive *line = canvas_item->alloc_command<Item::CommandPrimitive>();
|
Item::CommandPrimitive *line = canvas_item->alloc_command<Item::CommandPrimitive>();
|
||||||
ERR_FAIL_COND(!line);
|
ERR_FAIL_COND(!line);
|
||||||
if (p_width > 1.001) {
|
if (p_width > 1.001) {
|
||||||
Vector2 t = (p_from - p_to).orthogonal().normalized();
|
Vector2 t = (p_from - p_to).orthogonal().normalized() * p_width * 0.5;
|
||||||
line->points[0] = p_from + t * p_width;
|
line->points[0] = p_from + t;
|
||||||
line->points[1] = p_from - t * p_width;
|
line->points[1] = p_from - t;
|
||||||
line->points[2] = p_to - t * p_width;
|
line->points[2] = p_to - t;
|
||||||
line->points[3] = p_to + t * p_width;
|
line->points[3] = p_to + t;
|
||||||
line->point_count = 4;
|
line->point_count = 4;
|
||||||
} else {
|
} else {
|
||||||
line->point_count = 2;
|
line->point_count = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user