Revision: | 2.2 |
Committed: | Thu Mar 11 23:16:01 2004 UTC (21 years, 5 months ago) by greg |
Branch: | MAIN |
CVS Tags: | rad5R4, rad5R2, rad5R3, rad5R0, rad5R1, rad4R2, rad3R7P2, rad3R7P1, rad6R0, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1, rad4R2P2, HEAD |
Changes since 2.1: | +4 -4 lines |
Log Message: | Fixed tile texturing in tmesh2rad -- thanks to Marucs Jacobs for the request |
# | Content |
---|---|
1 | { RCSid: $Id: tmesh.cal,v 2.1 2003/03/10 19:38:19 greg Exp $ } |
2 | { |
3 | Interpolate triangle-mesh values using barycentric coordinates. |
4 | |
5 | A1 = Major axis (0==X, 1==Y, 2==Z) |
6 | A2 through A10 = Surface normal perturbation matrix |
7 | or: |
8 | A2 through A7 = Lookup in 2-dimensional pattern or texture |
9 | } |
10 | { Get dominant coordinates } |
11 | bu = select(arg(1)+1, Py, Pz, Px); |
12 | bv = select(arg(1)+1, Pz, Px, Py); |
13 | { Compute variables } |
14 | v1 = bu*arg( 2) + bv*arg( 3) + arg( 4); |
15 | v2 = bu*arg( 5) + bv*arg( 6) + arg( 7); |
16 | v3 = bu*arg( 8) + bv*arg( 9) + arg(10); |
17 | { Surface normal perturbation } |
18 | nf = 1/sqrt(v1*v1 + v2*v2 + v3*v3); |
19 | dx = v1*nf - Nx; |
20 | dy = v2*nf - Ny; |
21 | dz = v3*nf - Nz; |
22 | { Tiled texture coordinates } |
23 | u = frac(v1); |
24 | v = frac(v2); |