49{
51 auto pD3DDevice = pRender->GetDirect3DDevice();
52
54 TTextureResourceHAL* pLT0Texture =
TNULL;
55 TTextureResourceHAL* pLT1Texture =
TNULL;
56
58
59 if ( m_bIsHDLighting )
60 {
63
68
69 pD3DDevice->SetTextureStageState( 1, D3DTSS_MAGFILTER, 2 );
70 pD3DDevice->SetTextureStageState( 2, D3DTSS_MAGFILTER, 2 );
71 pD3DDevice->SetTextureStageState( 3, D3DTSS_MAGFILTER, 2 );
72 pD3DDevice->SetTextureStageState( 4, D3DTSS_MAGFILTER, 2 );
73
74 m_bHasLighting1Tex = pLT0Texture !=
TNULL;
75 m_bHasLighting2Tex = pLT1Texture !=
TNULL;
76 }
77
78 if ( pTexture !=
TNULL )
79 {
81
83 {
85
86 if ( pLT1Texture ==
TNULL )
87 {
88 pD3DDevice->SetTexture( 1,
TNULL );
89 pD3DDevice->SetTexture( 2,
TNULL );
90 }
91 else
92 {
94 pD3DDevice->SetTextureStageState( 1, D3DTSS_MIPFILTER, 0 );
95
96 if ( pLT0Texture ==
TNULL )
97 {
98 pD3DDevice->SetTexture( 2,
TNULL );
99 }
100 else
101 {
103 pD3DDevice->SetTextureStageState( 2, D3DTSS_MIPFILTER, 0 );
104 }
105 }
106
107 pD3DDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, 2 );
110 }
111 }
112 else
113 {
114 pD3DDevice->SetTexture( 0,
TNULL );
115 }
116
118 {
119 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
120 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 6 );
121 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
122 }
123 else
124 {
125 pD3DDevice->SetRenderState( D3DRS_SRCBLEND, 5 );
126 pD3DDevice->SetRenderState( D3DRS_DESTBLEND, 2 );
127 pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
128 }
129
130 if ( m_Flags & FLAGS_NO_CULL )
131 pD3DDevice->SetRenderState( D3DRS_CULLMODE, 1 );
132
133 auto pShader =
TDYNAMICCAST( ASkinShaderHAL, GetShader() );
134 pShader->SetAlphaRef( ( m_Flags & FLAGS_BLENDING ) ? 1 : 128 );
135
136 pD3DDevice->SetRenderState( D3DRS_COLORVERTEX, 0 );
137 pD3DDevice->SetRenderState( D3DRS_CULLMODE, 1 );
138
140
141 if ( pRenderContext->IsFogEnabled() )
142 pRenderContext->EnableFogHAL();
143}
static TRenderContextD3D * Upcast(TRenderContext *a_pRenderContext)
IDirect3DTexture8 * GetD3DTexture()
virtual TBOOL Validate() override
ADDRESSINGMODE GetAddressUState() const
ADDRESSINGMODE GetAddressVState() const