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