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); } }
if(viewCam.isParallelProjection()){ for (int i = 0; i < nbShadowMaps; i++) { splitsArray[i] = splitsArray[i]/(zFar- frustumNear);
if (!isParallelProjection()) { float nearSquared = frustumNear * frustumNear; float leftSquared = frustumLeft * frustumLeft;
if (cam.isParallelProjection()) { cam.setFrustumPerspective(45, (float) cam.getWidth() / cam.getHeight(), 1, 1000); } else {
if(viewCam.isParallelProjection()){ for (int i = 0; i < nbShadowMaps; i++) { splitsArray[i] = splitsArray[i]/(zFar- frustumNear);
float shadowMapSize) { boolean ortho = shadowCam.isParallelProjection();
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); }
boolean ortho = shadowCam.isParallelProjection(); shadowCam.setProjectionMatrix(null);
sceneCam.getFrustumTop(), sceneCam.getFrustumBottom()); reflectionCam.setParallelProjection(sceneCam.isParallelProjection());
worldPlane[TOP_PLANE].setConstant(location.dot(topPlaneNormal)); if (isParallelProjection()) { worldPlane[LEFT_PLANE].setConstant(worldPlane[LEFT_PLANE].getConstant() + frustumLeft); worldPlane[RIGHT_PLANE].setConstant(worldPlane[RIGHT_PLANE].getConstant() - frustumRight);
float far_width; if (viewCam.isParallelProjection()) { near_height = ftop; near_width = near_height * ratio;
@Deprecated public Vector3f getScreenCoordinates( Spatial relativeTo, Vector3f pos ) { ViewPort vp = getCollisionViewPort(relativeTo); if( vp == null ) { throw new RuntimeException("Could not find viewport for:" + relativeTo); } // Calculate the world position relative to the spatial pos = relativeTo.localToWorld(pos, null); Camera cam = vp.getCamera(); if( cam.isParallelProjection() ) { return pos.clone(); } return cam.getScreenCoordinates(pos); } }
public Vector3f getRelativeViewCoordinates( Spatial relativeTo, Vector3f pos ) { // Calculate the world position relative to the spatial pos = relativeTo.localToWorld(pos, null); Camera cam = view.getCamera(); if( cam.isParallelProjection() ) { return pos.clone(); } return cam.getScreenCoordinates(pos); }
if(viewCam.isParallelProjection()){ for (int i = 0; i < nbShadowMaps; i++) { splitsArray[i] = splitsArray[i]/(zFar- frustumNear);
if (!isParallelProjection()) { float nearSquared = frustumNear * frustumNear; float leftSquared = frustumLeft * frustumLeft;
if (!isParallelProjection()) { float nearSquared = frustumNear * frustumNear; float leftSquared = frustumLeft * frustumLeft;
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); }
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); }
sceneCam.getFrustumTop(), sceneCam.getFrustumBottom()); reflectionCam.setParallelProjection(sceneCam.isParallelProjection());
sceneCam.getFrustumTop(), sceneCam.getFrustumBottom()); reflectionCam.setParallelProjection(sceneCam.isParallelProjection());