Ejemplo n.º 1
0
    void TerrainTest()
    {
        int testSize = 100;
        int stepSize = 1;
        //int octaves,double persistence
        TerrainGenerator tg = new TerrainGenerator(16384);

        Vector3 testVector = new Vector3(0, 0, 0);
        testSize = testSize / 2;
        double moreThan = 0.44;
        double lessThan = 0.58;

        for (int i = -testSize; i < testSize; i+=stepSize)
        {
            for (int j = -testSize; j < testSize; j += stepSize)
            {

                for (int k = -10; k < 10; k++)
                {
                    testVector.x = i;
                    testVector.y = j;
                    testVector.z = k;

                    if (tg.hollowTube(testVector))
                    {

                        //double d = tg.OctavePerlin(testVector, 11, 2.5);

                            //Color col = UtilityColor.hsv2rgb(1.0f - (float)d, 1, 1);

                        Color col = Color.green;
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col,40.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 40.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.forward * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.back * 0.5f), col, 40.0f);

                    }
                    else if (tg.PlatVeines(testVector))
                    {
                            double d = tg.OctavePerlin(testVector, 11, 2.5);

                        Color col = UtilityColor.hsv2rgb(1.0f - (float)d, 1, 1);
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col, 40.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 40.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.forward * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.back * 0.5f), col, 40.0f);

                    }
                    else if (tg.PallasiteDeposit(testVector))
                    {
                        Color col = Color.red;
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col,40.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 40.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.forward * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.back * 0.5f), col, 40.0f);

                    }
                    else if (tg.IceDeposit(testVector))
                    {
                        Color col = Color.white;
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col, 20.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 20.0f);
                    }
                    else if (tg.subIceDeposit(testVector))
                    {
                        Color col = Color.cyan;
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col, 20.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 20.0f);
                    }
                   /* else
                    {
                        double d = tg.OctavePerlin(testVector, 12, 15.5);
                        Color col = UtilityColor.hsv2rgb((1.0f - (float)d)*0.66f, 1, 1);

                       // Color col = Color.green;
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col, 20.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 20.0f);
                    }*/

                   /* if (tg.subIceDeposit(testVector))
                    {
                        Color col = Color.cyan;
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col, 20.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 20.0f);
                    }

                    */

                    /*if (tg.doubleANDVectorV1(testVector, 0.78, 0.88, 10, 10.5))
                    {

                        double d = tg.OctavePerlin(testVector, 10, 10.5);

                        Color col = UtilityColor.hsv2rgb((float)d, 1, 1);

                        //Color col = Color.gray;
                        //UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, col, 20.0f);
                        //UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), col, 20.0f);

                    }*/

                    /*if (d > moreThan && d < lessThan )
                    {
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, UtilityColor.hsv2rgb(1.0f - (float)d, 1, 1), 20.0f);
                        UnityEngine.Debug.DrawLine(testVector + (Vector3.up * 0.5f) + (Vector3.left * 0.5f), testVector + (Vector3.up * 0.5f) + (Vector3.right * 0.5f), UtilityColor.hsv2rgb(1.0f - (float)d, 1, 1), 20.0f);
                    }*/

                   /* if (d>0.45 && d < 0.55)
                    {
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up,Color.blue,23.0f);
                    }
                    else if (d > 0.45)
                    {
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up,Color.red,23.0f);

                    }
                    else if (d > 0.40)
                    {
                        UnityEngine.Debug.DrawLine(testVector, testVector + Vector3.up, Color.green, 23.0f);

                    }*/

                }
            }
        }
    }