Simple Scene Management
    A common question on game programming forums is something like:
     I have a bunch of objects moving around the world; how do I render
      them? Do I have a Draw() function on each of them and let them call
      glVertexPointer() 
      themselves?
     Here's my proto-typical answer, assuming you know about the Interface
    way of structuring code, and some other common software patterns:
      You typically want objects implementing your Viewable interface to go
    into some scene graph (like an octree).
     Then, you use a Visitor to visit all Viewables that intersect the
    viewing frustum.
     The protocol for Viewable is typically to return a description of some
    sort (i e, group of geometry, material, and pose/matrix state) which the
    renderer uses to actually render the thing.
     The reason you don't want objects calling renderer->setTexture() and
    similar functions directly is that then, if you change your rendering to
    require multi-passing (for shadows, reflection, etc) then you have to
    update ALL the objects, if the objects do the rendering.
     Having objects describe themselves with multiples of
    geometry-material-state is much more flexible, as you can easily throw that
    at mirroring, cube mapping, shadow maps, shadow volumes, cel shading, and
    whatever else you care about implementing.
  |