by Preach » Sat Apr 14, 2007 10:14 pm
I swear I tested it and it saved, but I didn't check the file I got was the real thing, turns out it was just an error page.
It's based off the md2 exporter because that's the one that comes with blender, and also because mdl is much more similar to md2 than md3 - both formats compress vertex coordinates to a single byte, for instance, although most of that code got rewrtten anyway.
I'm pretty sure the vertex normals code should work, to the extent that quake allows. There's a list of 162 allowed normal vectors, and the code chooses the one that minimizes the dot product of the vertex, then records that that index as the 4th byte of the vertex coordinate. The md2 code added 2 to each index, which I don't think should be done, maybe that was causing the problem. Anyway, that's gone from this version.
(aside:this part of the code is pretty inefficient, making it take a noticably long time taken to export the model. If anyone knows a good optimisation for calculating with anorms.h, like what order the normals are in, let me know...)
I've not noticed dodgy vertices in this version, although admittedly only a day's testing so far. I did test it with a model that broke previously in the md2 exporter, and it seemed to work. The vertices do have to be handled quite differently for mdl format, since you need to add multiple vertices where triangles are seperated on the skin, even if they are joined on the model itself. One warning that should come with the file is that the program uses the first frame to determine if vertices are joined. If they occupy the same position in the first frame and on the skin, they are in effect welded. So you may need to add a "seperated" first frame to the model if this causes problems. For most models it shouldn't be an issue.
The origin thing is still there, I'll look into why it does it and if it can be fixed in a later version. Also, the models are rendering all black in glquake but fine in winquake/darkplaces. Changing the skin seems to fix it, and so I'm not that concerned, but I can't see what's up with it so any suggestions are welcomed.