Пример #1
0
        public unsafe System.Drawing.Image GetColorSet()
        {
            // ColorSet is R16G16B16A16F.
            const int width  = 4;
            const int height = 16;

            var bmp = new System.Drawing.Bitmap(width, height);
            var i   = 0;

            for (var y = 0; y < height; y++)
            {
                for (var x = 0; x < width; x++)
                {
                    var offset = i++ *4 * 2;

                    var red   = GetColorValue(HalfHelper.Unpack(DataSetData, offset));
                    var green = GetColorValue(HalfHelper.Unpack(DataSetData, offset + 2));
                    var blue  = GetColorValue(HalfHelper.Unpack(DataSetData, offset + 4));
                    var alpha = GetColorValue(HalfHelper.Unpack(DataSetData, offset + 6));
                    bmp.SetPixel(x, y, System.Drawing.Color.FromArgb(alpha, red, green, blue));
                }
            }

            return(bmp);
        }
Пример #2
0
 private static Vector4F AsHalf(Vector4F v, uint redMask, uint greenMask, uint blueMask, uint alphaMask)
 {
     v.X = (redMask > 0) ? HalfHelper.Unpack(HalfHelper.Pack(v.X)) : 0;
     v.Y = (greenMask > 0) ? HalfHelper.Unpack(HalfHelper.Pack(v.Y)) : 0;
     v.Z = (blueMask > 0) ? HalfHelper.Unpack(HalfHelper.Pack(v.Z)) : 0;
     v.W = (alphaMask > 0) ? HalfHelper.Unpack(HalfHelper.Pack(v.W)) : 0;
     return(v);
 }
Пример #3
0
        private static void ProcessA16R16G16B16_Float(byte[] src, byte[] dst, int width, int height)
        {
            // Clipping can, and will occur since values go outside 0..1
            for (var i = 0; i < width * height; ++i)
            {
                var srcOff = i * 4 * 2;
                var dstOff = i * 4;

                for (var j = 0; j < 4; ++j)
                {
                    dst[dstOff + j] = (byte)(HalfHelper.Unpack(src, srcOff + j * 2) * byte.MaxValue);
                }
            }
        }
Пример #4
0
        static MappyNPC[] mappyDataResult; //= engine.ReadFile(@"H:\xivapi_mappy_2019-11-16-12-53-32.csv");

        public override Task <bool> InvokeAsync(string paramList)
        {
            var recipes        = _Realm.GameData.GetSheet <Recipe>();
            var craftaction    = _Realm.GameData.GetSheet <CraftAction>();
            var generalActions = _Realm.GameData.GetSheet <Action>();
            var classes        = _Realm.GameData.GetSheet <ClassJob>();
            var maps1          = _Realm.GameData.GetSheet <TerritoryType>();

            //var gather = _Realm.GameData.GetSheet<GatheringPoint>();
            mappyDataResult = engine.ReadFile(@"H:\xivapi_mappy_2019-11-16-12-53-32.csv");



            var maps   = _Realm.GameData.GetSheet2 <MapMarker>().Cast <MapMarker>();
            var Gather = _Realm.GameData.GetSheet <GatheringPoint>();

            var   spot        = _Realm.GameData.GetSheet <FishingSpot>()[179];
            var   map         = maps1.Where(i => i.Key == 398).First().Map;
            float startWorldX = 504.1477f;
            float startWorldY = 34.56757f;
            var   PlaceX      = (float)ToMapCoordinate3d(startWorldX, map.OffsetX, map.SizeFactor);
            var   PlaceY      = (float)ToMapCoordinate3d(startWorldY, map.OffsetY, map.SizeFactor);

            OutputInformation($"OffsetX: {map.OffsetX} OffsetY: {map.OffsetY} SizeFactor {map.SizeFactor}");
            OutputInformation($"WorldToMap: {map.PlaceName}: ({PlaceX}, {PlaceY})");
            OutputInformation($"Backwards: {test(PlaceX,map.OffsetX, map.SizeFactor)} {test(PlaceY, map.OffsetY, map.SizeFactor)}");

            OutputInformation($"Map: {spot.PlaceName}: ({spot.MapX}, {spot.MapY}) {spot.Radius}");
            float f  = HalfHelper.Unpack((ushort)spot.X);
            float f1 = HalfHelper.Unpack((ushort)spot.Z);

            OutputInformation($"World: {spot.PlaceName}: ({f}, {f1}) {spot.Radius}");


/*            foreach (var c in Gather)
 *          {
 *              ParseGather(c, maps);
 *          }
 *
 *          foreach (var item in GatherData)
 *          {
 *              //OutputInformation($"{craft.Name} {craft.Key} {craft.ClassJob.Name.ToString()}");
 *              //var temp = new ClassAction(craft.Key, craft.Name.ToString(), craft.ClassJob.Name.ToString().FirstCharToUpper());
 *              OutputInformation($"{item.Key} {item.Value.NodeId} {item.Value.Position.Id} {item.Value.Position.ToVec3<Vector3>()}");
 *              //actionList.Add(temp);
 *          }*/

            return(Task.FromResult(true));
        }
Пример #5
0
        static object ReadData(byte[] buffer, VertexDataType type, int offset)
        {
            switch (type)
            {
            case VertexDataType.Half2:
                return(new Vector2 {
                    X = HalfHelper.Unpack(buffer, offset + 0x00),
                    Y = HalfHelper.Unpack(buffer, offset + 0x02)
                });

            case VertexDataType.Half4:
                return(new Vector4 {
                    X = HalfHelper.Unpack(buffer, offset + 0x00),
                    Y = HalfHelper.Unpack(buffer, offset + 0x02),
                    Z = HalfHelper.Unpack(buffer, offset + 0x04),
                    W = HalfHelper.Unpack(buffer, offset + 0x06)
                });

            case VertexDataType.UInt:
                return(BitConverter.ToUInt32(buffer, offset));

            case VertexDataType.ByteFloat4:
                return(new Vector4 {
                    X = buffer[offset + 0] / 255f,
                    Y = buffer[offset + 1] / 255f,
                    Z = buffer[offset + 2] / 255f,
                    W = buffer[offset + 3] / 255f
                });

            case VertexDataType.Single3:
                return(buffer.ToStructure <Vector3>(offset));

            case VertexDataType.Single4:
                return(buffer.ToStructure <Vector4>(offset));

            default:
                throw new NotSupportedException();
            }
        }