コード例 #1
0
    Chunk2 createChild(Vector3 start, Vector3 end, Algorithm2 algorithm)
    {
        Chunk2 child = (Instantiate(chunkPrefab, start, Quaternion.identity) as GameObject).GetComponent <Chunk2>();

        child.transform.parent = transform;
        child.name             = "Chunk " + start.x + "_" + start.z;
        child.startPoint       = start;
        child.endPoint         = end;
        child.createGeometry(meshRenderer.sharedMaterial, algorithm);
        return(child);
    }
コード例 #2
0
    public void generateTerrain()
    {
        upFace.reset();

        float radius = algorithm.getBaseRadius();

        // Setup the size of the chunks
        upFace.transform.position = new Vector3(transform.position.x - radius / 2f, 0, transform.position.z - radius / 2f);
        upFace.startPoint         = upFace.transform.position;
        upFace.endPoint           = upFace.transform.position + new Vector3(radius, 0, radius);

        // Create geometry
        upFace.createGeometry(material, algorithm);
    }