diff --git a/.gitignore b/.gitignore index 04c3561..47f9ae7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ Library/ -ProjectSettings/ Temp/ *.csproj *.meta diff --git a/Assets/Block.cs b/Assets/Block.cs index 3c66726..f54a386 100644 --- a/Assets/Block.cs +++ b/Assets/Block.cs @@ -49,7 +49,7 @@ public enum BlockType { GRASS, DIRT, STONE, BEDROCK, REDSTONE, DIAMOND, AIR }; { /* DIAMOND */ new Vector2( 0.125f, 0.75f ), new Vector2( 0.1875f, 0.75f ), new Vector2( 0.125f, 0.8125f ), new Vector2( 0.1875f, 0.8125f ) - }, + } }; public enum Healthstate { NOCRACK, CRACK1, CRACK2, CRACK3, CRACK4 }; @@ -76,7 +76,7 @@ public enum Healthstate { NOCRACK, CRACK1, CRACK2, CRACK3, CRACK4 }; new Vector2( 0.1875f, 0.0625f ), new Vector2( 0.25f, 0.0625f ) } }; - + public bool isSolid; public int hitpoints; public Healthstate health; @@ -130,6 +130,8 @@ public bool HitBlock() { public void Draw() { if (isSolid) { // TODO: could be optimized, no need to check for inner blocks. + // possibly set checks from within constructor - assign a var isEdge + // could be extended with edge types such as corner. // Culling if (!HasSolidNeighbour((int)position.x, (int)position.y, (int)position.z + 1)) diff --git a/Assets/Chunk.cs b/Assets/Chunk.cs index ace8b5b..b64dd83 100644 --- a/Assets/Chunk.cs +++ b/Assets/Chunk.cs @@ -61,6 +61,7 @@ bool Load() { } public void Save() { + // Not Working properly. string chunkFile = BuildChunkFileName(chunk.transform.position); if (File.Exists(chunkFile) == false) diff --git a/Assets/Utils.cs b/Assets/Utils.cs index 8cfdf0a..b93a51c 100644 --- a/Assets/Utils.cs +++ b/Assets/Utils.cs @@ -2,6 +2,9 @@ public class Utils { + // to avoid any negative values & mirroring + static float offset = 32000; + static int maxHeight = 150; static float smooth = 0.01f; static int octaves = 4; @@ -27,7 +30,7 @@ public static float FBM3D(float x, float y, float z, float sm, int oct) { return (XY + YZ + XZ + YX + ZY + ZX)/6.0f; } - static float Map(float newMin, float newMax, float origMin, float origMax,float value) { + static float Map(float newMin, float newMax, float origMin, float origMax, float value) { float inverse = Mathf.InverseLerp(origMin, origMax, value); return Mathf.Lerp(newMin, newMax, inverse); } @@ -39,9 +42,6 @@ static float FBM(float x, float z, int oct, float pers) { float amplitude = 1; float maxValue = 1; - // to avoid any negative values & mirroring - float offset = 32000; - for (int i = 0; i < oct; i++) { total += Mathf.PerlinNoise((x + offset) * frequency, (z + offset) * frequency) * amplitude; diff --git a/README b/README deleted file mode 100644 index 49af115..0000000 --- a/README +++ /dev/null @@ -1,2 +0,0 @@ -# Voxel World -A procedural world built with Unity3D.