Use the normal transform_uv method if the texture scale is 1.

This commit is contained in:
Relintai 2022-02-26 23:32:25 +01:00
parent 3855fa3dde
commit 67b9090bd1

View File

@ -154,12 +154,22 @@ void Terrain2DMesherBlocky::add_chunk_normal(Ref<Terrain2DChunkDefault> chunk) {
}
Vector2 uvs[] = {
surface->transform_uv_scaled(Vector2(0, 0), x % texture_scale, y % texture_scale, texture_scale),
surface->transform_uv_scaled(Vector2(1, 0), x % texture_scale, y % texture_scale, texture_scale),
surface->transform_uv_scaled(Vector2(0, 1), x % texture_scale, y % texture_scale, texture_scale),
surface->transform_uv_scaled(Vector2(1, 1), x % texture_scale, y % texture_scale, texture_scale)
Vector2(0, 0),
Vector2(1, 0),
Vector2(0, 1),
Vector2(1, 1)
};
if (texture_scale <= 1) {
for (int i = 0; i < 4; ++i) {
uvs[i] = surface->transform_uv_scaled(uvs[i], x % texture_scale, y % texture_scale, texture_scale);
}
} else {
for (int i = 0; i < 4; ++i) {
uvs[i] = surface->transform_uv(uvs[i]);
}
}
Vector2 verts_normal[] = {
Vector2(0, 0),
Vector2(cell_size_x, 0),