EntityOrder

BlitzMax Forums/BlitzMax Programming/EntityOrder

(tu) ENAY(Posted 2005) [#1]
I don't suppose there is any sort of entityorder commands in Blitzmax for drawing priorities?

I'm finding it pretty tricky thinking a way of drawing my objects. Writing my own Z ordering function isn't a problem. It's just coding it in a 'good' way.

For example I have everything in objects. If I had loads of tree objects and then loads of leaf objects. Then I would be drawing like this:-

Tree.Draw()
Leaf.Draw()

All the leaves would always be on top of the trees, regardless of drawing priority but that makes no sense since leaves and trees are connected together.

And then say if I add clouds and I want some clouds to be drawn behind all of the trees and some all in front. They'd either be only one or the other.

Clouds.Draw()
Tree.Draw()
Leaf.Draw()

etc.

Hope that made sense :)


Robert(Posted 2005) [#2]
I guess the easiest way to do it is to create a drawing list each frame, which stores a list of objects to draw, objects which have a draw() method and a Compare() method which works on the distance of the object away from the viewer.

When it comes to actually rendering the scene, the list can then be sorted by distance, and each object from the list is then drawn.