Beispiel #1
0
        public int GetLiquidDepth(MH2OInstance h, int pos)
        {
            if (h.OffsetVertexData == 0)
            {
                return(-1);
            }

            switch (GetLiquidVertexFormat(h))
            {
            case LiquidVertexFormatType.HeightDepth:
                return((sbyte)data[h.OffsetVertexData + (h.GetWidth() + 1) * (h.GetHeight() + 1) * 4 + pos]);

            case LiquidVertexFormatType.HeightTextureCoord:
                return(0);

            case LiquidVertexFormatType.Depth:
                return((sbyte)data[h.OffsetVertexData + pos]);

            case LiquidVertexFormatType.HeightDepthTextureCoord:
                return((sbyte)data[h.OffsetVertexData + (h.GetWidth() + 1) * (h.GetHeight() + 1) * 8 + pos]);

            case LiquidVertexFormatType.Unk4:
                return((sbyte)data[h.OffsetVertexData + pos * 8]);

            case LiquidVertexFormatType.Unk5:
                return(0);

            default:
                break;
            }
            return(0);
        }
Beispiel #2
0
        ushort?GetLiquidTextureCoordMap(MH2OInstance h, int pos)
        {
            if (h.OffsetVertexData == 0)
            {
                return(null);
            }

            switch (GetLiquidVertexFormat(h))
            {
            case LiquidVertexFormatType.HeightDepth:
            case LiquidVertexFormatType.Depth:
            case LiquidVertexFormatType.Unk4:
                return(null);

            case LiquidVertexFormatType.HeightTextureCoord:
            case LiquidVertexFormatType.HeightDepthTextureCoord:
                return(BitConverter.ToUInt16(data, (int)(h.OffsetVertexData + 4 * ((h.GetWidth() + 1) * (h.GetHeight() + 1) + pos))));

            case LiquidVertexFormatType.Unk5:
                return(BitConverter.ToUInt16(data, (int)(h.OffsetVertexData + 8 * ((h.GetWidth() + 1) * (h.GetHeight() + 1) + pos))));

            default:
                break;
            }
            return(null);
        }