Append for CDynamicMeshBuffer not working(?)

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
fanaticguy
Posts: 9
Joined: Sat Feb 18, 2017 3:51 pm

Append for CDynamicMeshBuffer not working(?)

Post by fanaticguy »

After executing code which is listed below i got following output in console:
"24
0".
mesh_buffers is std::vector<CDynamicMeshBuffer*> and buffer_side is CDynamicMeshBuffer*. Am I doing something wrong or this append method does not work? Of course this is not the only reason that i thought that it is not working. This is just an example which for me should work.

Code: Select all

std::cout << buffer_side->getIndexCount()<<std::endl;
mesh_buffers[block_num]->append(buffer_side);
std::cout <<mesh_buffers[block_num]->getIndexCount()<< std::endl;
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Append for CDynamicMeshBuffer not working(?)

Post by CuteAlien »

Yeah, appends are not working. For CMeshBuffer it was disabled in revision 1515 without comment. And for CDynamicMeshBuffer it never got implemented.
It was discussed somewhat in bug #310 and http://irrlicht.sourceforge.net/forum// ... hp?t=36226, but this was all before my time and the involved programmers are no longer active. I've put it on my todo when I noticed this last year, but it's just on my nice-to-have list for Irrlicht 1.9, so I haven't spend time on it so far to learn what this is all about.
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
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Append for CDynamicMeshBuffer not working(?)

Post by Mel »

If i recall correctly, you still can use append with vertices and indices directly, and works as expected. The problem is the format of the vertices and the indices, which can't be checked really during the appending time. So, technically you can append vertices of a format on a buffer of a smaller format (S3DTangentVertices on S3DVertices buffers for instance) giving potentially place to exceed the allocated memory, as the tangent vertices are larger in that example

I would remove that append method from the interfaces (IMeshBuffer, CMeshBuffer...) , as would only complicate things, and leave them only for the specific implementations (SMesh, STangentMesh...) The mesh manipulator is able to convert from a vertex format into another if it is needed
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Append for CDynamicMeshBuffer not working(?)

Post by CuteAlien »

Hm, I think we know the format of vertices and indeces but not the format of the meshbuffer. And the latter is a problem in other todo's I'm having as well (caused some troubles when I tried switching to 32-bit meshloaders), so probably those need a getType function.
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
fanaticguy
Posts: 9
Joined: Sat Feb 18, 2017 3:51 pm

Re: Append for CDynamicMeshBuffer not working(?)

Post by fanaticguy »

Mel wrote:If i recall correctly, you still can use append with vertices and indices directly, and works as expected.
Yeah, I tried this. It works, but in that case there is no option to set Material for separate "buffers". Btw i'm searching for a way to concatenate a lot of meshbuffers with only few used materials and I really need to store more than 16 bit of indices that's why I have chosen DynamicMeshBuffer. Downside of using separate meshbuffers in my case is that there is significant performance fall.
Post Reply