Exemplo n.º 1
0
void Screen3D::FlushOverlays()
{
	SetTextureMode(TMNormal);
	
	SetRenderState(D3DRS_FOGENABLE, FALSE );
	D3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
	D3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
	D3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
	D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );
	D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
	D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
	D3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_DISABLE );
	D3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
	D3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );

	D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,   TRUE);
	D3DDevice->SetRenderState(D3DRS_SRCBLEND,           D3DBLEND_SRCALPHA);
	D3DDevice->SetRenderState(D3DRS_DESTBLEND,          D3DBLEND_INVSRCALPHA);
	std::list<Overlay>::iterator it;

	for( it = OverlayQueue.begin(); it != OverlayQueue.end(); ++it )
	{
		this->DrawSprite( (*it).x, (*it).y, (*it).Image, ((*it).Alpha)*255.0f );
	}

	OverlayQueue.clear();
}
IFXRESULT CIFXShaderLitTexture::Construct()
{
	IFXRESULT rc = IFX_OK;

	// IFXShaderLitTexture
	m_uChannels = 0x00000000;
	m_uFlags = MATERIAL | USEDIFFUSE;
	m_uTexturesWithAlphaChannel = 0;

	m_bInvertTrans = TRUE;

	U32 i;
	for ( i=0; i<IFX_MAX_TEXUNITS && IFXSUCCESS(rc); i++ ) 
	{
		m_fTextureIntensity[i] = 1;
		m_eBlendFunction[i] = MULTIPLY;
		m_eBlendSource[i] = CONSTANT;
		m_fBlendConstant[i] = 0.5f;
		m_eTextureMode[i] = TM_NONE;
		rc = IFXCreateComponent( CID_IFXUVGenerator, 
			IID_IFXUVGenerator, 
			(void**)(&m_pUVMapper[i]) );
		m_sUVMapperParams[i].eWrapMode = IFX_UV_NONE;
		m_sUVMapperParams[i].eOrientation = IFX_UV_VERTEX;
		m_sUVMapperParams[i].uTextureLayer = i; 
		m_pTexTransforms[i].MakeIdentity();
		m_sUVMapperParams[i].mWrapTransformMatrix.MakeIdentity();
		m_uTextureRepeat[i] = 0x03;

		m_pTexUnits[i].SetConstantColor(IFXVector4(1,1,1,m_fBlendConstant[i]));
		SetTextureMode(i, TM_NONE);
	}

	m_uOpacityID           = 0;
	m_fOpacityIntensity    = 1;
	m_bAlphaTestEnabled    = FALSE;

	m_bLighting = TRUE;

	m_bDrawFaces = TRUE;
	m_bDrawLines = TRUE;
	m_bDrawPoints = TRUE;
	return rc;
}