Class MeshCombiner

java.lang.Object
com.ardor3d.util.geom.MeshCombiner

public class MeshCombiner extends Object
Utility for combining multiple Meshes into a single Mesh. Note that you generally will want to combine Mesh objects that have the same render states. XXX: should add in a way to combine only meshes with similar renderstates
XXX: Might be able to reduce memory usage in the singular case where all sources do not have indices defined (arrays).
XXX: combining of triangle strips may not work properly?
XXX: Could be smarter about texcoords and have a tuple size per channel.
  • Field Details

    • DEFAULT_COLOR

      public static final float[] DEFAULT_COLOR
    • DEFAULT_NORMAL

      public static final float[] DEFAULT_NORMAL
    • DEFAULT_TEXCOORD

      public static final float[] DEFAULT_TEXCOORD
  • Constructor Details

    • MeshCombiner

      public MeshCombiner()
  • Method Details

    • combine

      public static final Mesh combine(Node source)

      Combine all mesh objects that fall under the scene graph the given source node. All Mesh objects must have vertices and texcoords that have the same tuple width. It is possible to merge Mesh objects together that have mismatched normals/colors/etc. (eg. one with colors and one without.)

      Parameters:
      source - our source node
      Returns:
      the combined Mesh.
    • combine

      public static final Mesh combine(Spatial source, MeshCombiner.MeshCombineLogic logic)
    • combine

      public static final Mesh combine(Mesh... sources)
      Combine the given array of Mesh objects into a single Mesh. All Mesh objects must have vertices and texcoords that have the same tuple width. It is possible to merge Mesh objects together that have mismatched normals/colors/etc. (eg. one with colors and one without.)
      Parameters:
      sources - our Mesh objects to combine.
      Returns:
      the combined Mesh.
    • combine

      public static final Mesh combine(Collection<Mesh> sources)
      Combine the given collection of Mesh objects into a single Mesh. All Mesh objects must have vertices and texcoords that have the same tuple width. It is possible to merge Mesh objects together that have mismatched normals/colors/etc. (eg. one with colors and one without.)
      Parameters:
      sources - our collection of Mesh objects to combine.
      Returns:
      the combined Mesh.
    • combine

      public static final Mesh combine(Collection<Mesh> sources, MeshCombiner.MeshCombineLogic logic)