Fixed out of bound index bug in batching classes.
As promised, here is the new update with:
2 new SWCs
this one is the most powerful. It uses the fastmem opcodes (ByteArray fast domain memory access) to batch and upload mesh data to the GPU. This is the one you want to use if you need that special boost in performance and if you’re not using the fastmem opcodes elsewhere in your project (or it will break ND2Dx)
this one is the “less” powerful (but by a slight margin) as it batches and upload meshes to the GPU using a vector. This is the one you want to use if you’re using the fastmem opcodes for your own needs.
Why those SWCs ?
because ND2Dx contains a couple of compile time constants that make it difficult to quickly setup a project. Now with these two SWCs, you can choose the one you’d like to work with and it will work out of the box !
In case you need to compile ND2Dx from the sources, here are the compile time constants you will need to setup:
ND2DX::USE_DOMAIN_MEMORY_BATCHING,true (set this one to true if you want to use the fastmem opcode, or else set it to false)
ND2DX::USE_VECTOR_BATCHING,false (set this one to true if you want to use the vector batching approach, or else set it to false)
It is very important that USE_DOMAIN_MEMORY_BATCHING and USE_VECTOR_BATCHING have different values. Either you chose one or the other, not both or it will break the whole thing (and you might not even notice it straight away)
Dynamic Mesh system
now the TexturedMeshRendererComponent also accept a Mesh2D object and renders it while still preserving the batch (taking into account that you don’t do anything to break it: different texture, different shader, scissor rect, etc…)
Everything you need is on GitHub !
And an example of what you can do with the new Dynamic Mesh system
(sources of all the examples is available on GitHub)
Of course this is just an example. You could do many more things with a dynamic mesh (or shall we simply call it a “mesh” ?) and produce any shape that you need.