Example #1
0
        public ConvexVolume Parse(ConvexVolumeData data)
        {
            for (int i = 0; i < data.VertsCount; i++)
            {
                int     index = i * 3;
                Vector3 point = new Vector3(data.Verts[index], data.Verts[index + 1], data.Verts[index + 2]);
                this.Verts.Add(point);
            }

            this.AreaType         = (PolyAreas)data.Area;
            this.isCreatedFromBin = true;
            return(this);
        }
Example #2
0
        public ConvexVolumeData[] GetVolumeDatas()
        {
            int length = RecastDll.GetConvexCount(this.recastPtr);
            var array  = new ConvexVolumeData[length];
            var size   = Marshal.SizeOf(typeof(ConvexVolumeData)) * length;
            var ptr    = Marshal.AllocHGlobal(size);

            RecastDll.GetConvexArray(this.recastPtr, ptr);
            for (var i = 0; i < length; i++)
            {
                var p = new IntPtr(ptr.ToInt64() + Marshal.SizeOf(typeof(ConvexVolumeData)) * i);
                array[i] = (ConvexVolumeData)Marshal.PtrToStructure(p, typeof(ConvexVolumeData));
            }
            Marshal.FreeHGlobal(ptr);             // ι‡Šζ”Ύε†…ε­˜
            return(array);
        }