public void onAnalog(String name, float value, float tpf) { // Instead of moving closer/farther to object, we zoom in/out. if (name.equals("Size-")) frustumSize += 0.3f * tpf; else frustumSize -= 0.3f * tpf; float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); } }
cam.setFrustum(znear, zfar, -xmag, xmag, ymag, -ymag);
cam.setParallelProjection(true); float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize);
public void onAnalog(String name, float value, float tpf) { if (cam.isParallelProjection()) { // Instead of moving closer/farther to object, we zoom in/out. if (name.equals("Size-")) { frustumSize += 5f * tpf; } else { frustumSize -= 5f * tpf; } float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); } }
shadowCam.setFrustum(-1, 1, -1, 1, 1, -1); } else { shadowCam.setFrustumPerspective(45, 1, 1, 150);
@Override protected void initFrustumCam() { Camera viewCam = viewPort.getCamera(); frustumCam = viewCam.clone(); frustumCam.setFrustum(viewCam.getFrustumNear(), zFarOverride, viewCam.getFrustumLeft(), viewCam.getFrustumRight(), viewCam.getFrustumTop(), viewCam.getFrustumBottom()); }
@Override protected void initFrustumCam() { Camera viewCam = viewPort.getCamera(); frustumCam = viewCam.clone(); frustumCam.setFrustum(viewCam.getFrustumNear(), zFarOverride, viewCam.getFrustumLeft(), viewCam.getFrustumRight(), viewCam.getFrustumTop(), viewCam.getFrustumBottom()); }
shadowCam.setFrustum(-shadowCam.getFrustumFar(), shadowCam.getFrustumFar(), -1, 1, 1, -1);
public void simpleInitApp() { Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj"); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(Vector3f.UNIT_XYZ.negate()); rootNode.addLight(dl); rootNode.attachChild(teaGeom); // Setup first view cam.setParallelProjection(true); float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); inputManager.addListener(this, "Size+", "Size-"); inputManager.addMapping("Size+", new KeyTrigger(KeyInput.KEY_W)); inputManager.addMapping("Size-", new KeyTrigger(KeyInput.KEY_S)); }
public void postQueue(RenderQueue rq) { Camera sceneCam = rm.getCurrentCamera(); //update refraction cam refractionCam.setLocation(sceneCam.getLocation()); refractionCam.setRotation(sceneCam.getRotation()); refractionCam.setFrustum(sceneCam.getFrustumNear(), sceneCam.getFrustumFar(), sceneCam.getFrustumLeft(), sceneCam.getFrustumRight(), sceneCam.getFrustumTop(), sceneCam.getFrustumBottom()); refractionCam.setParallelProjection(sceneCam.isParallelProjection()); //update reflection cam WaterUtils.updateReflectionCam(reflectionCam, plane, sceneCam); //Rendering reflection and refraction rm.renderViewPort(reflectionView, savedTpf); rm.renderViewPort(refractionView, savedTpf); rm.getRenderer().setFrameBuffer(vp.getOutputFrameBuffer()); rm.setCamera(sceneCam, false); }
camLoc = plane.reflect(sceneCam.getLocation(), camLoc); reflectionCam.setLocation(camLoc); reflectionCam.setFrustum(sceneCam.getFrustumNear(), sceneCam.getFrustumFar(), sceneCam.getFrustumLeft(),
public void onAnalog(String name, float value, float tpf) { // Instead of moving closer/farther to object, we zoom in/out. if (name.equals("Size-")) frustumSize += 0.3f * tpf; else frustumSize -= 0.3f * tpf; float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); } }
public void onAnalog(String name, float value, float tpf) { // Instead of moving closer/farther to object, we zoom in/out. if (name.equals("Size-")) frustumSize += 0.3f * tpf; else frustumSize -= 0.3f * tpf; float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); } }
private void setupCamera(int numberOfCameras, int cameraScansPerSweep, int scanHeight, float fieldOfView, float minRange, float maxRange) { float cameraFoV = fieldOfView / (numberOfCameras); float frustrumX = FastMath.tan(cameraFoV / 2.0f) * minRange; float frustrumY = frustrumX / cameraScansPerSweep * scanHeight; cam.setParallelProjection(false); cam.setFrustum(minRange, maxRange, -frustrumX, frustrumX, frustrumY, -frustrumY); }
private void setupCamera(int numberOfCameras, int cameraScansPerSweep, int scanHeight, float fieldOfView, float minRange, float maxRange) { float cameraFoV = fieldOfView / (numberOfCameras); float frustrumX = FastMath.tan(cameraFoV / 2.0f) * minRange; float frustrumY = frustrumX / cameraScansPerSweep * scanHeight; cam.setParallelProjection(false); cam.setFrustum(minRange, maxRange, -frustrumX, frustrumX, frustrumY, -frustrumY); }
@Override protected void initFrustumCam() { Camera viewCam = viewPort.getCamera(); frustumCam = viewCam.clone(); frustumCam.setFrustum(viewCam.getFrustumNear(), zFarOverride, viewCam.getFrustumLeft(), viewCam.getFrustumRight(), viewCam.getFrustumTop(), viewCam.getFrustumBottom()); }
@Override protected void initFrustumCam() { Camera viewCam = viewPort.getCamera(); frustumCam = viewCam.clone(); frustumCam.setFrustum(viewCam.getFrustumNear(), zFarOverride, viewCam.getFrustumLeft(), viewCam.getFrustumRight(), viewCam.getFrustumTop(), viewCam.getFrustumBottom()); }
public void cameraRestore() { Camera cam = app.getCamera(); //cam.setAxes(storedCamera.getLeft(), storedCamera.getUp(), storedCamera.getDirection()); //cam.setRotation(storedCamera.getRotation()); cam.setFrame(storedCamera.getLocation(), storedCamera.getRotation()); cam.setFrustum(storedCamera.getFrustumNear(), storedCamera.getFrustumFar(), storedCamera.getFrustumLeft(), storedCamera.getFrustumRight(), storedCamera.getFrustumTop(), storedCamera.getFrustumBottom()); //cam.setLocation(storedCamera.getLocation()); }
public void simpleInitApp() { Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj"); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(Vector3f.UNIT_XYZ.negate()); // TODO: Fix frustum culling for parallel projection cameras. rootNode.setCullHint(CullHint.Never); rootNode.addLight(dl); rootNode.attachChild(teaGeom); flyCam.setDragToRotate(true); // Setup first view cam.setParallelProjection(true); float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-30, 30, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); inputManager.addListener(this, "Size+", "Size-"); inputManager.addMapping("Size+", new KeyTrigger(KeyInput.KEY_W)); inputManager.addMapping("Size-", new KeyTrigger(KeyInput.KEY_S)); }
public void simpleInitApp() { Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj"); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(Vector3f.UNIT_XYZ.negate()); // TODO: Fix frustum culling for parallel projection cameras. rootNode.setCullHint(CullHint.Never); rootNode.addLight(dl); rootNode.attachChild(teaGeom); flyCam.setDragToRotate(true); // Setup first view cam.setParallelProjection(true); float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-30, 30, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); inputManager.addListener(this, "Size+", "Size-"); inputManager.addMapping("Size+", new KeyTrigger(KeyInput.KEY_W)); inputManager.addMapping("Size-", new KeyTrigger(KeyInput.KEY_S)); }