A design for an indexed render queue

posted in Gamedev info
Published January 26, 2015
Advertisement
A design for an indexed render queue


drawing information is stored in a drawinfo struct. it could also be hashed into an int, etc.


the queue consists of an un-ordered list of drawinfo structs.

the queue is supplemented by a multi-dimensional indexing system that
allows processing of the queue in optimal draw order.

the index system consists of a list of textures.

for each texture there is a list of meshes.

for each mesh there is a list of instances, which are the indexes of the
drawinfo structs in the render queue that use that mesh and texture.

if desired, the list of instances can be sorted from near to far. but the
speeds i've gotten from optimal draw order alone has been fast enough i don't bother sorting instances (yet).

another layer can be added to the index as well for materials. in that case,
each mesh would have a list of materials, and each material would have a
list of instances (drawinfo indexes).

to render the queue, you go though the list of textures. you set the first texture, then go though its list of meshes used. you set the mesh, then go though its list of instances. for each instance, you set the world transform, then draw. then you continue with the next mesh until all meshes for that texture are drawn. then you continue with the next texture, until everything is drawn.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement