mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Drop fixed pipeline lighting stuff (#15165)
This commit is contained in:
parent
6dfd61cba0
commit
70e169f165
34 changed files with 59 additions and 426 deletions
|
@ -63,7 +63,7 @@ Camera::Camera(MapDrawControl &draw_control, Client *client, RenderingEngine *re
|
|||
// all other 3D scene nodes and before the GUI.
|
||||
m_wieldmgr = smgr->createNewSceneManager();
|
||||
m_wieldmgr->addCameraSceneNode();
|
||||
m_wieldnode = new WieldMeshSceneNode(m_wieldmgr, -1, false);
|
||||
m_wieldnode = new WieldMeshSceneNode(m_wieldmgr, -1);
|
||||
m_wieldnode->setItem(ItemStack(), m_client);
|
||||
m_wieldnode->drop(); // m_wieldmgr grabbed it
|
||||
|
||||
|
|
|
@ -1223,7 +1223,6 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver,
|
|||
local_material.FrontfaceCulling = material.FrontfaceCulling;
|
||||
}
|
||||
local_material.BlendOperation = material.BlendOperation;
|
||||
local_material.Lighting = false;
|
||||
driver->setMaterial(local_material);
|
||||
++material_swaps;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ Clouds::Clouds(scene::ISceneManager* mgr, IShaderSource *ssrc,
|
|||
assert(ssrc);
|
||||
m_enable_shaders = g_settings->getBool("enable_shaders");
|
||||
|
||||
m_material.Lighting = false;
|
||||
m_material.BackfaceCulling = true;
|
||||
m_material.FogEnable = true;
|
||||
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
||||
|
@ -139,7 +138,7 @@ void Clouds::updateMesh()
|
|||
video::SColorf c_side_2_f(m_color);
|
||||
video::SColorf c_bottom_f(m_color);
|
||||
if (m_enable_shaders) {
|
||||
// shader mixes the base color, set via EmissiveColor
|
||||
// shader mixes the base color, set via ColorParam
|
||||
c_top_f = c_side_1_f = c_side_2_f = c_bottom_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
c_side_1_f.r *= 0.95f;
|
||||
|
@ -364,7 +363,7 @@ void Clouds::render()
|
|||
|
||||
m_material.BackfaceCulling = is3D();
|
||||
if (m_enable_shaders)
|
||||
m_material.EmissiveColor = m_color.toSColor();
|
||||
m_material.ColorParam = m_color.toSColor();
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
driver->setMaterial(m_material);
|
||||
|
|
|
@ -186,10 +186,10 @@ static bool logOnce(const std::ostringstream &from, std::ostream &log_to)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void setEmissiveColor(scene::ISceneNode *node, video::SColor color)
|
||||
static void setColorParam(scene::ISceneNode *node, video::SColor color)
|
||||
{
|
||||
for (u32 i = 0; i < node->getMaterialCount(); ++i)
|
||||
node->getMaterial(i).EmissiveColor = color;
|
||||
node->getMaterial(i).ColorParam = color;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -261,7 +261,6 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||
u16 indices[] = {0,1,2,2,3,0};
|
||||
buf->append(vertices, 4, indices, 6);
|
||||
// Set material
|
||||
buf->getMaterial().Lighting = false;
|
||||
buf->getMaterial().BackfaceCulling = false;
|
||||
buf->getMaterial().TextureLayers[0].Texture = tsrc->getTextureForMesh("rat.png");
|
||||
buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
|
@ -648,12 +647,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||
|
||||
auto setMaterial = [this] (video::SMaterial &mat) {
|
||||
mat.MaterialType = m_material_type;
|
||||
mat.Lighting = false;
|
||||
mat.FogEnable = true;
|
||||
if (m_enable_shaders) {
|
||||
mat.GouraudShading = false;
|
||||
mat.NormalizeNormals = true;
|
||||
}
|
||||
mat.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
|
@ -710,7 +704,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||
// Set material
|
||||
setMaterial(buf->getMaterial());
|
||||
if (m_enable_shaders) {
|
||||
buf->getMaterial().EmissiveColor = c;
|
||||
buf->getMaterial().ColorParam = c;
|
||||
}
|
||||
|
||||
// Add to mesh
|
||||
|
@ -736,7 +730,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||
// Set material
|
||||
setMaterial(buf->getMaterial());
|
||||
if (m_enable_shaders) {
|
||||
buf->getMaterial().EmissiveColor = c;
|
||||
buf->getMaterial().ColorParam = c;
|
||||
}
|
||||
|
||||
// Add to mesh
|
||||
|
@ -936,7 +930,7 @@ void GenericCAO::setNodeLight(const video::SColor &light_color)
|
|||
auto *node = getSceneNode();
|
||||
if (!node)
|
||||
return;
|
||||
setEmissiveColor(node, light_color);
|
||||
setColorParam(node, light_color);
|
||||
} else {
|
||||
if (m_meshnode) {
|
||||
setMeshColor(m_meshnode->getMesh(), light_color);
|
||||
|
@ -1366,15 +1360,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
material.MaterialTypeParam = m_material_type_param;
|
||||
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
// has directional lighting, it should work automatically.
|
||||
if (!m_prop.colors.empty()) {
|
||||
material.AmbientColor = m_prop.colors[0];
|
||||
material.DiffuseColor = m_prop.colors[0];
|
||||
material.SpecularColor = m_prop.colors[0];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
|
@ -1417,17 +1402,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
use_anisotropic_filter);
|
||||
});
|
||||
}
|
||||
for (u32 i = 0; i < m_prop.colors.size() &&
|
||||
i < m_animated_meshnode->getMaterialCount(); ++i)
|
||||
{
|
||||
video::SMaterial &material = m_animated_meshnode->getMaterial(i);
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
// has directional lighting, it should work automatically.
|
||||
material.AmbientColor = m_prop.colors[i];
|
||||
material.DiffuseColor = m_prop.colors[i];
|
||||
material.SpecularColor = m_prop.colors[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1445,20 +1419,9 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||
material.MaterialType = m_material_type;
|
||||
material.MaterialTypeParam = m_material_type_param;
|
||||
material.Lighting = false;
|
||||
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
||||
material.getTextureMatrix(0).makeIdentity();
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
// has directional lighting, it should work automatically.
|
||||
if(m_prop.colors.size() > i)
|
||||
{
|
||||
material.AmbientColor = m_prop.colors[i];
|
||||
material.DiffuseColor = m_prop.colors[i];
|
||||
material.SpecularColor = m_prop.colors[i];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
|
@ -1475,15 +1438,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
auto &material = m_meshnode->getMaterial(0);
|
||||
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
// has directional lighting, it should work automatically.
|
||||
if(!m_prop.colors.empty()) {
|
||||
material.AmbientColor = m_prop.colors[0];
|
||||
material.DiffuseColor = m_prop.colors[0];
|
||||
material.SpecularColor = m_prop.colors[0];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
|
@ -1500,19 +1454,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
auto &material = m_meshnode->getMaterial(1);
|
||||
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
// has directional lighting, it should work automatically.
|
||||
if (m_prop.colors.size() >= 2) {
|
||||
material.AmbientColor = m_prop.colors[1];
|
||||
material.DiffuseColor = m_prop.colors[1];
|
||||
material.SpecularColor = m_prop.colors[1];
|
||||
} else if (!m_prop.colors.empty()) {
|
||||
material.AmbientColor = m_prop.colors[0];
|
||||
material.DiffuseColor = m_prop.colors[0];
|
||||
material.SpecularColor = m_prop.colors[0];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
|
|
|
@ -40,7 +40,6 @@ public:
|
|||
video::ITexture *tex = env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png");
|
||||
m_spritenode->forEachMaterial([tex] (auto &mat) {
|
||||
mat.TextureLayers[0].Texture = tex;
|
||||
mat.Lighting = false;
|
||||
mat.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
mat.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
|
|
|
@ -99,7 +99,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||
|
||||
// Initialize m_selection_material
|
||||
|
||||
m_selection_material.Lighting = false;
|
||||
|
||||
if (g_settings->getBool("enable_shaders")) {
|
||||
IShaderSource *shdrsrc = client->getShaderSource();
|
||||
|
@ -121,7 +120,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||
}
|
||||
|
||||
// Initialize m_block_bounds_material
|
||||
m_block_bounds_material.Lighting = false;
|
||||
if (g_settings->getBool("enable_shaders")) {
|
||||
IShaderSource *shdrsrc = client->getShaderSource();
|
||||
auto shader_id = shdrsrc->getShader("default_shader", TILE_MATERIAL_ALPHA);
|
||||
|
@ -155,7 +153,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||
indices[4] = 3;
|
||||
indices[5] = 0;
|
||||
|
||||
b->getMaterial().Lighting = false;
|
||||
b->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
b->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
|
@ -1205,7 +1202,6 @@ void drawItemStack(
|
|||
|
||||
video::SMaterial &material = buf->getMaterial();
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
material.Lighting = false;
|
||||
driver->setMaterial(material);
|
||||
driver->drawMeshBuffer(buf);
|
||||
}
|
||||
|
|
|
@ -736,7 +736,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
|||
|
||||
// Create material
|
||||
video::SMaterial material;
|
||||
material.Lighting = false;
|
||||
material.BackfaceCulling = true;
|
||||
material.FogEnable = true;
|
||||
material.setTexture(0, p.layer.texture);
|
||||
|
|
|
@ -99,7 +99,6 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
|
|||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||
buf->append(vertices + 4 * i, 4, indices, 6);
|
||||
// Set default material
|
||||
buf->getMaterial().Lighting = false;
|
||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
buf->getMaterial().forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
|
@ -401,7 +400,6 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
|
|||
for (u16 j = 0; j < 6; j++)
|
||||
{
|
||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||
buf->getMaterial().Lighting = false;
|
||||
buf->getMaterial().forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
|
|
|
@ -612,7 +612,6 @@ void Minimap::drawMinimap(core::rect<s32> rect)
|
|||
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
|
||||
tex.MagFilter = video::ETMAGF_LINEAR;
|
||||
});
|
||||
material.Lighting = false;
|
||||
material.TextureLayers[0].Texture = minimap_texture;
|
||||
material.TextureLayers[1].Texture = data->heightmap_texture;
|
||||
|
||||
|
|
|
@ -989,7 +989,6 @@ video::SMaterial ParticleManager::getMaterialForParticle(const ClientParticleTex
|
|||
video::SMaterial material;
|
||||
|
||||
// Texture
|
||||
material.Lighting = false;
|
||||
material.BackfaceCulling = false;
|
||||
material.FogEnable = true;
|
||||
material.forEachTexture([] (auto &tex) {
|
||||
|
|
|
@ -218,15 +218,15 @@ class MainShaderConstantSetter : public IShaderConstantSetter
|
|||
CachedVertexShaderSetting<float, 16> m_texture{"mTexture"};
|
||||
|
||||
// commonly used way to pass material color to shader
|
||||
video::SColor m_emissive_color;
|
||||
CachedPixelShaderSetting<float, 4> m_emissive_color_setting{"emissiveColor"};
|
||||
video::SColor m_material_color;
|
||||
CachedPixelShaderSetting<float, 4> m_material_color_setting{"materialColor"};
|
||||
|
||||
public:
|
||||
~MainShaderConstantSetter() = default;
|
||||
|
||||
virtual void onSetMaterial(const video::SMaterial& material) override
|
||||
{
|
||||
m_emissive_color = material.EmissiveColor;
|
||||
m_material_color = material.ColorParam;
|
||||
}
|
||||
|
||||
virtual void onSetConstants(video::IMaterialRendererServices *services) override
|
||||
|
@ -254,8 +254,8 @@ public:
|
|||
m_texture.set(texture, services);
|
||||
}
|
||||
|
||||
video::SColorf emissive_color(m_emissive_color);
|
||||
m_emissive_color_setting.set(emissive_color, services);
|
||||
video::SColorf colorf(m_material_color);
|
||||
m_material_color_setting.set(colorf, services);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
shadowScreenQuad::shadowScreenQuad()
|
||||
{
|
||||
Material.Wireframe = false;
|
||||
Material.Lighting = false;
|
||||
|
||||
video::SColor color(0x0);
|
||||
Vertices[0] = video::S3DVertex(
|
||||
|
|
|
@ -39,7 +39,6 @@ using namespace irr::core;
|
|||
static video::SMaterial baseMaterial()
|
||||
{
|
||||
video::SMaterial mat;
|
||||
mat.Lighting = false;
|
||||
mat.ZBuffer = video::ECFN_DISABLED;
|
||||
mat.ZWriteEnable = video::EZW_OFF;
|
||||
mat.AntiAliasing = 0;
|
||||
|
@ -95,7 +94,6 @@ Sky::Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShade
|
|||
|
||||
for (int i = 5; i < 11; i++) {
|
||||
m_materials[i] = baseMaterial();
|
||||
m_materials[i].Lighting = true;
|
||||
m_materials[i].MaterialType = video::EMT_SOLID;
|
||||
}
|
||||
|
||||
|
@ -169,7 +167,8 @@ void Sky::render()
|
|||
video::SColor texel_color (255, texel->getRed(),
|
||||
texel->getGreen(), texel->getBlue());
|
||||
m_sun_tonemap->unlock();
|
||||
m_materials[3].EmissiveColor = texel_color;
|
||||
// Only accessed by our code later, not used by a shader
|
||||
m_materials[3].ColorParam = texel_color;
|
||||
}
|
||||
|
||||
if (m_moon_tonemap) {
|
||||
|
@ -178,7 +177,8 @@ void Sky::render()
|
|||
video::SColor texel_color (255, texel->getRed(),
|
||||
texel->getGreen(), texel->getBlue());
|
||||
m_moon_tonemap->unlock();
|
||||
m_materials[4].EmissiveColor = texel_color;
|
||||
// Only accessed by our code later, not used by a shader
|
||||
m_materials[4].ColorParam = texel_color;
|
||||
}
|
||||
|
||||
const f32 t = 1.0f;
|
||||
|
@ -465,11 +465,11 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||
// which keeps previous behavior.
|
||||
if (m_sun_tonemap && m_default_tint) {
|
||||
pointcolor_sun_f.r = pointcolor_light *
|
||||
(float)m_materials[3].EmissiveColor.getRed() / 255;
|
||||
(float)m_materials[3].ColorParam.getRed() / 255;
|
||||
pointcolor_sun_f.b = pointcolor_light *
|
||||
(float)m_materials[3].EmissiveColor.getBlue() / 255;
|
||||
(float)m_materials[3].ColorParam.getBlue() / 255;
|
||||
pointcolor_sun_f.g = pointcolor_light *
|
||||
(float)m_materials[3].EmissiveColor.getGreen() / 255;
|
||||
(float)m_materials[3].ColorParam.getGreen() / 255;
|
||||
} else if (!m_default_tint) {
|
||||
pointcolor_sun_f = m_sky_params.fog_sun_tint;
|
||||
} else {
|
||||
|
@ -498,11 +498,11 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||
}
|
||||
if (m_moon_tonemap && m_default_tint) {
|
||||
pointcolor_moon_f.r = pointcolor_light *
|
||||
(float)m_materials[4].EmissiveColor.getRed() / 255;
|
||||
(float)m_materials[4].ColorParam.getRed() / 255;
|
||||
pointcolor_moon_f.b = pointcolor_light *
|
||||
(float)m_materials[4].EmissiveColor.getBlue() / 255;
|
||||
(float)m_materials[4].ColorParam.getBlue() / 255;
|
||||
pointcolor_moon_f.g = pointcolor_light *
|
||||
(float)m_materials[4].EmissiveColor.getGreen() / 255;
|
||||
(float)m_materials[4].ColorParam.getGreen() / 255;
|
||||
}
|
||||
|
||||
video::SColor pointcolor_sun = pointcolor_sun_f.toSColor();
|
||||
|
@ -603,11 +603,8 @@ void Sky::draw_sun(video::IVideoDriver *driver, const video::SColor &suncolor,
|
|||
// Another magic number that contributes to the ratio 1.57 sun/moon size
|
||||
// difference.
|
||||
float d = (sunsize * 1.7) * m_sun_params.scale;
|
||||
video::SColor c;
|
||||
if (m_sun_tonemap)
|
||||
c = video::SColor(0, 0, 0, 0);
|
||||
else
|
||||
c = video::SColor(255, 255, 255, 255);
|
||||
video::SColor c = m_sun_tonemap ? m_materials[3].ColorParam :
|
||||
video::SColor(255, 255, 255, 255);
|
||||
draw_sky_body(vertices, -d, d, c);
|
||||
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
|
||||
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
|
||||
|
@ -660,11 +657,8 @@ void Sky::draw_moon(video::IVideoDriver *driver, const video::SColor &mooncolor,
|
|||
// Another magic number that contributes to the ratio 1.57 sun/moon size
|
||||
// difference.
|
||||
float d = (moonsize * 1.9) * m_moon_params.scale;
|
||||
video::SColor c;
|
||||
if (m_moon_tonemap)
|
||||
c = video::SColor(0, 0, 0, 0);
|
||||
else
|
||||
c = video::SColor(255, 255, 255, 255);
|
||||
video::SColor c = m_sun_tonemap ? m_materials[4].ColorParam :
|
||||
video::SColor(255, 255, 255, 255);
|
||||
draw_sky_body(vertices, -d, d, c);
|
||||
place_sky_body(vertices, -90, wicked_time_of_day * 360 - 90);
|
||||
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
|
||||
|
@ -689,7 +683,7 @@ void Sky::draw_stars(video::IVideoDriver * driver, float wicked_time_of_day)
|
|||
if (color.a <= 0.0f) // Stars are only drawn when not fully transparent
|
||||
return;
|
||||
if (m_enable_shaders)
|
||||
m_materials[0].EmissiveColor = color.toSColor();
|
||||
m_materials[0].ColorParam = color.toSColor();
|
||||
else
|
||||
setMeshBufferColor(m_stars.get(), color.toSColor());
|
||||
|
||||
|
@ -745,7 +739,6 @@ void Sky::setSunTexture(const std::string &sun_texture,
|
|||
m_sun_params.tonemap = sun_tonemap;
|
||||
m_sun_tonemap = tsrc->isKnownSourceImage(sun_tonemap) ?
|
||||
tsrc->getTexture(sun_tonemap) : nullptr;
|
||||
m_materials[3].Lighting = !!m_sun_tonemap;
|
||||
|
||||
if (m_sun_params.texture == sun_texture && !m_first_update)
|
||||
return;
|
||||
|
@ -765,7 +758,6 @@ void Sky::setSunTexture(const std::string &sun_texture,
|
|||
m_materials[3].setTexture(0, m_sun_texture);
|
||||
m_materials[3].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
disableTextureFiltering(m_materials[3]);
|
||||
m_materials[3].Lighting = !!m_sun_tonemap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -789,7 +781,6 @@ void Sky::setMoonTexture(const std::string &moon_texture,
|
|||
m_moon_params.tonemap = moon_tonemap;
|
||||
m_moon_tonemap = tsrc->isKnownSourceImage(moon_tonemap) ?
|
||||
tsrc->getTexture(moon_tonemap) : nullptr;
|
||||
m_materials[4].Lighting = !!m_moon_tonemap;
|
||||
|
||||
if (m_moon_params.texture == moon_texture && !m_first_update)
|
||||
return;
|
||||
|
@ -809,7 +800,6 @@ void Sky::setMoonTexture(const std::string &moon_texture,
|
|||
m_materials[4].setTexture(0, m_moon_texture);
|
||||
m_materials[4].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
disableTextureFiltering(m_materials[4]);
|
||||
m_materials[4].Lighting = !!m_moon_tonemap;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -194,10 +194,9 @@ private:
|
|||
static ExtrusionMeshCache *g_extrusion_mesh_cache = nullptr;
|
||||
|
||||
|
||||
WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id, bool lighting):
|
||||
WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id):
|
||||
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
|
||||
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF),
|
||||
m_lighting(lighting)
|
||||
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");
|
||||
|
@ -390,8 +389,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||
// overlay is white, if present
|
||||
m_colors.emplace_back(true, video::SColor(0xFFFFFFFF));
|
||||
// initialize the color
|
||||
if (!m_lighting)
|
||||
setColor(video::SColor(0xFFFFFFFF));
|
||||
setColor(video::SColor(0xFFFFFFFF));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -468,8 +466,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||
}
|
||||
|
||||
// initialize the color
|
||||
if (!m_lighting)
|
||||
setColor(video::SColor(0xFFFFFFFF));
|
||||
setColor(video::SColor(0xFFFFFFFF));
|
||||
return;
|
||||
} else {
|
||||
const std::string inventory_image = item.getInventoryImage(idef);
|
||||
|
@ -485,8 +482,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||
m_colors.emplace_back(true, video::SColor(0xFFFFFFFF));
|
||||
|
||||
// initialize the color
|
||||
if (!m_lighting)
|
||||
setColor(video::SColor(0xFFFFFFFF));
|
||||
setColor(video::SColor(0xFFFFFFFF));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -496,7 +492,6 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||
|
||||
void WieldMeshSceneNode::setColor(video::SColor c)
|
||||
{
|
||||
assert(!m_lighting);
|
||||
scene::IMesh *mesh = m_meshnode->getMesh();
|
||||
if (!mesh)
|
||||
return;
|
||||
|
@ -535,7 +530,7 @@ void WieldMeshSceneNode::setNodeLightColor(video::SColor color)
|
|||
if (m_enable_shaders) {
|
||||
for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
|
||||
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||
material.EmissiveColor = color;
|
||||
material.ColorParam = color;
|
||||
}
|
||||
} else {
|
||||
setColor(color);
|
||||
|
@ -565,11 +560,6 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
|||
mesh->setHardwareMappingHint(scene::EHM_DYNAMIC);
|
||||
}
|
||||
|
||||
m_meshnode->forEachMaterial([this] (auto &mat) {
|
||||
mat.Lighting = m_lighting;
|
||||
// need to normalize normals when lighting is enabled (because of setScale())
|
||||
mat.NormalizeNormals = m_lighting;
|
||||
});
|
||||
m_meshnode->setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -667,7 +657,6 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
material.BackfaceCulling = cull_backface;
|
||||
material.Lighting = false;
|
||||
}
|
||||
|
||||
rotateMeshXZby(mesh, -45);
|
||||
|
@ -720,7 +709,6 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
|
|||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
material.BackfaceCulling = true;
|
||||
material.Lighting = false;
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ struct ItemMesh
|
|||
class WieldMeshSceneNode : public scene::ISceneNode
|
||||
{
|
||||
public:
|
||||
WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id = -1, bool lighting = false);
|
||||
WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id = -1);
|
||||
virtual ~WieldMeshSceneNode();
|
||||
|
||||
void setCube(const ContentFeatures &f, v3f wield_scale);
|
||||
|
@ -132,9 +132,6 @@ private:
|
|||
scene::IMeshSceneNode *m_meshnode = nullptr;
|
||||
video::E_MATERIAL_TYPE m_material_type;
|
||||
|
||||
// True if SMaterial::Lighting should be enabled.
|
||||
bool m_lighting;
|
||||
|
||||
bool m_enable_shaders;
|
||||
bool m_anisotropic_filter;
|
||||
bool m_bilinear_filter;
|
||||
|
|
|
@ -67,7 +67,6 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
|
|||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
material.TextureLayers[0].Texture = texture;
|
||||
material.Lighting = false;
|
||||
material.FogEnable = true;
|
||||
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||
|
|
|
@ -1098,13 +1098,9 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
|
|||
|
||||
// the default font material
|
||||
SMaterial mat;
|
||||
mat.Lighting = true;
|
||||
mat.ZWriteEnable = video::EZW_OFF;
|
||||
mat.NormalizeNormals = true;
|
||||
mat.ColorMaterial = video::ECM_NONE;
|
||||
mat.MaterialType = use_transparency ? video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_SOLID;
|
||||
mat.MaterialTypeParam = 0.01f;
|
||||
mat.DiffuseColor = color;
|
||||
|
||||
wchar_t current_char = 0, previous_char = 0;
|
||||
u32 n = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue