mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
parent
0fde9ab7e8
commit
794aea8e92
35 changed files with 117 additions and 411 deletions
|
@ -184,7 +184,6 @@ WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id):
|
|||
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
|
||||
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
||||
{
|
||||
m_enable_shaders = g_settings->getBool("enable_shaders");
|
||||
m_anisotropic_filter = g_settings->getBool("anisotropic_filter");
|
||||
m_bilinear_filter = g_settings->getBool("bilinear_filter");
|
||||
m_trilinear_filter = g_settings->getBool("trilinear_filter");
|
||||
|
@ -233,7 +232,7 @@ void WieldMeshSceneNode::setCube(const ContentFeatures &f,
|
|||
scene::IMesh *cubemesh = g_extrusion_mesh_cache->createCube();
|
||||
scene::SMesh *copy = cloneMesh(cubemesh);
|
||||
cubemesh->drop();
|
||||
postProcessNodeMesh(copy, f, false, true, &m_material_type, &m_colors, true);
|
||||
postProcessNodeMesh(copy, f, false, &m_material_type, &m_colors, true);
|
||||
changeToMesh(copy);
|
||||
copy->drop();
|
||||
m_meshnode->setScale(wield_scale * WIELD_SCALE_FACTOR);
|
||||
|
@ -297,7 +296,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
|
|||
static scene::SMesh *createSpecialNodeMesh(Client *client, MapNode n,
|
||||
std::vector<ItemPartColor> *colors, const ContentFeatures &f)
|
||||
{
|
||||
MeshMakeData mesh_make_data(client->ndef(), 1, false);
|
||||
MeshMakeData mesh_make_data(client->ndef(), 1);
|
||||
MeshCollector collector(v3f(0.0f * BS), v3f());
|
||||
mesh_make_data.setSmoothLighting(false);
|
||||
MapblockMeshGenerator gen(&mesh_make_data, &collector,
|
||||
|
@ -354,10 +353,8 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||
|
||||
scene::SMesh *mesh = nullptr;
|
||||
|
||||
if (m_enable_shaders) {
|
||||
u32 shader_id = shdrsrc->getShader("object_shader", TILE_MATERIAL_BASIC, NDT_NORMAL);
|
||||
m_material_type = shdrsrc->getShaderInfo(shader_id).material;
|
||||
}
|
||||
u32 shader_id = shdrsrc->getShader("object_shader", TILE_MATERIAL_BASIC, NDT_NORMAL);
|
||||
m_material_type = shdrsrc->getShaderInfo(shader_id).material;
|
||||
|
||||
// Color-related
|
||||
m_colors.clear();
|
||||
|
@ -500,10 +497,7 @@ void WieldMeshSceneNode::setColor(video::SColor c)
|
|||
|
||||
if (m_colors[j].needColorize(buffercolor)) {
|
||||
buf->setDirty(scene::EBT_VERTEX);
|
||||
if (m_enable_shaders)
|
||||
setMeshBufferColor(buf, buffercolor);
|
||||
else
|
||||
colorizeMeshBuffer(buf, &buffercolor);
|
||||
setMeshBufferColor(buf, buffercolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -513,13 +507,11 @@ void WieldMeshSceneNode::setNodeLightColor(video::SColor color)
|
|||
if (!m_meshnode)
|
||||
return;
|
||||
|
||||
if (m_enable_shaders) {
|
||||
{
|
||||
for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
|
||||
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||
material.ColorParam = color;
|
||||
}
|
||||
} else {
|
||||
setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -538,12 +530,7 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
|||
dummymesh->drop(); // m_meshnode grabbed it
|
||||
} else {
|
||||
m_meshnode->setMesh(mesh);
|
||||
// without shaders recolored often for lighting
|
||||
// otherwise only once
|
||||
if (m_enable_shaders)
|
||||
mesh->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
else
|
||||
mesh->setHardwareMappingHint(scene::EHM_DYNAMIC);
|
||||
mesh->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
|
||||
m_meshnode->setVisible(true);
|
||||
|
@ -596,7 +583,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||
} else
|
||||
scaleMesh(mesh, v3f(1.2, 1.2, 1.2));
|
||||
// add overlays
|
||||
postProcessNodeMesh(mesh, f, false, false, nullptr,
|
||||
postProcessNodeMesh(mesh, f, false, nullptr,
|
||||
&result->buffer_colors, true);
|
||||
if (f.drawtype == NDT_ALLFACES)
|
||||
scaleMesh(mesh, v3f(f.visual_scale));
|
||||
|
@ -704,7 +691,7 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
|
|||
}
|
||||
|
||||
void postProcessNodeMesh(scene::SMesh *mesh, const ContentFeatures &f,
|
||||
bool use_shaders, bool set_material, const video::E_MATERIAL_TYPE *mattype,
|
||||
bool set_material, const video::E_MATERIAL_TYPE *mattype,
|
||||
std::vector<ItemPartColor> *colors, bool apply_scale)
|
||||
{
|
||||
const u32 mc = mesh->getMeshBufferCount();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue