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); }
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); }
public float GetLiquidHeight(MH2OInstance h, int x, int y, int pos) { if (h.OffsetVertexData == 0) { return(0.0f); } if (GetLiquidVertexFormat(h) == LiquidVertexFormatType.Depth) { return(0.0f); } switch (GetLiquidVertexFormat(h)) { case LiquidVertexFormatType.HeightDepth: case LiquidVertexFormatType.HeightTextureCoord: case LiquidVertexFormatType.HeightDepthTextureCoord: return(BitConverter.ToSingle(data, (int)(h.OffsetVertexData + pos * 4))); case LiquidVertexFormatType.Depth: return(0.0f); case LiquidVertexFormatType.Unk4: case LiquidVertexFormatType.Unk5: return(BitConverter.ToSingle(data, (int)(h.OffsetVertexData + 4 + (pos * 4) * 2))); default: return(0.0f); } }
public ushort GetLiquidType(MH2OInstance h) { if (GetLiquidVertexFormat(h) == LiquidVertexFormatType.Depth) { return(2); } return(h.LiquidType); }
public ulong GetLiquidExistsBitmap(MH2OInstance h) { if (h.OffsetExistsBitmap != 0) { return(BitConverter.ToUInt64(data, (int)(h.OffsetExistsBitmap))); } else { return(0xFFFFFFFFFFFFFFFFuL); } }
public static LiquidVertexFormatType GetLiquidVertexFormat(MH2OInstance liquidInstance) { if (liquidInstance.LiquidVertexFormat < (LiquidVertexFormatType)42) { return(liquidInstance.LiquidVertexFormat); } if (liquidInstance.LiquidType == 2) { return(LiquidVertexFormatType.Depth); } var liquidType = MapFile.LiquidTypeStorage.LookupByKey(liquidInstance.LiquidType); if (liquidType != null) { if (MapFile.LiquidMaterialStorage.ContainsKey(liquidType.MaterialID)) { return((LiquidVertexFormatType)MapFile.LiquidMaterialStorage[liquidType.MaterialID].LVF); } } return((LiquidVertexFormatType)(-1)); }