Cloning constructor for TriMesh and TriangleBatch

Task: associate extra vertex data with a given model.

This requires extending TriangleBatch class and adding more float buffers. To make it compatible with the existing model loaders it much easier to take an existing TriMesh and reconstruct it into an extended version. The only other option is to rewrite all the model loaders.

However there is no straightforward way of cloning TriMesh and TriangleBatch instanses via constructor. Extending TriMesh and TriangleBatch would be alot easier and much less error prone if there was a cloning constructor that take TriMesh and TriangleBatch instances respectively.


public class MyBatch extends TriangleBatch {

  public MyBatch(TriangleBatch batch) {
    // custom initialization code


Addition of cloning constructor would allow focusing on your own logic instead of having a tediously long copy constructor using getters/setters and most likely making an incomplete copy.

Example of cloning right now:

public class CustomBatch extends TriangleBatch {

   private CustomBatch(TriangleBatch batch) {
      if (batch.getDisplayListID() != 0) {
         // report a problem
      // TrangleBatch
      // GeomBatch
      // SceneElement

               // custom initialization code