Create Octtree Scene Node out of Mesh with Tangents

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
rewb0rn
Posts: 15
Joined: Thu May 25, 2006 9:26 pm
Location: Berlin, Germany

Create Octtree Scene Node out of Mesh with Tangents

Post by rewb0rn »

Hey Ppl,

I am trying to render a bsp map with Material Type EMT_NORMAL_MAP_SOLID, therefor my bsp Mesh has to contain Tangents. It works when i use AddMeshSceneNode and CreateTriangleSelector, but thats quite too much effort for the collision and render computing(halves the FPS), so I tried to use AddOctTreeSceneNode and CreateOctTreeTriangleSelector, but that just wont work :( (Map is not rendered)

Here is my code

Code: Select all

bool MapManager::InitSelector(void)
{
	//Interesting: using Mesh instead of AniMesh->getMesh(0) does not work
	MapSelector = HardwareManager::Get()->GetScene()->createTriangleSelector(AniMesh->getMesh(0), Node);

	if (!MapSelector) return false;
	
	return true;
}

bool MapManager::InitNode(void)
{
	//creating an octreescene out of the map
	Node = HardwareManager::Get()->GetScene()->addMeshSceneNode(Mesh);
	
	Node->setPosition(core::vector3df(
		Ini->GetValue(SECTIONGENERAL, KEYPOSITIONX, DEFAULTPOSITIONX),
		Ini->GetValue(SECTIONGENERAL, KEYPOSITIONY, DEFAULTPOSITIONY),
		Ini->GetValue(SECTIONGENERAL, KEYPOSITIONZ, DEFAULTPOSITIONZ)));
	
	if (!Node) return false;

	return true;
}

bool MapManager::InitMesh(void)
{
	//Create the mesh for the map
	AniMesh = HardwareManager::Get()->GetScene()->getMesh(
		Ini->GetValue(SECTIONMATERIALS, KEYMAPBSPFILE, DEFAULTMAPBSPFILE).c_str());
	
	if (!AniMesh) return false;
	
	Mesh = HardwareManager::Get()->GetScene()->getMeshManipulator()->createMeshWithTangents(AniMesh->getMesh(0));
	if (!Mesh) return false;

	return true;
}
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

If you look at the COctTreeSceneNode source code, you'll see that only standard and 2tcoord vertex types are handled. There is probably a reason, but I don't know what it is.

I've never really looked at the oct tree code, but there is a lot of copy/paste going on in there. It seems like there is a lot of switches and copy/paste code in there that should be factored out and cleaned up. Not something that I'd expect you to do, it is just a note to self...

Travis
rewb0rn
Posts: 15
Joined: Thu May 25, 2006 9:26 pm
Location: Berlin, Germany

Post by rewb0rn »

Ok then..
After I really was satisfied realising what Irrlicht seems to be capable of, it appears now that there are lots of things not implemented yet or working strange, thats really a pity imo!
Post Reply