Changing Textures after loading .jme file!

My game outdoor will be made of many "sub-pices" (almost like Lego). putting then together will make the game environment. However i want to have Summer, Winter, Spring and Autumn. The "Lego" pieces are right now in .obj and .mtl. I want to have then in .jme as it will load faster in runtime (ain't it?). However i can't seem to change the "Texture State" from the models loaded in .jme format (neither .obj actually). How would i do it? most of then are composed of two Textures, one of 3 Textures and one of 1 texture. How can i do it? Besides having a .jme file for each season (what if i want to change the environment to desert? mountain? plains? underwater? can't have a .jme for each of those and on every season!)



Might have not been explained properly, so here goes a instance:



CurveWCave.obj is a model that needs 3 textures, "A Outdoor Texture", "A Cliff Texture" and "A Cave Texture".



During Spring it would be: Grass Texture 1, Earth Texture 1, Cave Texture 1.

During Summer it would be: Grass Texture 1, Earth Texture 1, Cave Texture 1.

During Winter it would be: Snow Texture 1. Snowed Earth Texture 1 and Cave Texture 1.

During Autumn it would be: Foliage Grass Texture 1. Earth Texture 1 and Cave Texture 1.

Hi.

I have this code:


Node slideBox = ModelLoader.loadFile("models/cube.jme");

TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
ts.setEnabled(true);
Texture tex = TextureManager.loadTexture(url,
         Texture.MinificationFilter.Trilinear,
         Texture.MagnificationFilter.Bilinear);
ts.setTexture(tex);

Spatial realBox = slideBox.getChild("Box01-1");
realBox.setRenderState(ts);



I run in debug mode for read the name of child that I want (Box01-1).
I want to change the texture of this model, I try with this code, but it does not work. the model appear without texture.
What is wrong in this code???

Oh i got it, when you load a Obj file that uses more than one texture, it will be a Node with as many objects as textures, so each of then will have it's own TextureState, just need to study this further to findout how to change the texture at will.

what is "url"?


TextureManager.loadTexture([b]url[/b],
         Texture.MinificationFilter.Trilinear,
         Texture.MagnificationFilter.Bilinear);



is this "url" correct?
what happens when you try this code? it appears with the "Missing Texture" texture?

it's the Unified Ressource Allocator. This represents the path to your texture image relative to the classes folder. In this case it is a String but e.g. if you use TextureManager.loadImage(URL file, boolean flipped) it is a URL.



referring to Javadoc:

http://www.jmonkeyengine.com/doc/com/jme/util/TextureManager.html#loadTexture(java.lang.String, com.jme.image.Texture.MinificationFilter, com.jme.image.Texture.MagnificationFilter)

I think guedez was asking what is the value passed in url, and is it a valid location - rather than what is a url.

Hi. my url is this: new URL("file:data/textures/green.jpg");

this path is relative to my project.



I use this texture on cube and it works fine.

The model not change the texture, it load and show the original texture.