|
@@ -101,6 +101,7 @@ LineBuilder::LineBuilder() {
|
|
round_precision = 8;
|
|
round_precision = 8;
|
|
begin_cap_mode = Line2D::LINE_CAP_NONE;
|
|
begin_cap_mode = Line2D::LINE_CAP_NONE;
|
|
end_cap_mode = Line2D::LINE_CAP_NONE;
|
|
end_cap_mode = Line2D::LINE_CAP_NONE;
|
|
|
|
+ tile_aspect = 1.f;
|
|
|
|
|
|
_interpolate_color = false;
|
|
_interpolate_color = false;
|
|
_last_index[0] = 0;
|
|
_last_index[0] = 0;
|
|
@@ -111,6 +112,7 @@ void LineBuilder::clear_output() {
|
|
vertices.clear();
|
|
vertices.clear();
|
|
colors.clear();
|
|
colors.clear();
|
|
indices.clear();
|
|
indices.clear();
|
|
|
|
+ uvs.clear();
|
|
}
|
|
}
|
|
|
|
|
|
void LineBuilder::build() {
|
|
void LineBuilder::build() {
|
|
@@ -121,6 +123,8 @@ void LineBuilder::build() {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ERR_FAIL_COND(tile_aspect <= 0.f);
|
|
|
|
+
|
|
const float hw = width / 2.f;
|
|
const float hw = width / 2.f;
|
|
const float hw_sq = hw * hw;
|
|
const float hw_sq = hw * hw;
|
|
const float sharp_limit_sq = sharp_limit * sharp_limit;
|
|
const float sharp_limit_sq = sharp_limit * sharp_limit;
|
|
@@ -164,7 +168,7 @@ void LineBuilder::build() {
|
|
current_distance1 = current_distance0;
|
|
current_distance1 = current_distance0;
|
|
} else if (begin_cap_mode == Line2D::LINE_CAP_ROUND) {
|
|
} else if (begin_cap_mode == Line2D::LINE_CAP_ROUND) {
|
|
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
|
|
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
|
|
- uvx0 = 0.5f;
|
|
|
|
|
|
+ uvx0 = 0.5f / tile_aspect;
|
|
}
|
|
}
|
|
new_arc(pos0, pos_up0 - pos0, -Math_PI, color0, Rect2(0.f, 0.f, 1.f, 1.f));
|
|
new_arc(pos0, pos_up0 - pos0, -Math_PI, color0, Rect2(0.f, 0.f, 1.f, 1.f));
|
|
total_distance += width;
|
|
total_distance += width;
|
|
@@ -286,8 +290,8 @@ void LineBuilder::build() {
|
|
color1 = gradient->get_color_at_offset(current_distance1 / total_distance);
|
|
color1 = gradient->get_color_at_offset(current_distance1 / total_distance);
|
|
}
|
|
}
|
|
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
|
|
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
|
|
- uvx0 = current_distance0 / width;
|
|
|
|
- uvx1 = current_distance1 / width;
|
|
|
|
|
|
+ uvx0 = current_distance0 / (width * tile_aspect);
|
|
|
|
+ uvx1 = current_distance1 / (width * tile_aspect);
|
|
}
|
|
}
|
|
|
|
|
|
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
|
|
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
|
|
@@ -373,7 +377,7 @@ void LineBuilder::build() {
|
|
color1 = gradient->get_color(gradient->get_points_count() - 1);
|
|
color1 = gradient->get_color(gradient->get_points_count() - 1);
|
|
}
|
|
}
|
|
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
|
|
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
|
|
- uvx1 = current_distance1 / width;
|
|
|
|
|
|
+ uvx1 = current_distance1 / (width * tile_aspect);
|
|
}
|
|
}
|
|
|
|
|
|
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
|
|
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
|