diff options
Diffstat (limited to 'src/net/java/joglutils/msg/elements')
8 files changed, 58 insertions, 0 deletions
diff --git a/src/net/java/joglutils/msg/elements/BlendElement.java b/src/net/java/joglutils/msg/elements/BlendElement.java index 2a0d488..422811f 100644 --- a/src/net/java/joglutils/msg/elements/BlendElement.java +++ b/src/net/java/joglutils/msg/elements/BlendElement.java @@ -63,6 +63,11 @@ public class BlendElement extends Element { BlendElement tmp = new BlendElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // These defaults match those in the Blend node -- is there a better way of factoring them out? diff --git a/src/net/java/joglutils/msg/elements/ColorElement.java b/src/net/java/joglutils/msg/elements/ColorElement.java index a725d61..a3a92d4 100644 --- a/src/net/java/joglutils/msg/elements/ColorElement.java +++ b/src/net/java/joglutils/msg/elements/ColorElement.java @@ -62,6 +62,11 @@ public class ColorElement extends Element { ColorElement tmp = new ColorElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The actual color data protected FloatBuffer colors; diff --git a/src/net/java/joglutils/msg/elements/CoordinateElement.java b/src/net/java/joglutils/msg/elements/CoordinateElement.java index 34b16bc..58a57c7 100644 --- a/src/net/java/joglutils/msg/elements/CoordinateElement.java +++ b/src/net/java/joglutils/msg/elements/CoordinateElement.java @@ -52,13 +52,21 @@ public class CoordinateElement extends Element { public Element newInstance() { return new CoordinateElement(); } + /** Returns the instance of this element in the passed State. */ public static CoordinateElement getInstance(State state) { return (CoordinateElement) state.getElement(index); } + /** Enables this element in the passed state, which should be the + default for a given action. */ public static void enable(State defaultState) { CoordinateElement tmp = new CoordinateElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The actual coordinate data protected FloatBuffer coords; diff --git a/src/net/java/joglutils/msg/elements/ModelMatrixElement.java b/src/net/java/joglutils/msg/elements/ModelMatrixElement.java index cfe726e..e4cdbb0 100644 --- a/src/net/java/joglutils/msg/elements/ModelMatrixElement.java +++ b/src/net/java/joglutils/msg/elements/ModelMatrixElement.java @@ -50,13 +50,21 @@ public class ModelMatrixElement extends Element { public Element newInstance() { return new ModelMatrixElement(); } + /** Returns the instance of this element in the passed State. */ public static ModelMatrixElement getInstance(State state) { return (ModelMatrixElement) state.getElement(index); } + /** Enables this element in the passed state, which should be the + default for a given action. */ public static void enable(State defaultState) { Element tmp = new ModelMatrixElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The matrix data protected Mat4f matrix; diff --git a/src/net/java/joglutils/msg/elements/ProjectionMatrixElement.java b/src/net/java/joglutils/msg/elements/ProjectionMatrixElement.java index dd70ca3..4635a83 100644 --- a/src/net/java/joglutils/msg/elements/ProjectionMatrixElement.java +++ b/src/net/java/joglutils/msg/elements/ProjectionMatrixElement.java @@ -50,13 +50,21 @@ public class ProjectionMatrixElement extends Element { public Element newInstance() { return new ProjectionMatrixElement(); } + /** Returns the instance of this element in the passed State. */ public static ProjectionMatrixElement getInstance(State state) { return (ProjectionMatrixElement) state.getElement(index); } + /** Enables this element in the passed state, which should be the + default for a given action. */ public static void enable(State defaultState) { Element tmp = new ProjectionMatrixElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The matrix data protected Mat4f matrix; diff --git a/src/net/java/joglutils/msg/elements/TextureCoordinateElement.java b/src/net/java/joglutils/msg/elements/TextureCoordinateElement.java index 6d36c6c..8d24bfc 100644 --- a/src/net/java/joglutils/msg/elements/TextureCoordinateElement.java +++ b/src/net/java/joglutils/msg/elements/TextureCoordinateElement.java @@ -52,13 +52,21 @@ public class TextureCoordinateElement extends Element { public Element newInstance() { return new TextureCoordinateElement(); } + /** Returns the instance of this element in the passed State. */ public static TextureCoordinateElement getInstance(State state) { return (TextureCoordinateElement) state.getElement(index); } + /** Enables this element in the passed state, which should be the + default for a given action. */ public static void enable(State defaultState) { TextureCoordinateElement tmp = new TextureCoordinateElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The actual coordinate data protected FloatBuffer coords; diff --git a/src/net/java/joglutils/msg/elements/TextureElement.java b/src/net/java/joglutils/msg/elements/TextureElement.java index 90a9ebc..199a113 100644 --- a/src/net/java/joglutils/msg/elements/TextureElement.java +++ b/src/net/java/joglutils/msg/elements/TextureElement.java @@ -57,13 +57,21 @@ public class TextureElement extends Element { public Element newInstance() { return new TextureElement(); } + /** Returns the instance of this element in the passed State. */ public static TextureElement getInstance(State state) { return (TextureElement) state.getElement(index); } + /** Enables this element in the passed state, which should be the + default for a given action. */ public static void enable(State defaultState) { TextureElement tmp = new TextureElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The actual Texture object protected Texture texture; diff --git a/src/net/java/joglutils/msg/elements/ViewingMatrixElement.java b/src/net/java/joglutils/msg/elements/ViewingMatrixElement.java index 5142678..b561bd8 100644 --- a/src/net/java/joglutils/msg/elements/ViewingMatrixElement.java +++ b/src/net/java/joglutils/msg/elements/ViewingMatrixElement.java @@ -50,13 +50,21 @@ public class ViewingMatrixElement extends Element { public Element newInstance() { return new ViewingMatrixElement(); } + /** Returns the instance of this element in the passed State. */ public static ViewingMatrixElement getInstance(State state) { return (ViewingMatrixElement) state.getElement(index); } + /** Enables this element in the passed state, which should be the + default for a given action. */ public static void enable(State defaultState) { Element tmp = new ViewingMatrixElement(); defaultState.setElement(tmp.getStateIndex(), tmp); } + /** Indicates whether this element is enabled in the given default + state for a particular action. */ + public static boolean isEnabled(State state) { + return (state.getDefaults().getElement(index) != null); + } // The matrix data protected Mat4f matrix; |