mirror of
https://github.com/Relintai/terraman_2d.git
synced 2024-11-08 10:02:11 +01:00
Use the normal transform_uv method if the texture scale is 1.
This commit is contained in:
parent
3855fa3dde
commit
67b9090bd1
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user