You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

43 lines
1.0 KiB

using System.Linq;
using UnityEngine;
using UnityEngine.Rendering;
namespace Metamesh
{
public class GoldbergPolyhedron : MonoBehaviour
{
public float radius = 1;
public uint subdivision = 2;
private void Start()
{
}
private void Update()
{
}
public void Generate()
{
var builder = new IcosphereBuilder();
for (var i = 1; i < subdivision; ++i)
{
builder = new IcosphereBuilder(builder);
}
var vertices = builder.Vertices.Select(v => (Vector3)(v * radius));
var normals = builder.Vertices.Select(v => (Vector3)v);
var indices = builder.Indices;
/*
if (builder.VertexCount > 65535) mesh.indexFormat = IndexFormat.UInt32;
mesh.SetVertices(vtx.ToList());
mesh.SetNormals(nrm.ToList());
mesh.SetIndices(idx.ToList(), MeshTopology.Triangles, 0);
*/
}
}
}