The big fat bernie revamp! Er, big fat miso revamp rather:

- Combined SceneViewPanel and IsoSceneView into one happy panel.
- Ditched the DisplayMisoScene notion; the new MisoScenePanel now manages
  resolved scene information (like base, object and fringe tiles) itself
  so that it can...
- ...support scrolling scenes by keeping blocks of resolved base, fringe
  and object information loaded only for what is potentially visible
  rather than for the whole scene.

Other things were surely cleaned up or broken in the process to keep a
keen eye out.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2413 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-04-17 19:21:17 +00:00
parent 3de98670db
commit d5701962a3
38 changed files with 2943 additions and 2532 deletions
+10 -3
View File
@@ -6,7 +6,14 @@
<viewwidth>10</viewwidth>
<viewheight>12</viewheight>
<base>131072, 131072, 131072, 131072, 131073, 131073, 131073, 131073, 131074, 65537, 65537, 131072, 131074, 131074, 131074, 131074, 131072, 131073, 131074, 131074, 131072, 131074, 131074, 131072, 131072, 131072, 131073, 131073, 131073, 131074, 131072, 65536, 65538, 131072, 131072, 131074, 131072, 131072, 131073, 131074, 131072, 131072, 131072, 131072, 131072, 131074, 131072, 131074, 131072, 131073, 131074, 131073, 131074, 65537, 65536, 131072, 131073, 131072, 131073, 131072, 131074, 131073, 131073, 131073, 131072, 131074, 131073, 131072, 131073, 131074, 131074, 131072, 131074, 131072, 131073, 65536, 65538, 131074, 131074, 131074, 131073, 131073, 131072, 131072, 131073, 131072, 131072, 131072, 131074, 131072, 131074, 131072, 131074, 131074, 131073, 131074, 131074, 65536, 65536, 131073, 131072, 131072, 131074, 131074, 131074, 131073, 131072, 131072, 131074, 131073, 131074, 131073, 131074, 131072, 131073, 131072, 131073, 131073, 131074, 65537, 65538, 131072, 131072, 131072, 131072, 131073, 131072, 131072, 131073, 131074, 131074, 131074, 131073, 131074, 131072, 131073, 131074, 131073, 131072, 131072, 131072, 65536, 65537, 131074, 131073, 131074, 131072, 131074, 131073, 131074, 131073, 131072, 131073, 131072, 131073, 131074, 131074, 131074, 131072, 131074, 131074, 131074, 131072, 65538, 65538, 131074, 131074, 131073, 131073, 131074, 131073, 131073, 131074, 131074, 131072, 131072, 131072, 131073, 131073, 131072, 131072, 131073, 131073, 131074, 131073, 65536, 65537, 65538, 65536, 65537, 65536, 65537, 65537, 65538, 65538, 65536, 131074, 131073, 131073, 131072, 131073, 131074, 131074, 131074, 131073, 131074, 131072, 65536, 65537, 65538, 65536, 65537, 65536, 65538, 65536, 65538, 65537, 65536, 131073, 131073, 131074, 131072, 131074, 131073, 131072, 131074, 131072, 131073, 131072, 65536, 65538, 65536, 65538, 65537, 65538, 65537, 65538, 65536, 65536, 65538, 65538, 131074, 131072, 131074, 131073, 131074, 131074, 131074, 131073, 131074, 131072, 65538, 131073, 131074, 131074, 131072, 131074, 131072, 131074, 131074, 131074, 131072, 131074, 131073, 131073, 131072, 131073, 131072, 131072, 131073, 131073, 131074, 131072, 65537, 131074, 131073, 131073, 131072, 131073, 131072, 131074, 131074, 131073, 131072, 131073, 131072, 131072, 131073, 131074, 131073, 131073, 131074, 65536, 65538, 65538, 65538, 131074, 131073, 131073, 131074, 131073, 131073, 131072, 131073, 131074, 131074, 131072, 131074, 131074, 131073, 131072, 131072, 131074, 131072, 65536, 65538, 65538, 65538, 131073, 131074, 131073, 131074, 131073, 131072, 131073, 131074, 131074, 131073, 131073, 131074, 131072, 131074, 131072, 131073, 131073, 131074, 65536, 65536, 65537, 65537, 131073, 131074, 131073, 131074, 131073, 131072, 131074, 131074, 131073, 131073, 131074, 131074, 131072, 131073, 131073, 131074, 131073, 131074, 65536, 65536, 65537, 65538, 131072, 131073, 131074, 131073, 131073, 131074, 131072, 131074, 131073, 131072, 131074, 131072, 131073, 131073, 131072, 131073, 131073, 131072, 131072, 131072, 65537, 65538, 131074, 131072, 131072, 131072, 131073, 131072, 131072, 131074, 131073, 131074, 131073, 131072, 131073, 131072, 131072, 131072, 131072, 131072, 131073, 131072, 65537, 65536, 131073, 131073, 131074, 131073, 131074, 131074, 131073, 131073, 131072, 131074, 131073, 131074, 131072, 131073, 131073, 131073, 131073, 131072, 131072, 131072, 65537, 65537, 131074, 131074, 131074, 131072, 131073, 131074, 131072, 131074, 131072, 131072, 131074, 131072, 131074, 131074, 131073, 131073, 131073, 131072, 131072, 131074, 131074, 131073, 131073, 131073, 131072, 131072, 131072, 131074, 131074, 131072, 131072, 131074, 131074, 131072, 131074, 131072, 131073, 131074, 131073, 131073, 131072, 131074, 131072, 131073, 131072, 131073, 131073, 131073, 131074, 131074, 131073, 131074, 131073, 131074, 131072, 131074</base>
<fringe>0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0</fringe>
<object>17, 11, 851968, 16, 14, 589825, 14, 7, 917505, 13, 7, 917505, 8, 15, 1179649, 8, 13, 917505, 7, 10, 655361</object>
<actions>, , , , , , </actions>
<objects>
<object tileId="40173568" x="17" y="11"/>
<object tileId="851968" x="17" y="11"/>
<object tileId="589825" x="16" y="14"/>
<object tileId="917505" x="14" y="7"/>
<object tileId="917505" x="13" y="7"/>
<object tileId="1179649" x="8" y="15"/>
<object tileId="917505" x="8" y="13"/>
<object tileId="655361" x="7" y="10"/>
</objects>
</miso>
@@ -1,5 +1,5 @@
//
// $Id: SoundTestApp.java,v 1.4 2003/01/13 22:57:45 mdb Exp $
// $Id: SoundTestApp.java,v 1.5 2003/04/17 19:21:17 mdb Exp $
package com.threerings.media.sound;
@@ -18,7 +18,7 @@ public class SoundTestApp
}
ResourceManager rmgr = new ResourceManager("rsrc");
_soundmgr = new SoundManager(rmgr);
_soundmgr = new SoundManager(rmgr, null, null);
_keys = args;
}
@@ -1,5 +1,5 @@
//
// $Id: ScrollingScene.java,v 1.12 2003/02/12 07:24:07 mdb Exp $
// $Id: ScrollingScene.java,v 1.13 2003/04/17 19:21:17 mdb Exp $
package com.threerings.miso.client;
@@ -18,15 +18,17 @@ import com.threerings.media.tile.Tile;
import com.threerings.media.tile.TileSet;
import com.threerings.media.tile.TileSetRepository;
import com.threerings.miso.client.util.ObjectSet;
import com.threerings.miso.data.MisoSceneModel;
import com.threerings.miso.tile.BaseTile;
import com.threerings.miso.tile.BaseTileSet;
import com.threerings.miso.util.MisoContext;
import com.threerings.miso.util.ObjectSet;
import com.threerings.miso.data.ObjectInfo;
/**
* Provides an infinite array of tiles in which to scroll.
*/
public class ScrollingScene extends VirtualDisplayMisoSceneImpl
public class ScrollingScene extends MisoSceneModel
{
public ScrollingScene (MisoContext ctx)
throws NoSuchTileSetException, NoSuchTileException, PersistenceException
@@ -60,6 +62,33 @@ public class ScrollingScene extends VirtualDisplayMisoSceneImpl
}
}
public int getBaseTileId (int x, int y)
{
return -1;
}
public boolean setBaseTile (int fqTileId, int x, int y)
{
return false;
}
public void addObject (ObjectInfo info)
{
}
public void getObjects (Rectangle region, ObjectSet set)
{
}
public void updateObject (ObjectInfo info)
{
}
public boolean removeObject (ObjectInfo info)
{
return false;
}
// documentation inherited from interface
public BaseTile getBaseTile (int x, int y)
{
@@ -1,5 +1,5 @@
//
// $Id: ScrollingTestApp.java,v 1.20 2003/02/12 07:24:07 mdb Exp $
// $Id: ScrollingTestApp.java,v 1.21 2003/04/17 19:21:17 mdb Exp $
package com.threerings.miso.client;
@@ -98,7 +98,7 @@ public class ScrollingTestApp
CharacterManager charmgr = new CharacterManager(imgr, crepo);
// create our scene view panel
_panel = new SceneViewPanel(_framemgr, new IsoSceneViewModel());
_panel = new MisoScenePanel(ctx, MisoConfig.getSceneMetrics());
_frame.setPanel(_panel);
// create our "ship" sprite
@@ -114,8 +114,8 @@ public class ScrollingTestApp
_ship.setFollowingPathAction("sailing");
_ship.setRestingAction("sailing");
_ship.setActionSequence("sailing");
_ship.setLocation(_panel.getModel().bounds.width/2,
_panel.getModel().bounds.height/2);
_ship.setLocation(_panel.getSceneMetrics().bounds.width/2,
_panel.getSceneMetrics().bounds.height/2);
_panel.addSprite(_ship);
}
@@ -161,7 +161,7 @@ public class ScrollingTestApp
}
try {
_panel.setScene(new ScrollingScene(ctx));
_panel.setSceneModel(new ScrollingScene(ctx));
} catch (Exception e) {
Log.warning("Error creating scene: " + e);
Log.logStackTrace(e);
@@ -174,10 +174,13 @@ public class ScrollingTestApp
*/
protected class ContextImpl implements MisoContext
{
public MisoTileManager getTileManager ()
{
public MisoTileManager getTileManager () {
return _tilemgr;
}
public FrameManager getFrameManager () {
return _framemgr;
}
}
/**
@@ -214,7 +217,7 @@ public class ScrollingTestApp
protected ScrollingFrame _frame;
/** The main panel. */
protected SceneViewPanel _panel;
protected MisoScenePanel _panel;
/** The ship in the center of our screen. */
protected CharacterSprite _ship;
@@ -1,5 +1,5 @@
//
// $Id: ViewerApp.java,v 1.37 2003/02/12 07:24:08 mdb Exp $
// $Id: ViewerApp.java,v 1.38 2003/04/17 19:21:17 mdb Exp $
package com.threerings.miso.viewer;
@@ -21,7 +21,6 @@ import com.threerings.cast.CharacterManager;
import com.threerings.cast.bundle.BundledComponentRepository;
import com.threerings.miso.Log;
import com.threerings.miso.client.SimpleDisplayMisoSceneImpl;
import com.threerings.miso.data.SimpleMisoSceneModel;
import com.threerings.miso.tile.MisoTileManager;
import com.threerings.miso.tools.xml.SimpleMisoSceneParser;
@@ -83,19 +82,19 @@ public class ViewerApp
CharacterManager charmgr = new CharacterManager(imgr, crepo);
// create our scene view panel
_panel = new ViewerSceneViewPanel(ctx, _framemgr, charmgr, crepo);
_panel = new ViewerSceneViewPanel(ctx, charmgr, crepo);
_frame.setPanel(_panel);
// load up the scene specified by the user
try {
SimpleMisoSceneParser parser = new SimpleMisoSceneParser("miso");
SimpleMisoSceneParser parser = new SimpleMisoSceneParser("");
SimpleMisoSceneModel model = parser.parseScene(args[0]);
if (model == null) {
Log.warning("No miso scene found in scene file " +
"[path=" + args[0] + "].");
System.exit(-1);
}
_panel.setScene(new SimpleDisplayMisoSceneImpl(model, _tilemgr));
_panel.setSceneModel(model);
} catch (Exception e) {
Log.warning("Unable to parse scene [path=" + args[0] + "].");
@@ -128,6 +127,11 @@ public class ViewerApp
{
return _tilemgr;
}
public FrameManager getFrameManager ()
{
return _framemgr;
}
}
/**
@@ -1,5 +1,5 @@
//
// $Id: ViewerSceneViewPanel.java,v 1.56 2003/02/12 07:24:08 mdb Exp $
// $Id: ViewerSceneViewPanel.java,v 1.57 2003/04/17 19:21:17 mdb Exp $
package com.threerings.miso.viewer;
@@ -28,25 +28,22 @@ import com.threerings.media.util.PerformanceMonitor;
import com.threerings.media.util.PerformanceObserver;
import com.threerings.miso.Log;
import com.threerings.miso.client.DisplayMisoScene;
import com.threerings.miso.client.IsoSceneView;
import com.threerings.miso.client.IsoSceneViewModel;
import com.threerings.miso.client.SceneViewPanel;
import com.threerings.miso.client.util.IsoUtil;
import com.threerings.miso.MisoConfig;
import com.threerings.miso.client.MisoScenePanel;
import com.threerings.miso.data.MisoSceneModel;
import com.threerings.miso.util.MisoContext;
public class ViewerSceneViewPanel extends SceneViewPanel
public class ViewerSceneViewPanel extends MisoScenePanel
implements PerformanceObserver, SpriteObserver
{
/**
* Construct the panel and initialize it with a context.
*/
public ViewerSceneViewPanel (MisoContext ctx,
FrameManager framemgr,
CharacterManager charmgr,
ComponentRepository crepo)
{
super(framemgr, new IsoSceneViewModel());
super(ctx, MisoConfig.getSceneMetrics());
// create the character descriptors
_descUser = CastUtil.getRandomDescriptor("female", crepo);
@@ -56,26 +53,17 @@ public class ViewerSceneViewPanel extends SceneViewPanel
_sprite = createSprite(_spritemgr, charmgr, _descUser);
setFollowsPathable(_sprite);
// // turn on object highlighting
// ((IsoSceneView)_view).setHighlightMode(IsoSceneView.HIGHLIGHT_ALWAYS);
// create the decoy sprites
createDecoys(_spritemgr, charmgr);
// listen to the desired events
addMouseListener(new MouseAdapter() {
public void mousePressed (MouseEvent e) {
ViewerSceneViewPanel.this.mousePressed(e);
}
});
PerformanceMonitor.register(this, "paint", 1000);
}
// documentation inherited
public void setScene (DisplayMisoScene scene)
public void setSceneModel (MisoSceneModel model)
{
super.setScene(scene);
super.setSceneModel(model);
Log.info("Using " + model + ".");
// now that we have a scene, we can create valid paths for our
// decoy sprites
@@ -138,10 +126,13 @@ public class ViewerSceneViewPanel extends SceneViewPanel
Log.info(name + " [ticks=" + ticks + "].");
}
/** MouseListener interface methods */
// documentation inherited
public void mousePressed (MouseEvent e)
{
super.mousePressed(e);
int x = e.getX(), y = e.getY();
Log.info("Mouse pressed +" + x + "+" + y);
switch (e.getModifiers()) {
case MouseEvent.BUTTON1_MASK:
@@ -164,7 +155,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
protected boolean createPath (CharacterSprite s, int x, int y)
{
// get the path from here to there
LineSegmentPath path = (LineSegmentPath)_view.getPath(s, x, y);
LineSegmentPath path = (LineSegmentPath)getPath(s, x, y);
if (path == null) {
s.cancelMove();
return false;
@@ -181,7 +172,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
*/
protected void createRandomPath (CharacterSprite s)
{
Dimension d = _viewmodel.bounds.getSize();
Dimension d = _metrics.bounds.getSize();
int x, y;
do {
@@ -204,7 +195,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
}
/** The number of decoy characters milling about. */
protected static final int NUM_DECOYS = 100;
protected static final int NUM_DECOYS = 5;
/** The character descriptor for the user character. */
protected CharacterDescriptor _descUser;
@@ -1,5 +1,5 @@
//
// $Id: DummyClientSceneRepository.java,v 1.5 2001/11/18 04:09:21 mdb Exp $
// $Id: DummyClientSceneRepository.java,v 1.6 2003/04/17 19:21:17 mdb Exp $
package com.threerings.whirled;
@@ -26,7 +26,14 @@ public class DummyClientSceneRepository implements SceneRepository
}
// documentation inherited
public void updateSceneModel (SceneModel scene)
public void storeSceneModel (SceneModel model)
throws IOException
{
// nothing doing
}
// documentation inherited
public void deleteSceneModel (int sceneId)
throws IOException
{
// nothing doing
@@ -1,5 +1,5 @@
//
// $Id: SpotSceneParserTest.java,v 1.4 2003/02/12 07:24:08 mdb Exp $
// $Id: SpotSceneParserTest.java,v 1.5 2003/04/17 19:21:17 mdb Exp $
package com.threerings.whirled.spot.tools.xml;
@@ -8,7 +8,8 @@ import com.samskivert.test.TestUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import com.threerings.whirled.spot.data.SpotScene;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.tools.xml.SceneParser;
public class SpotSceneParserTest extends TestCase
{
@@ -20,9 +21,10 @@ public class SpotSceneParserTest extends TestCase
public void runTest ()
{
try {
SpotSceneParser parser = new SpotSceneParser("scene");
SceneParser parser = new SceneParser("scene");
parser.registerAuxRuleSet(new SpotSceneRuleSet());
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
SpotScene scene = parser.parseScene(tspath);
SceneModel scene = parser.parseScene(tspath);
System.out.println("Parsed " + scene + ".");
} catch (Exception e) {
@@ -1,5 +1,5 @@
//
// $Id: SceneParserTest.java,v 1.4 2003/02/12 07:24:08 mdb Exp $
// $Id: SceneParserTest.java,v 1.5 2003/04/17 19:21:17 mdb Exp $
package com.threerings.whirled.tools.xml;
@@ -8,7 +8,7 @@ import com.samskivert.test.TestUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import com.threerings.whirled.data.Scene;
import com.threerings.whirled.data.SceneModel;
public class SceneParserTest extends TestCase
{
@@ -22,7 +22,7 @@ public class SceneParserTest extends TestCase
try {
SceneParser parser = new SceneParser("scene");
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
Scene scene = parser.parseScene(tspath);
SceneModel scene = parser.parseScene(tspath);
System.out.println("Parsed " + scene + ".");
} catch (Exception e) {