예제 #1
0
    public void spawnDelauney(int vertices, float size)
    {
        iDelauney = new Delauney();
        iDelauney.createDelauney(vertices, size, iTerrain);


        iDelauneyObject = new GameObject("iDelauney");
        iDelauneyObject.transform.parent = iSelf.transform;

        iDelauneyObject.AddComponent <MeshFilter> ();
        iDelauneyObject.AddComponent <MeshRenderer> ();
        iDelauneyObject.AddComponent <CustomRender> ();

        workingMesh = new Mesh();
        iDelauneyObject.GetComponent <MeshFilter> ().mesh = workingMesh;

        workingMesh.vertices  = iDelauney.getVertices();
        workingMesh.triangles = iDelauney.getTriangles();
        workingMesh.RecalculateNormals();

        iDelauneyObject.GetComponent <CustomRender> ().passColor(iLineColor);

        iDelauneyObject.GetComponent <CustomRender> ().CreateLinesFromMesh();
        iDelauneyObject.GetComponent <Renderer> ().material = iMaterial01;

        spawnBackfaceObject();
    }
예제 #2
0
    private void spawnBackfaceObject()
    {
        GameObject workingObject = new GameObject("iDelauney Backfaces");

        workingObject.transform.parent = iSelf.transform;

        workingObject.AddComponent <MeshFilter> ();
        workingObject.AddComponent <MeshRenderer> ();


        workingMesh = new Mesh();
        workingObject.GetComponent <MeshFilter> ().mesh = workingMesh;

        workingMesh.vertices  = iDelauney.getVertices();
        workingMesh.triangles = iDelauney.getTriangles();
        //		mesh.triangles = mesh.triangles.Reverse ();
        workingMesh.RecalculateNormals();

        workingMesh.triangles = workingMesh.triangles.Reverse().ToArray();

        workingObject.GetComponent <Renderer>().material        = iMaterial01;
        workingObject.GetComponent <Renderer> ().receiveShadows = false;
    }