Differentiate between blocks that are visible and those that probably
aren't (we can't truly know if a block is visible until we resolve it because objects of arbitrary height can overlap the view bounds even if the block's footprint does not); resolve the definitely visible ones first and go ahead and start drawing once the known visible blocks are ready. This cuts the time spent on the "blue screen" by about 75%. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2595 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: MisoScenePanel.java,v 1.31 2003/05/16 00:49:16 mdb Exp $
|
||||
// $Id: MisoScenePanel.java,v 1.32 2003/05/20 23:57:48 mdb Exp $
|
||||
|
||||
package com.threerings.miso.client;
|
||||
|
||||
@@ -690,11 +690,16 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
SceneBlock block = new SceneBlock(
|
||||
this, origin.x, origin.y,
|
||||
_metrics.blockwid, _metrics.blockhei);
|
||||
boolean visible =
|
||||
block.getFootprint().getBounds().intersects(_vbounds);
|
||||
_blocks.put(bkey, block);
|
||||
|
||||
// queue the block up to be resolved
|
||||
_pendingBlocks++;
|
||||
_resolver.resolveBlock(block);
|
||||
if (visible) {
|
||||
_visiBlocks.add(block);
|
||||
}
|
||||
_resolver.resolveBlock(block, visible);
|
||||
if (_dpanel != null) {
|
||||
_dpanel.queuedBlock(block);
|
||||
}
|
||||
@@ -705,6 +710,7 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
// recompute our visible object set
|
||||
recomputeVisible();
|
||||
|
||||
Log.info("Rethunk " + _pendingBlocks + "/" + _visiBlocks.size() + ".");
|
||||
return _pendingBlocks;
|
||||
}
|
||||
|
||||
@@ -783,10 +789,11 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
_remgr.invalidateRegion(sbounds);
|
||||
}
|
||||
}
|
||||
--_pendingBlocks;
|
||||
|
||||
// once all the pending blocks have completed their resolution,
|
||||
// recompute our visible object set
|
||||
if (--_pendingBlocks == 0) {
|
||||
// once all the visible pending blocks have completed their
|
||||
// resolution, recompute our visible object set and show ourselves
|
||||
if (_visiBlocks.remove(block) && _visiBlocks.size() == 0) {
|
||||
recomputeVisible();
|
||||
_delayRepaint = false;
|
||||
_remgr.invalidateRegion(_vbounds);
|
||||
@@ -1416,8 +1423,6 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
{
|
||||
public HashSet blocks = new HashSet();
|
||||
|
||||
public HashSet vizblocks = new HashSet();
|
||||
|
||||
public void apply (int tx, int ty, Rectangle tbounds) {
|
||||
_key.x = MathUtil.floorDiv(tx, _metrics.blockwid) *
|
||||
_metrics.blockwid;
|
||||
@@ -1461,6 +1466,9 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
/** A count of blocks in the process of being resolved. */
|
||||
protected int _pendingBlocks;
|
||||
|
||||
/** Used to track visible blocks that are waiting to be resolved. */
|
||||
protected HashSet _visiBlocks = new HashSet();
|
||||
|
||||
/** Used to avoid repaints while we don't yet have resolved all the
|
||||
* blocks needed to render the visible view. */
|
||||
protected boolean _delayRepaint = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneBlockResolver.java,v 1.4 2003/05/12 01:53:19 mdb Exp $
|
||||
// $Id: SceneBlockResolver.java,v 1.5 2003/05/20 23:57:48 mdb Exp $
|
||||
|
||||
package com.threerings.miso.client;
|
||||
|
||||
@@ -18,10 +18,15 @@ public class SceneBlockResolver extends LoopingThread
|
||||
/**
|
||||
* Queues up a scene block for resolution.
|
||||
*/
|
||||
public void resolveBlock (SceneBlock block)
|
||||
public void resolveBlock (SceneBlock block, boolean hipri)
|
||||
{
|
||||
Log.debug("Queueing block for resolution " + block + ".");
|
||||
_queue.append(block);
|
||||
Log.debug("Queueing block for resolution " + block +
|
||||
" (" + hipri + ").");
|
||||
if (hipri) {
|
||||
_queue.prepend(block);
|
||||
} else {
|
||||
_queue.append(block);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user