Viewer:
- added hacky support for pre-shader graphics cards. Seems to work, but I'll not know for sure until I acutally test it on such a crippled hardware. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@174 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
92ba3e433e
commit
366562e5d1
|
@ -1905,6 +1905,10 @@ int CDisplay::RenderNode (aiNode* piNode,const aiMatrix4x4& piMatrix,
|
||||||
piEnd->SetVector( "vCameraPos",&apcVec[0]);
|
piEnd->SetVector( "vCameraPos",&apcVec[0]);
|
||||||
|
|
||||||
// setup the best technique
|
// setup the best technique
|
||||||
|
if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0))
|
||||||
|
{
|
||||||
|
g_piDefaultEffect->SetTechnique( "DefaultFXSpecular_FF");
|
||||||
|
} else
|
||||||
if (g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || g_sOptions.bLowQuality)
|
if (g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || g_sOptions.bLowQuality)
|
||||||
{
|
{
|
||||||
if (g_sOptions.b3Lights)
|
if (g_sOptions.b3Lights)
|
||||||
|
|
|
@ -1054,7 +1054,13 @@ int CMaterialManager::CreateMaterial(
|
||||||
CLogDisplay::Instance().AddEntry("Unable to load material: UNNAMED");
|
CLogDisplay::Instance().AddEntry("Unable to load material: UNNAMED");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else
|
||||||
|
{
|
||||||
|
// use Fixed Function effect when working with shaderless cards
|
||||||
|
if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0))
|
||||||
|
pcMesh->piEffect->SetTechnique( "MaterialFX_FF");
|
||||||
|
}
|
||||||
|
|
||||||
if( piBuffer) piBuffer->Release();
|
if( piBuffer) piBuffer->Release();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1205,6 +1211,10 @@ int CMaterialManager::SetupMaterial (
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the correct shader technique to be used for drawing
|
// setup the correct shader technique to be used for drawing
|
||||||
|
if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0))
|
||||||
|
{
|
||||||
|
g_piDefaultEffect->SetTechnique( "MaterialFXSpecular_FF");
|
||||||
|
} else
|
||||||
if (g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || g_sOptions.bLowQuality)
|
if (g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || g_sOptions.bLowQuality)
|
||||||
{
|
{
|
||||||
if (g_sOptions.b3Lights)
|
if (g_sOptions.b3Lights)
|
||||||
|
|
|
@ -714,6 +714,7 @@ std::string g_szMaterialShader = std::string(
|
||||||
|
|
||||||
// and specular including emissive part
|
// and specular including emissive part
|
||||||
"float4 specularColor = float4( 0.0f, 0.0f, 0.0f, 1.0f); \n"
|
"float4 specularColor = float4( 0.0f, 0.0f, 0.0f, 1.0f); \n"
|
||||||
|
"#ifdef AV_SPECULAR_COMPONENT\n"
|
||||||
"float3 viewDir = normalize( worldPos - vCameraPos); \n"
|
"float3 viewDir = normalize( worldPos - vCameraPos); \n"
|
||||||
"for( int a = 0; a < 5; a++) \n"
|
"for( int a = 0; a < 5; a++) \n"
|
||||||
"{ \n"
|
"{ \n"
|
||||||
|
@ -721,6 +722,7 @@ std::string g_szMaterialShader = std::string(
|
||||||
" float specIntensity = pow( dot( -reflDir, viewDir), SPECULAR_STRENGTH) * SPECULARITY; \n"
|
" float specIntensity = pow( dot( -reflDir, viewDir), SPECULAR_STRENGTH) * SPECULARITY; \n"
|
||||||
" specularColor.rgb += afLightColor[a] * specIntensity; \n"
|
" specularColor.rgb += afLightColor[a] * specIntensity; \n"
|
||||||
"} \n"
|
"} \n"
|
||||||
|
"#endif // AV_SPECULAR_COMPONENT\n"
|
||||||
// factor in material properties and the emissive part
|
// factor in material properties and the emissive part
|
||||||
"Out.SpecularColor = specularColor * SPECULAR_COLOR + EMISSIVE_COLOR; \n"
|
"Out.SpecularColor = specularColor * SPECULAR_COLOR + EMISSIVE_COLOR; \n"
|
||||||
|
|
||||||
|
|
|
@ -924,6 +924,13 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
}
|
}
|
||||||
g_piDevice->SetFVF(AssetHelper::Vertex::GetFVF());
|
g_piDevice->SetFVF(AssetHelper::Vertex::GetFVF());
|
||||||
|
|
||||||
|
// get the capabilities of the device object
|
||||||
|
g_piDevice->GetDeviceCaps(&g_sCaps);
|
||||||
|
if(g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0))
|
||||||
|
{
|
||||||
|
EnableWindow(GetDlgItem(g_hDlg,IDC_LOWQUALITY),FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// compile the default material shader (gray gouraud/phong)
|
// compile the default material shader (gray gouraud/phong)
|
||||||
ID3DXBuffer* piBuffer = NULL;
|
ID3DXBuffer* piBuffer = NULL;
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
|
@ -948,6 +955,10 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
piBuffer = NULL;
|
piBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use Fixed Function effect when working with shaderless cards
|
||||||
|
if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0))
|
||||||
|
g_piDefaultEffect->SetTechnique( "DefaultFXSpecular_FF");
|
||||||
|
|
||||||
// create the shader used to draw the HUD
|
// create the shader used to draw the HUD
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szPassThroughShader.c_str(),(UINT)g_szPassThroughShader.length(),
|
g_szPassThroughShader.c_str(),(UINT)g_szPassThroughShader.length(),
|
||||||
|
@ -966,6 +977,10 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
piBuffer = NULL;
|
piBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use Fixed Function effect when working with shaderless cards
|
||||||
|
if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0))
|
||||||
|
g_piPassThroughEffect->SetTechnique( "PassThrough_FF");
|
||||||
|
|
||||||
// create the shader used to visualize normal vectors
|
// create the shader used to visualize normal vectors
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szNormalsShader.c_str(),(UINT)g_szNormalsShader.length(),
|
g_szNormalsShader.c_str(),(UINT)g_szNormalsShader.length(),
|
||||||
|
@ -984,12 +999,9 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
piBuffer = NULL;
|
piBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the capabilities of the device object
|
// use Fixed Function effect when working with shaderless cards
|
||||||
g_piDevice->GetDeviceCaps(&g_sCaps);
|
if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0))
|
||||||
if(g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0))
|
g_piNormalsEffect->SetTechnique( "RenderNormals_FF");
|
||||||
{
|
|
||||||
EnableWindow(GetDlgItem(g_hDlg,IDC_LOWQUALITY),FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the texture for the HUD
|
// create the texture for the HUD
|
||||||
CreateHUDTexture();
|
CreateHUDTexture();
|
||||||
|
|
Loading…
Reference in New Issue