public boolean hasNext() { return index < size(); }
public boolean isQueueEmpty(Bucket bucket) { switch (bucket) { case Gui: return guiList.size() == 0; case Opaque: return opaqueList.size() == 0; case Sky: return skyList.size() == 0; case Transparent: return transparentList.size() == 0; case Translucent: return translucentList.size() == 0; default: throw new UnsupportedOperationException("Unsupported bucket type: " + bucket); } }
/** * 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; } } }
@Override protected void getReceivers(GeometryList lightReceivers) { if (lightReceivers.size()==0) { for (Spatial scene : viewPort.getScenes()) { ShadowUtil.getGeometriesInCamFrustum(scene, viewPort.getCamera(), RenderQueue.ShadowMode.Receive, lightReceivers); } } }
@Override protected void getReceivers(GeometryList lightReceivers) { if (lightReceivers.size()==0) { for (Spatial scene : viewPort.getScenes()) { ShadowUtil.getGeometriesInCamFrustum(scene, viewPort.getCamera(), RenderQueue.ShadowMode.Receive, lightReceivers); } } }
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(); } }
@Override protected GeometryList getOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders) { // update frustum points based on current camera and split ShadowUtil.updateFrustumPoints(viewPort.getCamera(), splitsArray[shadowMapIndex], splitsArray[shadowMapIndex + 1], 1.0f, points); //Updating shadow cam with current split frusta if (lightReceivers.size()==0) { for (Spatial scene : viewPort.getScenes()) { ShadowUtil.getGeometriesInCamFrustum(scene, viewPort.getCamera(), RenderQueue.ShadowMode.Receive, lightReceivers); } } ShadowUtil.updateShadowCamera(viewPort, lightReceivers, shadowCam, points, shadowMapOccluders, stabilize?shadowMapSize:0); return shadowMapOccluders; }
@Override protected GeometryList getOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders) { // update frustum points based on current camera and split ShadowUtil.updateFrustumPoints(viewPort.getCamera(), splitsArray[shadowMapIndex], splitsArray[shadowMapIndex + 1], 1.0f, points); //Updating shadow cam with current split frusta if (lightReceivers.size()==0) { for (Spatial scene : viewPort.getScenes()) { ShadowUtil.getGeometriesInCamFrustum(scene, viewPort.getCamera(), RenderQueue.ShadowMode.Receive, lightReceivers); } } ShadowUtil.updateShadowCamera(viewPort, lightReceivers, shadowCam, points, shadowMapOccluders, stabilize?shadowMapSize:0); return shadowMapOccluders; }
/** * 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); } } }
for (int i = 0; i < l.size(); i++) { Material mat = l.get(i).getMaterial();
if (lightReceivers.size() != 0) {
if (lightReceivers.size() != 0) {
if (shadowOccluders.size() == 0) { noOccluders = true; return;