jme3tools.optimize
Class GeometryBatchFactory

java.lang.Object
  extended by jme3tools.optimize.GeometryBatchFactory

public class GeometryBatchFactory
extends java.lang.Object


Constructor Summary
GeometryBatchFactory()
           
 
Method Summary
static void gatherGeoms(Spatial scene, java.util.List<Geometry> geoms)
           
static void main(java.lang.String[] args)
           
static java.util.List<Geometry> makeBatches(java.util.Collection<Geometry> geometries)
           
static java.util.List<Geometry> makeBatches(java.util.Collection<Geometry> geometries, boolean useLods)
          Batches a collection of Geometries so that all with the same material get combined.
static void makeLods(java.util.Collection<Geometry> geometries, Mesh outMesh)
           
static void mergeGeometries(java.util.Collection<Geometry> geometries, Mesh outMesh)
          Merges all geometries in the collection into the output mesh.
static Spatial optimize(Node scene)
          Optimizes a scene by combining Geometry with the same material.
static Node optimize(Node scene, boolean useLods)
          Optimizes a scene by combining Geometry with the same material.
static void printMesh(Mesh mesh)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryBatchFactory

public GeometryBatchFactory()
Method Detail

mergeGeometries

public static void mergeGeometries(java.util.Collection<Geometry> geometries,
                                   Mesh outMesh)
Merges all geometries in the collection into the output mesh. Creates a new material using the TextureAtlas.

Parameters:
geometries -
outMesh -

makeLods

public static void makeLods(java.util.Collection<Geometry> geometries,
                            Mesh outMesh)

makeBatches

public static java.util.List<Geometry> makeBatches(java.util.Collection<Geometry> geometries)

makeBatches

public static java.util.List<Geometry> makeBatches(java.util.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
Returns:
A List of newly created Geometries, each with a distinct material

gatherGeoms

public static void gatherGeoms(Spatial scene,
                               java.util.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(java.lang.String[] args)