Why use meshBuffer?

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
fargoth
Posts: 22
Joined: Fri May 01, 2015 7:43 pm

Why use meshBuffer?

Post by fargoth »

I've got many similar meshes (walls) in my scene graph (created one mesh, and added many IMeshSceneNodes)
Is it better to add all these meshes up into one Mesh using it's meshBuffers? If so, Why?
I would have to add each vertex of the mesh over and over again with the appropriate offsets, which seems like a huge waste of resources...
I would want to check for collisions against all these meshes - does having all of them integrated give a significant performance boost?
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: Why use meshBuffer?

Post by thanhle »

Such class is already available.
Search for mesh combiner, progressive mesh buffer. There is a third one, but I forgot the name. I think these are available in irrExt.

Regards,
thanh
CuteAlien
Admin
Posts: 9664
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Why use meshBuffer?

Post by CuteAlien »

If the questions is if it's better to have one mesh with many meshbuffers instead of many meshes with few meshbuffers, then yes - that's a lot faster.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Why use meshBuffer?

Post by sudi »

And having a single bigger meshbuffer is again faster than many meshbuffers. At least up to a certain amount. You have to weigh drawcalls vs. vertex count and so on. But since irrlicht only supports 16bit meshbuffers i think having a view big buffers is just fine. Then again if you do clever occlusion culling you can again get away with more meshes/scenenodes whatever since you are not drawing all of them at them same time.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply