1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

Added simple alpha testing

This commit is contained in:
Daniel Evans 2013-07-02 03:51:59 +01:00
parent db3fc6f2dd
commit 92c8f6a10c
2 changed files with 4 additions and 3 deletions

View File

@ -55,7 +55,7 @@ bool TextureLoader::loadFromMemory(char *data)
uint8_t* coldata = reinterpret_cast<uint8_t*>(rootSection.raw() + sizeof(RW::BSSectionHeader) + sizeof(RW::BSTextureNative) + sizeof(RW::BSPaletteData) - 4);
uint8_t fullColor[texNative.width * texNative.height * 4];
bool hasAlpha = (texNative.rasterformat & 0x0500) == 0x0500;
bool hasAlpha = texNative.alpha == 1;
for(size_t j = 0; j < texNative.width * texNative.height; ++j)
{

View File

@ -38,8 +38,9 @@ const char *fragmentShaderSource = "#version 130\n"
"uniform sampler2D texture;"
"void main()"
"{"
// " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"
" gl_FragColor = texture2D(texture, TexCoords);"
" vec4 c = texture2D(texture, TexCoords);"
" if(c.a < 0.9) discard;"
" gl_FragColor = c;"
"}";
GLuint uniModel, uniProj, uniView;