While one could fake this up by asking for all objects in a region large

enough to cover the scene, I really just wanted a quick & dirty way to get
all objects in the scene.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@372 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2007-12-12 07:55:51 +00:00
parent accd0a0de7
commit 1074d68d5f
@@ -176,6 +176,16 @@ public class SparseMisoSceneModel extends MisoSceneModel
return -1;
}
public void getAllObjects (ArrayList list) {
for (ObjectInfo info : objectInfo) {
list.add(info);
}
for (int ii = 0; ii < objectTileIds.length; ii++) {
int x = objectXs[ii], y = objectYs[ii];
list.add(new ObjectInfo(objectTileIds[ii], x, y));
}
}
public void getObjects (Rectangle region, ObjectSet set) {
// first look for intersecting interesting objects
for (int ii = 0; ii < objectInfo.length; ii++) {
@@ -273,6 +283,18 @@ public class SparseMisoSceneModel extends MisoSceneModel
}
}
/**
* Adds all {@link ObjectInfo} records in this scene to the supplied list.
*/
public void getAllObjects (ArrayList list)
{
for (Iterator iter = getSections(); iter.hasNext(); ) {
Section sect = (Section)iter.next();
sect.getAllObjects(list);
}
}
/**
* Informs the supplied visitor of each object in this scene.
*/