mulova
January 2, 2009, 12:04am
1
Happy new year!
'Cause Pass only has one remove(Spatial) method,
If one wants to remove meshes from render pass, he has to keep them to remove.
How about adding removeAll(), remove(index) method
Index: src/com/jme/renderer/pass/Pass.java
===================================================================
--- src/com/jme/renderer/pass/Pass.java (revision 4080)
+++ src/com/jme/renderer/pass/Pass.java (working copy)
@@ -185,6 +185,16 @@
return spatials.remove(toRemove);
}
+ public Spatial remove(int index) {
+ if (spatials.size() <= index)
+ return null;
+ return spatials.remove(index);
+ }
+
+ public void removeAll() {
+ spatials.clear();
+ }
+
public int size() {
return spatials.size();
}
basixs
January 2, 2009, 5:45am
2
I think that method would require a little more information to work properly…
(such as how to get the index, when a spatial is removed all of the greater indexes change; therefore you would still need to get/maintain the actual index)
perhaps if you included a
indexOf( Spatial );
method and/or another add method:
addAt( Index, Spatial );
mulova
January 2, 2009, 9:04am
3
Yep, remove(index) can be simulated easily by current nethods 'get(index)' and 'remove(spatial)'
I suggested remove(index) because there exists get(index) method,
but may be useless if index changes as you said.
Actually what I think useful is removeAll() method.
How about this?
Index: src/com/jme/renderer/pass/Pass.java
===================================================================
--- src/com/jme/renderer/pass/Pass.java (revision 4080)
+++ src/com/jme/renderer/pass/Pass.java (working copy)
@@ -185,6 +185,11 @@
return spatials.remove(toRemove);
}
+
+ public void removeAll() {
+ spatials.clear();
+ }
+
public int size() {
return spatials.size();
}
basixs
January 2, 2009, 5:47pm
4
Sounds good to me (I think a removeAll() method is very appropriate and needed)