Open GoogleCodeExporter opened 8 years ago
Actually, that code above is still wrong.
Here is the completely correct code.
uint32_t len = sprite.data->width*sprite.data->height/128;
Decompress(length, len);
for (uint32_t i = 0; i*2 < len; i++) {
for (uint32_t j = 0; j < 512; j++) {
Buf2[i*512+j*2] = Buf1[2*i];
Buf2[i*512+j*2+1] = Buf1[2*i+1];
}
}
glTexImage2D(GL_TEXTURE_2D, 0, 4, sprite.data->width, sprite.data->height, 0,
GL_BGR, GL_UNSIGNED_SHORT_5_6_5_REV, Buf2);
Original comment by retep998
on 20 Sep 2011 at 4:48
517 format actually is R5G6B5 style, similar with 512. and its easy to load,
just:
Width >>= 4;
Height >>= 4;
And now use 512's way to load.
And the map.wz only two 517 image:
Map.wz\Back\midForest\back\0:
http://www.huosoft.com/bbs/UpFile/UpAttachment/2011-6/20116231816251.bmp
Map.wz\Back\dryRock\back\0:
http://www.huosoft.com/bbs/UpFile/UpAttachment/2011-6/20116231816250.bmp
I know map 000050000 use that image.
Original comment by thesh...@live.cn
on 22 Sep 2011 at 5:36
Well, this seems still have a little problem.
Because the origin position is (64, 64).
So only tile copy it.
This is c# code i used.
In WzPngProperty::ParsePng:
case 517:
{
int SourceWidth = width >> 4;
int SourceHeight = height >> 4;
uncompressedSize = SourceWidth * SourceHeight * 2;
decBuf = new byte[uncompressedSize];
zlib.Read(decBuf, 0, uncompressedSize);
bmp = new Bitmap(width, height, PixelFormat.Format16bppRgb565);
bmpData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format16bppRgb565);
int CopyCountH = width / SourceWidth;
int X = 0, Y = 0;
for (Y = 0; Y < height; ++Y)
{
for (X = 0; X < CopyCountH; ++X)
{
Marshal.Copy(decBuf, (Y % SourceHeight) * 2,
(IntPtr)(bmpData.Scan0.ToInt32() + (Y * width + X * SourceWidth) * 2),
SourceWidth * 2);
}
}
bmp.UnlockBits(bmpData);
}
break;
Original comment by thesh...@live.cn
on 5 Oct 2011 at 5:04
Attachments:
Original issue reported on code.google.com by
retep998
on 15 Sep 2011 at 6:58