public Geometry next() { if ( index >= size() ) { throw new NoSuchElementException("Geometry list has only " + size() + " elements"); } return get(index++); }
/** * Renders the given GeometryList. * <p> * For every geometry in the list, the * {@link #renderGeometry(com.jme3.scene.Geometry) } method is called. * * @param gl The geometry list to render. * * @see GeometryList * @see #renderGeometry(com.jme3.scene.Geometry) */ public void renderGeometryList(GeometryList gl) { for (int i = 0; i < gl.size(); i++) { renderGeometry(gl.get(i)); } }
private void buildMatCache(GeometryList l) { matCache.clear(); for (int i = 0; i < l.size(); i++) { Material mat = l.get(i).getMaterial(); //checking if the material has the post technique and adding it to the material cache if (mat.getMaterialDef().getTechniqueDefs(postTechniqueName) != null) { if (!matCache.contains(mat)) { matCache.add(mat); } } else { needsfallBackMaterial = true; } } }
private void buildMatCache(GeometryList l) { matCache.clear(); for (int i = 0; i < l.size(); i++) { Material mat = l.get(i).getMaterial(); //checking if the material has the post technique and adding it to the material cache if (mat.getMaterialDef().getTechniqueDefs(postTechniqueName) != null) { if (!matCache.contains(mat)) { matCache.add(mat); } } else { needsfallBackMaterial = true; } } }
private void renderGeometryList(GeometryList list, RenderManager rm, Camera cam, boolean clear) { list.setCamera(cam); // select camera for sorting list.sort(); for (int i = 0; i < list.size(); i++) { Geometry obj = list.get(i); assert obj != null; rm.renderGeometry(obj); obj.queueDistance = Float.NEGATIVE_INFINITY; } if (clear) { list.clear(); } }
/** * Compute bounds of a geomList * @param list * @param transform * @return */ public static BoundingBox computeUnionBound(GeometryList list, Transform transform) { BoundingBox bbox = new BoundingBox(); TempVars tempv = TempVars.get(); for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); BoundingVolume newVol = vol.transform(transform, tempv.bbox); //Nehon : prevent NaN and infinity values to screw the final bounding box if (!Float.isNaN(newVol.getCenter().x) && !Float.isInfinite(newVol.getCenter().x)) { bbox.mergeLocal(newVol); } } tempv.release(); return bbox; }
/** * Compute bounds of a geomList * @param list * @param mat * @return */ public static BoundingBox computeUnionBound(GeometryList list, Matrix4f mat) { BoundingBox bbox = new BoundingBox(); TempVars tempv = TempVars.get(); for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); BoundingVolume store = vol.transform(mat, tempv.bbox); //Nehon : prevent NaN and infinity values to screw the final bounding box if (!Float.isNaN(store.getCenter().x) && !Float.isInfinite(store.getCenter().x)) { bbox.mergeLocal(store); } } tempv.release(); return bbox; }
/** * Populates the outputGeometryList with the geometry of the * inputGeometryList that are in the frustum of the given camera * * @param inputGeometryList The list containing all geometries to check * against the camera frustum * @param camera the camera to check geometries against * @param outputGeometryList the list of all geometries that are in the * camera frustum */ public static void getGeometriesInCamFrustum(GeometryList inputGeometryList, Camera camera, GeometryList outputGeometryList) { for (int i = 0; i < inputGeometryList.size(); i++) { Geometry g = inputGeometryList.get(i); int planeState = camera.getPlaneState(); camera.setPlaneState(0); if (camera.contains(g.getWorldBound()) != Camera.FrustumIntersect.Outside) { outputGeometryList.add(g); } camera.setPlaneState(planeState); } }
/** * Populates the outputGeometryList with the geometry of the * inputGeometryList that are in the radius of a light. * The array of camera must be an array of 6 cameras initialized so they represent the light viewspace of a pointlight * * @param inputGeometryList The list containing all geometries to check * against the camera frustum * @param cameras the camera array to check geometries against * @param outputGeometryList the list of all geometries that are in the * camera frustum */ public static void getGeometriesInLightRadius(GeometryList inputGeometryList, Camera[] cameras, GeometryList outputGeometryList) { for (int i = 0; i < inputGeometryList.size(); i++) { Geometry g = inputGeometryList.get(i); boolean inFrustum = false; for (int j = 0; j < cameras.length && inFrustum == false; j++) { Camera camera = cameras[j]; int planeState = camera.getPlaneState(); camera.setPlaneState(0); inFrustum = camera.contains(g.getWorldBound()) != Camera.FrustumIntersect.Outside; camera.setPlaneState(planeState); } if (inFrustum) { outputGeometryList.add(g); } } }
Material mat = l.get(i).getMaterial();
Geometry receiver = receivers.get(i); BoundingVolume bv = receiver.getWorldBound(); BoundingVolume recvBox = bv.transform(viewProjMatrix, vars.bbox);
Material mat = gl.get(i).getMaterial(); String sortId = Integer.toHexString(mat.getSortId()).toUpperCase(); System.out.print(sortId + "\t"); Material current = null; for (int i = 0; i < gl.size(); i++) { Material mat = gl.get(i).getMaterial(); if (current == null) { current = mat; for (int g = 0; g < 5; g++) { int index = i * 5 + g; Material mat1 = gl.get(index).getMaterial(); Material mat2 = materials[i]; assert mat1.getName().equals(mat2.getName()) :
public Geometry next() { if ( index >= size() ) { throw new NoSuchElementException("Geometry list has only " + size() + " elements"); } return get(index++); }
/** * Renders the given GeometryList. * <p> * For every geometry in the list, the * {@link #renderGeometry(com.jme3.scene.Geometry) } method is called. * * @param gl The geometry list to render. * * @see GeometryList * @see #renderGeometry(com.jme3.scene.Geometry) */ public void renderGeometryList(GeometryList gl) { for (int i = 0; i < gl.size(); i++) { renderGeometry(gl.get(i)); } }
private void buildMatCache(GeometryList l) { matCache.clear(); for (int i = 0; i < l.size(); i++) { Material mat = l.get(i).getMaterial(); //checking if the material has the post technique and adding it to the material cache if (mat.getMaterialDef().getTechniqueDefs(postTechniqueName) != null) { if (!matCache.contains(mat)) { matCache.add(mat); } } else { needsfallBackMaterial = true; } } }
/** * Renders the given GeometryList. * <p> * For every geometry in the list, the * {@link #renderGeometry(com.jme3.scene.Geometry) } method is called. * * @param gl The geometry list to render. * * @see GeometryList * @see #renderGeometry(com.jme3.scene.Geometry) */ public void renderGeometryList(GeometryList gl) { for (int i = 0; i < gl.size(); i++) { renderGeometry(gl.get(i)); } }
private void renderGeometryList(GeometryList list, RenderManager rm, Camera cam, boolean clear) { list.setCamera(cam); // select camera for sorting list.sort(); for (int i = 0; i < list.size(); i++) { Geometry obj = list.get(i); assert obj != null; rm.renderGeometry(obj); obj.queueDistance = Float.NEGATIVE_INFINITY; } if (clear) { list.clear(); } }
private void renderGeometryList(GeometryList list, RenderManager rm, Camera cam, boolean clear) { list.setCamera(cam); // select camera for sorting list.sort(); for (int i = 0; i < list.size(); i++) { Spatial obj = list.get(i); assert obj != null; if (obj instanceof Geometry) { Geometry g = (Geometry) obj; rm.renderGeometry(g); // make sure to reset queue distance } if (obj != null) { obj.queueDistance = Float.NEGATIVE_INFINITY; } } if (clear) { list.clear(); } }
/** * Compute bounds of a geomList * @param list * @param transform * @return */ public static BoundingBox computeUnionBound(GeometryList list, Transform transform) { BoundingBox bbox = new BoundingBox(); for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); BoundingVolume newVol = vol.transform(transform); //Nehon : prevent NaN and infinity values to screw the final bounding box if (newVol.getCenter().x != Float.NaN && newVol.getCenter().x != Float.POSITIVE_INFINITY && newVol.getCenter().x != Float.NEGATIVE_INFINITY) { bbox.mergeLocal(newVol); } } return bbox; }
/** * Compute bounds of a geomList * @param list * @param mat * @return */ public static BoundingBox computeUnionBound(GeometryList list, Matrix4f mat) { BoundingBox bbox = new BoundingBox(); BoundingVolume store = null; for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); store = vol.clone().transform(mat, null); //Nehon : prevent NaN and infinity values to screw the final bounding box if (store.getCenter().x != Float.NaN && store.getCenter().x != Float.POSITIVE_INFINITY && store.getCenter().x != Float.NEGATIVE_INFINITY) { bbox.mergeLocal(store); } } return bbox; }