From 722fd26511d63a92f4a17ccb7fcf1b3d4fd0b355 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Thu, 23 Apr 2020 23:17:28 +0200 Subject: [PATCH] Basic terrain mesh done --- .idea/misc.xml | 2 +- core/core.iml | 2 +- core/src/se/cookery/CookeryClient.java | 26 +------- core/src/se/cookery/core/world/Block.java | 2 +- .../se/cookery/gfx/terrain/TerrainMesh.java | 63 ++++++++++++------- .../cookery/gfx/terrain/TerrainMeshTest.java | 41 +++++++++--- desktop/desktop.iml | 2 +- 7 files changed, 78 insertions(+), 60 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 140105b..3a93b1f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/core/core.iml b/core/core.iml index d33fa4b..42e26dc 100644 --- a/core/core.iml +++ b/core/core.iml @@ -1,5 +1,5 @@ - + diff --git a/core/src/se/cookery/CookeryClient.java b/core/src/se/cookery/CookeryClient.java index 6811b40..4a9dcf6 100644 --- a/core/src/se/cookery/CookeryClient.java +++ b/core/src/se/cookery/CookeryClient.java @@ -9,7 +9,6 @@ import se.cookery.core.world.Block; import se.cookery.core.world.gen.GrassLandWorldGenerator; import se.cookery.gfx.character.Player; import se.cookery.gfx.terrain.TerrainMesh; -import se.cookery.gfx.util.GeometryUtil; import se.cookery.gfx.util.MaterialUtil; import se.cookery.gfx.util.WireFrameProcessor; @@ -22,32 +21,9 @@ public class CookeryClient extends SimpleApplication { cam.setLocation(new Vector3f(0,20,-10)); cam.lookAt(new Vector3f(0f,0f,0f), Vector3f.UNIT_Z); - /** 3. We have prepared material and heightmap. - * Now we create the actual terrain: - * 3.1) Create a TerrainQuad and name it "my terrain". - * 3.2) A good value for terrain tiles is 64x64 -- so we supply 64+1=65. - * 3.3) We prepared a heightmap of size 512x512 -- so we supply 512+1=513. - * 3.4) As LOD step scale we supply Vector3f(1,1,1). - * 3.5) We supply the prepared heightmap itself. - */ - Block block = new GrassLandWorldGenerator().generateBlock(0, 0); - /*float[] heightMap = new float[Block.BLOCK_SIZE*Block.BLOCK_SIZE]; - for (int x=0; x - +