/** * * @param fovY * @param aspect * @param zNear * @param zFar * @param store */ public static void matrixPerspective(final double fovY, final double aspect, final double zNear, final double zFar, final Matrix4 store) { final double height = zNear * tan(fovY * 0.5 * MathUtils.DEG_TO_RAD); final double width = height * aspect; matrixFrustum(-width, width, -height, height, zNear, zFar, store); }
/** * * @param fovY * @param aspect * @param zNear * @param zFar * @param store */ public static void matrixPerspective(final double fovY, final double aspect, final double zNear, final double zFar, final Matrix4 store) { final double height = zNear * tan(fovY * 0.5 * MathUtils.DEG_TO_RAD); final double width = height * aspect; matrixFrustum(-width, width, -height, height, zNear, zFar, store); }
@Override public ResultSample doInverseTest(final int count, final int maxCount, final long timeOutMS) { final Matrix4d m1 = new Matrix4d(); final double near = 1.0, far = 1000.0, fovy = 90.0, aspect = 0.5; final double height = near * MathUtils.tan(fovy * 0.5 * MathUtils.DEG_TO_RAD); final double width = height * aspect; final double x = near / width; final double y = near / height; final double a = 0; final double b = 0; final double c = -(far + near) / (far - near); final double d = -(2.0 * far * near) / (far - near); m1.set(new double[] { x, 0.0, 0.0, 0.0, 0.0, y, 0.0, 0.0, a, b, c, -1.0, 0.0, 0.0, d, 0.0 }); final long start = System.currentTimeMillis(); int loopCount = 0; while (System.currentTimeMillis() - start < timeOutMS && loopCount != maxCount) { ++loopCount; for (int i = 0; i < count; ++i) { m1.invert(); } } return populateResult(System.currentTimeMillis() - start, loopCount, toArray(m1)); }
public void setupLeftRightCameras() { // Set viewport: // XXX: Could maybe make use of our current viewport? if (_sideBySideMode) { _leftCamera.setViewPort(0, .5, 0, 1); _rightCamera.setViewPort(.5, 1, 0, 1); } else { _leftCamera.setViewPort(0, 1, 0, 1); _rightCamera.setViewPort(0, 1, 0, 1); } // Set frustum: final double aspectRatio = (getWidth() / (double) getHeight() / (_sideBySideMode ? 2.0 : 1.0)); final double halfView = getFrustumNear() * MathUtils.tan(_aperture / 2); final double top = halfView; final double bottom = -halfView; final double horizontalShift = 0.5 * _eyeSeparation * getFrustumNear() / _focalDistance; // LEFT: { final double left = -aspectRatio * halfView + horizontalShift; final double right = aspectRatio * halfView + horizontalShift; _leftCamera.setFrustum(getFrustumNear(), getFrustumFar(), left, right, top, bottom); } // RIGHT: { final double left = -aspectRatio * halfView - horizontalShift; final double right = aspectRatio * halfView - horizontalShift; _rightCamera.setFrustum(getFrustumNear(), getFrustumFar(), left, right, top, bottom); } }
public void setupLeftRightCameras() { // Set viewport: // XXX: Could maybe make use of our current viewport? if (_sideBySideMode) { _leftCamera.setViewPort(0, .5, 0, 1); _rightCamera.setViewPort(.5, 1, 0, 1); } else { _leftCamera.setViewPort(0, 1, 0, 1); _rightCamera.setViewPort(0, 1, 0, 1); } // Set frustum: final double aspectRatio = (getWidth() / (double) getHeight() / (_sideBySideMode ? 2.0 : 1.0)); final double halfView = getFrustumNear() * MathUtils.tan(_aperture / 2); final double top = halfView; final double bottom = -halfView; final double horizontalShift = 0.5 * _eyeSeparation * getFrustumNear() / _focalDistance; // LEFT: { final double left = -aspectRatio * halfView + horizontalShift; final double right = aspectRatio * halfView + horizontalShift; _leftCamera.setFrustum(getFrustumNear(), getFrustumFar(), left, right, top, bottom); } // RIGHT: { final double left = -aspectRatio * halfView - horizontalShift; final double right = aspectRatio * halfView - horizontalShift; _rightCamera.setFrustum(getFrustumNear(), getFrustumFar(), left, right, top, bottom); } }