From 77d35acb221eb676fa9bb30aabe65dc96f396568 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Tue, 15 Nov 2011 23:03:30 +0000 Subject: [PATCH] - fix j3o to include material git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8690 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/test-data/TerrainGrid/TerrainGrid.j3o | Bin 887 -> 2601 bytes .../TerrainQuadGridSerializationTest.java | 59 ------------------ .../jme3test/terrain/TerrainQuadGridTest.java | 4 ++ 3 files changed, 4 insertions(+), 59 deletions(-) diff --git a/engine/src/test-data/TerrainGrid/TerrainGrid.j3o b/engine/src/test-data/TerrainGrid/TerrainGrid.j3o index f112f189c41a87ee25000f87c31d250799f1e749..67889d35798cb70e24930f033f64577827a41c30 100644 GIT binary patch literal 2601 zcma)7OK%%h6uxI>{I=^hZQgAYBq%E;irobgAeuOYiZ)VdT!h#}7yH_tbY7a7ge0qq zH5)eY3s{2${{itA*dl%be}M1YdDxBOw3g1Cxp&U-u9Tlfi^PmUwB!c&p~^eQ-^CVJxR& z70}1*HgcWt=zKb02Jg1U=r%%&N0{ZfIU92dZg%2%)Xp9pOVdCm!(93II{3EhVN5Be4;G=jbf{SowS=)a*CpgGPWO6fp@m?r05 zhW-V53HkzhHH*7~^tKu--rGhdK3C5X!g;!?1zFd zX!>p?G7Ku4L{zabmPBPpg{oDm)u_%Jb=pbS4bp>N69jY1pc3P!!PAenc*OBPeTA+b zi4;vB%?+7I%OJM}e@#vJjRDr^t_o`Or&l{sHBoWGw;^Nxk084jcwXRd;a1yIqj)Pb z-g>N*ZqXfDrWIPFyL68>Xp=d$jAKdf)h^B; zE8d`13SDm>(Dl9tx;@x3_udy&%f_#>M|nL(mj<=@pr{Rgik_g2%yx=i9O6pY8ah#8 zABSV2n+5_#j_deJMkbY?t5C_r%3r{5@!)OZ7{ukl^osHd%ne#F!Q%z4ZcotWoa)9A z?wPc_+ixxpki12pw7#q1D=1*lqDiJji*w<79t>V~wjw;!`j*~Y-<9xPj$;tBVM9=9 zU;i^x`w|(=U3{O%n65#q^S*TqT4y%ZY4;BhY3J2-L@J1_kuZS7ys+B_-A_rn`x}$= eF=Fp#vEO^01+R~Wj%;O-*QX87PK?>Zz4bq@m_Y~t delta 154 zcmZ1}@|}&x%h%PIfq{V$h&d)NVpN&z#1ub~$C#0OqC?BXOSzL@GuclrVK$nq#q5;` zRKo>T3#1sBfY=I%nSs~?h*^Nx7l>JbI0%T@fH)0^*?~A0h&h0`6o@&2xD$v$X7vFv S$ZkduVLG{j)pYU()*=9{trX4x diff --git a/engine/src/test/jme3test/terrain/TerrainQuadGridSerializationTest.java b/engine/src/test/jme3test/terrain/TerrainQuadGridSerializationTest.java index af56a86f1..b4e719721 100644 --- a/engine/src/test/jme3test/terrain/TerrainQuadGridSerializationTest.java +++ b/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); diff --git a/engine/src/test/jme3test/terrain/TerrainQuadGridTest.java b/engine/src/test/jme3test/terrain/TerrainQuadGridTest.java index 327b429bd..84c889bb1 100644 --- a/engine/src/test/jme3test/terrain/TerrainQuadGridTest.java +++ b/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 {