Time for action – scaling and tiling textures
Since it's used quite often, let's create a material with a seamless tiled texture, and use it as the floor under the hover tank:
- Go back to
HoverTank.java
. - Copy the provided
assets/Textures/BrickWall/
directory to yourassets/Textures
directory. - Add the following code to the
simpleInitApp()
method:Box floorMesh = new Box(new Vector3f(-20,-2,-20),new Vector3f(20,-3,20)); floorMesh.scaleTextureCoordinates(new Vector2f(8,8)); Geometry floorGeo = new Geometry("floor", floorMesh); Material floorMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); floorMat.setTexture("DiffuseMap", assetManager.loadTexture( "Textures/BrickWall/BrickWall_diffuse.jpg")); floorMat.setTexture("NormalMap", assetManager.loadTexture( ...
Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.