diff --git a/src/graphics/material_manager.cpp b/src/graphics/material_manager.cpp index 274901a96..8842938ea 100644 --- a/src/graphics/material_manager.cpp +++ b/src/graphics/material_manager.cpp @@ -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);