Reverting my changes from r4569 as they also break stuff by now. Will continue the discussion in http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=48940
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4575 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
a83451cf63
commit
ced8386dad
|
@ -101,7 +101,7 @@ namespace video
|
|||
EMT_TRANSPARENT_ALPHA_CHANNEL,
|
||||
|
||||
//! Makes the material transparent based on the texture alpha channel.
|
||||
/** If the alpha channel value is greater than a certain value (default 127), a
|
||||
/** If the alpha channel value is greater than 127, a
|
||||
pixel is written to the target, otherwise not. This
|
||||
material does not use alpha blending and is a lot faster
|
||||
than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing
|
||||
|
@ -109,12 +109,7 @@ namespace video
|
|||
blurry but sharp. Only first texture is used. If you are
|
||||
using this material with small textures and 3d object, it
|
||||
is a good idea to load the texture in 32 bit mode
|
||||
(video::IVideoDriver::setTextureCreationFlag()).
|
||||
By changing SMaterial::MaterialTypeParam you can control the value which is used
|
||||
to seperate transparent and opaque pixels. The range is 0-1 (corresponding to 0-255 values
|
||||
for the alpha-channel test). 0 is special and like 0.5 interpreted as 127
|
||||
(if you really want no transparency at all use a very small value above 0)
|
||||
*/
|
||||
(video::IVideoDriver::setTextureCreationFlag()). */
|
||||
EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
|
||||
|
||||
//! Makes the material transparent based on the vertex alpha value.
|
||||
|
|
|
@ -350,9 +350,7 @@ public:
|
|||
{
|
||||
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType
|
||||
|| material.MaterialTypeParam != lastMaterial.MaterialTypeParam
|
||||
|| resetAllRenderstates)
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
{
|
||||
setTextureColorStage(pID3DDevice, 0,
|
||||
D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT);
|
||||
|
@ -362,7 +360,8 @@ public:
|
|||
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAREF, material.MaterialTypeParam == 0 ? 127 : material.MaterialTypeParam * 255.f);
|
||||
// 127 is required by EMT_TRANSPARENT_ALPHA_CHANNEL_REF
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAREF, 127);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
|
||||
}
|
||||
|
|
|
@ -381,9 +381,7 @@ public:
|
|||
{
|
||||
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType
|
||||
|| material.MaterialTypeParam != lastMaterial.MaterialTypeParam
|
||||
|| resetAllRenderstates)
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
{
|
||||
setTextureColorStage(pID3DDevice, 0,
|
||||
D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT);
|
||||
|
@ -393,7 +391,8 @@ public:
|
|||
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAREF, material.MaterialTypeParam == 0 ? 127 : material.MaterialTypeParam * 255.f);
|
||||
// 127 is required by EMT_TRANSPARENT_ALPHA_CHANNEL_REF
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAREF, 127);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
|
||||
}
|
||||
|
|
|
@ -495,12 +495,10 @@ public:
|
|||
Driver->disableTextures(1);
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType
|
||||
|| material.MaterialTypeParam != lastMaterial.MaterialTypeParam
|
||||
|| resetAllRenderstates)
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
{
|
||||
Driver->getBridgeCalls()->setAlphaTest(true);
|
||||
Driver->getBridgeCalls()->setAlphaFunc(GL_GREATER, material.MaterialTypeParam == 0 ? 0.5 : material.MaterialTypeParam);
|
||||
Driver->getBridgeCalls()->setAlphaFunc(GL_GREATER, 0.5f);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
}
|
||||
|
@ -508,7 +506,7 @@ public:
|
|||
virtual void OnSetBaseMaterial(const SMaterial& material) _IRR_OVERRIDE_
|
||||
{
|
||||
Driver->getBridgeCalls()->setAlphaTest(true);
|
||||
Driver->getBridgeCalls()->setAlphaFunc(GL_GREATER, material.MaterialTypeParam == 0 ? 0.5 : material.MaterialTypeParam);
|
||||
Driver->getBridgeCalls()->setAlphaFunc(GL_GREATER, 0.5f);
|
||||
}
|
||||
|
||||
virtual void OnUnsetMaterial() _IRR_OVERRIDE_
|
||||
|
|
Loading…
Reference in New Issue