Ejemplo n.º 1
0
void CFlashRender::Render()
{
	CGraphic* pGraphic = CGraphic::GetInst();
	pGraphic->ClearStack();
	CMainWindowTarget::GetInst()->Clear();
	if(m_pText)
	{
		VerText2D* pVB;
		RenderState* pRS;
		CMatrix* Matrix = pGraphic->GetRenderStack( RS_GUI, m_pText, NULL, PT_TRIANGLESTRIP, 
			4, 2, VerText2D::Format, sizeof(VerText2D), (void**)&pVB, NULL, (void**)&pRS );
		pRS->m_Cull = 1;
		pRS->m_AlphaBlendEnable = m_bAlphaBlend;
		pRS->m_AlphaTestEnable  = m_bAlphaTest;
		pRS->m_ZTestEnable		= FALSE;
		Matrix->Identity();

		pVB[0].x = m_fOffX;  					pVB[0].y = m_fOffY;						pVB[0].z = 1.0f; 
		pVB[1].x = float(m_Width)+ m_fOffX;		pVB[1].y = m_fOffY;						pVB[1].z = 1.0f;	
		pVB[2].x = m_fOffX;						pVB[2].y = float(m_Height) + m_fOffY;	pVB[2].z = 1.0f;	
		pVB[3].x = float(m_Width)+ m_fOffX;		pVB[3].y = float(m_Height) + m_fOffY;	pVB[3].z = 1.0f;	

		pVB[0].w = 1.0;		pVB[0].tu = 0.0;	pVB[0].tv = 0.0;
		pVB[1].w = 1.0;		pVB[1].tu = 1.0;	pVB[1].tv = 0.0;
		pVB[2].w = 1.0;		pVB[2].tu = 0.0;	pVB[2].tv = 1.0; 
		pVB[3].w = 1.0;		pVB[3].tu = 1.0;	pVB[3].tv = 1.0;	

		if(m_bShowRect)
		{
			VerColor2D* pVBRenct;
			RenderState* pLRS;
			Matrix = pGraphic->GetRenderStack( RS_GUI, NULL, NULL, PT_TRIANGLESTRIP, 
				4, 2, VerColor2D::Format, sizeof(VerColor2D), (void**)&pVBRenct, NULL, (void**)&pLRS );
			Matrix->Identity();
			pLRS->m_Cull = 1;
			pLRS->m_AlpOP_S1		= TOP_SELECTARG1;
			pLRS->m_AlpArg1_S1		= TA_DIFFUSE;

			pLRS->m_TexOP_S1		= TOP_BLENDDIFFUSEALPHA;
			pLRS->m_TexArg1_S1		= TA_CURRENT;
			pLRS->m_TexArg2_S1		= TA_DIFFUSE;

			pLRS->m_AlphaBlendEnable = TRUE;
			pLRS->m_AlphaTestEnable = FALSE;
			pLRS->m_ZTestEnable		= FALSE;

			pVBRenct[0].x = m_fOffX + m_fRect.left;  	pVBRenct[0].y = m_fOffY + m_fRect.top;		pVBRenct[0].z = 1.0f;  
			pVBRenct[1].x = m_fOffX + m_fRect.right;	pVBRenct[1].y = m_fOffY + m_fRect.top;		pVBRenct[1].z = 1.0f;	
			pVBRenct[2].x = m_fOffX + m_fRect.left;		pVBRenct[2].y = m_fOffY + m_fRect.bottom;	pVBRenct[2].z = 1.0f;	
			pVBRenct[3].x = m_fOffX + m_fRect.right;	pVBRenct[3].y = m_fOffY + m_fRect.bottom;	pVBRenct[3].z = 1.0f;

			pVBRenct[0].w = 1.0f;
			pVBRenct[1].w = 1.0f;
			pVBRenct[2].w = 1.0f;
			pVBRenct[3].w = 1.0f;

			pVBRenct[0].diffuse = pVBRenct[1].diffuse = pVBRenct[2].diffuse = pVBRenct[3].diffuse = 0x800000FF;
		}
	}
}
Ejemplo n.º 2
0
	void CWndAreaRendere::RenderSelWndList()
	{
		if( !m_renderWndList || m_renderWndList->size() <= 1 )
			return;
		
		CGraphic* pGraphic = CGraphic::GetInst();
		vector<SQRWnd*>::iterator it = m_renderWndList->begin();
		vector<SQRWnd*>::iterator eit = m_renderWndList->end();
		while(it != eit)
		{
			SQRWnd* pwnd = *it;
			if (pwnd)
			{
				CFRect rt; pwnd->GetWndRect(rt);
				VerColor2D v[5]=
				{
					VerColor2D( (float)rt.left,  (float)rt.top,    0,	0xffff00ff ),
					VerColor2D( (float)rt.right, (float)rt.top,    0,	0xffff00ff ),
					VerColor2D( (float)rt.right, (float)rt.bottom, 0,	0xffff00ff ),
					VerColor2D( (float)rt.left,  (float)rt.bottom, 0,	0xffff00ff ),
					VerColor2D( (float)rt.left,  (float)rt.top,    0,	0xffff00ff ),
				};
				VerColor2D* pVB;
				RenderState * pRS;
				pGraphic->GetRenderStack( RS_FONT, NULL, NULL, PT_LINESTRIP, 5, 4, 
					VerColor2D::Format, sizeof(VerColor2D), (void**)&pVB, NULL, (void**)&pRS );
				pRS->m_ZTestEnable = false;
				pRS->m_ZTestFun    = CMP_ALWAYS;
				memcpy( pVB, v, sizeof( VerColor2D )*5 );
			}
			
			++it;
		}
		
	}
