mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Clamp UV-coordinates to centers of outermost texels when configured to do so
In addition, fix region_filter_clip_enabled documentation to be consistent with AtlasTexture.xml, since that is the option whose behavior was fixed
This commit is contained in:
parent
1fc8208765
commit
d720eb80e1
@ -76,7 +76,7 @@
|
||||
If [code]true[/code], texture is cut from a larger atlas texture. See [member region_rect].
|
||||
</member>
|
||||
<member name="region_filter_clip_enabled" type="bool" setter="set_region_filter_clip_enabled" getter="is_region_filter_clip_enabled" default="false">
|
||||
If [code]true[/code], the outermost pixels get blurred out. [member region_enabled] must be [code]true[/code].
|
||||
If [code]true[/code], the area outside of the [member region_rect] is clipped to avoid bleeding of the surrounding texture pixels. [member region_enabled] must be [code]true[/code].
|
||||
</member>
|
||||
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2(0, 0, 0, 0)">
|
||||
The region of the atlas texture to display. [member region_enabled] must be [code]true[/code].
|
||||
|
@ -579,7 +579,8 @@ void main() {
|
||||
|
||||
#endif
|
||||
if (bool(read_draw_data_flags & FLAGS_CLIP_RECT_UV)) {
|
||||
uv = clamp(uv, read_draw_data_src_rect.xy, read_draw_data_src_rect.xy + abs(read_draw_data_src_rect.zw));
|
||||
vec2 half_texpixel = read_draw_data_color_texture_pixel_size * 0.5;
|
||||
uv = clamp(uv, read_draw_data_src_rect.xy + half_texpixel, read_draw_data_src_rect.xy + abs(read_draw_data_src_rect.zw) - half_texpixel);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -493,7 +493,8 @@ void main() {
|
||||
|
||||
#endif
|
||||
if (bool(draw_data.flags & FLAGS_CLIP_RECT_UV)) {
|
||||
uv = clamp(uv, draw_data.src_rect.xy, draw_data.src_rect.xy + abs(draw_data.src_rect.zw));
|
||||
vec2 half_texpixel = draw_data.color_texture_pixel_size * 0.5;
|
||||
uv = clamp(uv, draw_data.src_rect.xy + half_texpixel, draw_data.src_rect.xy + abs(draw_data.src_rect.zw) - half_texpixel);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user