You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
fix clipping with v_flip fixes: #2929
This commit is contained in:
@@ -733,6 +733,9 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||||||
int w = current_clip->final_clip_rect.size.x;
|
int w = current_clip->final_clip_rect.size.x;
|
||||||
int h = current_clip->final_clip_rect.size.y;
|
int h = current_clip->final_clip_rect.size.y;
|
||||||
|
|
||||||
|
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
|
||||||
|
y = current_clip->final_clip_rect.position.y;
|
||||||
|
|
||||||
glScissor(x, y, w, h);
|
glScissor(x, y, w, h);
|
||||||
|
|
||||||
reclip = false;
|
reclip = false;
|
||||||
@@ -821,7 +824,10 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||||||
|
|
||||||
if (current_clip) {
|
if (current_clip) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(current_clip->final_clip_rect.position.x, (rt_size.height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.height)), current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
|
||||||
|
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
|
||||||
|
y = current_clip->final_clip_rect.position.y;
|
||||||
|
glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
@@ -969,7 +975,10 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||||||
|
|
||||||
if (reclip) {
|
if (reclip) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(current_clip->final_clip_rect.position.x, (rt_size.height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.height)), current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
|
||||||
|
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
|
||||||
|
y = current_clip->final_clip_rect.position.y;
|
||||||
|
glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
p_item_list = p_item_list->next;
|
p_item_list = p_item_list->next;
|
||||||
|
|||||||
@@ -997,13 +997,11 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
//glScissor(viewport.x+current_clip->final_clip_rect.pos.x,viewport.y+ (viewport.height-(current_clip->final_clip_rect.pos.y+current_clip->final_clip_rect.size.height)),
|
//glScissor(viewport.x+current_clip->final_clip_rect.pos.x,viewport.y+ (viewport.height-(current_clip->final_clip_rect.pos.y+current_clip->final_clip_rect.size.height)),
|
||||||
//current_clip->final_clip_rect.size.width,current_clip->final_clip_rect.size.height);
|
//current_clip->final_clip_rect.size.width,current_clip->final_clip_rect.size.height);
|
||||||
|
|
||||||
int x = current_clip->final_clip_rect.position.x;
|
|
||||||
int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
|
int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
|
||||||
int w = current_clip->final_clip_rect.size.x;
|
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
|
||||||
int h = current_clip->final_clip_rect.size.y;
|
y = current_clip->final_clip_rect.position.y;
|
||||||
|
|
||||||
glScissor(x, y, w, h);
|
glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.x, current_clip->final_clip_rect.size.y);
|
||||||
|
|
||||||
reclip = false;
|
reclip = false;
|
||||||
}
|
}
|
||||||
@@ -1138,7 +1136,11 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||||||
if (current_clip) {
|
if (current_clip) {
|
||||||
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(current_clip->final_clip_rect.position.x, (rt_size.height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.height)), current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
|
||||||
|
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
|
||||||
|
y = current_clip->final_clip_rect.position.y;
|
||||||
|
|
||||||
|
glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.x, current_clip->final_clip_rect.size.y);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -1515,7 +1517,10 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||||||
if (reclip) {
|
if (reclip) {
|
||||||
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(current_clip->final_clip_rect.position.x, (rt_size.height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.height)), current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
|
||||||
|
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
|
||||||
|
y = current_clip->final_clip_rect.position.y;
|
||||||
|
glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
p_item_list = p_item_list->next;
|
p_item_list = p_item_list->next;
|
||||||
|
|||||||
Reference in New Issue
Block a user