Calculation of texture coordinate in Q3 .map files
Hi,
I am currently loading a Q3 .map file. While loading the geometry data works fine now, I have problems calculating the texture coordinates for a brush.
A Brush line in the file looks like this:
( 64 0 0 ) ( 0 0 0 ) ( 0 0 64 ) BCRATE02 1 0 0 0 0 0 -1 0
The last eight values define the texture space. What I do at the moment is the following:
1. Load each four values into a plane
2. Calculate s, t seperately:
s = ( vertex * plane1.normal + plane1.d ) / Texture_Width;
Unfortunaltely the values become very big. Is this method correct and if yes how can I transform the coordinates into the range [ 0, 1 ]?
Any help is greatly appreciated.
-Dirk
PS: Does anybody know how to parse the patch definitions?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement