how to detect order of vertices?

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 detect order of vertices?

Post by Krampe »

Hi @ll,

as explained i have created an array of simple planes. Now i want to adress single vertices and modify them. I noticed that the vertices of my meshes were sorted in different ways. V[0] of one mesh was not at the same position as V[0] of another one, although the mesh was based on same geometry.

I hope a picture can show my problem:
Image

So how can i detect the specific order of vertices? How to know which one will be adressed with a specific number (v[x])?


Greetings,
Krampe³
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

and here we are again. if you would try my suggestion and use the meshmanipulator-copy then all meshes are equal and all 0,1,2,3 have the same position.
How have you got different positions of the points ? And who is the freak standing left in the pic ?
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

if you would try my suggestion and use the meshmanipulator-copy then all meshes are equal and all 0,1,2,3 have the same position.
Hum... i used the meshmanipulator o.O You dont believe i was able to do it without you guys, do you?^^

Code: Select all

tempmesh = smgr->getMesh("tile.3ds");
tileset[i][j]=smgr->getMeshManipulator()->createMeshCopy(tempmesh->getMesh(0));
How have you got different positions of the points ?
Thats the question... i even read that vertices are always following each other (clockwise or counter-clockwise)... but thats not happening in my app... i've got every possible combination there could be o.O
And who is the freak standing left in the pic ?
Just a quick mesh i tinkered for some minutes with, some kind of troll, dont feed him^^
FleshCrawler
Posts: 108
Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:

Post by FleshCrawler »

Krampe wrote:Just a quick mesh i tinkered for some minutes with, some kind of troll, dont feed him^^
That Troll is just as ugly as the picture in the Dungeons and Dragons Monster Manual :P

and another question, where did u got taht nice ground mesh? i mean like with that texture, when i add a texture its all spread wide, and when i make my own, my comp runs out of memory
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 »

That Troll is just as ugly as the picture in the Dungeons and Dragons Monster Manual

Hehe, i created this from my memory, but indeed a troll out of an old monster manual was in my head :)

and another question, where did u got taht nice ground mesh? i mean like with that texture, when i add a texture its all spread wide, and when i make my own, my comp runs out of memory

I dont know if i understand this correctly... i used just a simple plane mesh and made a seamless texture for it. The texture is 256x256 pixels. What you see are 20x20 tiles with that single texture, not a single mesh.
FleshCrawler
Posts: 108
Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:

Post by FleshCrawler »

ahh, ok :) might aswell try to create it that way, because i got 1 huge mesh from like 2048x2048 and 1 texture, that rather looks ugly now.
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 »

Ah ok... you can also use an uvw mapping for that. So you can keep your big mesh and the texture will be tiled.

*waits for KnightofLight and hopes he is able to help Krampe³*
FleshCrawler
Posts: 108
Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:

Post by FleshCrawler »

Krampe wrote:Ah ok... you can also use an uvw mapping for that. So you can keep your big mesh and the texture will be tiled.
care to give me an example code for that? :)

tnx in advance.
I've been absent for really long, but i'm ready to reign my terror on you once again, mwuahahahahaha
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

> ...*waits for KnightofLight and hopes he is able to help Krampe³*
sorry, i'm also a beginner, the truth is: cause Nikos Irrlicht is NEW, were all beginners (instead of Niko whos the Irrlicht-god).
If you really copied the meshes, the vertices CANT be different (a copy is a copy)
-> (my opinion) logical consequence is that theres a bug in you prog/access to the vertices
-> (my opinion) logical consequence is that you have to search the bug
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

We are all new to Irrlicht, but im new to 3d concepts and c++ also ;) For example, you are much more skilled than old, litte Krampe ;)


If you really copied the meshes, the vertices CANT be different (a copy is a copy)
-> (my opinion) logical consequence is that theres a bug in you prog/access to the vertices
-> (my opinion) logical consequence is that you have to search the bug


Yep sounds good. But i dont know how to find this bug... I used the meshmanipulator and copied the tile.3ds many times. I can adress every single tile and change its properties - so the copy process was ok.

I know i made a mistake somehow...

This is an extract of my code, perhaps you can have a look?

Code: Select all

scene::IAnimatedMesh* tempmesh;
scene::ISceneNode* combatMap[cTileBreite][cTileBreite];
scene::IMesh* tileset[cTileBreite][cTileBreite];

for (irr::s32 i = 0; i<cTileBreite; i++)
   {
      for (irr::s32 j = 0; j<cTileBreite; j++)
      {
         
		  //Tileset laden
			tempmesh = smgr->getMesh("tile.3ds");
			tileset[i][j]=smgr->getMeshManipulator()->createMeshCopy(tempmesh->getMesh(0));

//this is from saigumis seamless world: 

         irr::s32 LBName = (i*256) - j;
         combatMap[i][j] = smgr->addMeshSceneNode(tileset[i][j]);
		 combatMap[i][j]->setPosition(irr::core::vector3df(32.0f*(i-9),0.0f,32.0f*(j-9)));
			
         combatMap[i][j]->setMaterialFlag(irr::video::EMF_LIGHTING, false);
         combatMap[i][j]->setMaterialTexture( 0, driver->getTexture("gras.jpg") );

		 }
   }

//**************** Vertices manipulieren

scene::IMeshBuffer* buffer = tileset[10][10]->getMeshBuffer(0);
video::S3DVertex* v = (video::S3DVertex*)buffer->getVertices(); 
v[3].Pos.Y=30;
v[2].Pos.Y=30;


buffer = tileset[10][12]->getMeshBuffer(0);
v = (video::S3DVertex*)buffer->getVertices(); 
v[2].Pos.Y=30;
v[3].Pos.Y=30;


buffer = tileset[10][11]->getMeshBuffer(0);
v = (video::S3DVertex*)buffer->getVertices(); 
v[3].Pos.Y=30;
v[2].Pos.Y=30;
v[1].Pos.Y=30;
v[4].Pos.Y=30;
v[5].Pos.Y=30;
v[0].Pos.Y=30;
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

maybe you should load only one time
tempmesh = smgr->getMesh("tile.3ds"); //before the for's
and then copy within the for's ?
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

You mean the loading process assigns a different order of vertices every time i load the same mesh? I will try that asap...
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

Ok you are my hero, clad in shining armor... KnightofLight :) Thx³!

I dont understand why the getMesh process assigns a different order every time, though... its the same mesh, so of course the same geometry...
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

> ... I dont understand why the getMesh process assigns a different order every time
Thats Nikos part. You can look in the source code.

... And in some time we want to see pics of the game !
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

... And in some time we want to see pics of the game !

Sure, in 2-3 years or so :lol:
Post Reply