Original Post
I have everything working on my MD2 loader (using vertex streams and tweening)...except the tex coords don't line up correctly...they look very funny. Here's my decompression code:
md2::tex_coord* c_buffer = new md2::tex_coord[header.num_st];
MD2_TEXTURE_VERTEX* tex_buffer = new MD2_TEXTURE_VERTEX[header.num_st];
md2_stream.seekg(header.ofs_st, std::ios::beg);
md2_stream.read((char*)c_buffer, sizeof(md2::tex_coord)*header.num_st);
for (int i = 0; i < header.num_st; i++)
{
tex_buffer[i].s = ((float)c_buffer[i].s / (float)(header.skinwidth));
tex_buffer[i].t = ((float)c_buffer[i].t / (float)(header.skinheight));
}
device->CreateVertexBuffer(sizeof(MD2_TEXTURE_VERTEX)*header.num_st,0,0,D3DPOOL_MANAGED,&texture_VB,0);
See anything? This is my first time writing a loader, and I am ignorant about the format, so thanks!
EDIT: fix formatting in source box
Brian J
DL Vacuum - A media file organizer I made | Mumbling Miles - A band I was the guitarist/vocalist for [edited by - bjmumblingmiles on July 21, 2003 11:32:06 PM]