^^ Sweet thanx for the replies. Ill focus on learn things this summer while I’m out of school so by the time the game releases I should be able to construct a tree or a something lol.
PS: Just looked at this:
After the three points that define the face follow the first two rows of a homogeneous 3x3 matrix A_ij, in the format:
( ( a11 a12 a13 ) ( a21 a22 a23 ) )
Where the a_ij are decimal values. (Homogeneous matrices have the bottom row as [0 0 1]).
Let n = (nx, ny, nz) be a unit vector normal to the face.
theta_y = arctan(nz / sqrt(ny^2 + nx^2))
theta_z = arctan(ny / nx)
theta_y is the angle between n and the XY plane. theta_z is the angle between n and the XZ plane. N.b. these results depend on division by zero returning Inf (IEEE floating point).
Let Bij be the matrix such that:
b11 = -sin(theta_z) b21 = sin(theta_y) * cos(theta_z) b31 = 0
b12 = cos(theta_z) b22 = sin(theta_y) * sin(theta_z) b32 = 0
b13 = 0 b23 = -cos(theta_y) b33 = 0
Note that there are many ways of finding a suitable matrix for transforming from world coordinates to face coordinates, but this is the particular one used by the Brush Primitives file format.
Let A be the homogeneous matrix from the texture definition.
Let r = (x, y, z) be a point in 3D space. Let t be the texture coordinates corresponding to r. Clearly, t = A * B * r
The BSP file requires two vectors u and v, and offsets in the u and v directions (k1 and k2), so that t1 = u . r + k1 and t2 = v . r + k2 – in vector notation, this could be written as t = Mr where Mij is a 3x3 matrix such that M = AB.
. . . . and my head exploded.