texInf[i]=new TextureInfo(tm.getTextureID("layer"+i));
texInf[i].add(tm.getTextureID("floorTexN"),TextureInfo.MODE_MODULATE);
texInf[i].add(tm.getTextureID("floorTexN"),2f,2f,2f,2f,2f,2f,TextureInfo.MODE_MODULATE);
texInf[i].add(tm.getTextureID("floorTexN"),2f,2f,2f,2f,0f,0f,TextureInfo.MODE_MODULATE);texInf[i].add(tm.getTextureID("floorTexN"),3f,4f,5f,6f,7f,8f,TextureInfo.MODE_MODULATE);texInf[i].add(tm.getTextureID("floorTexN"),0.1f,0.1f,1f,1f,0.2f,0.2f,TextureInfo.MODE_MODULATE);
tm.addTexture("test1",new Texture("res/test1.png"));tm.addTexture("test2",new Texture("res/test2.png"));float scale=1f;testInfo=new TextureInfo(tm.getTextureID("test1"),scale,scale,scale,scale,scale,scale);scale=4f;testInfo.add(tm.getTextureID("test2"),scale,scale,scale,scale,scale,scale,TextureInfo.MODE_MODULATE);testObject=Primitives.getPlane(1,50);testObject.build();testObject.translate(0,50,50);testObject.setTexture(testInfo);testObject.compileAndStrip();world.addObject(testObject);
Texture coordinates for all layers are taken from the coordinates defined for the base layer of the Object3D.
tileTexture(testObject,1,4,1);
public static void tileTexture(Object3D obj,float tileFactor0,float tileFactor1,float tileFactor2){ PolygonManager pm=obj.getPolygonManager(); int lastPoly=pm.getMaxPolygonID(); for(int i=0;i<lastPoly;i++) { SimpleVector uv0=pm.getTextureUV(i,0); SimpleVector uv1=pm.getTextureUV(i,1); SimpleVector uv2=pm.getTextureUV(i,2); uv0.scalarMul(tileFactor0); uv1.scalarMul(tileFactor1); uv2.scalarMul(tileFactor2); int id=pm.getPolygonTexture(i); TextureInfo ti=new TextureInfo(id,uv0.x,uv0.y,uv1.x,uv1.y,uv2.x,uv2.y); pm.setPolygonTexture(i,ti); }}
I didn't realise the 6 parameters for the UV mapping were for 3 layers with 2 per layer. xD
Simply by not changing the coordinates for layer 0, i.e. get the u/vs, create a new TextureInfo with the original u/vs on the first layer and the modified ones on the second.
...TextureInfo ti=new TextureInfo(id,uv0.x,uv0.y,uv1.x,uv1.y,uv2.x,uv2.y);ti.add(layer2Id, uv0.x*2,uv0.y*2,uv1.x*2,uv1.y*2,uv2.x*2,uv2.y*2, TextureInfo.MODE_???);...