Skip to content

Commit

Permalink
#3 Mesh Construction Init - TerrainFace
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Oct 30, 2021
1 parent b9c8d66 commit 4fa180e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}

0 comments on commit 4fa180e

Please sign in to comment.