Added addObject().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2237 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-02-04 17:24:56 +00:00
parent c66efeb511
commit a5c01f8343
2 changed files with 25 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: RuntimeMisoScene.java,v 1.2 2003/01/31 23:10:45 mdb Exp $
// $Id: RuntimeMisoScene.java,v 1.3 2003/02/04 17:24:56 mdb Exp $
package com.threerings.miso.server;
@@ -17,4 +17,10 @@ public interface RuntimeMisoScene
* "interesting" objects in the scene.
*/
public Iterator enumerateObjects ();
/**
* Adds the supplied object to this scene and immediately updates the
* underlying scene model.
*/
public void addObject (ObjectInfo info);
}
@@ -1,5 +1,5 @@
//
// $Id: RuntimeMisoSceneImpl.java,v 1.2 2003/01/31 23:10:45 mdb Exp $
// $Id: RuntimeMisoSceneImpl.java,v 1.3 2003/02/04 17:24:56 mdb Exp $
package com.threerings.miso.server;
@@ -34,6 +34,23 @@ public class RuntimeMisoSceneImpl
return _objects.iterator();
}
// documentation inherited from interface
public void addObject (ObjectInfo info)
{
// slap it on our list
_objects.add(info);
// slip it into the interesting array
int ocount = _model.objectInfo.length;
ObjectInfo[] objectInfo = new ObjectInfo[ocount+1];
System.arraycopy(_model.objectInfo, 0, objectInfo, 0, ocount);
objectInfo[ocount] = info;
_model.objectInfo = objectInfo;
}
/** Our scene model. */
protected MisoSceneModel _model;
/** The object info records. */
protected ArrayList _objects = new ArrayList();
}