Gunship is hard-coded to look for shaders/debug_draw.glsl on startup, so if that file doesn't exist then the game crashes with a rather unhelpful warning message about unwrapping an Err value. debug_draw.glsl is distributed with the Gunship source code, however the resource loader uses relative paths so it still won't find the file unless the developer copies it to their local shaders directory.
While there are a bunch of changes that need to be made to the resource manager and the way Gunship handles resource files in general, I think the solution here is to have the shader code hard-coded insude debug_draw.rs the same way that the debug wireframe meshes are. To do this will require the following:
Copy the contents of debug_draw.glsl into a raw string in debug_draw.rs.
In DebugDraw::new() remove the call to call to resource_manager.get_shader().
Split up ResourceManager::get_shader() into two functions: get_shader() and compile_shader() where get_shader() loads the contents of the file into a string and then passes it to compile_shader() which parses and those contents and has the renderer compile them.
Have DebugDraw::new() call resource_manager.comiple_shader() passing in the hard-coded shader string.
Gunship is hard-coded to look for
shaders/debug_draw.glsl
on startup, so if that file doesn't exist then the game crashes with a rather unhelpful warning message about unwrapping anErr
value.debug_draw.glsl
is distributed with the Gunship source code, however the resource loader uses relative paths so it still won't find the file unless the developer copies it to their local shaders directory.While there are a bunch of changes that need to be made to the resource manager and the way Gunship handles resource files in general, I think the solution here is to have the shader code hard-coded insude
debug_draw.rs
the same way that the debug wireframe meshes are. To do this will require the following:debug_draw.glsl
into a raw string indebug_draw.rs
.DebugDraw::new()
remove the call to call toresource_manager.get_shader()
.ResourceManager::get_shader()
into two functions:get_shader()
andcompile_shader()
whereget_shader()
loads the contents of the file into a string and then passes it tocompile_shader()
which parses and those contents and has the renderer compile them.DebugDraw::new()
callresource_manager.comiple_shader()
passing in the hard-coded shader string.