summaryrefslogtreecommitdiffstats
path: root/src/classes/com
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-03-21 21:09:29 +0000
committerKenneth Russel <[email protected]>2007-03-21 21:09:29 +0000
commit7938e5ce11291bfac9373f62c795079c9bd7c6fc (patch)
tree8f4a9f4c69c874339e86ca2b914227a3347c2025 /src/classes/com
parent0871578761657543a5048b290c7957b08b4625d8 (diff)
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
Diffstat (limited to 'src/classes/com')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/Texture.java13
1 files changed, 13 insertions, 0 deletions
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;
@@ -287,6 +290,15 @@ public class Texture {
}
/**
+ * 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
* coordinates must be flipped vertically, the returned
@@ -367,6 +379,7 @@ public class Texture {
imgWidth = data.getWidth();
imgHeight = data.getHeight();
+ aspectRatio = (float) imgWidth / (float) imgHeight;
mustFlipVertically = data.getMustFlipVertically();
int newTarget = 0;