How to differentiate between several meshes?

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
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

How to differentiate between several meshes?

Post by Krampe »

Hi @ll,

i wanted to create some kind of map with several tiles like saigumis seamless world. After loading the single tiles (just simple planes) i want to control every single mesh in some way (for example, color of vertices).

I created an array of meshes:
scene::IAnimatedMesh* tileset[x][y];

I load the tiles and everything is fine. After that i want to control the vertices of just one single mesh:

scene::IMeshBuffer* buffer = tileset[1][1]->getMesh(0)->getMeshBuffer(0);
video::S3DVertex* v = (video::S3DVertex*)buffer->getVertices();
v[0].Pos.Y=50;

The problem is, all meshes in the tileset array are called "tile.3ds". So i only can control _all_ tiles at once. But i want to control just one mesh, for example the mesh of tileset[3][4]. So what to do?

Hope someone can help me, thx :)
Guest

Post by Guest »

i told you, i tried this some weeks ago, too:
one mesh for every tile. in this case the best is an array of meshes.

(btw: The girl this weekend who took me from the disco to her home, was sent by you, yes ? I didnt asked her cause im a gentleman and so i cant tell more about the night...)
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

The girl this weekend who took me from the disco to her home, was sent by you, yes ? I didnt asked her cause im a gentleman and so i cant tell more about the night...)
Hehe ;)

one mesh for every tile. in this case the best is an array of meshes.
Read my post again :P This is exactly the way i did this. Its running fine - but a change to one single mesh results in a change of all meshes because the base mesh has the same name (tile.3ds).

This question is not about manipulating vertices (so was the last), but about differentiating between several meshes in an array. The array was set up right, the tiles were created with the right texture, position and so on. Still i cant adress a single mesh... :(
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

yes. If i write one mesh for every tile, i meant one different mesh for every tile and not the same mesh for all.
For example, i did it with the meshmanipulator:
TileMesh[i][j]=smgr->getMeshManipulator()->createMeshCopy(SingleMesh->getMesh(0));
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

Im a little bit confused...

It must be the same geometry... i load the same mesh, but into different IAnimatesMesh's - that is not enough?

So i load one .3ds and then create copies of that, hum...

Oh man i guess i wont be able to create a small game, no way :shock:

Thx again though :)
FleshCrawler
Posts: 108
Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:

Post by FleshCrawler »

Krampe wrote:Im a little bit confused...
Oh man i guess i wont be able to create a small game, no way :shock:
Thats no good Spirit :P just keep trying and learning, so am i when i have the time :)
I've been absent for really long, but i'm ready to reign my terror on you once again, mwuahahahahaha
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

I call it realism ;)
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

>...Oh man i guess i wont be able to create a small game, no way
dont give up, youre on the path, you only can go a path step by step
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Aah.. you do know that you aren't making multiple meshes if you are loading them from the same file.

Code: Select all

virtual IAnimatedMesh* irr::scene::ISceneManager::getMesh  (  const c8 *    filename  )  [pure virtual] 
 
   Gets pointer to an animateable mesh. [color=red]Loads it if needed.[/color] Currently there are the following mesh formats supported: .obj(Alias Wavefront Maya), .ms3d(Milkshape3D), .bsp(Quake3 Level), .md2(Quake2 Model), .3ds (3D Studio). More formats coming soon, make a feature request on the Irrlicht Engine homepage if you like. 

Parameters: 
filename:  Filename of the mesh to load.  

Returns: 
Returns NULL if failed and the pointer to the mesh if successful. This pointer should not be dropped. See IUnknown::drop() for more information.  

Irrlicht only saves one copy of the mesh and gives you a pointer to it. Each for your sceneNodes has the same mesh in it, not just conceptually, but actually.

KoL's solution does work.
Crud, how do I do this again?
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

Ill try it if i find my motivation again ;)

EDIT:

I tried to use KoL's suggestion. I needed several hours for that o.O
TileMesh[j]=smgr->getMeshManipulator()->createMeshCopy(SingleMesh->getMesh(0));


I learned that "SingleMesh" (or whatever you want to call it) must be a IAnimatedMesh, whereas the array ("TileMesh") had to be an IMesh. o.O I learned that just per trial and error - there wasnt any way for me to learn it by thinking about the problem or reading the api. Thats my biggest problem - that i tried to describe in my thread "how to understand irrlicht".

I think im starting to understand the differences between the classes...
Post Reply