@Override public java.awt.Rectangle getActualViewportAsAwtRectangle( java.awt.Rectangle rv, edu.cmu.cs.dennisc.scenegraph.AbstractCamera camera) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrAbstractCamera<?> glrCamera = AdapterFactory.getAdapterFor(camera); return getActualViewport(rv, glrCamera); }
@Override public boolean isLetterboxedAsOpposedToDistorted( edu.cmu.cs.dennisc.scenegraph.AbstractCamera sgCamera) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrAbstractCamera< ? extends edu.cmu.cs.dennisc.scenegraph.AbstractCamera> cameraAdapter = AdapterFactory.getAdapterFor(sgCamera); return cameraAdapter.isLetterboxedAsOpposedToDistorted(); }
@Override public void setSpecifiedViewportAsAwtRectangle( edu.cmu.cs.dennisc.scenegraph.AbstractCamera camera, java.awt.Rectangle viewport) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrAbstractCamera< ? extends edu.cmu.cs.dennisc.scenegraph.AbstractCamera> cameraAdapter = AdapterFactory.getAdapterFor(camera); cameraAdapter.setSpecifiedViewport(viewport); }
private edu.cmu.cs.dennisc.math.ClippedZPlane getActualPicturePlane( edu.cmu.cs.dennisc.math.ClippedZPlane rv, edu.cmu.cs.dennisc.scenegraph.OrthographicCamera orthographicCamera) { synchronized (s_actualViewportBufferForReuse) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrOrthographicCamera orthographicCameraAdapter = AdapterFactory.getAdapterFor(orthographicCamera); getActualViewport(s_actualViewportBufferForReuse, orthographicCameraAdapter); return orthographicCameraAdapter.getActualPicturePlane(rv, s_actualViewportBufferForReuse); } }
private edu.cmu.cs.dennisc.math.ClippedZPlane getActualPicturePlane( edu.cmu.cs.dennisc.math.ClippedZPlane rv, edu.cmu.cs.dennisc.scenegraph.FrustumPerspectiveCamera frustumPerspectiveCamera) { synchronized (s_actualViewportBufferForReuse) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrFrustumPerspectiveCamera frustumPerspectiveCameraAdapter = AdapterFactory.getAdapterFor(frustumPerspectiveCamera); getActualViewport(s_actualViewportBufferForReuse, frustumPerspectiveCameraAdapter); return frustumPerspectiveCameraAdapter.getActualPicturePlane( rv, s_actualViewportBufferForReuse); } }
@Override public edu.cmu.cs.dennisc.math.Matrix4x4 getActualProjectionMatrix( edu.cmu.cs.dennisc.math.Matrix4x4 rv, edu.cmu.cs.dennisc.scenegraph.AbstractCamera camera) { synchronized (s_actualViewportBufferForReuse) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrAbstractCamera< ? extends edu.cmu.cs.dennisc.scenegraph.AbstractCamera> cameraAdapter = AdapterFactory.getAdapterFor(camera); getActualViewport(s_actualViewportBufferForReuse, cameraAdapter); return cameraAdapter.getActualProjectionMatrix(rv, s_actualViewportBufferForReuse); } }
@Override public edu.cmu.cs.dennisc.math.Angle getActualVerticalViewingAngle( edu.cmu.cs.dennisc.scenegraph.SymmetricPerspectiveCamera symmetricPerspectiveCamera) { synchronized (s_actualViewportBufferForReuse) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrSymmetricPerspectiveCamera symmetricPerspectiveCameraAdapter = AdapterFactory.getAdapterFor(symmetricPerspectiveCamera); getActualViewport(s_actualViewportBufferForReuse, symmetricPerspectiveCameraAdapter); return symmetricPerspectiveCameraAdapter.getActualVerticalViewingAngle( s_actualViewportBufferForReuse); } }
private edu.cmu.cs.dennisc.math.Ray getRayAtPixel( edu.cmu.cs.dennisc.math.Ray rv, int xPixel, int yPixel, edu.cmu.cs.dennisc.scenegraph.AbstractCamera sgCamera) { if (sgCamera != null) { synchronized (s_actualViewportBufferForReuse) { edu.cmu.cs.dennisc.render.gl.imp.adapters.GlrAbstractCamera< ? extends edu.cmu.cs.dennisc.scenegraph.AbstractCamera> cameraAdapter = AdapterFactory.getAdapterFor(sgCamera); getActualViewport(s_actualViewportBufferForReuse, cameraAdapter); // double halfWidth = s_actualViewportBufferForReuse.width / 2.0; // double halfHeight = s_actualViewportBufferForReuse.height / 2.0; // double xInPlane = (xPixel + 0.5 - halfWidth) / halfWidth; // double yInPlane = -(yPixel + 0.5 - halfHeight) / halfHeight; cameraAdapter.getRayAtPixel(rv, xPixel, yPixel, s_actualViewportBufferForReuse); } } else { rv.setNaN(); } // java.awt.Rectangle viewport = getActualViewport( camera ); // double halfWidth = viewport.width / 2.0; // double halfHeight = viewport.height / 2.0; // double x = (xPixel + 0.5 - halfWidth) / halfWidth; // double y = -(yPixel + 0.5 - halfHeight) / halfHeight; // // edu.cmu.cs.dennisc.math.Matrix4d inverseProjection = getActualProjectionMatrix( camera ); // inverseProjection.invert(); // // edu.cmu.cs.dennisc.math.Point3d origin = new edu.cmu.cs.dennisc.math.Point3d( // inverseProjection.backward.x / inverseProjection.backward.w, // inverseProjection.backward.y / inverseProjection.backward.w, // inverseProjection.backward.z / inverseProjection.backward.w // ); // // edu.cmu.cs.dennisc.math.Vector4d qs = new edu.cmu.cs.dennisc.math.Vector4d( x, y, 0, 1 ); // edu.cmu.cs.dennisc.math.Vector4d qw = edu.cmu.cs.dennisc.math.LinearAlgebra.multiply( qs, // inverseProjection ); // // edu.cmu.cs.dennisc.math.Vector3d direction = new edu.cmu.cs.dennisc.math.Vector3d( // qw.x * inverseProjection.backward.w - qw.w * inverseProjection.backward.x, // qw.y * inverseProjection.backward.w - qw.w * inverseProjection.backward.y, // qw.z * inverseProjection.backward.w - qw.w * inverseProjection.backward.z // ); // direction.normalize(); // // rv.setOrigin( origin ); // rv.setDirection( direction ); // return rv; return rv; }