Hey, I am using Nez to make my own Tile Engine and am struggling to get the layerDepth to work when rendering my tiles.
I have one component called
TileMapComponent, which implements
IRenderable and takes care of rendering all of the tiles on the map through a for loop which calls
Batcher.draw(). For some reason, specifying a
layerDepth in the
draw() method doesn't do anything, it seems that it only worries about draw call order.
I have found a "hack" to get it working by manually sorting all of the tiles that are at the same position but on different layers and then calling them in order. But then it still doesn't work with any external entities (say I have a player entity that is on the 1.0f
depthLayer, it renders behind the 0.5f tiles simply because it is declared/called before them). I've even tried inverting the
depthLayer, setting the
DepthStencilState, etc. Nothing worked.
So does Nez's Batcher not support depthLayer? or am I misunderstanding something?
Here's a small code sample which shows my draw calls.
Note: Since all of the tiles are rendered by one component, the renderableComponentList only includes ONE component when I try to debug.