andersonlucasg3 / SpriteKit-Android

(DISCONTINUED) SpriteKit port for Android
BSD 3-Clause "New" or "Revised" License
26 stars 9 forks source link

Ordered rendering performance #3

Open andersonlucasg3 opened 7 years ago

andersonlucasg3 commented 7 years ago

There is a problem with the zPosition property of the nodes and the order of rendering of these nodes when they have alpha channels in the texture. If I have 3 nodes to be rendered: node1 -> zPosition == 0 node2 -> zPosition == -1 node3 -> zPosition == 1 When the rendering occurs in the order node1, node2, node3, the node1 would be obfuscated by the alpha channel of the other two nodes if they intersected each other. So I have fixed this issue with a poor solution, that is ordering the children array each time I'm going to render the parent node of these nodes.

Most likely solution:

The most decent approach would be inserting ordered, and updating the order of the children nodes always that the zPosition value is changed.

Open to discussion.