mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
shader loading tweak
This commit is contained in:
16
material.cpp
16
material.cpp
@@ -124,6 +124,9 @@ void opengl_material::finalize(bool Loadnow)
|
|||||||
parse_info.reset();
|
parse_info.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!shader)
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto it : shader->param_conf)
|
for (auto it : shader->param_conf)
|
||||||
{
|
{
|
||||||
gl::shader::param_entry entry = it.second;
|
gl::shader::param_entry entry = it.second;
|
||||||
@@ -376,10 +379,15 @@ material_manager::create( std::string const &Filename, bool const Loadnow ) {
|
|||||||
|
|
||||||
if( false == material.name.empty() ) {
|
if( false == material.name.empty() ) {
|
||||||
// if we have material name and shader it means resource was processed succesfully
|
// if we have material name and shader it means resource was processed succesfully
|
||||||
material.finalize(Loadnow);
|
try {
|
||||||
materialhandle = m_materials.size();
|
material.finalize(Loadnow);
|
||||||
m_materialmappings.emplace( material.name, materialhandle );
|
materialhandle = m_materials.size();
|
||||||
m_materials.emplace_back( std::move(material) );
|
m_materialmappings.emplace( material.name, materialhandle );
|
||||||
|
m_materials.emplace_back( std::move(material) );
|
||||||
|
} catch (gl::shader_exception const &e) {
|
||||||
|
ErrorLog("invalid shader: " + std::string(e.what()));
|
||||||
|
m_materialmappings.emplace( filename, materialhandle );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// otherwise record our failure to process the resource, to speed up subsequent attempts
|
// otherwise record our failure to process the resource, to speed up subsequent attempts
|
||||||
|
|||||||
Reference in New Issue
Block a user