map3drendering/LandblockExtraction/Tools/MathOperations.cs

28 lines
1,000 B
C#

using AC2RE.Definitions;
using System.Numerics;
namespace LandblockExtraction.Tools {
public static class MathOperations {
public static uint GetXLandblock(uint landblock) {
return (landblock & 0xFF000000) >> 24;
}
public static uint GetYLandblock(uint landblock) {
return (landblock & 0x00FF0000) >> 16;
}
public static uint GetTerrainInCellInfo(uint cellInfo) {
return (cellInfo >> 0) & (0x7f);
}
public static uint GetRoadInCellInfo(uint cellInfo) {
return (cellInfo >> 24) & (0xff);
}
public static uint GetColorInCellInfo(uint cellInfo) {
return (cellInfo >> 16) & (0xff);
}
public static uint GetSceneInCellInfo(uint cellInfo) {
return (cellInfo >> 7) & (0x1f);
}
public static Vector4 RGBAColorToVector4(RGBAColor color) {
return new Vector4(color.r, color.g, color.b, color.a);
}
}
}