Ive tried EMT_TRANSPARENT_ADD_COLOR and I've tried VERTEX_ALPHA but to no luck.
Day Time (incorrect.. you can see stars ):
Night Time ( YOU CAN"T SEE STARS QQ ):
It really doesnt make sense to me. I've tried loading the Image from a PNG and a BMP.. PNG with transparency doesnt work.. and BMP with black areas and ADD_COLOR wont work. I don't know what im doing wrong.
Basically Im loading an IImage with 16x16 color data for each row of vertices in my skydome. The colors work fine, but not the transparency portions.
Heres the code for it.
Code: Select all
void ESphere::SkyTransform(irr::s32 shiftFactor)
{
irr::scene::IMesh *mesh = m->getMesh(m->getFrameCount() - 1);
int vertCount = mesh->getMeshBuffer(0)->getVertexCount();
void* v = mesh->getMeshBuffer(0)->getVertices();
irr::f32 temp;
// Get all of the vertices heights
float *vertList = new float[vertCount];
for(int a = 0; a < vertCount; a++)
{
temp = ((irr::video::S3DVertex*)v)[a].Pos.Y;
vertList[a] = (float)temp;
}
// Sort the vertices from least to greatest
std::sort(vertList + 0, vertList + (vertCount - 1));
// Map vertices from 0 to 1
float *vertMap = new float[vertCount];
float MaxVert = vertList[vertCount - 1];
for(int a = 0; a < vertCount; a++)
{
vertMap[a] = vertList[a] / MaxVert;
}
// Set Fog Color
device->getVideoDriver()->setFog(skyimage->getPixel(shiftFactor, 15), true, 8000, 100000, 0, true);
// Assign Color to heights
for(int a = 0; a < vertCount; a+=4)
{
if(vertMap[a] <= 0)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp <= vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 15);
}
}
if(vertMap[a] > 0)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 14);
}
}
if(vertMap[a] > 0.1)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 12);
}
}
if(vertMap[a] > 0.2)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 8);
}
}
if(vertMap[a] > 0.3)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 6);
}
}
if(vertMap[a] > 0.4)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 5);
}
}
if(vertMap[a] > 0.5)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 4);
}
}
if(vertMap[a] > 0.6)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 3);
}
}
if(vertMap[a] > 0.7)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 2);
}
}
if(vertMap[a] > 0.8)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 1);
}
}
if(vertMap[a] > 0.9)
{
for(int b = 0; b < vertCount; b++)
{
temp = ((irr::video::S3DVertex*)v)[b].Pos.Y;
if(temp == vertList[a])
((irr::video::S3DVertex*)v)[b].Color = skyimage->getPixel(shiftFactor, 0);
}
}
}
delete [] vertList;
delete [] vertMap;
}