/** * Internal use only. * Updates the resolution of all on-screen cameras to match * the given width and height. */ public void notifyReshape(int w, int h) { for (ViewPort vp : preViewPorts) { if (vp.getOutputFrameBuffer() == null) { Camera cam = vp.getCamera(); cam.resize(w, h, true); } notifyReshape(vp, w, h); } for (ViewPort vp : viewPorts) { if (vp.getOutputFrameBuffer() == null) { Camera cam = vp.getCamera(); cam.resize(w, h, true); } notifyReshape(vp, w, h); } for (ViewPort vp : postViewPorts) { if (vp.getOutputFrameBuffer() == null) { Camera cam = vp.getCamera(); cam.resize(w, h, true); } notifyReshape(vp, w, h); } }
/** * Sets the size of the reflection map * default is 512, the higher, the better quality, but the slower the effect. * @param reflectionMapSize */ public void setReflectionMapSize(int reflectionMapSize) { this.reflectionMapSize = reflectionMapSize; //if reflection pass is already initialized we must update it if(reflectionPass != null){ reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth); reflectionCam.resize(reflectionMapSize, reflectionMapSize, true); reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer()); material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture()); } }
vp.setOutputFrameBuffer(fb); vp.getCamera().resize(width, height, true);
private void renderProcessing(Renderer r, FrameBuffer dst, Material mat){ if (dst == null){ fsQuad.setWidth(mainSceneFB.getWidth()); fsQuad.setHeight(mainSceneFB.getHeight()); fbCam.resize(mainSceneFB.getWidth(), mainSceneFB.getHeight(), true); }else{ fsQuad.setWidth(dst.getWidth()); fsQuad.setHeight(dst.getHeight()); fbCam.resize(dst.getWidth(), dst.getHeight(), true); } fsQuad.setMaterial(mat); fsQuad.updateGeometricState(); renderManager.setCamera(fbCam, true); r.setFrameBuffer(dst); r.clearBuffers(true, true, true); renderManager.renderGeometry(fsQuad); }
@Override public void simpleInitApp() { Geometry cube = new Geometry("blue cube", new Box(1, 1, 1)); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); cube.setMaterial(mat); rootNode.attachChild(cube); // Trying to update the viewport: cam.setViewPortBottom(0.5f); cam.resize(640, 480 / 2, false); cam.setFrustumPerspective(40, 640f / (480 / 2), 0.05f, 500f); cam.update(); } }
cam.resize(w, h, false); left = cam.getViewPortLeft(); right = cam.getViewPortRight();
public void preFrame(float tpf) { if (filters.isEmpty() || lastFilterIndex == -1) { //If the camera is initialized and there are no filter to render, the camera viewport is restored as it was if (cameraInit) { viewPort.getCamera().resize(originalWidth, originalHeight, true); viewPort.getCamera().setViewPort(left, right, bottom, top); viewPort.setOutputFrameBuffer(outputBuffer); cameraInit = false; } } else { setupViewPortFrameBuffer(); //if we are ina multiview situation we need to resize the camera //to the viewportsize so that the backbuffer is rendered correctly if (multiView) { viewPort.getCamera().resize(width, height, false); viewPort.getCamera().setViewPort(0, 1, 0, 1); viewPort.getCamera().update(); renderManager.setCamera(viewPort.getCamera(), false); } } for (Filter filter : filters.getArray()) { if (filter.isEnabled()) { if (prof != null) prof.spStep(SpStep.ProcPreFrame, FPP, filter.getName()); filter.preFrame(tpf); } } }
public void cleanup() { if (viewPort != null) { //reset the viewport camera viewport to its initial value viewPort.getCamera().resize(originalWidth, originalHeight, true); viewPort.getCamera().setViewPort(left, right, bottom, top); viewPort.setOutputFrameBuffer(outputBuffer); viewPort = null; if(renderFrameBuffer != null){ renderFrameBuffer.dispose(); } if(depthTexture!=null){ depthTexture.getImage().dispose(); } filterTexture.getImage().dispose(); if(renderFrameBufferMS != null){ renderFrameBufferMS.dispose(); } for (Filter filter : filters.getArray()) { filter.cleanup(renderer); } } }
cam.resize((int) size.x, (int) size.y, false);
cam.resize((int) size.x, (int) size.y, false);
cam.resize((int)size.x, (int)size.y, false);
cam.resize((int)size.x, (int)size.y, false);
@Override public void resize(int width, int height, boolean fixAspect) { super.resize(width, height, false); if (fixAspect /* && !parallelProjection */) { frustumRight = frustumTop * ((float) getInternalWidth() / getInternalHeight()); frustumLeft = -frustumRight; onFrustumChange(); } }
@Override public void resize(int width, int height, boolean fixAspect) { super.resize(width, height, false); if (fixAspect /* && !parallelProjection */) { frustumRight = frustumTop * ((float) getInternalWidth() / getInternalHeight()); frustumLeft = -frustumRight; onFrustumChange(); } }
public void setupOffscreenView(int width, int height) { if (viewportType == ViewportType.CANVAS) { throw new RuntimeException("Viewport is setup for canvas rendering"); } frameBuffer = new FrameBuffer(width, height, 1); viewPort.setOutputFrameBuffer(frameBuffer); viewPort.getCamera().resize(width, height, true); frameBuffer.setDepthBuffer(Format.Depth); frameBuffer.setColorBuffer(Format.RGBA8); }
public void setupOffscreenView(int width, int height) { if (viewportType == ViewportType.CANVAS) { throw new RuntimeException("Viewport is setup for canvas rendering"); } frameBuffer = new FrameBuffer(width, height, 1); viewPort.setOutputFrameBuffer(frameBuffer); viewPort.getCamera().resize(width, height, true); frameBuffer.setDepthBuffer(Format.Depth); frameBuffer.setColorBuffer(Format.RGBA8); }
public void cleanup() { if (viewPort != null) { //reseting the viewport camera viewport to its initial value viewPort.getCamera().resize(originalWidth, originalHeight, true); viewPort.getCamera().setViewPort(left, right, bottom, top); viewPort.setOutputFrameBuffer(outputBuffer); viewPort = null; for (Filter filter : filters) { filter.cleanup(renderer); } } }
/** * Sets the size of the reflection map * default is 512, the higher, the better quality, but the slower the effect. * @param reflectionMapSize */ public void setReflectionMapSize(int reflectionMapSize) { this.reflectionMapSize = reflectionMapSize; //if reflection pass is already initialized we must update it if(reflectionPass != null){ reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth); reflectionCam.resize(reflectionMapSize, reflectionMapSize, true); reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer()); material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture()); } }
/** * Sets the size of the reflection map * default is 512, the higher, the better quality, but the slower the effect. * @param reflectionMapSize */ public void setReflectionMapSize(int reflectionMapSize) { this.reflectionMapSize = reflectionMapSize; //if reflection pass is already initialized we must update it if(reflectionPass != null){ reflectionPass.init(renderManager.getRenderer(), reflectionMapSize, reflectionMapSize, Format.RGBA8, Format.Depth); reflectionCam.resize(reflectionMapSize, reflectionMapSize, true); reflectionProcessor.setReflectionBuffer(reflectionPass.getRenderFrameBuffer()); material.setTexture("ReflectionMap", reflectionPass.getRenderedTexture()); } }