1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Make shading of CAOs optional (#10033)

This commit is contained in:
Danila Shutov 2020-06-16 22:48:31 +03:00 committed by GitHub
parent 0a1181f763
commit 3a6dfda358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 7 deletions

View file

@ -577,10 +577,16 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
if (m_enable_shaders) {
IShaderSource *shader_source = m_client->getShaderSource();
u32 shader_id = shader_source->getShader(
"object_shader",
(m_prop.use_texture_alpha) ? TILE_MATERIAL_ALPHA : TILE_MATERIAL_BASIC,
NDT_NORMAL);
MaterialType material_type;
if (m_prop.shaded && m_prop.glow == 0)
material_type = (m_prop.use_texture_alpha) ?
TILE_MATERIAL_ALPHA : TILE_MATERIAL_BASIC;
else
material_type = (m_prop.use_texture_alpha) ?
TILE_MATERIAL_PLAIN_ALPHA : TILE_MATERIAL_PLAIN;
u32 shader_id = shader_source->getShader("object_shader", material_type, NDT_NORMAL);
m_material_type = shader_source->getShaderInfo(shader_id).material;
} else {
m_material_type = (m_prop.use_texture_alpha) ?
@ -1504,6 +1510,7 @@ bool GenericCAO::visualExpiryRequired(const ObjectProperties &new_) const
return old.backface_culling != new_.backface_culling ||
old.is_visible != new_.is_visible ||
old.mesh != new_.mesh ||
old.shaded != new_.shaded ||
old.use_texture_alpha != new_.use_texture_alpha ||
old.visual != new_.visual ||
old.visual_size != new_.visual_size ||