Skip to content

Commit

Permalink
drop non-shader codepaths
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour committed Nov 15, 2024
1 parent 1c21a8c commit 3078a20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
33 changes: 3 additions & 30 deletions src/client/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,6 @@ void Camera::wield(const ItemStack &item)
void Camera::drawWieldedTool(irr::core::matrix4* translation,
const video::SColorf &post_color)
{
bool enable_shaders = g_settings->getBool("enable_shaders");

// Clear Z buffer so that the wielded tool stays in front of world geometry
m_wieldmgr->getVideoDriver()->clearBuffers(video::ECBF_DEPTH);

Expand All @@ -627,34 +625,9 @@ void Camera::drawWieldedTool(irr::core::matrix4* translation,
cam->updateAbsolutePosition();
cam->setTarget(focusPoint);
}
if (enable_shaders) {
m_client->setWieldPostEffectColor(post_color);
m_wieldmgr->drawAll();
m_client->setWieldPostEffectColor(video::SColorf(0.0f,0.0f,0.0f,0.0f));
} else {
// Without shaders we can't easily get the same effect.
// This only makes it looks slightly similar, but it's wrong, i.e. we
// can only make it darker.
video::SColorf col;
if (post_color.a == 0.0f) {
col = m_player_light_color;
} else {
video::SColorf post_color_nopremul = video::SColorf(
std::min(1.0f, post_color.r / post_color.a),
std::min(1.0f, post_color.g / post_color.a),
std::min(1.0f, post_color.b / post_color.a),
std::min(1.0f, post_color.a)
);
col = video::SColorf(
m_player_light_color.getRed() * post_color_nopremul.r * (1.0f / 255.0f),
m_player_light_color.getGreen() * post_color_nopremul.g * (1.0f / 255.0f),
m_player_light_color.getBlue() * post_color_nopremul.b * (1.0f / 255.0f),
1.0f
).getInterpolated(m_player_light_color, post_color_nopremul.a);
}
m_wieldnode->setNodeLightColor(col.toSColor());
m_wieldmgr->drawAll();
}
m_client->setWieldPostEffectColor(post_color);
m_wieldmgr->drawAll();
m_client->setWieldPostEffectColor(video::SColorf(0.0f,0.0f,0.0f,0.0f));
}

void Camera::drawNametags()
Expand Down
3 changes: 1 addition & 2 deletions src/client/clientmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,7 @@ ClientMap::getPostFxPolygons()
};

const std::optional<LiquidWaveParams> liquid_wave_params =
g_settings->getBool("enable_shaders")
&& g_settings->getBool("enable_waving_water") ?
g_settings->getBool("enable_waving_water") ?
LiquidWaveParams{
g_settings->getFloat("water_wave_height"),
g_settings->getFloat("water_wave_length"),
Expand Down

0 comments on commit 3078a20

Please sign in to comment.