diff options
author | Harvey Harrison <[email protected]> | 2012-06-27 00:08:58 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2012-06-27 00:10:53 -0700 |
commit | 1ae355b8e4ec376fe398cd24a9ca14431160276c (patch) | |
tree | f4be9b4971f62e5337de05fa80d09ca718263b30 /src/classes/share | |
parent | e4a64ecc32ff754e5995a34f8955cac5a2bc3372 (diff) |
j3dcore: annotate a list of GeometryAtoms, use ArrayList.toArray instead of a for() loop
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/classes/share')
-rw-r--r-- | src/classes/share/javax/media/j3d/BackgroundRetained.java | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/src/classes/share/javax/media/j3d/BackgroundRetained.java b/src/classes/share/javax/media/j3d/BackgroundRetained.java index e3c97c4..adc471f 100644 --- a/src/classes/share/javax/media/j3d/BackgroundRetained.java +++ b/src/classes/share/javax/media/j3d/BackgroundRetained.java @@ -97,14 +97,14 @@ ArrayList<LightRetained> lights = new ArrayList<LightRetained>(); // list of fog nodes for background geometry ArrayList<FogRetained> fogs = new ArrayList<FogRetained>(); - // a list of background geometry atoms - ArrayList bgGeometryAtomList = new ArrayList(); +// a list of background geometry atoms +ArrayList<GeometryAtom> bgGeometryAtomList = new ArrayList<GeometryAtom>(); - // false is background geometry atoms list has changed - boolean bgGeometryAtomListDirty = true; +// false is background geometry atoms list has changed +boolean bgGeometryAtomListDirty = true; - // an array of background geometry atoms - GeometryAtom[] bgGeometryAtoms = null; +// an array of background geometry atoms +GeometryAtom[] bgGeometryAtoms = null; // Target threads to be notified when light changes // Note, the rendering env structure only get notified @@ -734,31 +734,29 @@ ArrayList<FogRetained> fogs = new ArrayList<FogRetained>(); VirtualUniverse.mc.processMessage(createMessage); } - void addBgGeometryAtomList(GeometryAtom geomAtom) { - bgGeometryAtomList.add(geomAtom); - bgGeometryAtomListDirty = true; - } +void addBgGeometryAtomList(GeometryAtom geomAtom) { + bgGeometryAtomList.add(geomAtom); + bgGeometryAtomListDirty = true; +} - void removeBgGeometryAtomList(GeometryAtom geomAtom) { - bgGeometryAtomList.remove(bgGeometryAtomList.indexOf(geomAtom)); - bgGeometryAtomListDirty = true; - } +void removeBgGeometryAtomList(GeometryAtom geomAtom) { + bgGeometryAtomList.remove(geomAtom); + bgGeometryAtomListDirty = true; +} - GeometryAtom[] getBackgroundGeometryAtoms() { - if (bgGeometryAtomListDirty) { - int nAtoms = bgGeometryAtomList.size(); - if (nAtoms == 0) { - bgGeometryAtoms = null; - } else { - bgGeometryAtoms = new GeometryAtom[nAtoms]; - for (int i=0; i<bgGeometryAtoms.length; i++) { - bgGeometryAtoms[i] = (GeometryAtom)bgGeometryAtomList.get(i) ; - } - bgGeometryAtomListDirty = false; - } - } - return(bgGeometryAtoms); - } +GeometryAtom[] getBackgroundGeometryAtoms() { + if (bgGeometryAtomListDirty) { + int nAtoms = bgGeometryAtomList.size(); + if (nAtoms == 0) { + bgGeometryAtoms = null; + } + else { + bgGeometryAtoms = bgGeometryAtomList.toArray(new GeometryAtom[nAtoms]); + bgGeometryAtomListDirty = false; + } + } + return bgGeometryAtoms; +} void mergeTransform(TransformGroupRetained xform) { super.mergeTransform(xform); |