summaryrefslogtreecommitdiffstats
path: root/src/net/java/joglutils/msg/nodes/Texture2.java
diff options
context:
space:
mode:
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