Ok, based on the previous answer and some other forums I reach the following code that allows to set a different texture to each face of a cube:
Basically the line that allows to do that is the following one:
((Shape3D) textureCube.getChild(POSITION)).setAppearance(APPEARANCE);
Taking into account that:
textureCube:
Box textureCube = new Box(0.4f, 0.4f, 0.4f, Box.GENERATE_TEXTURE_COORDS,
defaultAppearance);
(defaultAppearance is just a basic Appearance object: Appearance defaultAppearance = new Appearance();)
The position is given by, as vembutech pointed out, TextureCubeMap class and their values for each face: POSITIVE_X, POSITIVE_Y, POSITIVE_Z, NEGATIVE_X, NEGATIVE_Y, NEGATIVE_Z.
And the appearance object is just an appearance object. I created mine appearance objects with this method:
private Appearance getAppearance(String f) throws Exception {
Appearance app = new Appearance();
URL texImage = new java.net.URL("file:" + f);
Texture tex = new TextureLoader(texImage, this).getTexture();
app.setTexture(tex);
TextureAttributes texAttr = new TextureAttributes();
texAttr.setTextureMode(TextureAttributes.MODULATE);
app.setTextureAttributes(texAttr);
return app;
}
This method creates an appearance based on an input file (f).
Cheers