From 4fa180e83c1348e1e992752bcdc3b9738502fa19 Mon Sep 17 00:00:00 2001 From: Liam Arbuckle Date: Thu, 28 Oct 2021 13:02:44 +0800 Subject: [PATCH] #3 Mesh Construction Init - TerrainFace --- .../Scripts/TerrainFace.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs b/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs index 491b6ff3f..0da119c91 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs +++ b/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs @@ -5,4 +5,27 @@ public class TerrainFace { Mesh mesh; int resolution; + Vector3 localUp; // What way it's facing + Vector3 axisA; + Vector3 axisB; + + public TerrainFace(Mesh mesh, int resolution, Vector3 localup) { + this.mesh = mesh; + this.resolution = resolution; + this.localUp = localUp; + + axisA = new Vector3(localUp.y, localUp.z, localUp.x); + axisB = new Vector3.Cross(localUp, axisA); + } + + public ConstructMesh() { + Vector3[] vertices = new Vector3[resolution * resolution]; // Resolution = number of verices across a single face + int[] triangles = new int[(resolution-1)*(resolution-1)*2*3]; + + for(int y = 0; y = resolution; y++) { + for(int x = 0; x < resolution; x++) { + Vector2 percent = new Vector2(x, y) / (resolution - 1); + } + } + } }