Ejemplo n.º 3
0
	void CWndAreaRendere::Render()
	{
		// first render the root rect
		RenderRootRect();

		// then render the wnd rect selected
		if( !m_bRender )
			return;

		CGraphic* pGraphic = CGraphic::GetInst();
		VerColor2D v[5]=
		{
			VerColor2D( (float)m_curRect.left,  (float)m_curRect.top,    0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.right, (float)m_curRect.top,    0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.right, (float)m_curRect.bottom, 0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.left,  (float)m_curRect.bottom, 0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.left,  (float)m_curRect.top,    0,	0xff0000ff ),
		};
		VerColor2D* pVB;
		RenderState * pRS;
		pGraphic->GetRenderStack( RS_FONT, NULL, NULL, PT_LINESTRIP, 5, 4, 
			VerColor2D::Format, sizeof(VerColor2D), (void**)&pVB, NULL, (void**)&pRS );
		pRS->m_ZTestEnable = false;
		pRS->m_ZTestFun    = CMP_ALWAYS;
		memcpy( pVB, v, sizeof( VerColor2D )*5 );

		// render wnd list
		RenderSelWndList();
	}
Ejemplo n.º 4
0
	void CWndAreaRendere::RenderRootRect()
	{
		if( !m_bRootRender )
			return;

		CGraphic* pGraphic = CGraphic::GetInst();
		VerColor2D v[5]=
		{
			VerColor2D( (float)m_rootRect.left,  (float)m_rootRect.top,    0,	0xffff0000 ),
			VerColor2D( (float)m_rootRect.right, (float)m_rootRect.top,    0,	0xffff0000 ),
			VerColor2D( (float)m_rootRect.right, (float)m_rootRect.bottom, 0,	0xffff0000 ),
			VerColor2D( (float)m_rootRect.left,  (float)m_rootRect.bottom, 0,	0xffff0000 ),
			VerColor2D( (float)m_rootRect.left,  (float)m_rootRect.top,    0,	0xffff0000 ),
		};
		VerColor2D* pVB;
		RenderState * pRS;
		pGraphic->GetRenderStack( RS_FONT, NULL, NULL, PT_LINESTRIP, 5, 4, 
			VerColor2D::Format, sizeof(VerColor2D), (void**)&pVB, NULL, (void**)&pRS );
		pRS->m_ZTestEnable = false;
		pRS->m_ZTestFun    = CMP_ALWAYS;
		memcpy( pVB, v, sizeof( VerColor2D )*5 );
	}
