Add a fallback for when splatting is not available in overworld
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10468 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -1457,6 +1457,15 @@ bool IrrDriver::OnEvent(const irr::SEvent &event)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool IrrDriver::supportsSplatting()
|
||||
{
|
||||
return m_video_driver->queryFeature(video::EVDF_ARB_GLSL) &&
|
||||
m_video_driver->queryFeature(video::EVDF_PIXEL_SHADER_2_0) &&
|
||||
m_video_driver->queryFeature(video::EVDF_MULTITEXTURE );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark RTT
|
||||
|
||||
@@ -205,6 +205,8 @@ public:
|
||||
|
||||
inline PostProcessing* getPostProcessing() {return &m_post_processing;}
|
||||
|
||||
bool supportsSplatting();
|
||||
|
||||
// --------------------- RTT --------------------
|
||||
/**
|
||||
* Class that provides RTT (currently, only when no other 3D rendering
|
||||
|
||||
@@ -691,10 +691,7 @@ void Material::setMaterialProperties(video::SMaterial *m)
|
||||
}
|
||||
if (m_splatting)
|
||||
{
|
||||
IVideoDriver* video_driver = irr_driver->getVideoDriver();
|
||||
if (video_driver->queryFeature(video::EVDF_ARB_GLSL) &&
|
||||
video_driver->queryFeature(video::EVDF_PIXEL_SHADER_2_0) &&
|
||||
video_driver->queryFeature(video::EVDF_MULTITEXTURE ))
|
||||
if (irr_driver->supportsSplatting())
|
||||
{
|
||||
ITexture* tex = irr_driver->getTexture(m_splatting_texture_1);
|
||||
m->setTexture(1, tex);
|
||||
@@ -724,7 +721,7 @@ void Material::setMaterialProperties(video::SMaterial *m)
|
||||
|
||||
// Material and shaders
|
||||
IGPUProgrammingServices* gpu =
|
||||
video_driver->getGPUProgrammingServices();
|
||||
irr_driver->getVideoDriver()->getGPUProgrammingServices();
|
||||
s32 material_type = gpu->addHighLevelShaderMaterialFromFiles(
|
||||
(file_manager->getDataDir() +
|
||||
"shaders/splatting.vert").c_str(),
|
||||
|
||||
@@ -689,6 +689,29 @@ bool Track::loadMainTrack(const XMLNode &root)
|
||||
continue;
|
||||
}
|
||||
|
||||
// some static meshes are conditional
|
||||
std::string condition;
|
||||
n->get("if", &condition);
|
||||
if (condition == "splatting")
|
||||
{
|
||||
if (!irr_driver->supportsSplatting()) continue;
|
||||
}
|
||||
else if (condition.size() > 0)
|
||||
{
|
||||
fprintf(stderr, "[Track] WARNING: unknown condition <%s>\n", condition.c_str());
|
||||
}
|
||||
|
||||
std::string neg_condition;
|
||||
n->get("ifnot", &neg_condition);
|
||||
if (neg_condition == "splatting")
|
||||
{
|
||||
if (irr_driver->supportsSplatting()) continue;
|
||||
}
|
||||
else if (neg_condition.size() > 0)
|
||||
{
|
||||
fprintf(stderr, "[Track] WARNING: unknown condition <%s>\n", neg_condition.c_str());
|
||||
}
|
||||
|
||||
bool tangent = false;
|
||||
n->get("tangents", &tangent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user