i have the following problem. I hope i can describe it correctly. I have three textures (space, ship and clouds) all with alphashannel. When i texture Billboards it works all correctly. Now i have make my own SceneNode and than it dont work. Here two Pictures.
with billboards
with my own scenenode
if i change the Texture loading order than i take an different effect. this load order is: first ship than space than clouds. Here some Code from my scenenode where could be the problem is.
the constructor
Code: Select all
IMySceneNode::IMySceneNode(ISceneNode* _parent, scene::ISceneManager* _mgr, video::ITexture *_texture):
scene::IMeshSceneNode(_parent, _mgr, -1)
{
_m_imageSize = _texture->getSize();
indices[0] = 0;
indices[1] = 2;
indices[2] = 1;
indices[3] = 0;
indices[4] = 3;
indices[5] = 2;
vertices[0].Pos.set((f32)_m_imageSize.Width,-(f32)_m_imageSize.Height,0);
vertices[0].TCoords.set(1.0f, 1.0f);
vertices[0].Color = 0xffffffff;
vertices[1].Pos.set((f32)_m_imageSize.Width,0,0);
vertices[1].TCoords.set(1.0f, 0.0f);
vertices[1].Color = 0xffffffff;
vertices[2].Pos.set(0,0,0);
vertices[2].TCoords.set(0.0f, 0.0f);
vertices[2].Color = 0xffffffff;
vertices[3].Pos.set(0,-(f32)_m_imageSize.Height,0);
vertices[3].TCoords.set(0.0f, 1.0f);
vertices[3].Color = 0xffffffff;
bbox.reset(vertices[0].Pos);
bbox.addInternalPoint(vertices[1].Pos);
bbox.addInternalPoint(vertices[2].Pos);
bbox.addInternalPoint(vertices[3].Pos);
_m_material.setTexture(0, _texture);
_m_material.setFlag(video::EMF_LIGHTING, false);
_m_material.MaterialType = video::EMT_ONETEXTURE_BLEND;
_m_material.MaterialTypeParam = video::pack_texureBlendFunc(
video::EBF_SRC_ALPHA,
video::EBF_ONE_MINUS_SRC_ALPHA,
irr::video::EMFN_MODULATE_1X,
irr::video::EAS_TEXTURE | irr::video::EAS_VERTEX_COLOR);
}
Code: Select all
void IMySceneNode::OnRegisterSceneNode()
{
if (IsVisible)
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
}
Code: Select all
void ISpriteSceneNode::render()
{
if(!IsVisible)
return;
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->setMaterial(_m_material);
driver->drawIndexedTriangleList(
vertices,
4,
indices,
2);
}
ship-node to 0, 0, 30
cloud-node to 0, 0, 50
space-node to 0, 0, 90
(in both examples)
I hope someone can help me, please.
Sorry for my bad english