Added MisoUtil.getTileHash(), made both SceneBlock and AutoFringer use
it to pick random tiles based on x/y location. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2622 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AutoFringer.java,v 1.23 2003/05/29 01:04:58 ray Exp $
|
||||
// $Id: AutoFringer.java,v 1.24 2003/05/29 01:58:06 ray Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.threerings.media.image.ImageManager;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
import com.threerings.miso.data.MisoSceneModel;
|
||||
import com.threerings.miso.util.MisoUtil;
|
||||
|
||||
/**
|
||||
* Automatically fringes a scene according to the rules in the supplied
|
||||
@@ -110,16 +111,7 @@ public class AutoFringer
|
||||
}
|
||||
}
|
||||
|
||||
return composeFringeTile(frecs, masks, generateHashValue(col, row));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a hash value for picking which fringe to use for a particular
|
||||
* tile.
|
||||
*/
|
||||
protected int generateHashValue (int col, int row)
|
||||
{
|
||||
return col ^ row;
|
||||
return composeFringeTile(frecs, masks, MisoUtil.getTileHash(col, row));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FringeConfiguration.java,v 1.14 2003/05/29 01:04:58 ray Exp $
|
||||
// $Id: FringeConfiguration.java,v 1.15 2003/05/29 01:58:06 ray Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
@@ -122,10 +122,8 @@ public class FringeConfiguration implements Serializable
|
||||
public FringeTileSetRecord getFringe (int baseset, int hashValue)
|
||||
{
|
||||
FringeRecord f = (FringeRecord) _frecs.get(baseset);
|
||||
|
||||
int size = f.tilesets.size();
|
||||
int pick = Math.abs(hashValue) % size;
|
||||
return (FringeTileSetRecord) f.tilesets.get(pick);
|
||||
return (FringeTileSetRecord) f.tilesets.get(
|
||||
hashValue % f.tilesets.size());
|
||||
}
|
||||
|
||||
/** The mapping from base tileset id to fringerecord. */
|
||||
|
||||
Reference in New Issue
Block a user