mirror of
https://github.com/minetest/minetest.git
synced 2024-07-02 14:10:33 +02:00
Make item alpha rendering consistent with their definition
This commit is contained in:
parent
1298374818
commit
a73b4f27cb
@ -23,6 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "EMaterialTypes.h"
|
||||
#include "itemdef.h"
|
||||
#include "mapnode.h"
|
||||
#include "settings.h"
|
||||
#include "util/numeric.h"
|
||||
#include "log.h"
|
||||
@ -1143,7 +1146,23 @@ void drawItemStack(
|
||||
}
|
||||
|
||||
video::SMaterial &material = buf->getMaterial();
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
material.MaterialTypeParam = 0.0f; // render everything with alpha > 0
|
||||
if (def.type == ITEM_NODE) {
|
||||
switch (client->ndef()->get(def.name).alpha) {
|
||||
case ALPHAMODE_OPAQUE:
|
||||
material.MaterialType = video::EMT_SOLID;
|
||||
break;
|
||||
case ALPHAMODE_CLIP:
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
break;
|
||||
case ALPHAMODE_BLEND:
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
material.Lighting = false;
|
||||
driver->setMaterial(material);
|
||||
driver->drawMeshBuffer(buf);
|
||||
|
Loading…
Reference in New Issue
Block a user