159 constexpr static TUINT8 s_VertexShaderFunction[] = { 0x01, 0x01, 0xfe, 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x03, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x55, 0x80, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x05, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x04, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x05, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0xff, 0x80, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xff, 0x90, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xff, 0x90, 0x04, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xff, 0x90, 0x05, 0x00, 0xe4, 0x80, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x02, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x04, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x80, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x07, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x02, 0x00, 0x54, 0x80, 0x5f, 0x00, 0x54, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x00, 0x54, 0x80, 0x5f, 0x00, 0xfe, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x59, 0x00, 0xe4, 0xa1, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x5d, 0x00, 0xaa, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0x00, 0x80, 0x5d, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0x00, 0x80, 0x5b, 0x00, 0xa4, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0xff, 0x80, 0x02, 0x00, 0x00, 0x81, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0x00, 0x80, 0x5a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xd0, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xd0, 0x5a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00 };
160 constexpr static TUINT8 s_VertexHDShaderFunction[] = { 0x01, 0x01, 0xfe, 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x03, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x55, 0x80, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x05, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x04, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x05, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0xff, 0x80, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x05, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xff, 0x90, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x06, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xff, 0x90, 0x04, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x80, 0x07, 0x20, 0xe4, 0xa0, 0x02, 0x00, 0xff, 0x90, 0x05, 0x00, 0xe4, 0x80, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x02, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x04, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x80, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x07, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x59, 0x00, 0xe4, 0xa1, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x5e, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xd0, 0x5a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x54, 0x80, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x54, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x54, 0x80, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x54, 0x80, 0xff, 0xff, 0x00, 0x00 };
162 if ( CreateSkinVertexShader(
"ASkinShader_D3D8_Win.vsh", (DWORD*)s_VertexShaderFunction, &m_hVertexShader ) &&
163 CreateSkinVertexShader(
"ASkinShader_D3D8_Win.vsh", (DWORD*)s_VertexHDShaderFunction, &m_hVertexShaderHD ) )
165 constexpr static TUINT8 s_PixelShaderFunction[] = { 0x04, 0x01, 0xff, 0xff, 0xfd, 0xff, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x42, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xb0, 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xb0, 0x42, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xb0, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0f, 0x80, 0x04, 0x00, 0xe4, 0xb0, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x12, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x40, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, 0xff, 0xff, 0x00, 0x00 };
166 constexpr static TUINT8 s_PixelShaderFunctionLowEnd[] = { 0x01, 0x01, 0xff, 0xff, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xb0, 0x42, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0xb0, 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0f, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x80, 0x01, 0x00, 0xe4, 0xb1, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xe4, 0xb0, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0xb0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
169 auto pD3DDevice = pRenderInterface->GetDirect3DDevice();
172 if ( pDevice->GetD3DCaps().PixelShaderVersion < 0xffff0104 )
181 ApplyGPUSpecificPatches();
185 return BaseClass::Validate();
196 ApplyGPUSpecificPatches();
200 return BaseClass::Validate();
258 if ( a_pRenderPacket && a_pRenderPacket->GetMesh() )
263 if ( pMesh->GetNumSubMeshes() == 0 )
return;
265 auto pSkeletonInstance = a_pRenderPacket->GetSkeletonInstance();
273 auto pD3DDevice = pRenderInterface->GetDirect3DDevice();
275 if ( pMaterial->IsHDLighting() && pMaterial->HasLighting1Tex() && pMaterial->HasLighting2Tex() )
281 pD3DDevice->SetVertexShader( m_hVertexShaderHD );
282 pD3DDevice->SetPixelShader( m_hPixelShader );
285 oViewModel.
Invert( a_pRenderPacket->GetModelViewMatrix() );
290 pD3DDevice->SetVertexShaderConstant( 94, &upVector, 1 );
292 TUINT ui8ShadeCoeff = a_pRenderPacket->GetShadeCoeff();
293 TFLOAT fShadeCoeff = a_pRenderPacket->GetShadeCoeff() * ( 1.0f / 255.0f );
297 if ( pDevice->GetD3DCaps().PixelShaderVersion < 0xffff0104 )
304 if ( ui8ShadeCoeff == 0 )
309 else if ( ui8ShadeCoeff == 255 )
314 else if ( ui8ShadeCoeff < 127 )
319 vLightingLerp2.
x = ( 1.0f - ( fShadeCoeff + fShadeCoeff ) ) * 0.3f + 0.7f;
320 vLightingLerp2.
y = vLightingLerp2.
x;
321 vLightingLerp2.
z = vLightingLerp2.
x;
328 vLightingLerp1.
x = ( ( fShadeCoeff - 0.5f ) + ( fShadeCoeff - 0.5f ) ) * 0.3f + 0.7f;
329 vLightingLerp1.
y = vLightingLerp1.
x;
330 vLightingLerp1.
z = vLightingLerp1.
x;
333 pD3DDevice->SetPixelShaderConstant( 0, &vLightingLerp1, 1 );
334 pD3DDevice->SetPixelShaderConstant( 1, &vLightingLerp2, 1 );
336 pD3DDevice->SetTextureStageState( 1, D3DTSS_MIPFILTER, 0 );
338 pD3DDevice->SetTextureStageState( 2, D3DTSS_MIPFILTER, 0 );
345 fShadeCoeff = fShadeCoeff - 0.3f;
347 vLightingLerp1.
x = 1.0f - fShadeCoeff;
348 vLightingLerp1.
y = vLightingLerp1.
x;
349 vLightingLerp1.
z = vLightingLerp1.
x;
350 vLightingLerp1.
w = 0.0f;
352 vLightingLerp2.
x = fShadeCoeff;
353 vLightingLerp2.
y = fShadeCoeff;
354 vLightingLerp2.
z = fShadeCoeff;
355 vLightingLerp2.
w = 0.0f;
357 pD3DDevice->SetTexture( 1, pMaterial->GetLightingTexture(
ASkinMaterial::LT_0 )->GetD3DTexture() );
358 pD3DDevice->SetTextureStageState( 1, D3DTSS_MIPFILTER, 0 );
360 pD3DDevice->SetTexture( 2, pMaterial->GetLightingTexture(
ASkinMaterial::LT_1 )->GetD3DTexture() );
361 pD3DDevice->SetTextureStageState( 2, D3DTSS_MIPFILTER, 0 );
363 pD3DDevice->SetTexture( 3, pMaterial->GetLightingTexture(
ASkinMaterial::LT_2 )->GetD3DTexture() );
364 pD3DDevice->SetTextureStageState( 3, D3DTSS_MIPFILTER, 0 );
366 pD3DDevice->SetTexture( 4, pMaterial->GetLightingTexture(
ASkinMaterial::LT_3 )->GetD3DTexture() );
367 pD3DDevice->SetTextureStageState( 4, D3DTSS_MIPFILTER, 0 );
369 pD3DDevice->SetPixelShaderConstant( 0, &vLightingLerp1, 1 );
370 pD3DDevice->SetPixelShaderConstant( 1, &vLightingLerp2, 1 );
378 pD3DDevice->SetVertexShaderConstant( 94, &upVector, 1 );
381 pD3DDevice->SetVertexShader( m_hVertexShader );
382 pD3DDevice->SetPixelShader( 0 );
384 auto pSomeTexture = pMaterial->GetSomeTexture();
388 constexpr TFLOAT kLightingLerp1 = 0.00f;
389 constexpr TFLOAT kLightingLerp2 = 0.25f;
391 pD3DDevice->SetTextureStageState( 3, D3DTSS_COLOROP, 1 );
392 pD3DDevice->SetTexture( 1, pSomeTexture->GetD3DTexture() );
393 pD3DDevice->SetTexture( 2, pSomeTexture->GetD3DTexture() );
394 pD3DDevice->SetTextureStageState( 1, D3DTSS_MIPFILTER, 2 );
395 pD3DDevice->SetTextureStageState( 2, D3DTSS_MIPFILTER, 2 );
396 vLightingLerp1.
x = kLightingLerp1;
397 vLightingLerp1.
y = kLightingLerp1;
398 vLightingLerp1.
z = kLightingLerp1;
399 vLightingLerp1.
w = 0.0f;
401 vLightingLerp2.
x = kLightingLerp2;
402 vLightingLerp2.
y = kLightingLerp2;
403 vLightingLerp2.
z = kLightingLerp2;
404 vLightingLerp2.
w = 0.0f;
406 pD3DDevice->SetPixelShaderConstant( 0, &vLightingLerp1, 1 );
407 pD3DDevice->SetPixelShaderConstant( 1, &vLightingLerp2, 1 );
408 pD3DDevice->SetPixelShader( m_hPixelShader );
413 D3DXMatrixMultiply( oModelViewProjection, a_pRenderPacket->GetModelViewMatrix(), pCurrentContext->GetProjectionMatrix() );
414 D3DXMatrixTranspose( oModelViewProjection, oModelViewProjection );
416 static constexpr TVector4 s_vUnknown =
TVector4( 256.0f, 256.0f, 256.0f, 256.0f );
418 pD3DDevice->SetVertexShaderConstant( 4, &s_vUnknown, 1 );
420 TFLOAT fLightDirX = -a_pRenderPacket->GetLightDirection().x;
421 TFLOAT fLightDirY = -a_pRenderPacket->GetLightDirection().y;
422 TFLOAT fLightDirZ = -a_pRenderPacket->GetLightDirection().z;
423 TVector4 vLightColour = a_pRenderPacket->GetLightColour();
425 TVector4 vAmbientColour = a_pRenderPacket->GetAmbientColour();
426 vAmbientColour.
w = a_pRenderPacket->GetAlpha();
428 TMatrix44 oModelView = a_pRenderPacket->GetModelViewMatrix();
431 for (
TINT i = 0; i < 4; i++ )
439 Toshi::TVector3 vLightDirWorld;
440 vLightDirWorld.x = oWorldModelView.
m_f11 * fLightDirX + oWorldModelView.
m_f21 * fLightDirY + oWorldModelView.
m_f31 * fLightDirZ;
441 vLightDirWorld.y = oWorldModelView.
m_f12 * fLightDirX + oWorldModelView.
m_f22 * fLightDirY + oWorldModelView.
m_f32 * fLightDirZ;
442 vLightDirWorld.z = oWorldModelView.
m_f13 * fLightDirX + oWorldModelView.
m_f23 * fLightDirY + oWorldModelView.
m_f33 * fLightDirZ;
443 vLightDirWorld.Normalize();
447 pD3DDevice->SetVertexShaderConstant( 89, &vLightDirWorld, 1 );
448 pD3DDevice->SetVertexShaderConstant( 90, &vAmbientColour, 1 );
449 pD3DDevice->SetVertexShaderConstant( 91, &vLightColour, 1 );
450 pD3DDevice->SetVertexShaderConstant( 93, &vUnkVector, 1 );
452 TINT iAlpha =
TINT( a_pRenderPacket->GetAlpha() * 128.0f );
453 if ( m_iAlphaRef < iAlpha ) iAlpha = m_iAlphaRef;
454 pD3DDevice->SetRenderState( D3DRS_ALPHAREF, iAlpha );
456 if ( pMaterial->GetBlendMode() != 0 || a_pRenderPacket->GetAlpha() < 1.0f )
460 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
466 pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
473 pVertexPool->GetHALBuffer( &vertexHALBuffer );
474 pD3DDevice->SetStreamSource( 0, vertexHALBuffer.
apVertexBuffers[ 0 ], 0x28 );
476 for (
TINT i = 0; i < pMesh->GetNumSubMeshes(); i++ )
478 auto pSubMesh = pMesh->GetSubMesh( i );
482 for (
TUINT k = 0; k < pSubMesh->uiNumBones; k++ )
484 auto pBone = &pSkeletonInstance->GetBone( pSubMesh->aBones[ k ] );
487 D3DXMatrixTranspose( oBoneTransform, pBone->m_Transform );
488 pD3DDevice->SetVertexShaderConstant( iCurrentRegister, oBoneTransform, 3 );
490 iCurrentRegister += 3;
497 pIndexPool->GetHALBuffer( &indexHALBuffer );
500 pD3DDevice->DrawIndexedPrimitive(
503 pVertexPool->GetNumVertices(),
505 pIndexPool->GetNumIndices()
512 RenderLowEnd( a_pRenderPacket );