link between IMesh and ISceneNode
link between IMesh and ISceneNode
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.
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.
-
- Posts: 118
- Joined: Thu Sep 18, 2003 10:05 pm
- Location: switzerland
Re: link between IMesh and ISceneNode
Yes, unfortunately there's no way to get an IMesh out of an ISceneNode.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?
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.
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();
}
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 ).
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
Openoko - www.openoko.pl
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.
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.
-
- Posts: 118
- Joined: Thu Sep 18, 2003 10:05 pm
- Location: switzerland
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
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
@Tyn
I'm observing you project already 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 I use an interface between game and graphics engine so it won't be hard.
I'm observing you project already 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 I use an interface between game and graphics engine so it won't be hard.
Tomasz Nowakowski
Openoko - www.openoko.pl
Openoko - www.openoko.pl
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.
I thought getMesh() was a function of ISceneNode. Hmm, puzzling why it isn't really.
-
- Posts: 118
- Joined: Thu Sep 18, 2003 10:05 pm
- Location: switzerland
@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.
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.
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.
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.
I need too this function - like SceneNode->GetMesh();
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:
In File CSceneManager.cpp must assign retMesh pointer to mesh pointer when we add any mesh with SceneManager
for example in function
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();
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;
}
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;
}
We can use this function in code without parameters like:
IMesh* myMesh =mySceneNode->GetMeshFromNode();
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
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
Crucible of Stars