コード例 #1
0
    void SetVectors()
    {
        GeometryProvider.Icosahedron(vectors, indices);
        sphereSpacing = scale * (float)timesToSubdivide;
        for (var i = 0; i < timesToSubdivide; i++)
        {
            GeometryProvider.Subdivide(vectors, indices, true);
        }
//		// commented Debug.Log("start, vectorsc:"+vectors.Count);
    }
コード例 #2
0
    public void BuildSphere()
    {
        var vectors = new List <Vector3>();
        var indices = new List <int>();

        GeometryProvider.Icosahedron(vectors, indices);

        for (var i = 0; i < detailLevel; i++)
        {
            GeometryProvider.Subdivide(vectors, indices, true);
        }

        /// normalize vectors to "inflate" the icosahedron into a sphere.
        for (var i = 0; i < vectors.Count; i++)
        {
            vectors [i] = Vector3.Normalize(vectors [i]);
        }
    }