[SOLVED] Custom Scene Node doesnt draw

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

[SOLVED] Custom Scene Node doesnt draw

Post by Galhad »

Hi, I'm trying to make custom scene node. It contains IMeshSceneNode. Mesh loades correctly, but if I set child to this it wont draw. I think the problem is in redner function, becouse I cant find what exactly it should be. Here is code:

Code: Select all

TFSMap::TFSMap(io::path filename, ISceneManager *scene,ISceneNode *parent,s32 id,vector3df pos,vector3df rot,vector3df scale):ISceneNode(parent,scene,id,pos,rot,scale)
{
    setMesh(SceneManager->getMesh(filename));
    Map=scene->addMeshSceneNode(Mesh, this, -1,pos,rot,scale);
    Box=Map->getBoundingBox();
}
void TFSMap::render()
{
		Map->render();
}
void TFSMap::OnRegisterSceneNode()
{
    if (IsVisible)
    {
		SceneManager->registerNodeForRendering(this);
    }
    ISceneNode::OnRegisterSceneNode();
}
Please help
Last edited by Galhad on Mon Mar 28, 2011 6:29 pm, edited 1 time in total.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Why are your creating a scene node which does nothing else but encapsulate a mesh scene node? I don't see the point of this
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

Post by Galhad »

Because it is example and test. It will be more functionally later, first it must work..
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

You should pass the root scene node as the scene node's parent (see ISceneManager::getRootSceneNode() )

Also, since the encapsulated node's parent is your custom node itself you don't have to call render() on it, as it will be registered by the scene manager
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

Post by Galhad »

I tried, but it isnt work

EDIT
It works, but I dont know why ;d. I didnt change anything important, so a bit strange.. Thanks everyone for ideas ;)
Post Reply