summaryrefslogtreecommitdiffstats
path: root/src/net/java/joglutils/msg/nodes/Texture2.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-04-10 00:23:45 +0000
committerKenneth Russel <[email protected]>2007-04-10 00:23:45 +0000
commit5da3c985902fb90edd32ce2af2e82518ff8cefbe (patch)
tree70248546e070b1ad63fa72827a2c698e9628f61c /src/net/java/joglutils/msg/nodes/Texture2.java
parent3e839104e21ff5010f3b4751db9408f5c3386c5d (diff)
Fixed bug in computation of orthographic projection matrix where it
was not taking into account the Z offset of the near/far planes. Fixed bug in Camera's unprojection routine where it needed to specify the negation of the near distance for the initial Z coordinate. Added getWidth() and getHeight() to Texture2 node. Added convenience method getPickedPoint() to RayPickAction. Added check to Camera to avoid recomputing the projection matrix if the aspect ratio was set to the same value as the last time. Made Group node Iterable. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/joglutils/trunk@65 83d24430-9974-4f80-8418-2cc3294053b9
Diffstat (limited to 'src/net/java/joglutils/msg/nodes/Texture2.java')
-rw-r--r--src/net/java/joglutils/msg/nodes/Texture2.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/net/java/joglutils/msg/nodes/Texture2.java b/src/net/java/joglutils/msg/nodes/Texture2.java
index 02763fc..d405f0a 100644
--- a/src/net/java/joglutils/msg/nodes/Texture2.java
+++ b/src/net/java/joglutils/msg/nodes/Texture2.java
@@ -140,6 +140,44 @@ public class Texture2 extends Node {
dirty = true;
}
+ /** Returns the width of the texture or TextureRenderer this
+ Texture2 node is referencing, or 0 if it has not been set up
+ yet. */
+ public int getWidth() {
+ if (data != null) {
+ return data.getWidth();
+ }
+
+ if (texture != null) {
+ return texture.getWidth();
+ }
+
+ if (textureRenderer != null) {
+ return textureRenderer.getWidth();
+ }
+
+ return 0;
+ }
+
+ /** Returns the height of the texture or TextureRenderer this
+ Texture2 node is referencing, or 0 if it has not been set up
+ yet. */
+ public int getHeight() {
+ if (data != null) {
+ return data.getHeight();
+ }
+
+ if (texture != null) {
+ return texture.getHeight();
+ }
+
+ if (textureRenderer != null) {
+ return textureRenderer.getHeight();
+ }
+
+ return 0;
+ }
+
/**
* Updates a subregion of the content area of this texture using the
* specified sub-region of the given data. Only updates the