Exemplo n.º 1
0
    float GetNoiseAbove(HexWorldCoord hex)
    {
        Vector3 pos   = HexToPos(hex);
        float   noise = Procedural.Noise.noiseMethods[2][2](hex.ToVector3(), noiseScale, worldName.GetHashCode()).value * 20 + hex.y * thresDropOff;

        if (island)
        {
            noise += 100 * Mathf.Pow(islandDropOff, (Mathf.Pow(pos.x, 2) + Mathf.Pow(pos.z, 2)) - 10386);
        }
        return(noise);
    }
Exemplo n.º 2
0
    Vector3 GetNormalAbove(HexWorldCoord hex)
    {
        Vector3 pos = HexToPos(hex);
        Vector3 gradient;

        gradient = Procedural.Noise.noiseMethods[2][2](hex.ToVector3(), noiseScale, worldName.GetHashCode()).derivative * 20 + new Vector3(0, thresDropOff, 0);
        if (island)
        {
            gradient += 100 * new Vector3(pos.x * Mathf.Log(islandDropOff) * Mathf.Pow(islandDropOff, (Mathf.Pow(pos.x, 2) + Mathf.Pow(pos.z, 2)) - 10386), 0, pos.z * Mathf.Log(islandDropOff) * Mathf.Pow(islandDropOff, (Mathf.Pow(pos.x, 2) + Mathf.Pow(pos.z, 2)) - 10386));
        }
        return(gradient);
    }
Exemplo n.º 3
0
    float GetNoiseBelow(HexWorldCoord hex)
    {
        Vector3       pos     = HexToPos(hex);
        Vector3       basePos = new Vector3(pos.x, heightBoundary, pos.z);
        HexWorldCoord baseHex = PosToHex(basePos);
        float         noise   = Procedural.Noise.noiseMethods[2][2](baseHex.ToVector3(), noiseScale, worldName.GetHashCode()).value * 20 + baseHex.y * thresDropOff;

        if (island)
        {
            noise += 100 * Mathf.Pow(islandDropOff, (Mathf.Pow(basePos.x, 2) + Mathf.Pow(basePos.z, 2)) - 10386);
        }
        noise += 5 * (Mathf.Pow(-pos.y + heightBoundary, 0.35f));
        return(noise);
    }
Exemplo n.º 4
0
    Vector3 GetNormalBelow(HexWorldCoord hex)
    {
        Vector3       pos = HexToPos(hex);
        Vector3       gradient;
        Vector3       basePos = new Vector3(pos.x, heightBoundary, pos.z);
        HexWorldCoord baseHex = PosToHex(basePos);

        gradient = Procedural.Noise.noiseMethods[2][2](baseHex.ToVector3(), noiseScale, worldName.GetHashCode()).derivative * 20 + new Vector3(0, thresDropOff, 0);
        if (island)
        {
            gradient += 100 * new Vector3(basePos.x * Mathf.Log(islandDropOff) * Mathf.Pow(islandDropOff, (Mathf.Pow(basePos.x, 2) + Mathf.Pow(basePos.z, 2)) - 10386), 0, pos.z * Mathf.Log(islandDropOff) * Mathf.Pow(islandDropOff, (Mathf.Pow(basePos.x, 2) + Mathf.Pow(basePos.z, 2)) - 10386));
        }
        gradient = new Vector3(gradient.x, -1.75f * Mathf.Pow(-pos.y + heightBoundary, -0.65f), gradient.z);
        return(gradient);
    }