}
}
- // Apply the "clean transparent" filter, if configured.
- if (g_settings->getBool("texture_clean_transparent"))
- imageCleanTransparent(toadd, 127);
-
if (need_to_grab)
toadd->grab();
m_images[name] = toadd;
video::ITexture* TextureSource::getTextureForMesh(const std::string &name, u32 *id)
{
- return getTexture(name + "^[autoupscaleformesh", id);
+ return getTexture(name + "^[applyfiltersformesh", id);
}
void TextureSource::processQueue()
Adds a cracking texture
N = animation frame count, P = crack progression
*/
- if (part_of_name.substr(0,6) == "[crack")
+ if (str_starts_with(part_of_name, "[crack"))
{
if (baseimg == NULL) {
errorstream<<"generateImagePart(): baseimg == NULL "
[combine:WxH:X,Y=filename:X,Y=filename2
Creates a bigger texture from an amount of smaller ones
*/
- else if (part_of_name.substr(0,8) == "[combine")
+ else if (str_starts_with(part_of_name, "[combine"))
{
Strfnd sf(part_of_name);
sf.next(":");
/*
"[brighten"
*/
- else if (part_of_name.substr(0,9) == "[brighten")
+ else if (str_starts_with(part_of_name, "[brighten"))
{
if (baseimg == NULL) {
errorstream<<"generateImagePart(): baseimg==NULL "
that the transparent parts don't look completely black
when simple alpha channel is used for rendering.
*/
- else if (part_of_name.substr(0,8) == "[noalpha")
+ else if (str_starts_with(part_of_name, "[noalpha"))
{
if (baseimg == NULL){
errorstream<<"generateImagePart(): baseimg==NULL "
"[makealpha:R,G,B"
Convert one color to transparent.
*/
- else if (part_of_name.substr(0,11) == "[makealpha:")
+ else if (str_starts_with(part_of_name, "[makealpha:"))
{
if (baseimg == NULL) {
errorstream<<"generateImagePart(): baseimg == NULL "
The resulting transform will be equivalent to one of the
eight existing ones, though (see: dihedral group).
*/
- else if (part_of_name.substr(0,10) == "[transform")
+ else if (str_starts_with(part_of_name, "[transform"))
{
if (baseimg == NULL) {
errorstream<<"generateImagePart(): baseimg == NULL "
Example (a grass block (not actually used in game):
"[inventorycube{grass.png{mud.png&grass_side.png{mud.png&grass_side.png"
*/
- else if (part_of_name.substr(0,14) == "[inventorycube")
+ else if (str_starts_with(part_of_name, "[inventorycube"))
{
if (baseimg != NULL){
errorstream<<"generateImagePart(): baseimg != NULL "
[lowpart:percent:filename
Adds the lower part of a texture
*/
- else if (part_of_name.substr(0,9) == "[lowpart:")
+ else if (str_starts_with(part_of_name, "[lowpart:"))
{
Strfnd sf(part_of_name);
sf.next(":");
Crops a frame of a vertical animation.
N = frame count, I = frame index
*/
- else if (part_of_name.substr(0,15) == "[verticalframe:")
+ else if (str_starts_with(part_of_name, "[verticalframe:"))
{
Strfnd sf(part_of_name);
sf.next(":");
[mask:filename
Applies a mask to an image
*/
- else if (part_of_name.substr(0,6) == "[mask:")
+ else if (str_starts_with(part_of_name, "[mask:"))
{
if (baseimg == NULL) {
errorstream << "generateImage(): baseimg == NULL "
Overlays image with given color
color = color as ColorString
*/
- else if (part_of_name.substr(0,10) == "[colorize:") {
+ else if (str_starts_with(part_of_name, "[colorize:"))
+ {
Strfnd sf(part_of_name);
sf.next(":");
std::string color_str = sf.next(":");
blit_with_interpolate_overlay(img, baseimg, v2s32(0,0), v2s32(0,0), dim, ratio);
img->drop();
}
- else if (part_of_name.substr(0,19) == "[autoupscaleformesh") {
+ else if (str_starts_with(part_of_name, "[applyfiltersformesh"))
+ {
+ // Apply the "clean transparent" filter, if configured.
+ if (g_settings->getBool("texture_clean_transparent"))
+ imageCleanTransparent(baseimg, 127);
+
/* Upscale textures to user's requested minimum size. This is a trick to make
* filters look as good on low-res textures as on high-res ones, by making
* low-res textures BECOME high-res ones. This is helpful for worlds that