Renderstates accessor for Pass

Index: src/com/jme/renderer/pass/Pass.java

===================================================================

— src/com/jme/renderer/pass/Pass.java (revision 4051)

+++ src/com/jme/renderer/pass/Pass.java (working copy)

@@ -92,6 +92,14 @@

        resetOldStates();

        context = null;

    }

+   

+    /**

+    * Returns the render states for this pass.

+    * @return

+    */

+    public    RenderState[]  getRenderStates() {

+              return passStates;

+      }

This would allow direct manipulation of the array. Is this a problem? Does the setter for the single states probably have side effect or can be overwritten? (I don't have the code at hand to check that)

this might be an issue for updates on the states when the save states are being used…

i've been adding them and manipulating them with an editor with no issues but they are just basic passes i am using…

i'll check this out a bit more on the custom passes and see if it is an issue…

There are needs to get RenderStates.(for me, at least)

setPassState(RenderState), clearPassState(int) exists, but no getter.

How about getPassState(int)?

mulova said:

How about getPassState(int)?

that's safe, yes - I'd prefer that.
irrisor said:

mulova said:

How about getPassState(int)?

that's safe, yes - I'd prefer that.

That also follows the current design in Spatial. +1

ncomp, can you post a diff for this?

apologies for not getting around to this sooner…

here's the diff…



Index: src/com/jme/renderer/pass/Pass.java
===================================================================
--- src/com/jme/renderer/pass/Pass.java (revision 4058)
+++ src/com/jme/renderer/pass/Pass.java (working copy)
@@ -92,6 +92,14 @@

+   
+    /**
+     * Returns the render state for this type for this pass.
+     * @return
+     */
+    public     RenderState             getRenderStates(int i_type) {
+               return passStates[i_type];
+       }

Commited, r4073. Note: The patch wouldn't go so I just typed it, and changed the method name from getRenderStates to getRenderState, to match the method in Spatial.