/** Bind the next side of cubemap and return false if no more side. Should be called in between a call to {@link #begin()} and * #end to cycle to each side of the cubemap to render on. */ public boolean nextSide () { if (currentSide > 5) { throw new GdxRuntimeException("No remaining sides."); } else if (currentSide == 5) { return false; } currentSide++; bindSide(getSide()); return true; }
/** Bind the next side of cubemap and return false if no more side. Should be called in between a call to {@link #begin()} and * #end to cycle to each side of the cubemap to render on. */ public boolean nextSide () { if (currentSide > 5) { throw new GdxRuntimeException("No remaining sides."); } else if (currentSide == 5) { return false; } currentSide++; bindSide(getSide()); return true; }
public void renderScene() { Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST); // Render scene to screen super.render(); // Render scene to cubemap camFb.position.set(cam.position); camFb.near = cam.near; camFb.far = cam.far; fb.begin(); while( fb.nextSide() ) { fb.getSide().getUp(camFb.up); fb.getSide().getDirection(camFb.direction); camFb.update(); Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); modelBatch.begin(camFb); for (ModelInstance instance : instances) modelBatch.render(instance, lights); if (space != null) modelBatch.render(space); modelBatch.end(); } fb.end(); }
/** Bind the next side of cubemap and return false if no more side. Should be called in between a call to {@link #begin()} and * #end to cycle to each side of the cubemap to render on. */ public boolean nextSide () { if (currentSide > 5) { throw new GdxRuntimeException("No remaining sides."); } else if (currentSide == 5) { return false; } currentSide++; bindSide(getSide()); return true; }