76 auto pD3DDevice = pRender->GetDirect3DDevice();
79 auto pDisplayParams = pRender->GetCurrentDisplayParams();
85 auto& rTransform = m_pTransforms[ m_iTransformCount ];
86 rTransform.m_aMatrixRows[ 0 ] = { pDisplayParams->uiWidth / fRootWidth, 0.0f };
87 rTransform.m_aMatrixRows[ 1 ] = { 0.0f, -
TFLOAT( pDisplayParams->uiHeight ) / fRootHeight };
88 rTransform.m_vecTranslation = { 0.0f, 0.0f };
90 static TUINT32 s_MatrixFlags = 0;
91 static Toshi::TMatrix44 s_IdentityMatrix;
93 if ( ( s_MatrixFlags & 1 ) == 0 )
99 pD3DDevice->SetTransform( D3DTS_WORLDMATRIX( 0 ), (D3DMATRIX*)&s_IdentityMatrix );
100 pD3DDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)&s_IdentityMatrix );
103 2.0f / (
TFLOAT)pDisplayParams->uiWidth, 0.0f, 0.0f, 0.0f,
104 0.0f, 2.0f / (
TFLOAT)pDisplayParams->uiHeight, 0.0f, 0.0f,
105 0.0f, 0.0f, 1.0f, 0.0f,
106 0.0f, 0.0f, 0.0f, 1.0f
109 pD3DDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)&projection );
110 pD3DDevice->SetVertexShader( 322 );
111 pD3DDevice->SetPixelShader( 0 );
112 pD3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, 1 );
113 pD3DDevice->SetRenderState( D3DRS_SPECULARENABLE, 0 );
114 pD3DDevice->SetRenderState( D3DRS_LIGHTING, 0 );
115 pD3DDevice->SetRenderState( D3DRS_FOGENABLE, 0 );
116 pD3DDevice->SetRenderState( D3DRS_ZFUNC, 8 );
117 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 0 );
118 pD3DDevice->SetRenderState( D3DRS_CULLMODE, 1 );
123 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
124 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
125 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
126 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
127 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
128 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
129 pD3DDevice->SetRenderState( D3DRS_ZBIAS, 0 );
130 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, 2 );
131 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, 0 );
132 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, 2 );
133 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, 0 );
134 pD3DDevice->SetTextureStageState( 0, D3DTSS_MIPMAPLODBIAS, 0 );
135 pD3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, 1 );
136 pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, 1 );
243 auto pD3DDevice = pRender->GetDirect3DDevice();
245 if ( a_pMaterial == m_pMaterial )
250 pD3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, 0 );
251 pD3DDevice->SetRenderState( D3DRS_CULLMODE, 1 );
254 if ( a_pMaterial ==
TNULL )
256 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
257 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
258 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
259 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
260 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
261 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
262 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, 2 );
263 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, 0 );
264 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, 2 );
265 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, 0 );
266 pD3DDevice->SetTextureStageState( 0, D3DTSS_MIPMAPLODBIAS, 0 );
267 pD3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, 1 );
268 pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, 1 );
273 auto pTexture =
TSTATICCAST( Toshi::TTextureResourceHAL, a_pMaterial->m_pTextureResource );
274 pTexture->Validate();
276 pD3DDevice->SetTexture( 0, pTexture->GetD3DTexture() );
277 pRender->SetTextureAddress( 0, pTexture->GetAddressing(),
TEXCOORD_UV );
279 switch ( a_pMaterial->m_eBlendState )
282 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 0 );
283 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
284 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
287 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
288 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
289 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
290 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
291 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
292 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
293 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 0 );
296 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
297 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
298 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
299 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
300 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
301 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 2 );
302 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 0 );
305 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
306 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
307 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
308 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 3 );
309 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
310 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 2 );
311 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 0 );
314 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 1 );
315 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 2 );
316 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
317 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
318 pD3DDevice->SetRenderState( D3DRS_ZENABLE, 1 );
319 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 1 );
320 pD3DDevice->SetRenderState( D3DRS_ZFUNC, 4 );
321 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0x3c );
322 pD3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, 1 );
323 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 7 );
336 pD3DDevice->SetRenderState( D3DRS_ZENABLE, 1 );
337 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 0 );
338 pD3DDevice->SetRenderState( D3DRS_ZFUNC, 4 );
339 pD3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, 0 );
340 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
341 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
342 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
343 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
344 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
354 pD3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, 0 );
355 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
356 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
357 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
358 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
359 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
360 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
361 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, 1 );
362 pD3DDevice->SetRenderState( D3DRS_ZFUNC, 4 );
367 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, 1 );
368 pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, 5 );
369 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
370 pD3DDevice->SetRenderState( D3DRS_BLENDOP, 1 );
371 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
372 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
376 if ( a_pMaterial->m_eTextureAddress == 1 )
378 pD3DDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP );
379 pD3DDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP );
381 else if ( a_pMaterial->m_eTextureAddress == 2 )
383 pD3DDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_MIRROR );
384 pD3DDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_MIRROR );
388 pD3DDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP );
389 pD3DDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP );
392 pD3DDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, 2 );
393 pD3DDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, 2 );
394 pD3DDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, 1 );
395 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, 4 );
396 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, 2 );
397 pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, 0 );
398 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, 4 );
399 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, 2 );
400 pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, 0 );
401 pD3DDevice->SetTextureStageState( 0, D3DTSS_MIPMAPLODBIAS, a_pMaterial->m_iMipMapLODBias );
402 pD3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, 1 );
403 pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, 1 );
404 m_pMaterial = a_pMaterial;