Fixed --no-graphics option.

This commit is contained in:
hiker 2015-10-22 11:53:52 +11:00
parent 4833659085
commit 9b9fc2ee35

View File

@ -27,6 +27,7 @@
#include "graphics/shaders.hpp"
#include "io/file_manager.hpp"
#include "io/xml_node.hpp"
#include "modes/profile_world.hpp"
#include "modes/world.hpp"
#include "tracks/track.hpp"
#include "utils/string_utils.hpp"
@ -127,11 +128,16 @@ Material* MaterialManager::getDefaultMaterial(video::E_MATERIAL_TYPE shader_type
// TODO: workaround, should not hardcode these material types here?
// Try to find a cleaner way
if (shader_type == Shaders::getShader(ShaderType::ES_OBJECT_UNLIT))
// If graphics are disabled, shaders should not be accessed (getShader
// asserts that shaders are initialised).
if(!ProfileWorld::isNoGraphics() &&
shader_type == Shaders::getShader(ShaderType::ES_OBJECT_UNLIT))
default_material->setShaderType(Material::SHADERTYPE_SOLID_UNLIT);
else if (shader_type == Shaders::getShader(ShaderType::ES_OBJECTPASS_REF))
else if (!ProfileWorld::isNoGraphics() &&
shader_type == Shaders::getShader(ShaderType::ES_OBJECTPASS_REF))
default_material->setShaderType(Material::SHADERTYPE_ALPHA_TEST);
//else if (shader_type == Shaders::getShader(ShaderType::ES_OBJECTPASS))
//else if (!ProfileWorld::isNoGraphics() &&
// shader_type == Shaders::getShader(ShaderType::ES_OBJECTPASS))
// default_material->setShaderType(Material::SHADERTYPE_ALPHA_BLEND);
else
default_material->setShaderType(Material::SHADERTYPE_SOLID);