Class GeometryBatchFactory

java.lang.Object
jme3tools.optimize.GeometryBatchFactory

public class GeometryBatchFactory extends Object
  • Constructor Details

    • GeometryBatchFactory

      public GeometryBatchFactory()
  • Method Details

    • mergeGeometries

      public static void mergeGeometries(Collection<Geometry> geometries, Mesh outMesh)
      Merges all geometries in the collection into the output mesh. Creates a new material using the TextureAtlas.
      Parameters:
      geometries - the geometries to merge
      outMesh - a Mesh to receive the geometries
    • makeLods

      public static void makeLods(Collection<Geometry> geometries, Mesh outMesh)
    • makeBatches

      public static List<Geometry> makeBatches(Collection<Geometry> geometries)
    • makeBatches

      public static List<Geometry> makeBatches(Collection<Geometry> geometries, boolean useLods)
      Batches a collection of Geometries so that all with the same material get combined.
      Parameters:
      geometries - The Geometries to combine
      useLods - true→generate levels of detail, false→don't generate them
      Returns:
      A List of newly created Geometries, each with a distinct material
    • gatherGeoms

      public static void gatherGeoms(Spatial scene, List<Geometry> geoms)
    • optimize

      public static Spatial optimize(Node scene)
      Optimizes a scene by combining Geometry with the same material. All Geometries found in the scene are detached from their parent and a new Node containing the optimized Geometries is attached.
      Parameters:
      scene - The scene to optimize
      Returns:
      The newly created optimized geometries attached to a node
    • optimize

      public static Node optimize(Node scene, boolean useLods)
      Optimizes a scene by combining Geometry with the same material. All Geometries found in the scene are detached from their parent and a new Node containing the optimized Geometries is attached.
      Parameters:
      scene - The scene to optimize
      useLods - true if you want the resulting geometry to keep lod information
      Returns:
      The newly created optimized geometries attached to a node
    • printMesh

      public static void printMesh(Mesh mesh)
    • main

      public static void main(String[] args)
    • alignBuffers

      public static void alignBuffers(Node n, GeometryBatchFactory.AlignOption option)
      Will ensure that all the geometries' meshes of the n sub graph have the same types of buffers
      Parameters:
      n - the node to gather geometries from
      option - the align options
      See Also: