I am trying to load a texture onto an object as a decal (one side only). For instance, loading a face onto a head. How do I set the location of the decal texture and how do I apply it to the object?
Here is the code that I've tried so far which doesn't seem to work.
// just for a test - load a texture
Node clone = ...
java.net.URL loc = BaseTable.class.getClassLoader().getResource("texture/facialFeatures.png");
Texture texture = TextureManager.loadTexture(loc, Texture.MinificationFilter.BilinearNoMipMaps, Texture.MagnificationFilter.Bilinear);
texture.setApply(Texture.ApplyMode.Decal);
TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
ts.setTexture(texture,0);
clone.setRenderState(ts);
So I am trying to create a Nintendo Mii loader. Once I get most of the loading code finished, I plan on open sourcing it via source forge (since that's where I have all my open source projects).
Basically the face (freckles, mouth, nose, etc) are textures. So in order to provide the diversity that Nintendo does, I need to be able to add the texture based on the mii file.
Note, I'm using http://www.myavatareditor.com/ as a reference and currently am only loading the XML format provided by this site. After I get things working with the XML, then I'll add the binary mii files.
In the xml file are x and y coordinates for the eyes for example, i guess you have to translate these somehow into texture corrdiantes for the head?
Your are correct. There is also a rotation option on some of the components.
I've created a lookup table for the components and colors (color 4 might correspond to yellow for instance). So what I don't know how to do is to load up textures from a file and add them as a decal to a model.
I should be open sourcing the project soon (this is in relation to a scale program I'm working on that records your weight from the wii balance board, keeps track of it, and graphs it out). The 3D avatar code will be included so I'll post back once I have a sourceforge project created.