How can i wrap a texture (for ex a 4x4 pixels) on a box (1x1x1) in such a way that the texture is repeated and not enlarged to cover all the surface.
Geometry box = new Geometry("Box", new Box(1f,1f,1f));
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
Geometry box = new Geometry("Box", new Box(1f, 1f, 1f)); Material woodMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); //create a simple material Texture tex = assetManager.loadTexture(new TextureKey("Models/guide.png", false)); tex.setWrap(Texture.WrapMode.Repeat); //This should set the texture to repeat. woodMat.setTexture("ColorMap", assetManager.loadTexture(tex)); // with Unshaded.j3md woodGeom.setMaterial(woodMat); // set the cube's material
Let me know if it works :)
(Note, I'm new to jMonkeyEngine myself, so this might not work. Good luck!)
NOTE: You might have to tinker with using:
box.scaleTextureCoordinates(new Vector2f(0.5f, 0.5f));
This will scale the texture to your liking.