コード例 #1
0
        //qpic_t *Draw_PicFromWad (char *name);
        public static BasePicture FromWad(BaseDevice device, Wad wad, string name, string filter = "GL_LINEAR_MIPMAP_NEAREST")
        {
            if (BasePicture.PicturePool.ContainsKey(name))
            {
                return(BasePicture.PicturePool[name]);
            }

            var offset = wad.GetLumpNameOffset(name);
            var ptr    = new IntPtr(wad.DataPointer.ToInt64( ) + offset);
            var header = ( WadPicHeader )Marshal.PtrToStructure(ptr, typeof(WadPicHeader));

            offset += Marshal.SizeOf(typeof(WadPicHeader));

            return(BasePicture.FromBuffer(device, new(wad.Data, offset), header.width, header.height, name, filter));
        }