Significance of Builder class?

Builder class looks very interesting:

From builder.h:

So, questions on usage:

  • when should one use the Builder object?
  • do bits of Panda itself use it?
  • should PandaNode derivatives use it?
  • or is this class primarily a utility class for the Python applications?

And also:

  • how does the Builder work?
  • what can it do?
  • what are its limitations? (eg, can it cope with duplicate vertices?)


Actually, the builder class is being phased out with the new Geom rewrite.

The replacement for the builder is the egg library, which can still be used to create geometry on-the-fly. In fact, the egg library was the primary interface to the builder before; we’re really just folding the builder directly into the egg loader now.

It does resolve duplicate vertices sensibly, collects triangles with similar state, and generates triangle strips and all that nice stuff. However, it’s really designed with a pre-processing philosophy in mind; it does a lot of work in the short term to make its output as optimal as possible over the long term. it’s therefore a good way to generate geometry if you’re going to invoke it once at application start, or only occasionally, but you probably don’t want to be invoking it every frame.