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
How to differentiate between several meshes?
HeheThe 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...)
Read my post again 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).one mesh for every tile. in this case the best is an array of meshes.
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...
-
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
-
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
Aah.. you do know that you aren't making multiple meshes if you are loading them from the same file.
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.
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.
KoL's solution does work.
Crud, how do I do this again?
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
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...
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...