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