I have a quick little C# app that draws 3D objects (primitives)
I have 3 objects that I want to draw:
At the moment I am drawing them as they come in. So I could have 3 cones, 1 Cube, 2 spheres, 1 cone, 5 cubes etc.
As you can imagine this is in-efficient. Basically what I would like to do is batch the objects together so that all like objects are together eg: all cones, all cubes, all spheres are together.
Just before I finish a frame I will refer to the batch and draw the primitives.
What I was planning was to create a simple design pattern that simply added the objects to the relevant structure (either an array list or perhaps a hash table.) Then iterate through the structures when ready.
Anyone have any ideas on how to organise or store basic objects in a structure that would all for the most efficient insertion and retrieval?