Ejemplo n.º 5
0
void CRenderTarget::Flip()
{
	m_matPreDeltaView = m_matCurDeltaView;
	m_matCurDeltaView.Identity();

	CGraphic* pGph = CGraphic::GetInst();

	for ( int i = 0; i < m_nNearCount; i++ )
	{
		Vertex2D* pVB;
		RenderState* pRS;
		if( pGph->GetRenderStack( RS_DEFAULT, m_NearFilter[i].pText, NULL, PT_TRIANGLESTRIP, 4, 2,
			Vertex2D::Format, sizeof(Vertex2D), (void**)&pVB, NULL, (void**)&pRS ) )
		{
			if ( m_NearFilter[i].bRatio )
			{
				pVB[0] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.bottom),	0.99999994f, m_NearFilter[i].dwColor, m_NearFilter[i].cTexRt.left, m_NearFilter[i].cTexRt.bottom );
				pVB[1] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.top),	0.99999994f, m_NearFilter[i].dwColor, m_NearFilter[i].cTexRt.left, m_NearFilter[i].cTexRt.top );
				pVB[2] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.bottom),0.99999994f, m_NearFilter[i].dwColor, m_NearFilter[i].cTexRt.right, m_NearFilter[i].cTexRt.bottom );
				pVB[3] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.top),	0.99999994f, m_NearFilter[i].dwColor, m_NearFilter[i].cTexRt.right, m_NearFilter[i].cTexRt.top );

				pRS->m_UAddr_S0 = m_NearFilter[i].eSamp;
				pRS->m_VAddr_S0 = m_NearFilter[i].eSamp;
			}
			else
			{
				pVB[0] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.bottom),	0.99999994f, m_NearFilter[i].dwColor, 0, 1 );
				pVB[1] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.top),	0.99999994f, m_NearFilter[i].dwColor, 0, 0 );
				pVB[2] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.bottom),0.99999994f, m_NearFilter[i].dwColor, 1, 1 );
				pVB[3] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.top),	0.99999994f, m_NearFilter[i].dwColor, 1, 0 );
			}
			if(m_NearFilter[i].pText == NULL)
			{
				pRS->m_TexOP_S0		= TOP_SELECTARG2;
				pRS->m_AlpOP_S0		= TOP_SELECTARG2;
			}
			else
				pRS->m_AlpOP_S0		= TOP_MODULATE;
			pRS->m_LightEnable = FALSE;
			if ( !m_NearFilter[i].bMulti )
				pRS->m_DestBlend = BLEND_ONE;
		}
	}
	m_nNearCount = 0;
	
	for ( int i = 0; i < m_nFarCount; i++ )
	{
		Vertex2D* pVB;
		RenderState* pRS;
		if( pGph->GetRenderStack( RS_DEFAULT, m_FarFilter[i].pText, NULL, PT_TRIANGLESTRIP, 4, 2,
			Vertex2D::Format, sizeof(Vertex2D), (void**)&pVB, NULL, (void**)&pRS ) )
		{
			if ( m_FarFilter[i].bRatio )
			{
				pVB[0] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.bottom),	0.000018f, m_FarFilter[i].dwColor, m_FarFilter[i].cTexRt.left, m_FarFilter[i].cTexRt.bottom );
				pVB[1] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.top),	0.000018f, m_FarFilter[i].dwColor, m_FarFilter[i].cTexRt.left, m_FarFilter[i].cTexRt.top );
				pVB[2] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.bottom),0.000018f, m_FarFilter[i].dwColor, m_FarFilter[i].cTexRt.right, m_FarFilter[i].cTexRt.bottom );
				pVB[3] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.top),	0.000018f, m_FarFilter[i].dwColor, m_FarFilter[i].cTexRt.right, m_FarFilter[i].cTexRt.top );

				pRS->m_UAddr_S0 = m_FarFilter[i].eSamp;
				pRS->m_VAddr_S0 = m_FarFilter[i].eSamp;
			}
			else
			{
				pVB[0] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.bottom),	0.000018f, m_FarFilter[i].dwColor, 0, 1 );
				pVB[1] = Vertex2D( float(m_rcViewPort.left),float(m_rcViewPort.top),	0.000018f, m_FarFilter[i].dwColor, 0, 0 );
				pVB[2] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.bottom),0.000018f, m_FarFilter[i].dwColor, 1, 1 );
				pVB[3] = Vertex2D( float(m_rcViewPort.right),float(m_rcViewPort.top),	0.000018f, m_FarFilter[i].dwColor, 1, 0 );
			}
			if(m_FarFilter[i].pText == NULL)
			{
				pRS->m_TexOP_S0		= TOP_SELECTARG2;
				pRS->m_AlpOP_S0		= TOP_SELECTARG2;
			}
			else
				pRS->m_AlpOP_S0		= TOP_MODULATE;
			pRS->m_LightEnable	= FALSE;
			if ( !m_FarFilter[i].bMulti )
				pRS->m_DestBlend = BLEND_ONE;
		}
	}
	m_nFarCount = 0;

	for ( int i = 0; i < m_nPostCount; i++ )
	{
		m_PostFilter[i]->RenderFilter();
	}
	m_nPostCount = 0;
}