😀 JohnBlackburne
Well actually I am or was.. trying.
I could/will share the source if needed but since it is extremely high in indices and vectors I was trying to not inflict that, on anybody..
The source is top-secret info afcourse =) And since it is failing atm, all the better.
The background tiles make up the X*Y tilemap so that the vector.vector always has a tile value that I can access with no funky null value stuff.
The shadow tiles are embedded in the tile class with their own image for shadow. (just several black images with some full shadow and corner shadow variations)
The background layer is in its own meshbatch, The shadow layers(this one only uses the highest layer==12) are on a vector.vector.meshbatch that are all stacked into 1 screensprite above that for starling to batch it.. (see I do trust starling with some batching)
I used to just .clean the meshbatch and reAdd the whole x*y screen area to the batch(QuadBatch it used to be, no access to the vertices and such).
With the meshbatch and the addMeshAt, I'm only swapping the offscreen culled meshes and reinserting them into the meshbatch with addAt.
For the shadow layers, I .push the indices into a pool when they get culled. When a new edge tile has to be created, I pull it from the pool and addAt it, if the pool is empty I just addMesh it.
For the shadow tiles, the .alpha is always 0.5 since the shadows are just black image tiles shaped to some angles and stuff.
Tiles that get deleted with the cull… What I thought to be clever is. I overwrite their index value in the meshbatch with an single image meshbatch index value positioned offscreen at -10000,-10000.
This way, I can use the meshbatch itself as a vertex pool. If It would get very unbalanced, I could just .clear and redraw the meshbatch and reset all the meshbatch pools.
I hope you understand, It's better than reading my code.
I tried making it readable and reusable today and it stopped working, directly writing into the meshbatch is not very forgiving.
I restored my old code just to be able to debug this .alpha stuff.
Highest regards,
Mac