Rev 8232 | Rev 8719 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8232 | Rev 8666 | ||
---|---|---|---|
1 | x3d equ 0 |
1 | x3d equ 0 |
2 | y3d equ 2 |
2 | y3d equ 2 |
3 | z3d equ 4 |
3 | z3d equ 4 |
4 | vec_x equ 0 |
4 | vec_x equ 0 |
5 | vec_y equ 4 |
5 | vec_y equ 4 |
6 | vec_z equ 8 |
6 | vec_z equ 8 |
7 | ; 3d point - triple integer word coordinate |
7 | ; 3d point - triple integer word coordinate |
8 | ; vector - triple float dword coordinate |
8 | ; vector - triple float dword coordinate |
9 | ;----------------------in: -------------------------------- |
9 | ;----------------------in: -------------------------------- |
10 | ;------------------------ esi - pointer to 1st 3d point --- |
10 | ;------------------------ esi - pointer to 1st 3d point --- |
11 | ;------------------------ edi - pointer to 2nd 3d point --- |
11 | ;------------------------ edi - pointer to 2nd 3d point --- |
12 | ;------------------------ ebx - pointer to result vector -- |
12 | ;------------------------ ebx - pointer to result vector -- |
13 | ;---------------------- out : none ------------------------ |
13 | ;---------------------- out : none ------------------------ |
14 | reverse_mx_3x3: |
14 | reverse_mx_3x3: |
15 | ; esi - source matrix |
15 | ; esi - source matrix |
16 | ; edi - desired reversed matrix |
16 | ; edi - desired reversed matrix |
17 | 17 | ||
18 | push ebp |
18 | push ebp |
19 | mov ebp,esp |
19 | mov ebp,esp |
20 | sub esp,4 |
20 | sub esp,4 |
21 | .det equ ebp-4 |
21 | .det equ ebp-4 |
22 | 22 | ||
23 | fninit |
23 | fninit |
24 | fld dword[esi] |
24 | fld dword[esi] |
25 | fmul dword[esi+16] |
25 | fmul dword[esi+16] |
26 | fmul dword[esi+32] |
26 | fmul dword[esi+32] |
27 | fld dword[esi+12] |
27 | fld dword[esi+12] |
28 | fmul dword[esi+28] |
28 | fmul dword[esi+28] |
29 | fmul dword[esi+8] |
29 | fmul dword[esi+8] |
30 | faddp |
30 | faddp |
31 | fld dword[esi+24] |
31 | fld dword[esi+24] |
32 | fmul dword[esi+4] |
32 | fmul dword[esi+4] |
33 | fmul dword[esi+20] |
33 | fmul dword[esi+20] |
34 | faddp |
34 | faddp |
35 | fld dword[esi] |
35 | fld dword[esi] |
36 | fmul dword[esi+28] |
36 | fmul dword[esi+28] |
37 | fmul dword[esi+20] |
37 | fmul dword[esi+20] |
38 | fchs |
38 | fchs |
39 | faddp |
39 | faddp |
40 | fld dword[esi+24] |
40 | fld dword[esi+24] |
41 | fmul dword[esi+16] |
41 | fmul dword[esi+16] |
42 | fmul dword[esi+8] |
42 | fmul dword[esi+8] |
43 | fchs |
43 | fchs |
44 | faddp |
44 | faddp |
45 | fld dword[esi+12] |
45 | fld dword[esi+12] |
46 | fmul dword[esi+4] |
46 | fmul dword[esi+4] |
47 | fmul dword[esi+32] |
47 | fmul dword[esi+32] |
48 | fchs |
48 | fchs |
49 | faddp |
49 | faddp |
50 | fstp dword[.det] |
50 | fstp dword[.det] |
51 | cmp dword[.det],0 |
51 | cmp dword[.det],0 |
52 | jne @f |
52 | jne @f |
53 | int3 |
53 | int3 |
54 | @@: |
54 | @@: |
55 | ; fld1 |
55 | ; fld1 |
56 | ; fdiv dword[.det] |
56 | ; fdiv dword[.det] |
57 | ; fstp dword[.det] |
57 | ; fstp dword[.det] |
58 | 58 | ||
59 | fld dword[esi+16] |
59 | fld dword[esi+16] |
60 | fmul dword[esi+32] |
60 | fmul dword[esi+32] |
61 | fld dword[esi+20] |
61 | fld dword[esi+20] |
62 | fmul dword[esi+28] |
62 | fmul dword[esi+28] |
63 | fchs |
63 | fchs |
64 | faddp |
64 | faddp |
65 | fdiv dword[.det] |
65 | fdiv dword[.det] |
66 | fstp dword[edi] |
66 | fstp dword[edi] |
67 | 67 | ||
68 | fld dword[esi+8] |
68 | fld dword[esi+8] |
69 | fmul dword[esi+28] |
69 | fmul dword[esi+28] |
70 | fld dword[esi+4] |
70 | fld dword[esi+4] |
71 | fmul dword[esi+32] |
71 | fmul dword[esi+32] |
72 | fchs |
72 | fchs |
73 | faddp |
73 | faddp |
74 | fdiv dword[.det] |
74 | fdiv dword[.det] |
75 | fstp dword[edi+4] |
75 | fstp dword[edi+4] |
76 | 76 | ||
77 | fld dword[esi+4] |
77 | fld dword[esi+4] |
78 | fmul dword[esi+20] |
78 | fmul dword[esi+20] |
79 | fld dword[esi+8] |
79 | fld dword[esi+8] |
80 | fmul dword[esi+16] |
80 | fmul dword[esi+16] |
81 | fchs |
81 | fchs |
82 | faddp |
82 | faddp |
83 | fdiv dword[.det] |
83 | fdiv dword[.det] |
84 | fstp dword[edi+8] |
84 | fstp dword[edi+8] |
85 | 85 | ||
86 | fld dword[esi+20] |
86 | fld dword[esi+20] |
87 | fmul dword[esi+24] |
87 | fmul dword[esi+24] |
88 | fld dword[esi+12] |
88 | fld dword[esi+12] |
89 | fmul dword[esi+32] |
89 | fmul dword[esi+32] |
90 | fchs |
90 | fchs |
91 | faddp |
91 | faddp |
92 | fdiv dword[.det] |
92 | fdiv dword[.det] |
93 | fstp dword[edi+12] |
93 | fstp dword[edi+12] |
94 | 94 | ||
95 | fld dword[esi] |
95 | fld dword[esi] |
96 | fmul dword[esi+32] |
96 | fmul dword[esi+32] |
97 | fld dword[esi+8] |
97 | fld dword[esi+8] |
98 | fmul dword[esi+24] |
98 | fmul dword[esi+24] |
99 | fchs |
99 | fchs |
100 | faddp |
100 | faddp |
101 | fdiv dword[.det] |
101 | fdiv dword[.det] |
102 | fstp dword[edi+16] |
102 | fstp dword[edi+16] |
103 | 103 | ||
104 | fld dword[esi+8] |
104 | fld dword[esi+8] |
105 | fmul dword[esi+12] |
105 | fmul dword[esi+12] |
106 | fld dword[esi] |
106 | fld dword[esi] |
107 | fmul dword[esi+20] |
107 | fmul dword[esi+20] |
108 | fchs |
108 | fchs |
109 | faddp |
109 | faddp |
110 | fdiv dword[.det] |
110 | fdiv dword[.det] |
111 | fstp dword[edi+20] |
111 | fstp dword[edi+20] |
112 | 112 | ||
113 | fld dword[esi+12] |
113 | fld dword[esi+12] |
114 | fmul dword[esi+28] |
114 | fmul dword[esi+28] |
115 | fld dword[esi+16] |
115 | fld dword[esi+16] |
116 | fmul dword[esi+24] |
116 | fmul dword[esi+24] |
117 | fchs |
117 | fchs |
118 | faddp |
118 | faddp |
119 | fdiv dword[.det] |
119 | fdiv dword[.det] |
120 | fstp dword[edi+24] |
120 | fstp dword[edi+24] |
121 | 121 | ||
122 | fld dword[esi+4] |
122 | fld dword[esi+4] |
123 | fmul dword[esi+24] |
123 | fmul dword[esi+24] |
124 | fld dword[esi] |
124 | fld dword[esi] |
125 | fmul dword[esi+28] |
125 | fmul dword[esi+28] |
126 | fchs |
126 | fchs |
127 | faddp |
127 | faddp |
128 | fdiv dword[.det] |
128 | fdiv dword[.det] |
129 | fstp dword[edi+28] |
129 | fstp dword[edi+28] |
130 | 130 | ||
131 | fld dword[esi] |
131 | fld dword[esi] |
132 | fmul dword[esi+16] |
132 | fmul dword[esi+16] |
133 | fld dword[esi+4] |
133 | fld dword[esi+4] |
134 | fmul dword[esi+12] |
134 | fmul dword[esi+12] |
135 | fchs |
135 | fchs |
136 | faddp |
136 | faddp |
137 | fdiv dword[.det] |
137 | fdiv dword[.det] |
138 | fstp dword[edi+32] |
138 | fstp dword[edi+32] |
139 | 139 | ||
140 | 140 | ||
141 | mov esp,ebp |
141 | mov esp,ebp |
142 | pop ebp |
142 | pop ebp |
143 | ret |
143 | ret |
144 | 144 | ||
145 | make_vector_r: |
145 | make_vector_r: |
146 | if Ext < SSE2 |
146 | if Ext < SSE2 |
147 | fninit |
147 | fninit |
148 | fld dword[edi] ;edi+x3d |
148 | fld dword[edi] ;edi+x3d |
149 | fsub dword[esi] ;esi+x3d |
149 | fsub dword[esi] ;esi+x3d |
150 | fstp dword[ebx+vec_x] |
150 | fstp dword[ebx+vec_x] |
151 | 151 | ||
152 | fld dword[edi+4] |
152 | fld dword[edi+4] |
153 | fsub dword[esi+4] |
153 | fsub dword[esi+4] |
154 | fstp dword[ebx+vec_y] |
154 | fstp dword[ebx+vec_y] |
155 | 155 | ||
156 | fld dword[edi+8] |
156 | fld dword[edi+8] |
157 | fsub dword[esi+8] |
157 | fsub dword[esi+8] |
158 | fstp dword[ebx+vec_z] |
158 | fstp dword[ebx+vec_z] |
159 | else |
159 | else |
160 | movups xmm0,[esi] |
160 | movups xmm0,[esi] |
161 | movups xmm1,[edi] |
161 | movups xmm1,[edi] |
162 | subps xmm1,xmm0 |
162 | subps xmm1,xmm0 |
163 | movlps [ebx],xmm1 |
163 | movlps [ebx],xmm1 |
164 | movhlps xmm1,xmm1 |
164 | movhlps xmm1,xmm1 |
165 | movss [ebx+8],xmm1 |
165 | movss [ebx+8],xmm1 |
166 | end if |
166 | end if |
167 | 167 | ||
168 | ret |
168 | ret |
169 | ;---------------------- in: ------------------------------- |
169 | ;---------------------- in: ------------------------------- |
170 | ;--------------------------- esi - pointer to 1st vector -- |
170 | ;--------------------------- esi - pointer to 1st vector -- |
171 | ;--------------------------- edi - pointer to 2nd vector -- |
171 | ;--------------------------- edi - pointer to 2nd vector -- |
172 | ;--------------------------- ebx - pointer to result vector |
172 | ;--------------------------- ebx - pointer to result vector |
173 | ;---------------------- out : none |
173 | ;---------------------- out : none |
174 | cross_product: |
174 | cross_product: |
175 | fninit |
175 | fninit |
176 | fld dword [esi+vec_y] |
176 | fld dword [esi+vec_y] |
177 | fmul dword [edi+vec_z] |
177 | fmul dword [edi+vec_z] |
178 | fld dword [esi+vec_z] |
178 | fld dword [esi+vec_z] |
179 | fmul dword [edi+vec_y] |
179 | fmul dword [edi+vec_y] |
180 | fsubp ;st1 ,st |
180 | fsubp ;st1 ,st |
181 | fstp dword [ebx+vec_x] |
181 | fstp dword [ebx+vec_x] |
182 | 182 | ||
183 | fld dword [esi+vec_z] |
183 | fld dword [esi+vec_z] |
184 | fmul dword [edi+vec_x] |
184 | fmul dword [edi+vec_x] |
185 | fld dword [esi+vec_x] |
185 | fld dword [esi+vec_x] |
186 | fmul dword [edi+vec_z] |
186 | fmul dword [edi+vec_z] |
187 | fsubp ;st1 ,st |
187 | fsubp ;st1 ,st |
188 | fstp dword [ebx+vec_y] |
188 | fstp dword [ebx+vec_y] |
189 | 189 | ||
190 | fld dword [esi+vec_x] |
190 | fld dword [esi+vec_x] |
191 | fmul dword [edi+vec_y] |
191 | fmul dword [edi+vec_y] |
192 | fld dword [esi+vec_y] |
192 | fld dword [esi+vec_y] |
193 | fmul dword [edi+vec_x] |
193 | fmul dword [edi+vec_x] |
194 | fsubp ;st1 ,st |
194 | fsubp ;st1 ,st |
195 | fstp dword [ebx+vec_z] |
195 | fstp dword [ebx+vec_z] |
196 | ret |
196 | ret |
197 | ;----------------------- in: ------------------------------ |
197 | ;----------------------- in: ------------------------------ |
198 | ;---------------------------- edi - pointer to vector ----- |
198 | ;---------------------------- edi - pointer to vector ----- |
199 | ;----------------------- out : none |
199 | ;----------------------- out : none |
200 | normalize_vector: |
200 | normalize_vector: |
- | 201 | if Ext = SSE2 | Ext = SSE | Ext = SSE3 |
|
- | 202 | movups xmm0,[edi] |
|
- | 203 | andps xmm0,[zero_hgst_dd] |
|
- | 204 | movups xmm1,xmm0 |
|
- | 205 | mulps xmm0,xmm0 |
|
- | 206 | movhlps xmm2,xmm0 |
|
- | 207 | addps xmm0,xmm2 |
|
- | 208 | movaps xmm2,xmm0 |
|
- | 209 | shufps xmm2,xmm2,11100001b |
|
- | 210 | addps xmm0,xmm2 |
|
- | 211 | shufps xmm0,xmm0,0 |
|
- | 212 | rsqrtps xmm0,xmm0 |
|
- | 213 | mulps xmm0,xmm1 |
|
- | 214 | movlps [edi],xmm0 |
|
- | 215 | movhlps xmm0,xmm0 |
|
- | 216 | movss [edi+8],xmm0 |
|
- | 217 | end if |
|
201 | if Ext >= SSE3 |
218 | if 0 ; Ext >= SSE3 |
202 | movups xmm0,[edi] |
219 | movups xmm0,[edi] |
203 | andps xmm0,[zero_hgst_dd] |
220 | andps xmm0,[zero_hgst_dd] |
204 | movups xmm1,xmm0 |
221 | movups xmm1,xmm0 |
205 | mulps xmm0,xmm0 |
222 | mulps xmm0,xmm0 |
206 | haddps xmm0,xmm0 |
223 | haddps xmm0,xmm0 |
207 | haddps xmm0,xmm0 |
224 | haddps xmm0,xmm0 |
208 | rsqrtps xmm0,xmm0 |
225 | rsqrtps xmm0,xmm0 |
209 | mulps xmm0,xmm1 |
226 | mulps xmm0,xmm1 |
210 | movlps [edi],xmm0 |
227 | movlps [edi],xmm0 |
211 | movhlps xmm0,xmm0 |
228 | movhlps xmm0,xmm0 |
212 | movss [edi+8],xmm0 |
229 | movss [edi+8],xmm0 |
213 | else |
230 | end if |
- | 231 | if Ext < SSE |
|
214 | 232 | ||
215 | fninit |
233 | fninit |
216 | fld dword [edi+vec_x] |
234 | fld dword [edi+vec_x] |
217 | fmul st, st |
235 | fmul st, st |
218 | fld dword [edi+vec_y] |
236 | fld dword [edi+vec_y] |
219 | fmul st, st |
237 | fmul st, st |
220 | fld dword [edi+vec_z] |
238 | fld dword [edi+vec_z] |
221 | fmul st, st |
239 | fmul st, st |
222 | faddp st1, st |
240 | faddp st1, st |
223 | faddp st1, st |
241 | faddp st1, st |
224 | fsqrt |
242 | fsqrt |
225 | 243 | ||
226 | ftst |
244 | ftst |
227 | fstsw ax |
245 | fstsw ax |
228 | sahf |
246 | sahf |
229 | jnz @f |
247 | jnz @f |
230 | 248 | ||
231 | fst dword [edi+vec_x] |
249 | fst dword [edi+vec_x] |
232 | fst dword [edi+vec_y] |
250 | fst dword [edi+vec_y] |
233 | fstp dword [edi+vec_z] |
251 | fstp dword [edi+vec_z] |
234 | ret |
252 | ret |
235 | @@: |
253 | @@: |
236 | fld st |
254 | fld st |
237 | fld st |
255 | fld st |
238 | fdivr dword [edi+vec_x] |
256 | fdivr dword [edi+vec_x] |
239 | fstp dword [edi+vec_x] |
257 | fstp dword [edi+vec_x] |
240 | fdivr dword [edi+vec_y] |
258 | fdivr dword [edi+vec_y] |
241 | fstp dword [edi+vec_y] |
259 | fstp dword [edi+vec_y] |
242 | fdivr dword [edi+vec_z] |
260 | fdivr dword [edi+vec_z] |
243 | fstp dword [edi+vec_z] |
261 | fstp dword [edi+vec_z] |
244 | end if |
262 | end if |
245 | ret |
263 | ret |
246 | ;------------------in: ------------------------- |
264 | ;------------------in: ------------------------- |
247 | ;------------------ esi - pointer to 1st vector |
265 | ;------------------ esi - pointer to 1st vector |
248 | ;------------------ edi - pointer to 2nd vector |
266 | ;------------------ edi - pointer to 2nd vector |
249 | ;------------------out: ------------------------ |
267 | ;------------------out: ------------------------ |
250 | ;------------------ st0 - dot-product |
268 | ;------------------ st0 - dot-product |
251 | dot_product: |
269 | dot_product: |
252 | fninit |
270 | fninit |
253 | ;if Ext >=SSE3 |
271 | ;if Ext >=SSE3 |
254 | ; movups xmm0,[esi] |
272 | ; movups xmm0,[esi] |
255 | ; movups xmm1,[edi] |
273 | ; movups xmm1,[edi] |
256 | ; andps xmm0,[zero_hgst_dd] |
274 | ; andps xmm0,[zero_hgst_dd] |
257 | ; mulps xmm0,xmm1 |
275 | ; mulps xmm0,xmm1 |
258 | ; haddps xmm0,xmm0 |
276 | ; haddps xmm0,xmm0 |
259 | ; haddps xmm0,xmm0 |
277 | ; haddps xmm0,xmm0 |
260 | ; movss [esp-4],xmm0 |
278 | ; movss [esp-4],xmm0 |
261 | ; fld dword[esp-4] |
279 | ; fld dword[esp-4] |
262 | ;else |
280 | ;else |
263 | fld dword [esi+vec_x] |
281 | fld dword [esi+vec_x] |
264 | fmul dword [edi+vec_x] |
282 | fmul dword [edi+vec_x] |
265 | fld dword [esi+vec_y] |
283 | fld dword [esi+vec_y] |
266 | fmul dword [edi+vec_y] |
284 | fmul dword [edi+vec_y] |
267 | fld dword [esi+vec_z] |
285 | fld dword [esi+vec_z] |
268 | fmul dword [edi+vec_z] |
286 | fmul dword [edi+vec_z] |
269 | faddp |
287 | faddp |
270 | faddp |
288 | faddp |
271 | ;end if |
289 | ;end if |
272 | ret |
290 | ret |
273 | 291 | ||
274 | ; DOS version Coded by Mikolaj Felix aka Majuma |
292 | ; DOS version Coded by Mikolaj Felix aka Majuma |
275 | ; mfelix@polbox.com |
293 | ; mfelix@polbox.com |
276 | ; www.majuma.xt.pl |
294 | ; www.majuma.xt.pl |
277 | ; into FASM translation by Macgub |
295 | ; into FASM translation by Macgub |
278 | init_sincos_tab: |
296 | init_sincos_tab: |
279 | .counter equ dword [ebp-4] ; cur angle |
297 | .counter equ dword [ebp-4] ; cur angle |
280 | 298 | ||
281 | push ebp |
299 | push ebp |
282 | mov ebp,esp |
300 | mov ebp,esp |
283 | 301 | ||
284 | xor eax,eax |
302 | xor eax,eax |
285 | push eax ; init .counter |
303 | push eax ; init .counter |
286 | mov edi,cos_tab |
304 | mov edi,cos_tab |
287 | mov esi,sin_tab |
305 | mov esi,sin_tab |
288 | mov ecx,256 |
306 | mov ecx,256 |
289 | fninit |
307 | fninit |
290 | 308 | ||
291 | fld .counter |
309 | fld .counter |
292 | @@: |
310 | @@: |
293 | fld st |
311 | fld st |
294 | fsincos |
312 | fsincos |
295 | fstp dword [edi] |
313 | fstp dword [edi] |
296 | fstp dword [esi] |
314 | fstp dword [esi] |
297 | ; fadd [piD180] |
315 | ; fadd [piD180] |
298 | fadd [piD128] |
316 | fadd [piD128] |
299 | add esi,4 |
317 | add esi,4 |
300 | add edi,4 |
318 | add edi,4 |
301 | loop @b |
319 | loop @b |
302 | ffree st |
320 | ffree st |
303 | 321 | ||
304 | mov esp,ebp |
322 | mov esp,ebp |
305 | pop ebp |
323 | pop ebp |
306 | ret |
324 | ret |
307 | ;------ |
325 | ;------ |
308 | ; esi - offset (pointer) to angles, edi offset to 3x3 matrix |
326 | ; esi - offset (pointer) to angles, edi offset to 3x3 matrix |
309 | make_rotation_matrix: |
327 | make_rotation_matrix: |
310 | .sinx equ dword[ebp-4] |
328 | .sinx equ dword[ebp-4] |
311 | .cosx equ dword[ebp-8] |
329 | .cosx equ dword[ebp-8] |
312 | .siny equ dword[ebp-12] |
330 | .siny equ dword[ebp-12] |
313 | .cosy equ dword[ebp-16] |
331 | .cosy equ dword[ebp-16] |
314 | .sinz equ dword[ebp-20] |
332 | .sinz equ dword[ebp-20] |
315 | .cosz equ dword[ebp-24] |
333 | .cosz equ dword[ebp-24] |
316 | push ebp |
334 | push ebp |
317 | mov ebp,esp |
335 | mov ebp,esp |
318 | sub esp,24 |
336 | sub esp,24 |
319 | 337 | ||
320 | movzx ebx,word[esi] |
338 | movzx ebx,word[esi] |
321 | shl ebx,2 |
339 | shl ebx,2 |
322 | mov eax,dword[sin_tab+ebx] |
340 | mov eax,dword[sin_tab+ebx] |
323 | mov .sinx,eax |
341 | mov .sinx,eax |
324 | mov edx,dword[cos_tab+ebx] |
342 | mov edx,dword[cos_tab+ebx] |
325 | mov .cosx,edx |
343 | mov .cosx,edx |
326 | 344 | ||
327 | movzx ebx,word[esi+2] |
345 | movzx ebx,word[esi+2] |
328 | shl ebx,2 |
346 | shl ebx,2 |
329 | mov eax,dword[sin_tab+ebx] |
347 | mov eax,dword[sin_tab+ebx] |
330 | mov .siny,eax |
348 | mov .siny,eax |
331 | mov edx,dword[cos_tab+ebx] |
349 | mov edx,dword[cos_tab+ebx] |
332 | mov .cosy,edx |
350 | mov .cosy,edx |
333 | 351 | ||
334 | movzx ebx,word[esi+4] |
352 | movzx ebx,word[esi+4] |
335 | shl ebx,2 |
353 | shl ebx,2 |
336 | mov eax,dword[sin_tab+ebx] |
354 | mov eax,dword[sin_tab+ebx] |
337 | mov .sinz,eax |
355 | mov .sinz,eax |
338 | mov edx,dword[cos_tab+ebx] |
356 | mov edx,dword[cos_tab+ebx] |
339 | mov .cosz,edx |
357 | mov .cosz,edx |
340 | 358 | ||
341 | fninit |
359 | fninit |
342 | fld .cosy |
360 | fld .cosy |
343 | fmul .cosz |
361 | fmul .cosz |
344 | fstp dword[edi] |
362 | fstp dword[edi] |
345 | 363 | ||
346 | fld .sinx |
364 | fld .sinx |
347 | fmul .siny |
365 | fmul .siny |
348 | fmul .cosz |
366 | fmul .cosz |
349 | fld .cosx |
367 | fld .cosx |
350 | fmul .sinz |
368 | fmul .sinz |
351 | fchs |
369 | fchs |
352 | faddp |
370 | faddp |
353 | fstp dword[edi+12] |
371 | fstp dword[edi+12] |
354 | 372 | ||
355 | fld .cosx |
373 | fld .cosx |
356 | fmul .siny |
374 | fmul .siny |
357 | fmul .cosz |
375 | fmul .cosz |
358 | fld .sinx |
376 | fld .sinx |
359 | fmul .sinz |
377 | fmul .sinz |
360 | faddp |
378 | faddp |
361 | fstp dword[edi+24] |
379 | fstp dword[edi+24] |
362 | 380 | ||
363 | fld .cosy |
381 | fld .cosy |
364 | fmul .sinz |
382 | fmul .sinz |
365 | fstp dword[edi+4] |
383 | fstp dword[edi+4] |
366 | 384 | ||
367 | fld .sinx |
385 | fld .sinx |
368 | fmul .siny |
386 | fmul .siny |
369 | fmul .sinz |
387 | fmul .sinz |
370 | fld .cosx |
388 | fld .cosx |
371 | fmul .cosz |
389 | fmul .cosz |
372 | faddp |
390 | faddp |
373 | fstp dword[edi+16] |
391 | fstp dword[edi+16] |
374 | 392 | ||
375 | fld .cosx |
393 | fld .cosx |
376 | fmul .siny |
394 | fmul .siny |
377 | fmul .sinz |
395 | fmul .sinz |
378 | fld .sinx |
396 | fld .sinx |
379 | fchs |
397 | fchs |
380 | fmul .cosz |
398 | fmul .cosz |
381 | faddp |
399 | faddp |
382 | fstp dword[edi+28] |
400 | fstp dword[edi+28] |
383 | 401 | ||
384 | fld .siny |
402 | fld .siny |
385 | fchs |
403 | fchs |
386 | fstp dword[edi+8] |
404 | fstp dword[edi+8] |
387 | 405 | ||
388 | fld .cosy |
406 | fld .cosy |
389 | fmul .sinx |
407 | fmul .sinx |
390 | fstp dword[edi+20] |
408 | fstp dword[edi+20] |
391 | 409 | ||
392 | fld .cosx |
410 | fld .cosx |
393 | fmul .cosy |
411 | fmul .cosy |
394 | fstp dword[edi+32] |
412 | fstp dword[edi+32] |
395 | 413 | ||
396 | mov esp,ebp |
414 | mov esp,ebp |
397 | pop ebp |
415 | pop ebp |
398 | ret |
416 | ret |
399 | ;--------------------- |
417 | ;--------------------- |
400 | ; in: esi - ptr to points(normals], each point(normal) coeficient as dword |
418 | ; in: esi - ptr to points(normals], each point(normal) coeficient as dword |
401 | ; edi - ptr to rotated points(normals) |
419 | ; edi - ptr to rotated points(normals) |
402 | ; ebx - ptr to 3x3 (9 dwords, 36 bytes) rotation matrix |
420 | ; ebx - ptr to 3x3 (9 dwords, 36 bytes) rotation matrix |
403 | ; ecx - number of points(normals) |
421 | ; ecx - number of points(normals) |
404 | rotary: |
422 | rotary: |
405 | if Ext |
423 | if Ext |
406 | fninit |
424 | fninit |
407 | .again: |
425 | .again: |
408 | 426 | ||
409 | fld dword[esi] |
427 | fld dword[esi] |
410 | fmul dword[ebx] |
428 | fmul dword[ebx] |
411 | fld dword[esi+4] |
429 | fld dword[esi+4] |
412 | fmul dword[ebx+12] |
430 | fmul dword[ebx+12] |
413 | faddp |
431 | faddp |
414 | fld dword[esi+8] |
432 | fld dword[esi+8] |
415 | fmul dword[ebx+24] |
433 | fmul dword[ebx+24] |
416 | faddp |
434 | faddp |
417 | fstp dword[edi] |
435 | fstp dword[edi] |
418 | 436 | ||
419 | 437 | ||
420 | fld dword[esi+4] |
438 | fld dword[esi+4] |
421 | fmul dword[ebx+16] |
439 | fmul dword[ebx+16] |
422 | fld dword[esi] |
440 | fld dword[esi] |
423 | fmul dword[ebx+4] |
441 | fmul dword[ebx+4] |
424 | faddp |
442 | faddp |
425 | fld dword[esi+8] |
443 | fld dword[esi+8] |
426 | fmul dword[ebx+28] |
444 | fmul dword[ebx+28] |
427 | faddp |
445 | faddp |
428 | fstp dword[edi+4] |
446 | fstp dword[edi+4] |
429 | 447 | ||
430 | 448 | ||
431 | fld dword[esi+8] |
449 | fld dword[esi+8] |
432 | fmul dword[ebx+32] |
450 | fmul dword[ebx+32] |
433 | fld dword[esi] |
451 | fld dword[esi] |
434 | fmul dword[ebx+8] |
452 | fmul dword[ebx+8] |
435 | fld dword[esi+4] |
453 | fld dword[esi+4] |
436 | fmul dword[ebx+20] |
454 | fmul dword[ebx+20] |
437 | faddp |
455 | faddp |
438 | faddp |
456 | faddp |
439 | fstp dword[edi+8] |
457 | fstp dword[edi+8] |
440 | 458 | ||
441 | 459 | ||
442 | add esi,12 |
460 | add esi,12 |
443 | add edi,12 |
461 | add edi,12 |
444 | loop .again |
462 | loop .again |
445 | mov [edi],dword -1 |
463 | mov [edi],dword -1 |
446 | else |
464 | else |
447 | ; Copyright (C) 1999-2001 Brian Paul |
465 | ; Copyright (C) 1999-2001 Brian Paul |
448 | ; Copyright (C) Maciej Guba |
466 | ; Copyright (C) Maciej Guba |
449 | ;--------------------- |
467 | ;--------------------- |
450 | ; in: esi - ptr to points(normals], each point(normal) coeficient as dword |
468 | ; in: esi - ptr to points(normals], each point(normal) coeficient as dword |
451 | ; edi - ptr to rotated points(normals) |
469 | ; edi - ptr to rotated points(normals) |
452 | ; ebx - ptr to 3x3 (9 dwords, 36 bytes) rotation matrix |
470 | ; ebx - ptr to 3x3 (9 dwords, 36 bytes) rotation matrix |
453 | ; ecx - number of points(normals) |
471 | ; ecx - number of points(normals) |
454 | ;align 32 |
472 | ;align 32 |
455 | movups xmm4,[ebx] |
473 | movups xmm4,[ebx] |
456 | ; lddqu xmm4,[ebx] ; I tried sse3 :D |
474 | ; lddqu xmm4,[ebx] ; I tried sse3 :D |
457 | movups xmm5,[ebx+12] |
475 | movups xmm5,[ebx+12] |
458 | movups xmm6,[ebx+24] |
476 | movups xmm6,[ebx+24] |
459 | ;align 32 |
477 | ;align 32 |
460 | .again: |
478 | .again: |
461 | movss xmm0,dword[esi] |
479 | movss xmm0,dword[esi] |
462 | shufps xmm0,xmm0,0 |
480 | shufps xmm0,xmm0,0 |
463 | mulps xmm0,xmm4 |
481 | mulps xmm0,xmm4 |
464 | 482 | ||
465 | movss xmm1,dword[esi+4] |
483 | movss xmm1,dword[esi+4] |
466 | shufps xmm1,xmm1,0 |
484 | shufps xmm1,xmm1,0 |
467 | mulps xmm1,xmm5 |
485 | mulps xmm1,xmm5 |
468 | 486 | ||
469 | movss xmm2,dword[esi+8] |
487 | movss xmm2,dword[esi+8] |
470 | shufps xmm2,xmm2,0 |
488 | shufps xmm2,xmm2,0 |
471 | mulps xmm2,xmm6 |
489 | mulps xmm2,xmm6 |
472 | 490 | ||
473 | addps xmm0,xmm1 |
491 | addps xmm0,xmm1 |
474 | addps xmm0,xmm2 |
492 | addps xmm0,xmm2 |
475 | 493 | ||
476 | movups [edi],xmm0 |
494 | movups [edi],xmm0 |
477 | 495 | ||
478 | add esi,12 |
496 | add esi,12 |
479 | add edi,12 |
497 | add edi,12 |
480 | dec ecx |
498 | dec ecx |
481 | jne .again |
499 | jne .again |
482 | mov [edi],dword -1 |
500 | mov [edi],dword -1 |
483 | end if |
501 | end if |
484 | ret |
502 | ret |
485 | ;---------------------------------------------- |
503 | ;---------------------------------------------- |
486 | ; esi - pointer to 3x3 matrix |
504 | ; esi - pointer to 3x3 matrix |
487 | add_scale_to_matrix: |
505 | add_scale_to_matrix: |
488 | fninit |
506 | fninit |
489 | fld [rsscale] |
507 | fld [rsscale] |
490 | fld dword[esi] ;----- |
508 | fld dword[esi] ;----- |
491 | fmul st,st1 |
509 | fmul st,st1 |
492 | fstp dword[esi] |
510 | fstp dword[esi] |
493 | fld dword[esi+12] ; x scale |
511 | fld dword[esi+12] ; x scale |
494 | fmul st,st1 |
512 | fmul st,st1 |
495 | fstp dword[esi+12] |
513 | fstp dword[esi+12] |
496 | fld dword[esi+24] |
514 | fld dword[esi+24] |
497 | fmul st,st1 |
515 | fmul st,st1 |
498 | fstp dword[esi+24] ;------ |
516 | fstp dword[esi+24] ;------ |
499 | 517 | ||
500 | fld dword[esi+4] ;----- |
518 | fld dword[esi+4] ;----- |
501 | fmul st,st1 |
519 | fmul st,st1 |
502 | fstp dword[esi+4] |
520 | fstp dword[esi+4] |
503 | fld dword[esi+16] ; y scale |
521 | fld dword[esi+16] ; y scale |
504 | fmul st,st1 |
522 | fmul st,st1 |
505 | fstp dword[esi+16] |
523 | fstp dword[esi+16] |
506 | fld dword[esi+28] |
524 | fld dword[esi+28] |
507 | fmul st,st1 |
525 | fmul st,st1 |
508 | fstp dword[esi+28] ;------ |
526 | fstp dword[esi+28] ;------ |
509 | 527 | ||
510 | 528 | ||
511 | fld dword[esi+8] ;----- |
529 | fld dword[esi+8] ;----- |
512 | fmul st,st1 |
530 | fmul st,st1 |
513 | fstp dword[esi+8] |
531 | fstp dword[esi+8] |
514 | fld dword[esi+20] ; z scale |
532 | fld dword[esi+20] ; z scale |
515 | fmul st,st1 |
533 | fmul st,st1 |
516 | fstp dword[esi+20] |
534 | fstp dword[esi+20] |
517 | fld dword[esi+32] |
535 | fld dword[esi+32] |
518 | fmulp st1,st |
536 | fmulp st1,st |
519 | fstp dword[esi+32] ;------ |
537 | fstp dword[esi+32] ;------ |
520 | 538 | ||
521 | ret |
539 | ret |
522 | 540 | ||
523 | ;in esi - offset to 3d points (point as 3 dwords float) |
541 | ;in esi - offset to 3d points (point as 3 dwords float) |
524 | ; edi - offset to 2d points ( as 3 words integer) |
542 | ; edi - offset to 2d points ( as 3 words integer) |
525 | ; ecx - number of points |
543 | ; ecx - number of points |
526 | translate_points: ; just convert into integer; z coord still needed |
544 | translate_points: ; just convert into integer; z coord still needed |
527 | fninit |
545 | fninit |
528 | .again: |
546 | .again: |
529 | if 0 |
547 | if 0 |
530 | fld dword[esi+8] |
548 | fld dword[esi+8] |
531 | ; fmul [rsscale] |
549 | ; fmul [rsscale] |
532 | fist word[edi+4] |
550 | fist word[edi+4] |
533 | 551 | ||
534 | fisub [zobs] |
552 | fisub [zobs] |
535 | fchs |
553 | fchs |
536 | 554 | ||
537 | fld dword[esi] |
555 | fld dword[esi] |
538 | ; fmul [rsscale] |
556 | ; fmul [rsscale] |
539 | fisub [xobs] |
557 | fisub [xobs] |
540 | fimul [zobs] |
558 | fimul [zobs] |
541 | fdiv st0,st1 |
559 | fdiv st0,st1 |
542 | 560 | ||
543 | fiadd [xobs] |
561 | fiadd [xobs] |
544 | fiadd [vect_x] |
562 | fiadd [vect_x] |
545 | fistp word[edi] |
563 | fistp word[edi] |
546 | 564 | ||
547 | fld dword[esi+4] |
565 | fld dword[esi+4] |
548 | ; fmul [rsscale] |
566 | ; fmul [rsscale] |
549 | fisub [yobs] |
567 | fisub [yobs] |
550 | fimul [zobs] |
568 | fimul [zobs] |
551 | fdivrp ; st0,st1 |
569 | fdivrp ; st0,st1 |
552 | 570 | ||
553 | fiadd [yobs] |
571 | fiadd [yobs] |
554 | fiadd [vect_y] |
572 | fiadd [vect_y] |
555 | fistp word[edi+2] |
573 | fistp word[edi+2] |
556 | end if |
574 | end if |
557 | ; movups xmm0,[esi] |
575 | ; movups xmm0,[esi] |
558 | ; cvtps2dq xmm0,xmm0 |
576 | ; cvtps2dq xmm0,xmm0 |
559 | ; packsdw xmm0,xmm0 |
577 | ; packsdw xmm0,xmm0 |
560 | ; movq [edi] |
578 | ; movq [edi] |
561 | fld dword[esi] |
579 | fld dword[esi] |
562 | fiadd [vect_x] |
580 | fiadd [vect_x] |
563 | fistp word[edi] |
581 | fistp word[edi] |
564 | fld dword[esi+4] |
582 | fld dword[esi+4] |
565 | fiadd [vect_y] |
583 | fiadd [vect_y] |
566 | fistp word[edi+2] |
584 | fistp word[edi+2] |
567 | fld dword[esi+8] |
585 | fld dword[esi+8] |
568 | fistp word[edi+4] |
586 | fistp word[edi+4] |
569 | add esi,12 |
587 | add esi,12 |
570 | add edi,6 |
588 | add edi,6 |
571 | dec ecx |
589 | dec ecx |
572 | jnz .again |
590 | jnz .again |
573 | 591 | ||
574 | ret |
592 | ret |
575 | >> |
593 | >>> |