public static List<Geometry> makeBatches(Collection<Geometry> geometries) { return makeBatches(geometries, false); }
/** * 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. * @param scene The scene to optimize * @param useLods true if you want the resulting geometry to keep lod information * @return The newly created optimized geometries attached to a node */ public static Node optimize(Node scene, boolean useLods) { ArrayList<Geometry> geoms = new ArrayList<Geometry>(); gatherGeoms(scene, geoms); List<Geometry> batchedGeoms = makeBatches(geoms, useLods); for (Geometry geom : batchedGeoms) { scene.attachChild(geom); } for (Iterator<Geometry> it = geoms.iterator(); it.hasNext();) { Geometry geometry = it.next(); geometry.removeFromParent(); } // Since the scene is returned unaltered the transform must be reset scene.setLocalTransform(Transform.IDENTITY); return scene; }
public static List<Geometry> makeBatches(Collection<Geometry> geometries) { return makeBatches(geometries, false); }
public static List<Geometry> makeBatches(Collection<Geometry> geometries) { return makeBatches(geometries, false); }
public void createFastOctnode(List<Geometry> globalGeomList){ fastNode = new FastOctnode(); if (geoms != null){ Collection<Geometry> geomsColl = Arrays.asList(geoms); List<Geometry> myOptimizedList = GeometryBatchFactory.makeBatches(geomsColl); int startIndex = globalGeomList.size(); globalGeomList.addAll(myOptimizedList); fastNode.setOffset(startIndex); fastNode.length = myOptimizedList.size(); }else{ fastNode.setOffset(0); fastNode.length = 0; } for (int i = 0; i < 8; i++){ if (children[i] != null){ children[i].createFastOctnode(globalGeomList); } } }
/** * 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. * @param scene The scene to optimize * @param useLods true if you want the resulting geometry to keep lod information * @return The newly created optimized geometries attached to a node */ public static Node optimize(Node scene, boolean useLods) { ArrayList<Geometry> geoms = new ArrayList<Geometry>(); gatherGeoms(scene, geoms); List<Geometry> batchedGeoms = makeBatches(geoms, useLods); for (Geometry geom : batchedGeoms) { scene.attachChild(geom); } for (Iterator<Geometry> it = geoms.iterator(); it.hasNext();) { Geometry geometry = it.next(); geometry.removeFromParent(); } // Since the scene is returned unaltered the transform must be reset scene.setLocalTransform(Transform.IDENTITY); return 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. * @param scene The scene to optimize * @param useLods true if you want the resulting geometry to keep lod information * @return The newly created optimized geometries attached to a node */ public static Node optimize(Node scene, boolean useLods) { ArrayList<Geometry> geoms = new ArrayList<Geometry>(); gatherGeoms(scene, geoms); List<Geometry> batchedGeoms = makeBatches(geoms, useLods); for (Geometry geom : batchedGeoms) { scene.attachChild(geom); } for (Iterator<Geometry> it = geoms.iterator(); it.hasNext();) { Geometry geometry = it.next(); geometry.removeFromParent(); } // Since the scene is returned unaltered the transform must be reset scene.setLocalTransform(Transform.IDENTITY); return scene; }