.map file loading


(DonDickieD) #1

Hi,

I am currently writing a Quake3 .map file loader in my free time to improve my programming skills. So far I have loaded the geometry and can render them. At the moment I am stuck with the calculation of the texture coordinates of the vertices. So I am wondering if somebody here can explain me how they are calculated. I have loaded the eight values after the texture name into a plane and calculate the coordinates like this:

s = ( plane1.normal * vertex + plane1.d ) / texture_width;
t = ( plane2.normal * vertex + plane2.d ) / texture_height;

My idea was to project the vertex onto the texture axis, add the offset and finally scale by the dimension. Unfortunaltely the values get very big and I am not sure how to transform them into the range [ 0, 1 ]. So any help is greatly appreciated.

If this is the wrong forum for this kind of questions please let me know and excuse the inconvinience.

Best regards,

-Dirk


(ydnar) #2

Have a peek at the sourcecode on zerowing to see how texture coordinates are calculated from the map file:

http://zerowing.idsoftware.com/

y


(DonDickieD) #3

Many thanks,

I downloaded the GtkRadiant 1.5 sources already, but could’t really figure out how it works. Can you give a hint where to look in the sources?

What is the best way to get an overview over the difference in the .map files (HL, Q3, Doom3)?. Are there any specs? Can you recommend paper, tutorial, link or something else to get a little more familiar with this topic?

Best regards,

-Dirk