Exemplo n.º 1
0
LLScreenClipRect::~LLScreenClipRect()
{
	if (mEnabled)
	{
		popClipRect();
		updateScissorRegion();
	}
}
Exemplo n.º 2
0
LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled)
:	mScissorState(GL_SCISSOR_TEST),
	mEnabled(enabled)
{
	if (mEnabled)
	{
		pushClipRect(rect);
		mScissorState.setEnabled(!sClipRectStack.empty());
		updateScissorRegion();
	}
}
void LLScreenClipRect::popClipRect()
{
	sClipRectStack.pop();
	if (!sClipRectStack.empty())
	{
		updateScissorRegion();
	}
	else
	{
		gGL.setScissor(mRootScissorRect);
	}
}
void LLScreenClipRect::pushClipRect(const LLRect& rect)
{
	LLRect combined_clip_rect = rect;
	if (!sClipRectStack.empty())
	{
		LLRect top = sClipRectStack.top();
		combined_clip_rect.intersectWith(top);

		if(combined_clip_rect.isEmpty())
		{
			// avoid artifacts where zero area rects show up as lines
			combined_clip_rect = LLRect::null;
		}
	}
	
	sClipRectStack.push(combined_clip_rect);
	updateScissorRegion();
}