From 7938e5ce11291bfac9373f62c795079c9bd7c6fc Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 21 Mar 2007 21:09:29 +0000 Subject: Added Texture.getAspectRatio(). git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1177 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/opengl/util/texture/Texture.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/classes') diff --git a/src/classes/com/sun/opengl/util/texture/Texture.java b/src/classes/com/sun/opengl/util/texture/Texture.java index 46d435245..167b4e073 100755 --- a/src/classes/com/sun/opengl/util/texture/Texture.java +++ b/src/classes/com/sun/opengl/util/texture/Texture.java @@ -127,6 +127,9 @@ public class Texture { private int imgWidth; /** The height of the image. */ private int imgHeight; + /** The original aspect ratio of the image, before any rescaling + that might have occurred due to using the GLU mipmap routines. */ + private float aspectRatio; /** Indicates whether the TextureData requires a vertical flip of the texture coords. */ private boolean mustFlipVertically; @@ -286,6 +289,15 @@ public class Texture { return imgHeight; } + /** + * Returns the original aspect ratio of the image, defined as (image + * width) / (image height), before any scaling that might have + * occurred as a result of using the GLU mipmap routines. + */ + public float getAspectRatio() { + return aspectRatio; + } + /** * Returns the set of texture coordinates corresponding to the * entire image. If the TextureData indicated that the texture @@ -367,6 +379,7 @@ public class Texture { imgWidth = data.getWidth(); imgHeight = data.getHeight(); + aspectRatio = (float) imgWidth / (float) imgHeight; mustFlipVertically = data.getMustFlipVertically(); int newTarget = 0; -- cgit v1.2.3