Added an example colorization configuration, wired it into the Miso scene
viewer, so now we have colorized pirates walking around the scene instead of weird red/purple ones. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1060 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -230,7 +230,16 @@
|
||||
<property name="testrsrc.dir" value="${tclasses.dir}/rsrc"/>
|
||||
</target>
|
||||
|
||||
<target name="test-tsbundles" depends="-prep-test-rsrcs"
|
||||
<target name="test-colorpos" depends="compile,-prep-test-rsrcs"
|
||||
description="Builds the test colorpository data.">
|
||||
<taskdef name="confcomp" classpathref="test.classpath"
|
||||
classname="com.threerings.tools.CompiledConfigTask"/>
|
||||
<confcomp parser="com.threerings.media.image.tools.xml.ColorPositoryParser"
|
||||
configdef="${testrsrc.dir}/config/media/colordefs.xml"
|
||||
target="${testrsrc.dir}/config/media/colordefs.dat"/>
|
||||
</target>
|
||||
|
||||
<target name="test-tsbundles" depends="compile,-prep-test-rsrcs"
|
||||
description="Build test tileset bundles.">
|
||||
<taskdef name="tilebundle" classpathref="test.classpath"
|
||||
classname="com.threerings.media.tile.bundle.tools.TileSetBundlerTask"/>
|
||||
@@ -253,7 +262,7 @@
|
||||
target="${testrsrc.dir}/config/miso/tile/fringeconf.dat"/>
|
||||
</target>
|
||||
|
||||
<target name="test-cbundles" depends="-prep-test-rsrcs"
|
||||
<target name="test-cbundles" depends="compile,-prep-test-rsrcs"
|
||||
description="Builds test component bundles.">
|
||||
<taskdef name="metabundle" classpathref="test.classpath"
|
||||
classname="com.threerings.cast.bundle.tools.MetadataBundlerTask"/>
|
||||
@@ -277,7 +286,7 @@
|
||||
</target>
|
||||
|
||||
<property name="test" value=""/>
|
||||
<target name="tests" depends="compile,test-tsbundles,test-cbundles"
|
||||
<target name="tests" depends="compile,test-colorpos,test-tsbundles,test-cbundles"
|
||||
description="Runs unit tests. Use -Dtest=Foo to run only FooTest.">
|
||||
<taskdef name="unit" classpathref="test.classpath"
|
||||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
|
||||
|
||||
@@ -29,6 +29,9 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import com.samskivert.util.RandomUtil;
|
||||
|
||||
import com.threerings.media.image.ColorPository;
|
||||
import com.threerings.media.image.Colorization;
|
||||
|
||||
import com.threerings.cast.CharacterDescriptor;
|
||||
import com.threerings.cast.ComponentClass;
|
||||
import com.threerings.cast.ComponentRepository;
|
||||
@@ -41,11 +44,10 @@ import static com.threerings.cast.Log.log;
|
||||
public class CastUtil
|
||||
{
|
||||
/**
|
||||
* Returns a new character descriptor populated with a random set of
|
||||
* components.
|
||||
* Returns a new character descriptor populated with a random set of components.
|
||||
*/
|
||||
public static CharacterDescriptor getRandomDescriptor (
|
||||
String gender, ComponentRepository crepo)
|
||||
String gender, ComponentRepository crepo, ColorPository cpos)
|
||||
{
|
||||
// get all available classes
|
||||
ArrayList<ComponentClass> classes = Lists.newArrayList();
|
||||
@@ -63,8 +65,7 @@ public class CastUtil
|
||||
// make sure there are some components in this class
|
||||
Iterator<Integer> iter = crepo.enumerateComponentIds(cclass);
|
||||
if (!iter.hasNext()) {
|
||||
log.info("Skipping class for which we have no components " +
|
||||
"[class=" + cclass + "].");
|
||||
log.info("Skipping class for which we have no components [class=" + cclass + "].");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -72,15 +73,20 @@ public class CastUtil
|
||||
}
|
||||
|
||||
// select the components
|
||||
int size = classes.size();
|
||||
int components[] = new int[size];
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
int[] components = new int[classes.size()];
|
||||
Colorization[][] zations = new Colorization[components.length][];
|
||||
for (int ii = 0; ii < components.length; ii++) {
|
||||
ComponentClass cclass = classes.get(ii);
|
||||
|
||||
// get the components available for this class
|
||||
ArrayList<Integer> choices = Lists.newArrayList();
|
||||
Iterators.addAll(choices, crepo.enumerateComponentIds(cclass));
|
||||
|
||||
zations[ii] = new Colorization[COLOR_CLASSES.length];
|
||||
for (int zz = 0; zz < COLOR_CLASSES.length; zz++) {
|
||||
zations[ii][zz] = cpos.getRandomStartingColor(COLOR_CLASSES[zz]).getColorization();
|
||||
}
|
||||
|
||||
// choose a random component
|
||||
if (choices.size() > 0) {
|
||||
int idx = RandomUtil.getInt(choices.size());
|
||||
@@ -90,10 +96,13 @@ public class CastUtil
|
||||
}
|
||||
}
|
||||
|
||||
return new CharacterDescriptor(components, null);
|
||||
return new CharacterDescriptor(components, zations);
|
||||
}
|
||||
|
||||
// these are all specific to our test resourcse
|
||||
protected static final String[] CLASSES = {
|
||||
"legs", "feet", "hand_left", "hand_right", "torso",
|
||||
"head", "hair", "hat", "eyepatch" };
|
||||
protected static final String[] COLOR_CLASSES = {
|
||||
"skin", "hair", "textile_p", "textile_s" };
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.threerings.resource.ResourceManager;
|
||||
|
||||
import com.threerings.media.FrameManager;
|
||||
import com.threerings.media.image.ClientImageManager;
|
||||
import com.threerings.media.image.ColorPository;
|
||||
import com.threerings.media.tile.bundle.BundledTileSetRepository;
|
||||
|
||||
import com.threerings.miso.data.SimpleMisoSceneModel;
|
||||
@@ -96,9 +97,10 @@ public class ViewerApp
|
||||
BundledComponentRepository crepo =
|
||||
new BundledComponentRepository(rmgr, imgr, "components");
|
||||
CharacterManager charmgr = new CharacterManager(imgr, crepo);
|
||||
ColorPository cpos = ColorPository.loadColorPository(rmgr);
|
||||
|
||||
// create our scene view panel
|
||||
_panel = new ViewerSceneViewPanel(ctx, charmgr, crepo);
|
||||
_panel = new ViewerSceneViewPanel(ctx, charmgr, crepo, cpos);
|
||||
_frame.setPanel(_panel);
|
||||
|
||||
// load up the scene specified by the user
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.awt.event.MouseEvent;
|
||||
|
||||
import com.samskivert.util.RandomUtil;
|
||||
|
||||
import com.threerings.media.image.ColorPository;
|
||||
import com.threerings.media.sprite.PathObserver;
|
||||
import com.threerings.media.sprite.Sprite;
|
||||
import com.threerings.media.sprite.SpriteManager;
|
||||
@@ -54,15 +55,14 @@ public class ViewerSceneViewPanel extends MisoScenePanel
|
||||
/**
|
||||
* Construct the panel and initialize it with a context.
|
||||
*/
|
||||
public ViewerSceneViewPanel (MisoContext ctx,
|
||||
CharacterManager charmgr,
|
||||
ComponentRepository crepo)
|
||||
public ViewerSceneViewPanel (
|
||||
MisoContext ctx, CharacterManager charmgr, ComponentRepository crepo, ColorPository cpos)
|
||||
{
|
||||
super(ctx, MisoConfig.getSceneMetrics());
|
||||
|
||||
// create the character descriptors
|
||||
_descUser = CastUtil.getRandomDescriptor("female", crepo);
|
||||
_descDecoy = CastUtil.getRandomDescriptor("male", crepo);
|
||||
_descUser = CastUtil.getRandomDescriptor("female", crepo, cpos);
|
||||
_descDecoy = CastUtil.getRandomDescriptor("male", crepo, cpos);
|
||||
|
||||
// create the manipulable sprite
|
||||
_sprite = createSprite(_spritemgr, charmgr, _descUser);
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<!-- class ids are assigned by hand, which means that if you delete a -->
|
||||
<!-- colorization class, *do not* change the ids of the other colorization -->
|
||||
<!-- classes; reuse ids at your own risk -->
|
||||
<colors>
|
||||
<!-- hair recolorations -->
|
||||
<class classId="1" name="hair" source="#922226" range="0.05, 0.8, 1" starter="true">
|
||||
<color colorId="1" name="red" offsets="0.02, -0.1, 0"/>
|
||||
<color colorId="2" name="silver" offsets="0.13, -0.9, -0.15"/>
|
||||
<color colorId="3" name="white" offsets="0.13, -0.8, .15"/>
|
||||
<color colorId="4" name="black" offsets="0.6, -0.7, -0.6"/>
|
||||
<color colorId="5" name="darkBrown" offsets="0.1, 0, -0.4"/>
|
||||
<color colorId="6" name="lightBrown" offsets="0.11, -0.2, -0.2"/>
|
||||
<color colorId="7" name="strawberryBlonde" offsets="0.1, -0.1, 0"/>
|
||||
<color colorId="8" name="sandy" offsets="0.13, -0.4, -0.1"/>
|
||||
<color colorId="9" name="blonde" offsets="0.15, -0.4, 0.05"/>
|
||||
</class>
|
||||
|
||||
<!-- skin recolorations -->
|
||||
<class classId="4" name="skin" source="#C550D7" range="0.08, 0.4, 1" starter="true">
|
||||
<color colorId="1" name="darkest" offsets="-0.75, -0.2, -0.45"/>
|
||||
<color colorId="2" name="dark" offsets="-0.75, 0.16, -0.26"/>
|
||||
<color colorId="3" name="medium" offsets="-0.75, -0.05, -0.01"/>
|
||||
<color colorId="4" name="tan" offsets="-0.73, -0.08, -0.03"/>
|
||||
<color colorId="5" name="white" offsets="-0.74, -0.28, -0.02"/>
|
||||
<color colorId="6" name="pale" offsets="-0.72, -0.42, 0"/>
|
||||
<color colorId="7" name="pasty" offsets="-0.72, -0.48, 0"/>
|
||||
<color colorId="8" name="ghost" offsets="-0.32, -0.35, 0.28" starter="false"/>
|
||||
</class>
|
||||
|
||||
<!-- primary clothing recolorations -->
|
||||
<class classId="2" name="textile_p" source="#922226" range="0.07, 0.7, 1" defaultId="3">
|
||||
<color colorId="1" name="red" offsets="0, 0, 0" starter="true"/>
|
||||
<color colorId="2" name="brown" offsets="-0.91, -0.2, -0.2" starter="true"/>
|
||||
<color colorId="3" name="white" offsets="0, -1, 0.1" starter="true"/>
|
||||
<color colorId="4" name="black" offsets="0, -1, -0.6"/>
|
||||
<color colorId="5" name="grey" offsets="0, -1, -0.2"/>
|
||||
<color colorId="6" name="yellow" offsets="-0.83, -0.2, 0.1"/>
|
||||
<color colorId="7" name="pink" offsets="0.95, -0.2, 0.15"/>
|
||||
<color colorId="8" name="violet" offsets="0.83, -0.1, -0.15"/>
|
||||
<color colorId="9" name="purple" offsets="0.76, 0.05, -0.11"/>
|
||||
<color colorId="10" name="navyBlue" offsets="0.65, -0.2, -0.2"/>
|
||||
<color colorId="11" name="blue" offsets="-0.4, 0, 0" starter="true"/>
|
||||
<color colorId="12" name="aqua" offsets="0.5, 0, -0.1"/>
|
||||
<color colorId="13" name="lime" offsets="0.32, -0.1, -0.1"/>
|
||||
<color colorId="14" name="green" offsets="0.3, -0.2, -0.4"/>
|
||||
<color colorId="15" name="orange" offsets="0.08, 0, 0.05"/>
|
||||
<color colorId="16" name="maroon" offsets="0, 0.1, -0.3"/>
|
||||
<color colorId="17" name="darkBrown" offsets="-0.91, -0.2, -0.4"/>
|
||||
<color colorId="18" name="gold" offsets="0.125, 0.4, 0.1"/>
|
||||
<color colorId="19" name="atlantean" offsets="0.60, -0.36, 0.10"/>
|
||||
<color colorId="20" name="rose" offsets="0.95, -0.5, 0.16"/>
|
||||
<color colorId="21" name="lavender" offsets="0.76, -0.4, 0.05"/>
|
||||
<color colorId="22" name="mint" offsets="-0.59, -0.35, 0.13"/>
|
||||
<color colorId="23" name="lightGreen" offsets="-0.77, 0.072, -0.24"/>
|
||||
<color colorId="24" name="magenta" offsets="0.91, 0.07, -0.04"/>
|
||||
<color colorId="25" name="indigo" offsets="-0.29, -0.01, 0.1"/>
|
||||
<color colorId="26" name="lemon" offsets="-0.83, -0.39, 0.16"/>
|
||||
<color colorId="27" name="peach" offsets="0.1, -0.3, 0.15"/>
|
||||
<color colorId="28" name="lightBlue" offsets="-0.462, -0.301, 0.161"/>
|
||||
<!--
|
||||
<color colorId="29" name="bluegrey" offsets="-0.4, -0.5, -0.15"/>
|
||||
-->
|
||||
<color colorId="30" name="persimmon" offsets="0.054, 0.516, 0.129"/>
|
||||
<color colorId="31" name="royalBlue" offsets="-0.359, 0.4, 0.152"/>
|
||||
<color colorId="32" name="iceBlue" offsets="-0.468, -0.548, 0.301"/>
|
||||
<color colorId="33" name="springGreen" offsets="-0.757, 0.770, 0.099"/>
|
||||
<color colorId="34" name="banana" offsets="0.140, 0.770, 0.300"/>
|
||||
<color colorId="35" name="wine" offsets="-0.100, 0.770, -0.290"/>
|
||||
<color colorId="36" name="eggplant" offsets="0.765, 0.086, -0.496"/>
|
||||
<color colorId="37" name="brightRed" offsets="-0.010, 0.770, 0.200"/>
|
||||
<color colorId="38" name="chocolate" offsets="0.050, 0.190, -0.440"/>
|
||||
<color colorId="39" name="seaGreen" offsets="-0.542, 0.770, -0.272"/>
|
||||
<color colorId="40" name="nightBlue" offsets="0.634, 0.770, -0.351"/>
|
||||
</class>
|
||||
|
||||
<!-- secondary clothing recolorations -->
|
||||
<class classId="3" name="textile_s" source="#57AC6A" range="0.1, 0.6, 1" defaultId="3">
|
||||
<color colorId="1" name="red" offsets="0.65, 0, 0.2" starter="true"/>
|
||||
<color colorId="2" name="brown" offsets="-0.28, -0.37, -0.1" starter="true"/>
|
||||
<color colorId="3" name="white" offsets="0.72, -1, 0.2" starter="true"/>
|
||||
<color colorId="4" name="black" offsets="0.72, -1, -0.5"/>
|
||||
<color colorId="5" name="grey" offsets="0.2, -1, 0"/>
|
||||
<color colorId="6" name="yellow" offsets="0.81, -0.25, 0.2"/>
|
||||
<color colorId="7" name="pink" offsets="0.6, -0.27, 0.25"/>
|
||||
<color colorId="8" name="violet" offsets="-0.55, -0.15, 0.09"/>
|
||||
<color colorId="9" name="purple" offsets="-0.6, 0.1, 0.1"/>
|
||||
<color colorId="10" name="navyBlue" offsets="0.28, -0.27, -0.07"/>
|
||||
<color colorId="11" name="blue" offsets="0.25, -0.15, 0.2" starter="true"/>
|
||||
<color colorId="12" name="aqua" offsets="0.15, 0, 0.15"/>
|
||||
<color colorId="13" name="lime" offsets="-0.05, -0.1, 0.1"/>
|
||||
<color colorId="14" name="green" offsets="-0.05, -0.25, -0.3"/>
|
||||
<color colorId="15" name="orange" offsets="0.72, 0.04, 0.252"/>
|
||||
<color colorId="16" name="maroon" offsets="0.65, 0.1, -0.2"/>
|
||||
<color colorId="17" name="darkBrown" offsets="-0.28, -0.37, -0.27"/>
|
||||
<color colorId="18" name="gold" offsets="0.76, 0.6, 0.24"/>
|
||||
<color colorId="19" name="atlantean" offsets="0.25, -0.36, 0.12"/>
|
||||
<color colorId="20" name="rose" offsets="0.6, -0.5, 0.3"/>
|
||||
<color colorId="21" name="lavender" offsets="0.41, -0.4, 0.19"/>
|
||||
<color colorId="22" name="mint" offsets="-0.94, -0.35, 0.27"/>
|
||||
<color colorId="23" name="lightGreen" offsets="-1.12, 0.072, -0.1"/>
|
||||
<color colorId="24" name="magenta" offsets="0.56, 0.07, 0.1"/>
|
||||
<color colorId="25" name="indigo" offsets="0.36, -0.01, 0.3"/>
|
||||
<color colorId="26" name="lemon" offsets="-0.18, -0.39, 0.3"/>
|
||||
<color colorId="27" name="peach" offsets="-0.25, -0.3, 0.29"/>
|
||||
<color colorId="28" name="lightBlue" offsets="0.171, -0.058, 0.325"/>
|
||||
<!--
|
||||
<color colorId="29" name="bluegrey" offsets="-0.75, -0.5, -0.01"/>
|
||||
-->
|
||||
<color colorId="30" name="persimmon" offsets="0.699, 0.796, 0.179"/>
|
||||
<color colorId="31" name="royalBlue" offsets="0.285, 0.68, 0.202"/>
|
||||
<color colorId="32" name="iceBlue" offsets="0.176, -0.268, 0.351"/>
|
||||
<color colorId="33" name="springGreen" offsets="-0.113, 1.0, 0.149"/>
|
||||
<color colorId="34" name="banana" offsets="0.784, 1.0, 0.350"/>
|
||||
<color colorId="35" name="wine" offsets="0.544, 1.0, -0.240"/>
|
||||
<color colorId="36" name="eggplant" offsets="0.409, 0.366, -0.446"/>
|
||||
<color colorId="37" name="brightRed" offsets="0.634, 1.0, 0.250"/>
|
||||
<color colorId="38" name="chocolate" offsets="0.694, 0.470, -0.390"/>
|
||||
<color colorId="39" name="seaGreen" offsets="0.102, 1.0, -0.222"/>
|
||||
<color colorId="40" name="nightBlue" offsets="0.278, 1.0, -0.301"/>
|
||||
</class>
|
||||
</colors>
|
||||
Reference in New Issue
Block a user