23
|
1 |
vs_3_sw
|
|
2 |
def c3056, 1, 2, 3, 4
|
|
3 |
|
|
4 |
dcl_position v0
|
|
5 |
dcl_normal v1
|
|
6 |
dcl_normal1 v3
|
|
7 |
|
|
8 |
dcl_color4 o3.x
|
|
9 |
dcl_texcoord3 o3.yz
|
|
10 |
dcl_fog o3.w
|
|
11 |
dcl_tangent o4.xyz
|
|
12 |
dcl_position o7.xyzw
|
|
13 |
dcl_psize o6
|
|
14 |
|
|
15 |
#define oPos o7
|
|
16 |
#define oD0 o3
|
|
17 |
|
|
18 |
def c76, -10.0e5, 2.0e4, 3.3e2, 4.4
|
|
19 |
def c15, 1, 2, 3, 4
|
|
20 |
defi i1, 1, 2, 3,0
|
|
21 |
defb b11, true
|
|
22 |
defb b12, false
|
|
23 |
|
|
24 |
if_le v0.x, v1.y
|
|
25 |
nop
|
|
26 |
else
|
|
27 |
nop
|
|
28 |
endif
|
|
29 |
|
|
30 |
mova a0.yw, v0.argb
|
|
31 |
loop aL, i1
|
|
32 |
nop
|
|
33 |
break_le v1.x, r0.y
|
|
34 |
breakp !p0.y
|
|
35 |
nop
|
|
36 |
endloop
|
|
37 |
|
|
38 |
; Decompress position
|
|
39 |
mov r0.x, v0.x
|
|
40 |
mov r0.y, c4.w ; 1
|
|
41 |
mov r0.z, v0.y
|
|
42 |
mov r0.w, c4.w ; 1
|
|
43 |
|
|
44 |
setp_ge p0.yz, v1, v1
|
|
45 |
|
|
46 |
callnz l1, b11
|
|
47 |
callnz l1, !p0.w
|
|
48 |
|
|
49 |
|
|
50 |
if !p0.z
|
|
51 |
m3x2 r0.xy, r1, c0 ;which will be expanded to:
|
|
52 |
else
|
|
53 |
nop
|
|
54 |
endif
|
|
55 |
|
|
56 |
call l1
|
|
57 |
|
|
58 |
; Debug code [start]
|
|
59 |
ret
|
|
60 |
label l1
|
|
61 |
m3x2 r0.xy, r1, c0 ;which will be expanded to:
|
|
62 |
mov r0, r0.xz
|
|
63 |
; Debug code [end]
|
|
64 |
|
|
65 |
; Compute theta from distance and time
|
|
66 |
mov r4.xz, r0 ; xz
|
|
67 |
mov r4.y, c4.y ; y = 0
|
|
68 |
dp3 r4.x, r4, r4 ; d2
|
|
69 |
rsq r4.x, r4.x
|
|
70 |
rcp r4.x, r4.x ; d
|
|
71 |
mul r4.xyz, r4, c4.x ; scale by time
|
|
72 |
|
|
73 |
; Clamp theta to -pi..pi
|
|
74 |
add r4.x, r4.x, c7.x
|
|
75 |
mul r4.x, r4.x, c7.y
|
|
76 |
frc r4.xy, r4.x
|
|
77 |
mul r4.x, r4.x, c7.z
|
|
78 |
add r4.x, r4.x,-c7.x
|
|
79 |
|
|
80 |
; Compute first 4 values in sin and cos series
|
|
81 |
mov r5.x, c4.w ; d^0
|
|
82 |
mov r4.x, r4.x ; d^1
|
|
83 |
mul r5.y, r4.x, r4.x ; d^2
|
|
84 |
mul r4.y, r4.x, r5.y ; d^3
|
|
85 |
mul r5.z, r5.y, r5.y ; d^4
|
|
86 |
mul r4.z, r4.x, r5.z ; d^5
|
|
87 |
mul r5.w, r5.y, r5.z ; d^6
|
|
88 |
mul r4.w, r4.x, r5.w ; d^7
|
|
89 |
|
|
90 |
mul r4, r4, c10 ; sin
|
|
91 |
dp4 r4.x, r4, c4.w
|
|
92 |
|
|
93 |
mul r5, r5, c11 ; cos
|
|
94 |
dp4 r5.x, r5, c4.w
|
|
95 |
|
|
96 |
; Set color
|
|
97 |
add r5.x, -r5.x, c4.w ; + 1.0
|
|
98 |
mul oD0, r5.x, c4.z ; * 0.5
|
|
99 |
|
|
100 |
; Scale height
|
|
101 |
mul r0.y, r4.x, c7.w
|
|
102 |
|
|
103 |
; Transform position
|
|
104 |
dp4 oPos.x, r0, c0
|
|
105 |
dp4 oPos.y, r0, c1
|
|
106 |
dp4 oPos.z, r0, c2
|
|
107 |
dp4 oPos.w, r0, c3
|
|
108 |
|
|
109 |
ret
|
|
110 |
|