Added proper ZWrite behavior for transparency.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1614 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
009e6d440c
commit
f1f236b9d7
|
@ -588,7 +588,7 @@ bool CB3DMeshFileLoader::readChunkBONE(CSkinnedMesh::SJoint *InJoint)
|
||||||
bool CB3DMeshFileLoader::readChunkKEYS(CSkinnedMesh::SJoint *InJoint)
|
bool CB3DMeshFileLoader::readChunkKEYS(CSkinnedMesh::SJoint *InJoint)
|
||||||
{
|
{
|
||||||
#ifdef _B3D_READER_DEBUG
|
#ifdef _B3D_READER_DEBUG
|
||||||
os::Printer::log("read ChunkKEYS");
|
// os::Printer::log("read ChunkKEYS");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s32 flags;
|
s32 flags;
|
||||||
|
@ -683,6 +683,10 @@ bool CB3DMeshFileLoader::readChunkTEXS()
|
||||||
#ifdef __BIG_ENDIAN__
|
#ifdef __BIG_ENDIAN__
|
||||||
B3dTexture.Flags = os::Byteswap::byteswap(B3dTexture.Flags);
|
B3dTexture.Flags = os::Byteswap::byteswap(B3dTexture.Flags);
|
||||||
B3dTexture.Blend = os::Byteswap::byteswap(B3dTexture.Blend);
|
B3dTexture.Blend = os::Byteswap::byteswap(B3dTexture.Blend);
|
||||||
|
#endif
|
||||||
|
#ifdef _B3D_READER_DEBUG
|
||||||
|
os::Printer::log("Flags", core::stringc(B3dTexture.Flags).c_str());
|
||||||
|
os::Printer::log("Blend", core::stringc(B3dTexture.Blend).c_str());
|
||||||
#endif
|
#endif
|
||||||
readFloats(&B3dTexture.Xpos, 1);
|
readFloats(&B3dTexture.Xpos, 1);
|
||||||
readFloats(&B3dTexture.Ypos, 1);
|
readFloats(&B3dTexture.Ypos, 1);
|
||||||
|
@ -816,13 +820,19 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
||||||
B3dMaterial.Material.Lighting = false;
|
B3dMaterial.Material.Lighting = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
|
B3dMaterial.Material.ZWriteEnable = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (B3dMaterial.Textures[0]) //One texture:
|
else if (B3dMaterial.Textures[0]) //One texture:
|
||||||
{
|
{
|
||||||
// Flags & 0x1 is usual SOLID, 0x8 is mipmap (handled before)
|
// Flags & 0x1 is usual SOLID, 0x8 is mipmap (handled before)
|
||||||
if (B3dMaterial.Textures[0]->Flags & 0x2) //(Alpha mapped)
|
if (B3dMaterial.Textures[0]->Flags & 0x2) //(Alpha mapped)
|
||||||
|
{
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
|
B3dMaterial.Material.ZWriteEnable = false;
|
||||||
|
}
|
||||||
else if (B3dMaterial.Textures[0]->Flags & 0x4) //(Masked)
|
else if (B3dMaterial.Textures[0]->Flags & 0x4) //(Masked)
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; // TODO: create color key texture
|
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; // TODO: create color key texture
|
||||||
else if (B3dMaterial.Textures[0]->Flags & 0x40)
|
else if (B3dMaterial.Textures[0]->Flags & 0x40)
|
||||||
|
@ -832,14 +842,20 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
||||||
else if (B3dMaterial.alpha == 1.f)
|
else if (B3dMaterial.alpha == 1.f)
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_SOLID;
|
B3dMaterial.Material.MaterialType = video::EMT_SOLID;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
|
B3dMaterial.Material.ZWriteEnable = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else //No texture:
|
else //No texture:
|
||||||
{
|
{
|
||||||
if (B3dMaterial.alpha == 1.f)
|
if (B3dMaterial.alpha == 1.f)
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_SOLID;
|
B3dMaterial.Material.MaterialType = video::EMT_SOLID;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
|
B3dMaterial.Material.ZWriteEnable = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
B3dMaterial.Material.DiffuseColor = video::SColorf(B3dMaterial.red, B3dMaterial.green, B3dMaterial.blue, B3dMaterial.alpha).toSColor();
|
B3dMaterial.Material.DiffuseColor = video::SColorf(B3dMaterial.red, B3dMaterial.green, B3dMaterial.blue, B3dMaterial.alpha).toSColor();
|
||||||
|
@ -863,7 +879,10 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
||||||
B3dMaterial.Material.BackfaceCulling = false;
|
B3dMaterial.Material.BackfaceCulling = false;
|
||||||
|
|
||||||
// if (B3dMaterial.fx & 32) //force vertex alpha-blending
|
// if (B3dMaterial.fx & 32) //force vertex alpha-blending
|
||||||
|
// {
|
||||||
// B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
// B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
|
// B3dMaterial.Material.ZWriteEnable = false;
|
||||||
|
// }
|
||||||
|
|
||||||
B3dMaterial.Material.Shininess = B3dMaterial.shininess;
|
B3dMaterial.Material.Shininess = B3dMaterial.shininess;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue