Esempio n. 1
0
    public float GetSplatMax(int x, int z, int mask = -1)
    {
        byte num = 0;

        for (int i = 0; i < this.num; i++)
        {
            if ((TerrainSplat.IndexToType(i) & mask) != 0)
            {
                byte num1 = this.src[(i * this.res + z) * this.res + x];
                if (num1 >= num)
                {
                    num = num1;
                }
            }
        }
        return(BitUtility.Byte2Float((int)num));
    }
Esempio n. 2
0
    public float GetSplat(int x, int z, int mask)
    {
        if (Mathf.IsPowerOfTwo(mask))
        {
            return(BitUtility.Byte2Float(this.src[(TerrainSplat.TypeToIndex(mask) * this.res + z) * this.res + x]));
        }
        int num = 0;

        for (int i = 0; i < this.num; i++)
        {
            if ((TerrainSplat.IndexToType(i) & mask) != 0)
            {
                num += this.src[(i * this.res + z) * this.res + x];
            }
        }
        return(Mathf.Clamp01(BitUtility.Byte2Float(num)));
    }
    public float GetSplatMax(int x, int z, int mask = -1)
    {
        byte num1 = 0;

        for (int index = 0; index < this.num; ++index)
        {
            if ((TerrainSplat.IndexToType(index) & mask) != 0)
            {
                byte num2 = this.src[(index * this.res + z) * this.res + x];
                if ((int)num2 >= (int)num1)
                {
                    num1 = num2;
                }
            }
        }
        return(BitUtility.Byte2Float((int)num1));
    }
Esempio n. 4
0
    public int GetSplatMaxIndex(int x, int z, int mask = -1)
    {
        byte num  = 0;
        int  num1 = 0;

        for (int i = 0; i < this.num; i++)
        {
            if ((TerrainSplat.IndexToType(i) & mask) != 0)
            {
                byte num2 = this.src[(i * this.res + z) * this.res + x];
                if (num2 >= num)
                {
                    num  = num2;
                    num1 = i;
                }
            }
        }
        return(num1);
    }
    public int GetSplatMaxIndex(int x, int z, int mask = -1)
    {
        byte num1 = 0;
        int  num2 = 0;

        for (int index = 0; index < this.num; ++index)
        {
            if ((TerrainSplat.IndexToType(index) & mask) != 0)
            {
                byte num3 = this.src[(index * this.res + z) * this.res + x];
                if ((int)num3 >= (int)num1)
                {
                    num1 = num3;
                    num2 = index;
                }
            }
        }
        return(num2);
    }
Esempio n. 6
0
 public int GetSplatMaxType(int x, int z, int mask = -1)
 {
     return(TerrainSplat.IndexToType(this.GetSplatMaxIndex(x, z, mask)));
 }
Esempio n. 7
0
 public int GetSplatMaxType(float normX, float normZ, int mask = -1)
 {
     return(TerrainSplat.IndexToType(this.GetSplatMaxIndex(normX, normZ, mask)));
 }
Esempio n. 8
0
 public int GetSplatMaxType(Vector3 worldPos, int mask = -1)
 {
     return(TerrainSplat.IndexToType(this.GetSplatMaxIndex(worldPos, mask)));
 }
Esempio n. 9
0
 public SplatMask(IConverter <Vector2Int, Vector3> coordinateConverter, int splatIndex)
 {
     _coordinateConverter = coordinateConverter;
     _splatType           = TerrainSplat.IndexToType(splatIndex);
 }