Browse Source

- fix j3o to include material

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8690 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 years ago
parent
commit
77d35acb22

BIN
engine/src/test-data/TerrainGrid/TerrainGrid.j3o


+ 0 - 59
engine/src/test/jme3test/terrain/TerrainQuadGridSerializationTest.java

@@ -19,21 +19,13 @@ import com.jme3.terrain.geomipmap.TerrainGrid;
 import com.jme3.terrain.geomipmap.TerrainGridListener;
 import com.jme3.terrain.geomipmap.TerrainLodControl;
 import com.jme3.terrain.geomipmap.TerrainQuad;
-import com.jme3.terrain.geomipmap.grid.AssetQuadGrid;
 import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
-import com.jme3.texture.Texture;
-import com.jme3.texture.Texture.WrapMode;
 import java.io.File;
 
 public class TerrainQuadGridSerializationTest extends SimpleApplication {
 
-    private Material mat_terrain;
     private TerrainGrid terrain;
-    private float grassScale = 64;
-    private float dirtScale = 16;
-    private float rockScale = 128;
     private boolean usePhysics = true;
-    private boolean physicsAdded = false;
 
     public static void main(final String[] args) {
         TerrainQuadGridSerializationTest app = new TerrainQuadGridSerializationTest();
@@ -54,58 +46,7 @@ public class TerrainQuadGridSerializationTest extends SimpleApplication {
         ScreenshotAppState state = new ScreenshotAppState();
         this.stateManager.attach(state);
 
-        // TERRAIN TEXTURE material
-        this.mat_terrain = new Material(this.assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
-
-        // Parameters to material:
-        // regionXColorMap: X = 1..4 the texture that should be appliad to state X
-        // regionX: a Vector3f containing the following information:
-        //      regionX.x: the start height of the region
-        //      regionX.y: the end height of the region
-        //      regionX.z: the texture scale for the region
-        //  it might not be the most elegant way for storing these 3 values, but it packs the data nicely :)
-        // slopeColorMap: the texture to be used for cliffs, and steep mountain sites
-        // slopeTileFactor: the texture scale for slopes
-        // terrainSize: the total size of the terrain (used for scaling the texture)
-        // GRASS texture
-        Texture grass = this.assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
-        grass.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region1ColorMap", grass);
-        this.mat_terrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));
-
-        // DIRT texture
-        Texture dirt = this.assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
-        dirt.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region2ColorMap", dirt);
-        this.mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
-
-        // ROCK texture
-        Texture rock = this.assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
-        rock.setWrap(WrapMode.Repeat);
-        this.mat_terrain.setTexture("region3ColorMap", rock);
-        this.mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
-
-        this.mat_terrain.setTexture("region4ColorMap", rock);
-        this.mat_terrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));
-
-        this.mat_terrain.setTexture("slopeColorMap", rock);
-        this.mat_terrain.setFloat("slopeTileFactor", 32);
-
-        this.mat_terrain.setFloat("terrainSize", 129);
-//quad.getHeightMap(), terrain.getLocalScale()), 0
-//        AssetQuadGrid grid = new AssetQuadGrid(assetManager, "testgrid", "TerrainGrid");
-//        this.terrain = new TerrainGrid("terrain", 65, 257, grid);
         this.terrain= (TerrainGrid) assetManager.loadModel("TerrainGrid/TerrainGrid.j3o");
-        terrain.setMaterial(mat_terrain);
-//        this.terrain.setMaterial(this.mat_terrain);
-//        this.terrain.setLocalTranslation(0, 0, 0);
-//        this.terrain.setLocalScale(2f, 1f, 2f);
-//        try {
-//            BinaryExporter.getInstance().save(terrain, new File("/Users/normenhansen/Documents/Code/jme3/engine/src/test-data/TerrainGrid/"
-//                    + "TerrainGrid.j3o"));
-//        } catch (IOException ex) {
-//            Logger.getLogger(TerrainFractalGridTest.class.getName()).log(Level.SEVERE, null, ex);
-//        }
         
         this.rootNode.attachChild(this.terrain);
         

+ 4 - 0
engine/src/test/jme3test/terrain/TerrainQuadGridTest.java

@@ -9,6 +9,7 @@ import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
 import com.jme3.bullet.collision.shapes.HeightfieldCollisionShape;
 import com.jme3.bullet.control.CharacterControl;
 import com.jme3.bullet.control.RigidBodyControl;
+import com.jme3.export.binary.BinaryExporter;
 import com.jme3.input.KeyInput;
 import com.jme3.input.controls.ActionListener;
 import com.jme3.input.controls.KeyTrigger;
@@ -24,6 +25,9 @@ import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
 import com.jme3.texture.Texture;
 import com.jme3.texture.Texture.WrapMode;
 import java.io.File;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 public class TerrainQuadGridTest extends SimpleApplication {