public void GenerateMesh() { Random.InitState(this.seed); var mesh = GenMeshFactory.CreateCube(); Generate(mesh); var meshFilter = GetComponent <MeshFilter>(); meshFilter.sharedMesh = mesh.ToUnityMesh(smoothShading); }
internal void CreateIcosphere(int subdivisions, float sphereSize, Matrix4x4 sphereMatrix) { var icosphereMesh = GenMeshFactory.CreateIcosphere(subdivisions, sphereSize); foreach (var vertex in icosphereMesh.Vertices) { vertex.Coordinates = sphereMatrix.MultiplyPoint3x4(vertex.Coordinates); } foreach (var face in icosphereMesh.Faces) { this.Faces.Add(face); } }
public void CreateCylinder(int numberOfSegments, float cylinderSize1, float cylinderSize2, float cylinderDepth, Matrix4x4 cylinderMatrix) { var cylinderMesh = GenMeshFactory.CreateCylinder(numberOfSegments, cylinderSize1, cylinderSize2, cylinderDepth); foreach (var vertex in cylinderMesh.Vertices) { vertex.Coordinates = cylinderMatrix.MultiplyPoint3x4(vertex.Coordinates); } foreach (var face in cylinderMesh.Faces) { this.Faces.Add(face); } }