link between IMesh and ISceneNode

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!
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

link between IMesh and ISceneNode

Post by tip »

I want to get an IMesh out of my ISceneNode.

my project has several ISceneNode. they contain 3D vertices and face lists, generated programmatically at startup. To use some of the irrlicht engine functions, a pointer to a IMesh is required (createOctTreeTriangleSelector for example).

so? do i have to build an IMesh from scratch for my datas?


I looked if there's something to get an IMseh out of my IsceneNode, seems not. I saw CMeshSceneNode (implemented in CMeshSceneNode.cpp in irrlicht sources). the class isn't in documentation, i'm not sure i can help anyway, seems just to contain a mesh pointer in an ISceneNode.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Re: link between IMesh and ISceneNode

Post by Gorgon Zola »

tip wrote:I want to get an IMesh out of my ISceneNode.
so? do i have to build an IMesh from scratch for my datas?
Yes, unfortunately there's no way to get an IMesh out of an ISceneNode.
If, however, You have made those scenenodes by your own there's noone stoping you from adding a getMesh() method that returns a pointer to the scenenodes IMesh.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

There already is a getMesh() function. This code is from the tutorials:

Code: Select all

scene::ITriangleSelector* selector = 0;
	
	if (q3node)
	{		
		q3node->setPosition(core::vector3df(-1370,-130,-1400));

		selector = smgr->createOctTreeTriangleSelector(
            q3levelmesh->getMesh(0), q3node, 128);
		q3node->setTriangleSelector(selector);
		selector->drop();
	}
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

But it's not a method of a node, but a mesh and scenemanager. There's no way to get mesh pointer form a give node. And even if you make you own scene node with GetMesh function you wan't be able to use some of IAnimatedMeshX (or others) functions. Node stores only a pointer to a mesh wich is hold in a scene manager AFAIK. So when you for example set an animation using IAnimatedMeshX::setCurrentAnimation() it will be set for all node using that mesh.

I'll try to work on reorganizing how X meshys are handled in Irrlicht. But it will have to wait till Thursday because i'll be busy prepering parts of my master thesis (it will be a game using Irrlicht, Laser Squad remake actualy or more if it will evolve ;) ).
Tomasz Nowakowski
Openoko - www.openoko.pl
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Laser Squad is one of my influences too for 2080, I'll be following your project with interest :) X-Com would never have been made if the Gallop brothers weren't told to make Laser Squad bigger by Microprose.

I don't know what you mean by it's not a method of ISceneNode. You call it by:

node->getMesh(0);

To get mesh 0 of the node. You set the mesh when you create the node.
Last edited by Tyn on Sun Jun 13, 2004 12:51 pm, edited 1 time in total.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

I wasn't aware that 'tip' was talking about IAnimatedMesh... :?

Anyway, cool thesis subject warui.
Do You have to change a lot in the engine for Your thesis?
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

Post by tip »

thanks for you interest in this problem. No it's not an animated Mesh, it's a static one. So as i understood your reply, there's no IMesh in a ISceneNode and no way to get it.

It's not really a problem to build a SMeshBuffer with my data instead of the buffer i'm using (i'm now drawing it with drawIndexedTriangleList). So, why not change all my code to acheive that....

A question I was also asking to myself is how the IMeshes are handled by irrLicht : are the meshes uploaded on the video card memory for faster transform? if so, using an Smesh will be faster than having the object rendered with drawIndexedTriangleList. That would be another good reason to port my object generation working with a SMesh.

Just for info : here's what i'm doing : it's France South coast real datas and place names
Image
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

@Tyn
I'm observing you project already :D BTW have you seen www.lasersquadnemesis.com ?

I checked docs and source code but wasn;t able to fing getMesh() for ISceneNode (or any other nodes). That's a method of only IAnimatedMesh, SAnimatedMesh and ISceneManager. And in an example code you gave q3levelmesh is na object of IAnimatedMesh.

@Gorgon Zola
I don't know. We'll see :) And if it will be too much i'll just switch too another engine :twisted: I use an interface between game and graphics engine so it won't be hard.
Tomasz Nowakowski
Openoko - www.openoko.pl
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Yeah, I like Nemesis a lot, although I still prefer turn based play. They freshened up the genre a bit although IMO they were a little too keen to go down the multiplayer route at the expense of single player. I can't fault them though, they have defined the genre. Pitty they took to dumping turn based so soon IMO.

I thought getMesh() was a function of ISceneNode. Hmm, puzzling why it isn't really.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

@tip
At the moment (irr v0.6) there are no hardware buffers for the meshes, so storing your mesh in an array or using SMeshBuffer and SMesh is merely a question of convenience.
How did You go about the labels that are fading out when labeling points far away? Did You have to implement them yourself? Look nice.

@warui
Well good luck with your project then.
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

Post by tip »

ho, really, no hardware buffer for meshes? too bad, it's really important for performances. i can hardly believe it...

the fading labels are just stupid static texts with alpha calculated with distance.

thanks for information, anyway

here another shoot in 800x600
Image
Manakel

Post by Manakel »

Hello Tip are you doing this project for school or tourism office .
What is the final purpose ?


I'm interrested i'm from Orleans but know peoples around grenoble...
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

Post by tip »

the purpose is to make a 3D map instead of a 2D map. i don't think it can be useful, just interesting.
as the relief is based on NASA datas, i can display the whole earth. the terrain is generated only around the camera, so i can have a huge area (the whole earth, is youve enough disk space).
now it's still under development; it's a personal leasure project, i'll see what i do with it when it's finished.
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

I need too this function - like SceneNode->GetMesh(); :lol:

That is impossible without any modification in files IScenenode.h, and CSceneManager.cpp

I just tryed some tricks and got success.

First In ISceneNode.h I wrote function:

Code: Select all

virtual IMesh *  GetMeshFromNode(IMesh * aMesh =0) 
{

 static IMesh *retMesh;
 if(aMesh)
 {
   retMesh = aMesh; 
  } 
 return retMesh;
}

In File CSceneManager.cpp must assign retMesh pointer to mesh pointer when we add any mesh with SceneManager

for example in function

Code: Select all


ISceneNode* CSceneManager::addOctTreeSceneNode(IMesh* mesh,  ISceneNode* parent, s32 id, s32 minimalPolysPerNode)
{
 ........................
  ...........................
//we can use
ISceneNode::GetMeshFromNode(mesh); 
.......................
............

return node;
}

This technique must be used and for another functions like addMeshSceneNode, addAnimatedMeshSceneNode,...


We can use this function in code without parameters like:

IMesh* myMesh =mySceneNode->GetMeshFromNode();
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

it should be quite easy to add, as CAnimatedMeshSceneNode and CMeshSceneNode already store pointers to their meshes (thoguh eahc mesh is actually only loaded once, which presents problems, but is a completely seperate issue)

l0calhost made a modification to render static meshes with OGL display lists. Considerably faster, though I was having trouble with materials occasionally not showing up, and something seemed a bit screwey with .x models, but it's definitely a valuable improvement. Check the open discusion forum, though I think the thread's a couple weeks old
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Post Reply