snogglethorpe / snogray

Snogray renderer

Home Page:http://www.nongnu.org/snogray

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add simple statistics method for surfaces

snogglethorpe opened this issue · comments

Very simple, basically: number of real surfaces (not including containers?), number of virtual surfaces (the number of surfaces participating in rendering, i.e., the complexity of the scene), number of lights.

Should this be multiple methods in Surface, or a single method that returns a structure...? The latter is more complicated, but reduces the amount of enumeration required for the (usual) case where more than one piece of info is needed. It also means that container surfaces don't need to be updated for new fields (though maybe this is a disadvantage too, if it hides changes that container surfaces would need to participate in).

Maybe:

struct Surface::Stats
{
  // only surfaces that actually participate in rendering are counted

  // Number of physically distinct surfaces (surfaces that actually take up
  // space in memory, not including container-only surfaces).
  //
  unsigned long num_real_surfaces;

  // Number of surfaces participating in rendering, including multiple virtual
  // instances of models.  In other words, the complexity of the scene.
  //
  unsigned long num_virtual_surfaces;

  // Number of lights participating in rendering.  [We don't currently support
  // support instanced lights, but maybe lights will need a similar split to the above?]
  //
  unsigned long num_lights;
};

Surface::Stats Surface::stats () const;