0419 겹치는UI클리핑 ScissorClip
PushClipRect 의 개념이다.
"Rect와 Rect의 AND연산의 결과는 Rect이다"
위의 것이 성립하기 때문에,
Scissor는 결국 1번만 불러도 되며,
Rect를 Accumulate 해가면서
그려지는 범위를 좁히면 된다.
트리에서는 매프레임마다 parent_trace 돌면서 AND해가면 될듯.
또는 축적을 해두거나
***** 참고로 엔진에서는
ContainerBase에 Clip_Content라는 속성이 있어서
그거 끄면 parent_trace에서 제외해야 함.
Rect final_scissor_rect = {0, 0, 1280, 720};
void push_clip_rect(const Rect& rect) {
// rect가 final_scissor_rect보다 작은(안쪽) 부분만 검출해서
// final_scissor_rect를 업데이트.
Rect old = final_scissor_rect;
if (rect.x > old.x) old.x = rect.x
if (rect.y > old.y) old.y = rect.y
if (rect.x + rect.w < old.x + old.w)
old.w = (rect.x + rect.w) - old.x
if (rect.y + rect.h < old.y + old.h)
old.h = (rect.y + rect.h) - old.y
final_scissor_rect = old;
}