i want to apply Wrap.repeat to exported Model.
In Blender, I create One Model.
This mode have hierarchy structure like this.
i export this model by Ogre.xml and I import .scene file by JME3.
So, i use ‘loadmodel(this.j3o)’…
[java]
Node object = (Node)assetManager.loadModel(“this.j3o”);
Spatial Body = (Spatial)object.getChild(“body”);
Spatial Head = (Spatial)object.getChild(“head”);
Node Tail = (Node)object.getChild(“tail”);
Spatial ChildTail = (Spatial)object.getChild(“childtail”);
[/java]
Also, i read this post → http://hub.jmonkeyengine.org/groups/import-assets/forum/topic/tile-texture-on-spatial
In this post, they give me some guideline, so i use this code…
[java]
protected void setTextureOfObject(Spatial spatial, String str_Texture, Vector2f vec_TextureScale)
{
Texture tex = assetManager.loadTexture(new TextureKey(str_Texture,false));
tex.setWrap(Texture.WrapMode.Repeat);
Material mat_temp = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat_temp.setTexture(“ColorMap”, tex);
setTextureScale(spatial, new Vector2f(2, 2));
spatial.setMaterial(mat_temp);
}
public void setTextureScale(Spatial spatial, Vector2f vector) {
if (spatial instanceof Node) {
Node findingnode = (Node) spatial;
for (int i = 0; i < findingnode.getQuantity(); i++) {
Spatial child = findingnode.getChild(i);
setTextureScale(child, vector);
}
}else if (spatial instanceof Geometry) {
((Geometry) spatial).getMesh().scaleTextureCoordinates(vector); // Exception Error!!!
}
}
[/java]
i type like this :: setTextureScale(ChildTail, new Vector2f(4,4));
When i use this code … ((Geometry) spatial).getMesh().scaleTextureCoordinates(vector); this create exception error ,
Please, give me advise.