mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Initial refactoring on shader usage and generation
`IShaderSource` was designed with the idea that if you want a shader, you must want it for a node. So it depends heavily on being given a tile material and the node drawtype. But this doesn't make sense neither in theory nor in practice. This commit takes a small step towards removing the incorrect abstraction.
This commit is contained in:
parent
eb8beb335e
commit
a6293b9861
14 changed files with 81 additions and 53 deletions
|
@ -86,10 +86,11 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||
|
||||
// Initialize m_selection_material
|
||||
IShaderSource *shdrsrc = client->getShaderSource();
|
||||
{
|
||||
auto shader_id = shdrsrc->getShader(
|
||||
m_mode == HIGHLIGHT_HALO ? "selection_shader" : "default_shader", TILE_MATERIAL_ALPHA);
|
||||
if (m_mode == HIGHLIGHT_HALO) {
|
||||
auto shader_id = shdrsrc->getShaderRaw("selection_shader", true);
|
||||
m_selection_material.MaterialType = shdrsrc->getShaderInfo(shader_id).material;
|
||||
} else {
|
||||
m_selection_material.MaterialType = video::EMT_SOLID;
|
||||
}
|
||||
|
||||
if (m_mode == HIGHLIGHT_BOX) {
|
||||
|
@ -103,10 +104,7 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||
}
|
||||
|
||||
// Initialize m_block_bounds_material
|
||||
{
|
||||
auto shader_id = shdrsrc->getShader("default_shader", TILE_MATERIAL_ALPHA);
|
||||
m_block_bounds_material.MaterialType = shdrsrc->getShaderInfo(shader_id).material;
|
||||
}
|
||||
m_block_bounds_material.MaterialType = video::EMT_SOLID;
|
||||
m_block_bounds_material.Thickness =
|
||||
rangelim(g_settings->getS16("selectionbox_width"), 1, 5);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue