Rev 2279 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2279 | Rev 5763 | ||
---|---|---|---|
1 | ; |
1 | ; |
2 | ; application : Caritas - flat shading, Gouraud shading, |
2 | ; application : Caritas - flat shading, Gouraud shading, |
3 | ; enviornament mapping, bump mapping |
3 | ; enviornament mapping, bump mapping |
4 | ; compiler : FASM |
4 | ; compiler : FASM |
5 | ; system : KolibriOS |
5 | ; system : KolibriOS |
6 | ; author : macgub alias Maciej Guba |
6 | ; author : macgub alias Maciej Guba |
7 | ; email : macgub3@wp.pl |
7 | ; email : macgub3@wp.pl |
8 | ; web : www.menuet.xt.pl |
8 | ; web : www.menuet.xt.pl |
9 | ; Fell free to use this intro in your own distribution of KolibriOS. |
9 | ; Fell free to use this intro in your own distribution of KolibriOS. |
10 | ; Special greetings to all MenuetOS maniax in the world. |
10 | ; Special greetings to all MenuetOS maniax in the world. |
11 | ; I hope because my intros Christian Belive will be near to each of You. |
11 | ; I hope because my intros Christian Belive will be near to each of You. |
12 | 12 | ||
13 | 13 | ||
14 | ; Some adjustments made by Madis Kalme |
14 | ; Some adjustments made by Madis Kalme |
15 | ; madis.kalme@mail.ee |
15 | ; madis.kalme@mail.ee |
16 | ; I tried optimizing it a bit, but don't know if it was successful. The objects |
16 | ; I tried optimizing it a bit, but don't know if it was successful. The objects |
17 | ; can be: |
17 | ; can be: |
18 | ; 1) Read from a file (*.3DS standard) |
18 | ; 1) Read from a file (*.3DS standard) |
19 | ; 2) Written in manually (at the end of the code) |
19 | ; 2) Written in manually (at the end of the code) |
20 | SIZE_X equ 350 |
20 | SIZE_X equ 350 |
21 | SIZE_Y equ 350 |
21 | SIZE_Y equ 350 |
22 | TIMEOUT equ 4 |
22 | TIMEOUT equ 4 |
23 | ROUND equ 10 |
23 | ROUND equ 10 |
24 | TEX_X equ 512 ; texture width |
24 | TEX_X equ 512 ; texture width |
25 | TEX_Y equ 512 ; height |
25 | TEX_Y equ 512 ; height |
26 | TEX_SHIFT equ 9 ; texture width shifting |
26 | TEX_SHIFT equ 9 ; texture width shifting |
27 | TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 |
27 | TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 |
28 | TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} |
28 | TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} |
29 | FLUENTLY = 0 |
29 | FLUENTLY = 0 |
30 | SHIFTING = 1 |
30 | SHIFTING = 1 |
31 | CATMULL_SHIFT equ 8 |
31 | CATMULL_SHIFT equ 8 |
32 | NON = 0 |
32 | NON = 0 |
33 | MMX = 1 |
33 | MMX = 1 |
34 | 34 | ||
35 | Ext = MMX ;Ext={ NON | MMX} |
35 | Ext = MMX ;Ext={ NON | MMX} |
36 | 36 | ||
37 | use32 |
37 | use32 |
38 | org 0x0 |
38 | org 0x0 |
39 | db 'MENUET01' ; 8 byte id |
39 | db 'MENUET01' ; 8 byte id |
40 | dd 0x01 ; header version |
40 | dd 0x01 ; header version |
41 | dd START ; start of code |
41 | dd START ; start of code |
42 | dd I_END ; size of image |
42 | dd I_END ; size of image |
43 | dd I_END ; memory for app |
43 | dd I_END ; memory for app |
44 | dd I_END ; esp |
44 | dd I_END ; esp |
45 | dd 0x0 , 0x0 ; I_Param , I_Icon |
45 | dd 0x0 , 0x0 ; I_Param , I_Icon |
46 | 46 | ||
47 | START: ; start of execution |
47 | START: ; start of execution |
48 | cld |
48 | cld |
49 | ; call alloc_buffer_mem |
49 | ; call alloc_buffer_mem |
50 | call read_from_file |
50 | call read_from_file |
51 | call init_triangles_normals |
51 | call init_triangles_normals |
52 | call init_point_normals |
52 | call init_point_normals |
53 | call init_envmap |
53 | call init_envmap |
54 | mov edi,bumpmap |
54 | mov edi,bumpmap |
55 | call calc_bumpmap |
55 | call calc_bumpmap |
56 | call calc_bumpmap_coords |
56 | call calc_bumpmap_coords |
57 | call draw_window |
57 | call draw_window |
58 | 58 | ||
59 | 59 | ||
60 | still: |
60 | still: |
61 | mov eax,23 ; wait here for event with timeout |
61 | mov eax,23 ; wait here for event with timeout |
62 | mov ebx,TIMEOUT |
62 | mov ebx,TIMEOUT |
63 | cmp [speed_flag],1 |
63 | cmp [speed_flag],1 |
64 | jne .skip |
64 | jne .skip |
65 | mov eax,11 |
65 | mov eax,11 |
66 | .skip: |
66 | .skip: |
67 | int 0x40 |
67 | int 0x40 |
68 | 68 | ||
69 | cmp eax,1 ; redraw request ? |
69 | cmp eax,1 ; redraw request ? |
70 | je red |
70 | je red |
71 | cmp eax,2 ; key in buffer ? |
71 | cmp eax,2 ; key in buffer ? |
72 | je key |
72 | je key |
73 | cmp eax,3 ; button in buffer ? |
73 | cmp eax,3 ; button in buffer ? |
74 | je button |
74 | je button |
75 | 75 | ||
76 | jmp noclose |
76 | jmp noclose |
77 | 77 | ||
78 | red: ; redraw |
78 | red: ; redraw |
79 | call draw_window |
79 | call draw_window |
80 | jmp noclose |
80 | jmp noclose |
81 | 81 | ||
82 | key: ; key |
82 | key: ; key |
83 | mov eax,2 ; just read it and ignore |
83 | mov eax,2 ; just read it and ignore |
84 | int 0x40 |
84 | int 0x40 |
85 | jmp noclose |
85 | jmp noclose |
86 | 86 | ||
87 | button: ; button |
87 | button: ; button |
88 | mov eax,17 ; get id |
88 | mov eax,17 ; get id |
89 | int 0x40 |
89 | int 0x40 |
90 | 90 | ||
91 | cmp ah,1 ; button id=1 ? |
91 | cmp ah,1 ; button id=1 ? |
92 | jne .ch_another |
92 | jne .ch_another |
93 | 93 | ||
94 | mov eax,-1 ; close this program |
94 | mov eax,-1 ; close this program |
95 | int 0x40 |
95 | int 0x40 |
96 | .ch_another: |
96 | .ch_another: |
97 | cmp ah,2 |
97 | cmp ah,2 |
98 | jne .ch_another1 |
98 | jne .ch_another1 |
99 | inc [r_flag] |
99 | inc [r_flag] |
100 | cmp [r_flag],3 |
100 | cmp [r_flag],3 |
101 | jne noclose |
101 | jne noclose |
102 | mov [r_flag],0 |
102 | mov [r_flag],0 |
103 | .ch_another1: |
103 | .ch_another1: |
104 | cmp ah,3 |
104 | cmp ah,3 |
105 | jne .ch_another2 |
105 | jne .ch_another2 |
106 | inc [dr_flag] |
106 | inc [dr_flag] |
107 | cmp [dr_flag],4 |
107 | cmp [dr_flag],4 |
108 | jne noclose |
108 | jne noclose |
109 | mov [dr_flag],0 |
109 | mov [dr_flag],0 |
110 | .ch_another2: |
110 | .ch_another2: |
111 | cmp ah,4 ; toggle speed |
111 | cmp ah,4 ; toggle speed |
112 | jne @f |
112 | jne @f |
113 | inc [speed_flag] |
113 | inc [speed_flag] |
114 | cmp [speed_flag],2 |
114 | cmp [speed_flag],2 |
115 | jne noclose |
115 | jne noclose |
116 | mov [speed_flag],0 |
116 | mov [speed_flag],0 |
117 | @@: |
117 | @@: |
118 | cmp ah,5 |
118 | cmp ah,5 |
119 | jne @f ;scale- |
119 | jne @f ;scale- |
120 | mov [scale],0.7 |
120 | mov [scale],0.7 |
121 | fninit |
121 | fninit |
122 | fld [sscale] |
122 | fld [sscale] |
123 | fmul [scale] |
123 | fmul [scale] |
124 | fstp [sscale] |
124 | fstp [sscale] |
125 | call read_from_file |
125 | call read_from_file |
126 | mov ax,[vect_x] ;-- last change |
126 | mov ax,[vect_x] ;-- last change |
127 | mov bx,[vect_y] |
127 | mov bx,[vect_y] |
128 | mov cx,[vect_z] |
128 | mov cx,[vect_z] |
129 | call add_vector |
129 | call add_vector |
130 | ; call do_scale |
130 | ; call do_scale |
131 | @@: |
131 | @@: |
132 | cmp ah,6 |
132 | cmp ah,6 |
133 | jne @f ; scale+ |
133 | jne @f ; scale+ |
134 | mov [scale],1.3 |
134 | mov [scale],1.3 |
135 | fninit |
135 | fninit |
136 | fld [sscale] |
136 | fld [sscale] |
137 | fmul [scale] |
137 | fmul [scale] |
138 | fstp [sscale] |
138 | fstp [sscale] |
139 | call read_from_file |
139 | call read_from_file |
140 | mov ax,[vect_x] |
140 | mov ax,[vect_x] |
141 | mov bx,[vect_y] |
141 | mov bx,[vect_y] |
142 | mov cx,[vect_z] |
142 | mov cx,[vect_z] |
143 | call add_vector |
143 | call add_vector |
144 | call init_triangles_normals |
144 | call init_triangles_normals |
145 | call init_point_normals |
145 | call init_point_normals |
146 | @@: |
146 | @@: |
147 | cmp ah,7 |
147 | cmp ah,7 |
148 | jne @f |
148 | jne @f |
149 | xor ax,ax ;add vector to object and rotary point |
149 | xor ax,ax ;add vector to object and rotary point |
150 | mov bx,-10 |
150 | mov bx,-10 |
151 | xor cx,cx |
151 | xor cx,cx |
152 | call add_vector |
152 | call add_vector |
153 | sub [vect_y],10 |
153 | sub [vect_y],10 |
154 | sub [yo],10 |
154 | sub [yo],10 |
155 | @@: |
155 | @@: |
156 | cmp ah,8 |
156 | cmp ah,8 |
157 | jne @f |
157 | jne @f |
158 | xor ax,ax |
158 | xor ax,ax |
159 | xor bx,bx |
159 | xor bx,bx |
160 | mov cx,10 |
160 | mov cx,10 |
161 | call add_vector |
161 | call add_vector |
162 | add [vect_z],10 |
162 | add [vect_z],10 |
163 | add [zo],10 |
163 | add [zo],10 |
164 | @@: |
164 | @@: |
165 | cmp ah,9 |
165 | cmp ah,9 |
166 | jne @f |
166 | jne @f |
167 | mov ax,-10 |
167 | mov ax,-10 |
168 | xor bx,bx |
168 | xor bx,bx |
169 | xor cx,cx |
169 | xor cx,cx |
170 | call add_vector |
170 | call add_vector |
171 | sub [vect_x],10 |
171 | sub [vect_x],10 |
172 | sub [xo],10 |
172 | sub [xo],10 |
173 | @@: |
173 | @@: |
174 | cmp ah,10 |
174 | cmp ah,10 |
175 | jne @f |
175 | jne @f |
176 | mov ax,10 |
176 | mov ax,10 |
177 | xor bx,bx |
177 | xor bx,bx |
178 | xor cx,cx |
178 | xor cx,cx |
179 | call add_vector |
179 | call add_vector |
180 | add [vect_x],10 |
180 | add [vect_x],10 |
181 | add [xo],10 |
181 | add [xo],10 |
182 | @@: |
182 | @@: |
183 | cmp ah,11 |
183 | cmp ah,11 |
184 | jne @f |
184 | jne @f |
185 | xor ax,ax |
185 | xor ax,ax |
186 | xor bx,bx |
186 | xor bx,bx |
187 | mov cx,-10 |
187 | mov cx,-10 |
188 | call add_vector |
188 | call add_vector |
189 | sub [vect_z],10 |
189 | sub [vect_z],10 |
190 | sub [zo],10 |
190 | sub [zo],10 |
191 | @@: |
191 | @@: |
192 | cmp ah,12 |
192 | cmp ah,12 |
193 | jne @f |
193 | jne @f |
194 | xor ax,ax |
194 | xor ax,ax |
195 | mov bx,10 |
195 | mov bx,10 |
196 | xor cx,cx |
196 | xor cx,cx |
197 | call add_vector |
197 | call add_vector |
198 | add [vect_y],10 |
198 | add [vect_y],10 |
199 | add [yo],10 |
199 | add [yo],10 |
200 | @@: |
200 | @@: |
201 | cmp ah,13 ; change main color - |
201 | cmp ah,13 ; change main color - |
202 | jne @f ; - lead color setting |
202 | jne @f ; - lead color setting |
203 | cmp [max_color_r],245 |
203 | cmp [max_color_r],245 |
204 | jge @f |
204 | jge @f |
205 | add [max_color_r],10 |
205 | add [max_color_r],10 |
206 | call init_envmap |
206 | call init_envmap |
207 | @@: |
207 | @@: |
208 | cmp ah,14 |
208 | cmp ah,14 |
209 | jne @f |
209 | jne @f |
210 | cmp [max_color_g],245 |
210 | cmp [max_color_g],245 |
211 | jge @f |
211 | jge @f |
212 | add [max_color_g],10 |
212 | add [max_color_g],10 |
213 | call init_envmap |
213 | call init_envmap |
214 | @@: |
214 | @@: |
215 | cmp ah,15 |
215 | cmp ah,15 |
216 | jne @f |
216 | jne @f |
217 | cmp [max_color_b],245 |
217 | cmp [max_color_b],245 |
218 | jge @f |
218 | jge @f |
219 | add [max_color_b],10 |
219 | add [max_color_b],10 |
220 | call init_envmap |
220 | call init_envmap |
221 | @@: |
221 | @@: |
222 | cmp ah,16 ; change main color |
222 | cmp ah,16 ; change main color |
223 | jne @f |
223 | jne @f |
224 | cmp [max_color_r],10 |
224 | cmp [max_color_r],10 |
225 | jle @f |
225 | jle @f |
226 | sub [max_color_r],10 |
226 | sub [max_color_r],10 |
227 | call init_envmap |
227 | call init_envmap |
228 | @@: |
228 | @@: |
229 | cmp ah,17 |
229 | cmp ah,17 |
230 | jne @f |
230 | jne @f |
231 | cmp [max_color_g],10 |
231 | cmp [max_color_g],10 |
232 | jle @f |
232 | jle @f |
233 | sub [max_color_g],10 |
233 | sub [max_color_g],10 |
234 | call init_envmap |
234 | call init_envmap |
235 | @@: |
235 | @@: |
236 | cmp ah,18 |
236 | cmp ah,18 |
237 | jne @f |
237 | jne @f |
238 | cmp [max_color_b],10 |
238 | cmp [max_color_b],10 |
239 | jle @f |
239 | jle @f |
240 | sub [max_color_b],10 |
240 | sub [max_color_b],10 |
241 | call init_envmap |
241 | call init_envmap |
242 | @@: |
242 | @@: |
243 | cmp ah,19 |
243 | cmp ah,19 |
244 | jne @f |
244 | jne @f |
245 | inc [catmull_flag] |
245 | inc [catmull_flag] |
246 | cmp [catmull_flag],2 |
246 | cmp [catmull_flag],2 |
247 | jne @f |
247 | jne @f |
248 | mov [catmull_flag],0 |
248 | mov [catmull_flag],0 |
249 | @@: |
249 | @@: |
250 | noclose: |
250 | noclose: |
251 | 251 | ||
252 | call calculate_angle ; calculates sinus and cosinus |
252 | call calculate_angle ; calculates sinus and cosinus |
253 | call copy_point_normals |
253 | call copy_point_normals |
254 | ; copy normals and rotate the copy using sin/cosbeta - best way |
254 | ; copy normals and rotate the copy using sin/cosbeta - best way |
255 | call rotate_point_normals |
255 | call rotate_point_normals |
256 | cmp [dr_flag],2 |
256 | cmp [dr_flag],2 |
257 | jge @f |
257 | jge @f |
258 | call calculate_colors |
258 | call calculate_colors |
259 | @@: |
259 | @@: |
260 | call copy_points |
260 | call copy_points |
261 | call rotate_points |
261 | call rotate_points |
262 | call translate_perspective_points; translate from 3d to 2d |
262 | call translate_perspective_points; translate from 3d to 2d |
263 | call clrscr ; clear the screen |
263 | call clrscr ; clear the screen |
264 | cmp [catmull_flag],1 ;non sort if Catmull |
264 | cmp [catmull_flag],1 ;non sort if Catmull |
265 | je .no_sort |
265 | je .no_sort |
266 | call sort_triangles |
266 | call sort_triangles |
267 | .no_sort: |
267 | .no_sort: |
268 | call fill_Z_buffer ; make background |
268 | call fill_Z_buffer ; make background |
269 | 269 | ||
270 | RDTSC |
270 | RDTSC |
271 | push eax |
271 | push eax |
272 | call draw_triangles ; draw all triangles from the list |
272 | call draw_triangles ; draw all triangles from the list |
273 | 273 | ||
274 | RDTSC |
274 | RDTSC |
275 | sub eax,[esp] |
275 | sub eax,[esp] |
276 | sub eax,41 |
276 | sub eax,41 |
277 | ; lea esi,[debug_points] |
277 | ; lea esi,[debug_points] |
278 | ; lea edi,[debug_points+6] |
278 | ; lea edi,[debug_points+6] |
279 | ; lea ebx,[debug_vector1] |
279 | ; lea ebx,[debug_vector1] |
280 | ; call make_vector |
280 | ; call make_vector |
281 | ; fninit |
281 | ; fninit |
282 | ; fld [sinbeta_one] |
282 | ; fld [sinbeta_one] |
283 | ; fimul [debug_dwd] |
283 | ; fimul [debug_dwd] |
284 | ; fistp [debug_dd] |
284 | ; fistp [debug_dd] |
285 | ; movzx eax,[debug_dd] |
285 | ; movzx eax,[debug_dd] |
286 | 286 | ||
287 | 287 | ||
288 | mov ecx,10 |
288 | mov ecx,10 |
289 | .dc: |
289 | .dc: |
290 | 290 | ||
291 | pop eax |
291 | pop eax |
292 | macro show |
292 | macro show |
293 | { |
293 | { |
294 | mov eax,7 ; put image |
294 | mov eax,7 ; put image |
295 | mov ebx,screen |
295 | mov ebx,screen |
296 | mov ecx,SIZE_X shl 16 + SIZE_Y |
296 | mov ecx,SIZE_X shl 16 + SIZE_Y |
297 | xor edx,edx |
297 | xor edx,edx |
298 | int 0x40 |
298 | int 0x40 |
299 | } |
299 | } |
300 | show |
300 | show |
301 | 301 | ||
302 | 302 | ||
303 | jmp still |
303 | jmp still |
304 | 304 | ||
305 | ;-------------------------------------------------------------------------------- |
305 | ;-------------------------------------------------------------------------------- |
306 | ;-------------------------PROCEDURES--------------------------------------------- |
306 | ;-------------------------PROCEDURES--------------------------------------------- |
307 | ;-------------------------------------------------------------------------------- |
307 | ;-------------------------------------------------------------------------------- |
308 | include "tex3.ASM" |
308 | include "tex3.ASM" |
309 | include "flat_cat.ASM" |
309 | include "flat_cat.ASM" |
310 | include "grd_cat.ASM" |
310 | include "grd_cat.ASM" |
311 | include "tex_cat.ASM" |
311 | include "tex_cat.ASM" |
312 | include "bump_cat.ASM" |
312 | include "bump_cat.ASM" |
313 | include "3dmath.asm" |
313 | include "3dmath.asm" |
314 | include "grd3.asm" |
314 | include "grd3.asm" |
315 | include "flat3.asm" |
315 | include "flat3.asm" |
316 | include "bump3.asm" |
316 | include "bump3.asm" |
317 | include "b_procs.asm" |
317 | include "b_procs.asm" |
318 | 318 | ||
319 | 319 | ||
320 | ;alloc_buffer_mem: |
320 | ;alloc_buffer_mem: |
321 | ; mov eax,68 |
321 | ; mov eax,68 |
322 | ; mov ebx,5 |
322 | ; mov ebx,5 |
323 | ; mov ecx,SIZE_X*SIZE_Y*3 |
323 | ; mov ecx,SIZE_X*SIZE_Y*3 |
324 | ; int 0x40 |
324 | ; int 0x40 |
325 | ; mov [screen],eax |
325 | ; mov [screen],eax |
326 | ;ret |
326 | ;ret |
327 | calc_bumpmap_coords: |
327 | calc_bumpmap_coords: |
328 | ; fninit |
328 | ; fninit |
329 | mov esi,points |
329 | mov esi,points |
330 | mov edi,tex_points |
330 | mov edi,tex_points |
331 | ; @@: |
331 | ; @@: |
332 | ; add esi,2 |
332 | ; add esi,2 |
333 | ; fild word[esi] |
333 | ; fild word[esi] |
334 | ; fmul [bump_scale] |
334 | ; fmul [bump_scale] |
335 | ; fistp word[edi] |
335 | ; fistp word[edi] |
336 | ; fild word[esi+2] |
336 | ; fild word[esi+2] |
337 | ; fmul [bump_scale] |
337 | ; fmul [bump_scale] |
338 | ; fistp word[edi+2] |
338 | ; fistp word[edi+2] |
339 | ; add esi,4 |
339 | ; add esi,4 |
340 | ; add edi,4 |
340 | ; add edi,4 |
341 | ; cmp [esi],dword -1 |
341 | ; cmp [esi],dword -1 |
342 | ; jnz @b |
342 | ; jnz @b |
343 | @@: |
343 | @@: |
344 | add esi,2 |
344 | add esi,2 |
345 | movsd |
345 | movsd |
346 | ; add esi,2 |
346 | ; add esi,2 |
347 | cmp dword[esi],dword -1 |
347 | cmp dword[esi],dword -1 |
348 | jne @b |
348 | jne @b |
349 | ret |
349 | ret |
350 | ;bump_scale dd 1.4 ;TEX_X/SIZE_X |
350 | ;bump_scale dd 1.4 ;TEX_X/SIZE_X |
351 | 351 | ||
352 | init_envmap: |
352 | init_envmap: |
353 | 353 | ||
354 | .temp equ word [ebp-2] |
354 | .temp equ word [ebp-2] |
355 | push ebp |
355 | push ebp |
356 | mov ebp,esp |
356 | mov ebp,esp |
357 | sub esp,2 |
357 | sub esp,2 |
358 | mov edi,envmap |
358 | mov edi,envmap |
359 | fninit |
359 | fninit |
360 | 360 | ||
361 | mov dx,-256 |
361 | mov dx,-256 |
362 | .ie_ver: |
362 | .ie_ver: |
363 | mov cx,-256 |
363 | mov cx,-256 |
364 | .ie_hor: |
364 | .ie_hor: |
365 | mov .temp,cx |
365 | mov .temp,cx |
366 | fild .temp |
366 | fild .temp |
367 | fmul st,st0 |
367 | fmul st,st0 |
368 | mov .temp,dx |
368 | mov .temp,dx |
369 | fild .temp |
369 | fild .temp |
370 | fmul st,st0 |
370 | fmul st,st0 |
371 | faddp |
371 | faddp |
372 | fsqrt |
372 | fsqrt |
373 | mov .temp,254 |
373 | mov .temp,254 |
374 | fisubr .temp |
374 | fisubr .temp |
375 | fmul [env_const] |
375 | fmul [env_const] |
376 | fistp .temp |
376 | fistp .temp |
377 | mov ax,.temp |
377 | mov ax,.temp |
378 | 378 | ||
379 | or ax,ax |
379 | or ax,ax |
380 | jge .ie_ok1 |
380 | jge .ie_ok1 |
381 | xor ax,ax |
381 | xor ax,ax |
382 | jmp .ie_ok2 |
382 | jmp .ie_ok2 |
383 | .ie_ok1: |
383 | .ie_ok1: |
384 | cmp ax,254 |
384 | cmp ax,254 |
385 | jle .ie_ok2 |
385 | jle .ie_ok2 |
386 | mov ax,254 |
386 | mov ax,254 |
387 | .ie_ok2: |
387 | .ie_ok2: |
388 | push dx |
388 | push dx |
389 | mov bx,ax |
389 | mov bx,ax |
390 | mul [max_color_b] |
390 | mul [max_color_b] |
391 | shr ax,8 |
391 | shr ax,8 |
392 | stosb |
392 | stosb |
393 | mov ax,bx |
393 | mov ax,bx |
394 | mul [max_color_g] |
394 | mul [max_color_g] |
395 | shr ax,8 |
395 | shr ax,8 |
396 | stosb |
396 | stosb |
397 | mov ax,bx |
397 | mov ax,bx |
398 | mul [max_color_r] |
398 | mul [max_color_r] |
399 | shr ax,8 |
399 | shr ax,8 |
400 | stosb |
400 | stosb |
401 | pop dx |
401 | pop dx |
402 | 402 | ||
403 | inc cx |
403 | inc cx |
404 | cmp cx,256 |
404 | cmp cx,256 |
405 | jne .ie_hor |
405 | jne .ie_hor |
406 | 406 | ||
407 | inc dx |
407 | inc dx |
408 | cmp dx,256 |
408 | cmp dx,256 |
409 | jne .ie_ver |
409 | jne .ie_ver |
410 | 410 | ||
411 | mov esp,ebp |
411 | mov esp,ebp |
412 | pop ebp |
412 | pop ebp |
413 | macro debug |
413 | macro debug |
414 | { |
414 | { |
415 | mov edi,envmap |
415 | mov edi,envmap |
416 | mov ecx,512*512*3/4 |
416 | mov ecx,512*512*3/4 |
417 | mov eax,0xffffffff |
417 | mov eax,0xffffffff |
418 | rep stosd |
418 | rep stosd |
419 | } |
419 | } |
420 | ret |
420 | ret |
421 | calculate_colors: |
421 | calculate_colors: |
422 | fninit |
422 | fninit |
423 | xor ebx,ebx |
423 | xor ebx,ebx |
424 | movzx ecx,[points_count_var] |
424 | movzx ecx,[points_count_var] |
425 | lea ecx,[ecx*3] |
425 | lea ecx,[ecx*3] |
426 | add ecx,ecx |
426 | add ecx,ecx |
427 | .cc_again: |
427 | .cc_again: |
428 | mov esi,light_vector |
428 | mov esi,light_vector |
429 | lea edi,[point_normals_rotated+ebx*2] |
429 | lea edi,[point_normals_rotated+ebx*2] |
430 | call dot_product |
430 | call dot_product |
431 | fcom [dot_min] |
431 | fcom [dot_min] |
432 | fstsw ax |
432 | fstsw ax |
433 | sahf |
433 | sahf |
434 | ja .cc_ok1 |
434 | ja .cc_ok1 |
435 | ffree st |
435 | ffree st |
436 | mov dword[points_color+ebx],0 |
436 | mov dword[points_color+ebx],0 |
437 | mov word[points_color+ebx+4],0 |
437 | mov word[points_color+ebx+4],0 |
438 | add ebx,6 |
438 | add ebx,6 |
439 | cmp ebx,ecx |
439 | cmp ebx,ecx |
440 | jne .cc_again |
440 | jne .cc_again |
441 | jmp .cc_done |
441 | jmp .cc_done |
442 | .cc_ok1: |
442 | .cc_ok1: |
443 | fcom [dot_max] |
443 | fcom [dot_max] |
444 | fstsw ax |
444 | fstsw ax |
445 | sahf |
445 | sahf |
446 | jb .cc_ok2 |
446 | jb .cc_ok2 |
447 | ffree st |
447 | ffree st |
448 | mov dword[points_color+ebx],0 ; clear r,g,b |
448 | mov dword[points_color+ebx],0 ; clear r,g,b |
449 | mov word[points_color+ebx+4],0 |
449 | mov word[points_color+ebx+4],0 |
450 | add ebx,6 |
450 | add ebx,6 |
451 | cmp ebx,ecx |
451 | cmp ebx,ecx |
452 | jne .cc_again |
452 | jne .cc_again |
453 | jmp .cc_done |
453 | jmp .cc_done |
454 | .cc_ok2: |
454 | .cc_ok2: |
455 | fld st |
455 | fld st |
456 | fld st |
456 | fld st |
457 | fimul [max_color_r] |
457 | fimul [max_color_r] |
458 | fistp word[points_color+ebx] ;each color as word |
458 | fistp word[points_color+ebx] ;each color as word |
459 | fimul [max_color_g] |
459 | fimul [max_color_g] |
460 | fistp word[points_color+ebx+2] |
460 | fistp word[points_color+ebx+2] |
461 | fimul [max_color_b] |
461 | fimul [max_color_b] |
462 | fistp word[points_color+ebx+4] |
462 | fistp word[points_color+ebx+4] |
463 | add ebx,6 |
463 | add ebx,6 |
464 | cmp ebx,ecx |
464 | cmp ebx,ecx |
465 | jne .cc_again |
465 | jne .cc_again |
466 | .cc_done: |
466 | .cc_done: |
467 | ret |
467 | ret |
468 | copy_point_normals: |
468 | copy_point_normals: |
469 | movzx ecx,[points_count_var] |
469 | movzx ecx,[points_count_var] |
470 | shl ecx,2 |
470 | shl ecx,2 |
471 | inc ecx |
471 | inc ecx |
472 | mov esi,point_normals |
472 | mov esi,point_normals |
473 | mov edi,point_normals_rotated |
473 | mov edi,point_normals_rotated |
474 | rep movsd |
474 | rep movsd |
475 | ret |
475 | ret |
476 | rotate_point_normals: |
476 | rotate_point_normals: |
477 | movzx ecx,[points_count_var] |
477 | movzx ecx,[points_count_var] |
478 | mov ebx,point_normals_rotated |
478 | mov ebx,point_normals_rotated |
479 | fninit ; for now only rotate around Z axle |
479 | fninit ; for now only rotate around Z axle |
480 | .again_r: |
480 | .again_r: |
481 | cmp [r_flag],1 |
481 | cmp [r_flag],1 |
482 | je .z_rot |
482 | je .z_rot |
483 | cmp [r_flag],2 |
483 | cmp [r_flag],2 |
484 | je .x_rot |
484 | je .x_rot |
485 | 485 | ||
486 | .y_rot: |
486 | .y_rot: |
487 | fld dword[ebx] ; x |
487 | fld dword[ebx] ; x |
488 | fld [sinbeta] |
488 | fld [sinbeta] |
489 | fmul dword[ebx+8] ; z * sinbeta |
489 | fmul dword[ebx+8] ; z * sinbeta |
490 | fchs |
490 | fchs |
491 | fld [cosbeta] |
491 | fld [cosbeta] |
492 | fmul dword[ebx] ; x * cosbeta |
492 | fmul dword[ebx] ; x * cosbeta |
493 | faddp |
493 | faddp |
494 | fstp dword[ebx] ; new x |
494 | fstp dword[ebx] ; new x |
495 | fmul [sinbeta] ; old x * sinbeta |
495 | fmul [sinbeta] ; old x * sinbeta |
496 | fld [cosbeta] |
496 | fld [cosbeta] |
497 | fmul dword[ebx+8] ; z * cosbeta |
497 | fmul dword[ebx+8] ; z * cosbeta |
498 | faddp |
498 | faddp |
499 | fstp dword[ebx+8] ; new z |
499 | fstp dword[ebx+8] ; new z |
500 | add ebx,12 |
500 | add ebx,12 |
501 | loop .y_rot |
501 | loop .y_rot |
502 | jmp .end_rot |
502 | jmp .end_rot |
503 | .z_rot: |
503 | .z_rot: |
504 | fld dword[ebx] ;x |
504 | fld dword[ebx] ;x |
505 | fld [sinbeta] |
505 | fld [sinbeta] |
506 | fmul dword[ebx+4] ;y |
506 | fmul dword[ebx+4] ;y |
507 | fld [cosbeta] |
507 | fld [cosbeta] |
508 | fmul dword[ebx] ;x |
508 | fmul dword[ebx] ;x |
509 | faddp |
509 | faddp |
510 | fstp dword[ebx] ;new x |
510 | fstp dword[ebx] ;new x |
511 | fmul [sinbeta] ; sinbeta * old x |
511 | fmul [sinbeta] ; sinbeta * old x |
512 | fchs |
512 | fchs |
513 | fld [cosbeta] |
513 | fld [cosbeta] |
514 | fmul dword[ebx+4] ; cosbeta * y |
514 | fmul dword[ebx+4] ; cosbeta * y |
515 | faddp |
515 | faddp |
516 | fstp dword[ebx+4] ; new y |
516 | fstp dword[ebx+4] ; new y |
517 | add ebx,12 |
517 | add ebx,12 |
518 | loop .z_rot |
518 | loop .z_rot |
519 | jmp .end_rot |
519 | jmp .end_rot |
520 | .x_rot: |
520 | .x_rot: |
521 | fld dword[ebx+4] ;y |
521 | fld dword[ebx+4] ;y |
522 | fld [sinbeta] |
522 | fld [sinbeta] |
523 | fmul dword[ebx+8] ;z |
523 | fmul dword[ebx+8] ;z |
524 | fld [cosbeta] |
524 | fld [cosbeta] |
525 | fmul dword[ebx+4] ;y |
525 | fmul dword[ebx+4] ;y |
526 | faddp |
526 | faddp |
527 | fstp dword[ebx+4] ; new y |
527 | fstp dword[ebx+4] ; new y |
528 | fmul [sinbeta] ; sinbeta * old y |
528 | fmul [sinbeta] ; sinbeta * old y |
529 | fchs |
529 | fchs |
530 | fld [cosbeta] |
530 | fld [cosbeta] |
531 | fmul dword[ebx+8] |
531 | fmul dword[ebx+8] |
532 | faddp |
532 | faddp |
533 | fstp dword[ebx+8] |
533 | fstp dword[ebx+8] |
534 | add ebx,12 |
534 | add ebx,12 |
535 | loop .x_rot |
535 | loop .x_rot |
536 | .end_rot: |
536 | .end_rot: |
537 | ret |
537 | ret |
538 | init_triangles_normals: |
538 | init_triangles_normals: |
539 | mov ebx,triangles_normals |
539 | mov ebx,triangles_normals |
540 | mov ebp,triangles |
540 | mov ebp,triangles |
541 | @@: |
541 | @@: |
542 | push ebx |
542 | push ebx |
543 | mov ebx,vectors |
543 | mov ebx,vectors |
544 | movzx esi,word[ebp] ; first point index |
544 | movzx esi,word[ebp] ; first point index |
545 | lea esi,[esi*3] |
545 | lea esi,[esi*3] |
546 | lea esi,[points+esi*2] ; esi - pointer to 1st 3d point |
546 | lea esi,[points+esi*2] ; esi - pointer to 1st 3d point |
547 | movzx edi,word[ebp+2] ; second point index |
547 | movzx edi,word[ebp+2] ; second point index |
548 | lea edi,[edi*3] |
548 | lea edi,[edi*3] |
549 | lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point |
549 | lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point |
550 | call make_vector |
550 | call make_vector |
551 | add ebx,12 |
551 | add ebx,12 |
552 | mov esi,edi |
552 | mov esi,edi |
553 | movzx edi,word[ebp+4] ; third point index |
553 | movzx edi,word[ebp+4] ; third point index |
554 | lea edi,[edi*3] |
554 | lea edi,[edi*3] |
555 | lea edi,[points+edi*2] |
555 | lea edi,[points+edi*2] |
556 | call make_vector |
556 | call make_vector |
557 | mov edi,ebx ; edi - pointer to 2nd vector |
557 | mov edi,ebx ; edi - pointer to 2nd vector |
558 | mov esi,ebx |
558 | mov esi,ebx |
559 | sub esi,12 ; esi - pointer to 1st vector |
559 | sub esi,12 ; esi - pointer to 1st vector |
560 | pop ebx |
560 | pop ebx |
561 | call cross_product |
561 | call cross_product |
562 | mov edi,ebx |
562 | mov edi,ebx |
563 | call normalize_vector |
563 | call normalize_vector |
564 | add ebp,6 |
564 | add ebp,6 |
565 | add ebx,12 |
565 | add ebx,12 |
566 | cmp dword[ebp],-1 |
566 | cmp dword[ebp],-1 |
567 | jne @b |
567 | jne @b |
568 | ret |
568 | ret |
569 | 569 | ||
570 | init_point_normals: |
570 | init_point_normals: |
571 | .x equ dword [ebp-4] |
571 | .x equ dword [ebp-4] |
572 | .y equ dword [ebp-8] |
572 | .y equ dword [ebp-8] |
573 | .z equ dword [ebp-12] |
573 | .z equ dword [ebp-12] |
574 | .point_number equ word [ebp-26] |
574 | .point_number equ word [ebp-26] |
575 | .hit_faces equ word [ebp-28] |
575 | .hit_faces equ word [ebp-28] |
576 | 576 | ||
577 | fninit |
577 | fninit |
578 | mov ebp,esp |
578 | mov ebp,esp |
579 | sub esp,28 |
579 | sub esp,28 |
580 | mov edi,point_normals |
580 | mov edi,point_normals |
581 | mov .point_number,0 |
581 | mov .point_number,0 |
582 | .ipn_loop: |
582 | .ipn_loop: |
583 | mov .hit_faces,0 |
583 | mov .hit_faces,0 |
584 | mov .x,0 |
584 | mov .x,0 |
585 | mov .y,0 |
585 | mov .y,0 |
586 | mov .z,0 |
586 | mov .z,0 |
587 | mov esi,triangles |
587 | mov esi,triangles |
588 | xor ecx,ecx ; ecx - triangle number |
588 | xor ecx,ecx ; ecx - triangle number |
589 | .ipn_check_face: |
589 | .ipn_check_face: |
590 | xor ebx,ebx ; ebx - 'position' in one triangle |
590 | xor ebx,ebx ; ebx - 'position' in one triangle |
591 | .ipn_check_vertex: |
591 | .ipn_check_vertex: |
592 | movzx eax,word[esi+ebx] ; eax - point_number |
592 | movzx eax,word[esi+ebx] ; eax - point_number |
593 | cmp ax,.point_number |
593 | cmp ax,.point_number |
594 | jne .ipn_next_vertex |
594 | jne .ipn_next_vertex |
595 | push esi |
595 | push esi |
596 | mov esi,ecx |
596 | mov esi,ecx |
597 | lea esi,[esi*3] |
597 | lea esi,[esi*3] |
598 | lea esi,[triangles_normals+esi*4] |
598 | lea esi,[triangles_normals+esi*4] |
599 | ; shl esi,2 |
599 | ; shl esi,2 |
600 | ; add esi,triangles_normals |
600 | ; add esi,triangles_normals |
601 | 601 | ||
602 | fld .x |
602 | fld .x |
603 | fadd dword[esi+vec_x] |
603 | fadd dword[esi+vec_x] |
604 | fstp .x |
604 | fstp .x |
605 | fld .y |
605 | fld .y |
606 | fadd dword[esi+vec_y] |
606 | fadd dword[esi+vec_y] |
607 | fstp .y |
607 | fstp .y |
608 | fld .z |
608 | fld .z |
609 | fadd dword[esi+vec_z] |
609 | fadd dword[esi+vec_z] |
610 | fstp .z |
610 | fstp .z |
611 | pop esi |
611 | pop esi |
612 | inc .hit_faces |
612 | inc .hit_faces |
613 | jmp .ipn_next_face |
613 | jmp .ipn_next_face |
614 | .ipn_next_vertex: |
614 | .ipn_next_vertex: |
615 | add ebx,2 |
615 | add ebx,2 |
616 | cmp ebx,6 |
616 | cmp ebx,6 |
617 | jne .ipn_check_vertex |
617 | jne .ipn_check_vertex |
618 | .ipn_next_face: |
618 | .ipn_next_face: |
619 | add esi,6 |
619 | add esi,6 |
620 | inc ecx |
620 | inc ecx |
621 | cmp cx,[triangles_count_var] |
621 | cmp cx,[triangles_count_var] |
622 | jne .ipn_check_face |
622 | jne .ipn_check_face |
623 | 623 | ||
624 | fld .x |
624 | fld .x |
625 | fidiv .hit_faces |
625 | fidiv .hit_faces |
626 | fstp dword[edi+vec_x] |
626 | fstp dword[edi+vec_x] |
627 | fld .y |
627 | fld .y |
628 | fidiv .hit_faces |
628 | fidiv .hit_faces |
629 | fstp dword[edi+vec_y] |
629 | fstp dword[edi+vec_y] |
630 | fld .z |
630 | fld .z |
631 | fidiv .hit_faces |
631 | fidiv .hit_faces |
632 | fstp dword[edi+vec_z] |
632 | fstp dword[edi+vec_z] |
633 | call normalize_vector |
633 | call normalize_vector |
634 | add edi,12 ;type vector 3d |
634 | add edi,12 ;type vector 3d |
635 | inc .point_number |
635 | inc .point_number |
636 | mov dx,.point_number |
636 | mov dx,.point_number |
637 | cmp dx,[points_count_var] |
637 | cmp dx,[points_count_var] |
638 | jne .ipn_loop |
638 | jne .ipn_loop |
639 | 639 | ||
640 | mov esp,ebp |
640 | mov esp,ebp |
641 | ret |
641 | ret |
642 | 642 | ||
643 | add_vector: |
643 | add_vector: |
644 | mov ebp,points |
644 | mov ebp,points |
645 | @@: |
645 | @@: |
646 | add word[ebp],ax |
646 | add word[ebp],ax |
647 | add word[ebp+2],bx |
647 | add word[ebp+2],bx |
648 | add word[ebp+4],cx |
648 | add word[ebp+4],cx |
649 | add ebp,6 |
649 | add ebp,6 |
650 | cmp dword[ebp],-1 |
650 | cmp dword[ebp],-1 |
651 | jne @b |
651 | jne @b |
652 | ret |
652 | ret |
653 | ;do_scale: |
653 | ;do_scale: |
654 | ; fninit |
654 | ; fninit |
655 | ; mov ebp,points |
655 | ; mov ebp,points |
656 | ; .next_sc: |
656 | ; .next_sc: |
657 | ; fld1 |
657 | ; fld1 |
658 | ; fsub [scale] |
658 | ; fsub [scale] |
659 | ; fld st |
659 | ; fld st |
660 | ; fimul [xo] |
660 | ; fimul [xo] |
661 | ; fld [scale] |
661 | ; fld [scale] |
662 | ; fimul word[ebp] ;x |
662 | ; fimul word[ebp] ;x |
663 | ; faddp |
663 | ; faddp |
664 | ; fistp word[ebp] |
664 | ; fistp word[ebp] |
665 | ; fld st |
665 | ; fld st |
666 | ; fimul [yo] |
666 | ; fimul [yo] |
667 | ; fld [scale] |
667 | ; fld [scale] |
668 | ; fimul word[ebp+2] |
668 | ; fimul word[ebp+2] |
669 | ; faddp |
669 | ; faddp |
670 | ; fistp word[ebp+2] |
670 | ; fistp word[ebp+2] |
671 | ; fimul [zo] |
671 | ; fimul [zo] |
672 | ; fld [scale] |
672 | ; fld [scale] |
673 | ; fimul word[ebp+4] |
673 | ; fimul word[ebp+4] |
674 | ; faddp |
674 | ; faddp |
675 | ; fistp word[ebp+4] |
675 | ; fistp word[ebp+4] |
676 | ; add ebp,6 |
676 | ; add ebp,6 |
677 | ; cmp dword[ebp],-1 |
677 | ; cmp dword[ebp],-1 |
678 | ; jne .next_sc |
678 | ; jne .next_sc |
679 | ;ret |
679 | ;ret |
680 | sort_triangles: |
680 | sort_triangles: |
681 | mov esi,triangles |
681 | mov esi,triangles |
682 | mov edi,triangles_with_z |
682 | mov edi,triangles_with_z |
683 | mov ebp,points_rotated |
683 | mov ebp,points_rotated |
684 | 684 | ||
685 | make_triangle_with_z: ;makes list with triangles and z position |
685 | make_triangle_with_z: ;makes list with triangles and z position |
686 | movzx eax,word[esi] |
686 | movzx eax,word[esi] |
687 | lea eax,[eax*3] |
687 | lea eax,[eax*3] |
688 | movzx ecx,word[ebp+eax*2+4] |
688 | movzx ecx,word[ebp+eax*2+4] |
689 | 689 | ||
690 | movzx eax,word[esi+2] |
690 | movzx eax,word[esi+2] |
691 | lea eax,[eax*3] |
691 | lea eax,[eax*3] |
692 | add cx,word[ebp+eax*2+4] |
692 | add cx,word[ebp+eax*2+4] |
693 | 693 | ||
694 | movzx eax,word[esi+4] |
694 | movzx eax,word[esi+4] |
695 | lea eax,[eax*3] |
695 | lea eax,[eax*3] |
696 | add cx,word[ebp+eax*2+4] |
696 | add cx,word[ebp+eax*2+4] |
697 | 697 | ||
698 | mov ax,cx |
698 | mov ax,cx |
699 | ; cwd |
699 | ; cwd |
700 | ; idiv word[i3] |
700 | ; idiv word[i3] |
701 | movsd ; store vertex coordinates |
701 | movsd ; store vertex coordinates |
702 | movsw |
702 | movsw |
703 | stosw ; middle vertex coordinate 'z' in triangles_with_z list |
703 | stosw ; middle vertex coordinate 'z' in triangles_with_z list |
704 | cmp dword[esi],-1 |
704 | cmp dword[esi],-1 |
705 | jne make_triangle_with_z |
705 | jne make_triangle_with_z |
706 | movsd ; copy end mark |
706 | movsd ; copy end mark |
707 | mov eax,4 |
707 | mov eax,4 |
708 | lea edx,[edi-8-trizdd] |
708 | lea edx,[edi-8-trizdd] |
709 | mov [high],edx |
709 | mov [high],edx |
710 | call quicksort |
710 | call quicksort |
711 | mov eax,4 |
711 | mov eax,4 |
712 | mov edx,[high] |
712 | mov edx,[high] |
713 | call insertsort |
713 | call insertsort |
714 | jmp end_sort |
714 | jmp end_sort |
715 | 715 | ||
716 | quicksort: |
716 | quicksort: |
717 | mov ecx,edx |
717 | mov ecx,edx |
718 | sub ecx,eax |
718 | sub ecx,eax |
719 | cmp ecx,32 |
719 | cmp ecx,32 |
720 | jc .exit |
720 | jc .exit |
721 | lea ecx,[eax+edx] |
721 | lea ecx,[eax+edx] |
722 | shr ecx,4 |
722 | shr ecx,4 |
723 | lea ecx,[ecx*8-4]; i |
723 | lea ecx,[ecx*8-4]; i |
724 | mov ebx,[trizdd+eax]; trizdd[l] |
724 | mov ebx,[trizdd+eax]; trizdd[l] |
725 | mov esi,[trizdd+ecx]; trizdd[i] |
725 | mov esi,[trizdd+ecx]; trizdd[i] |
726 | mov edi,[trizdd+edx]; trizdd[h] |
726 | mov edi,[trizdd+edx]; trizdd[h] |
727 | cmp ebx,esi |
727 | cmp ebx,esi |
728 | jg @f ; direction NB! you need to negate these to invert the order |
728 | jg @f ; direction NB! you need to negate these to invert the order |
729 | if Ext=NON |
729 | if Ext=NON |
730 | mov [trizdd+eax],esi |
730 | mov [trizdd+eax],esi |
731 | mov [trizdd+ecx],ebx |
731 | mov [trizdd+ecx],ebx |
732 | mov ebx,[trizdd+eax-4] |
732 | mov ebx,[trizdd+eax-4] |
733 | mov esi,[trizdd+ecx-4] |
733 | mov esi,[trizdd+ecx-4] |
734 | mov [trizdd+eax-4],esi |
734 | mov [trizdd+eax-4],esi |
735 | mov [trizdd+ecx-4],ebx |
735 | mov [trizdd+ecx-4],ebx |
736 | mov ebx,[trizdd+eax] |
736 | mov ebx,[trizdd+eax] |
737 | mov esi,[trizdd+ecx] |
737 | mov esi,[trizdd+ecx] |
738 | else |
738 | else |
739 | movq mm0,[trizdq+eax-4] |
739 | movq mm0,[trizdq+eax-4] |
740 | movq mm1,[trizdq+ecx-4] |
740 | movq mm1,[trizdq+ecx-4] |
741 | movq [trizdq+ecx-4],mm0 |
741 | movq [trizdq+ecx-4],mm0 |
742 | movq [trizdq+eax-4],mm1 |
742 | movq [trizdq+eax-4],mm1 |
743 | xchg ebx,esi |
743 | xchg ebx,esi |
744 | end if |
744 | end if |
745 | @@: |
745 | @@: |
746 | cmp ebx,edi |
746 | cmp ebx,edi |
747 | jg @f ; direction |
747 | jg @f ; direction |
748 | if Ext=NON |
748 | if Ext=NON |
749 | mov [trizdd+eax],edi |
749 | mov [trizdd+eax],edi |
750 | mov [trizdd+edx],ebx |
750 | mov [trizdd+edx],ebx |
751 | mov ebx,[trizdd+eax-4] |
751 | mov ebx,[trizdd+eax-4] |
752 | mov edi,[trizdd+edx-4] |
752 | mov edi,[trizdd+edx-4] |
753 | mov [trizdd+eax-4],edi |
753 | mov [trizdd+eax-4],edi |
754 | mov [trizdd+edx-4],ebx |
754 | mov [trizdd+edx-4],ebx |
755 | mov ebx,[trizdd+eax] |
755 | mov ebx,[trizdd+eax] |
756 | mov edi,[trizdd+edx] |
756 | mov edi,[trizdd+edx] |
757 | else |
757 | else |
758 | movq mm0,[trizdq+eax-4] |
758 | movq mm0,[trizdq+eax-4] |
759 | movq mm1,[trizdq+edx-4] |
759 | movq mm1,[trizdq+edx-4] |
760 | movq [trizdq+edx-4],mm0 |
760 | movq [trizdq+edx-4],mm0 |
761 | movq [trizdq+eax-4],mm1 |
761 | movq [trizdq+eax-4],mm1 |
762 | xchg ebx,edi |
762 | xchg ebx,edi |
763 | end if |
763 | end if |
764 | @@: |
764 | @@: |
765 | cmp esi,edi |
765 | cmp esi,edi |
766 | jg @f ; direction |
766 | jg @f ; direction |
767 | if Ext=NON |
767 | if Ext=NON |
768 | mov [trizdd+ecx],edi |
768 | mov [trizdd+ecx],edi |
769 | mov [trizdd+edx],esi |
769 | mov [trizdd+edx],esi |
770 | mov esi,[trizdd+ecx-4] |
770 | mov esi,[trizdd+ecx-4] |
771 | mov edi,[trizdd+edx-4] |
771 | mov edi,[trizdd+edx-4] |
772 | mov [trizdd+ecx-4],edi |
772 | mov [trizdd+ecx-4],edi |
773 | mov [trizdd+edx-4],esi |
773 | mov [trizdd+edx-4],esi |
774 | else |
774 | else |
775 | movq mm0,[trizdq+ecx-4] |
775 | movq mm0,[trizdq+ecx-4] |
776 | movq mm1,[trizdq+edx-4] |
776 | movq mm1,[trizdq+edx-4] |
777 | movq [trizdq+edx-4],mm0 |
777 | movq [trizdq+edx-4],mm0 |
778 | movq [trizdq+ecx-4],mm1 |
778 | movq [trizdq+ecx-4],mm1 |
779 | ; xchg ebx,esi |
779 | ; xchg ebx,esi |
780 | end if |
780 | end if |
781 | @@: |
781 | @@: |
782 | mov ebp,eax ; direction |
782 | mov ebp,eax ; direction |
783 | add ebp,8 ; j |
783 | add ebp,8 ; j |
784 | if Ext=NON |
784 | if Ext=NON |
785 | mov esi,[trizdd+ebp] |
785 | mov esi,[trizdd+ebp] |
786 | mov edi,[trizdd+ecx] |
786 | mov edi,[trizdd+ecx] |
787 | mov [trizdd+ebp],edi |
787 | mov [trizdd+ebp],edi |
788 | mov [trizdd+ecx],esi |
788 | mov [trizdd+ecx],esi |
789 | mov esi,[trizdd+ebp-4] |
789 | mov esi,[trizdd+ebp-4] |
790 | mov edi,[trizdd+ecx-4] |
790 | mov edi,[trizdd+ecx-4] |
791 | mov [trizdd+ecx-4],esi |
791 | mov [trizdd+ecx-4],esi |
792 | mov [trizdd+ebp-4],edi |
792 | mov [trizdd+ebp-4],edi |
793 | else |
793 | else |
794 | movq mm0,[trizdq+ebp-4] |
794 | movq mm0,[trizdq+ebp-4] |
795 | movq mm1,[trizdq+ecx-4] |
795 | movq mm1,[trizdq+ecx-4] |
796 | movq [trizdq+ecx-4],mm0 |
796 | movq [trizdq+ecx-4],mm0 |
797 | movq [trizdq+ebp-4],mm1 |
797 | movq [trizdq+ebp-4],mm1 |
798 | end if |
798 | end if |
799 | mov ecx,edx ; i; direction |
799 | mov ecx,edx ; i; direction |
800 | mov ebx,[trizdd+ebp]; trizdd[j] |
800 | mov ebx,[trizdd+ebp]; trizdd[j] |
801 | .loop: |
801 | .loop: |
802 | sub ecx,8 ; direction |
802 | sub ecx,8 ; direction |
803 | cmp [trizdd+ecx],ebx |
803 | cmp [trizdd+ecx],ebx |
804 | jl .loop ; direction |
804 | jl .loop ; direction |
805 | @@: |
805 | @@: |
806 | add ebp,8 ; direction |
806 | add ebp,8 ; direction |
807 | cmp [trizdd+ebp],ebx |
807 | cmp [trizdd+ebp],ebx |
808 | jg @b ; direction |
808 | jg @b ; direction |
809 | cmp ebp,ecx |
809 | cmp ebp,ecx |
810 | jge @f ; direction |
810 | jge @f ; direction |
811 | if Ext=NON |
811 | if Ext=NON |
812 | mov esi,[trizdd+ecx] |
812 | mov esi,[trizdd+ecx] |
813 | mov edi,[trizdd+ebp] |
813 | mov edi,[trizdd+ebp] |
814 | mov [trizdd+ebp],esi |
814 | mov [trizdd+ebp],esi |
815 | mov [trizdd+ecx],edi |
815 | mov [trizdd+ecx],edi |
816 | mov edi,[trizdd+ecx-4] |
816 | mov edi,[trizdd+ecx-4] |
817 | mov esi,[trizdd+ebp-4] |
817 | mov esi,[trizdd+ebp-4] |
818 | mov [trizdd+ebp-4],edi |
818 | mov [trizdd+ebp-4],edi |
819 | mov [trizdd+ecx-4],esi |
819 | mov [trizdd+ecx-4],esi |
820 | else |
820 | else |
821 | movq mm0,[trizdq+ecx-4] |
821 | movq mm0,[trizdq+ecx-4] |
822 | movq mm1,[trizdq+ebp-4] |
822 | movq mm1,[trizdq+ebp-4] |
823 | movq [trizdq+ebp-4],mm0 |
823 | movq [trizdq+ebp-4],mm0 |
824 | movq [trizdq+ecx-4],mm1 |
824 | movq [trizdq+ecx-4],mm1 |
825 | end if |
825 | end if |
826 | jmp .loop |
826 | jmp .loop |
827 | @@: |
827 | @@: |
828 | if Ext=NON |
828 | if Ext=NON |
829 | mov esi,[trizdd+ecx] |
829 | mov esi,[trizdd+ecx] |
830 | mov edi,[trizdd+eax+8] |
830 | mov edi,[trizdd+eax+8] |
831 | mov [trizdd+eax+8],esi |
831 | mov [trizdd+eax+8],esi |
832 | mov [trizdd+ecx],edi |
832 | mov [trizdd+ecx],edi |
833 | mov edi,[trizdd+ecx-4] |
833 | mov edi,[trizdd+ecx-4] |
834 | mov esi,[trizdd+eax+4] |
834 | mov esi,[trizdd+eax+4] |
835 | mov [trizdd+eax+4],edi |
835 | mov [trizdd+eax+4],edi |
836 | mov [trizdd+ecx-4],esi |
836 | mov [trizdd+ecx-4],esi |
837 | else |
837 | else |
838 | movq mm0,[trizdq+ecx-4] |
838 | movq mm0,[trizdq+ecx-4] |
839 | movq mm1,[trizdq+eax+4]; dir |
839 | movq mm1,[trizdq+eax+4]; dir |
840 | movq [trizdq+eax+4],mm0; dir |
840 | movq [trizdq+eax+4],mm0; dir |
841 | movq [trizdq+ecx-4],mm1 |
841 | movq [trizdq+ecx-4],mm1 |
842 | end if |
842 | end if |
843 | add ecx,8 |
843 | add ecx,8 |
844 | push ecx edx |
844 | push ecx edx |
845 | mov edx,ebp |
845 | mov edx,ebp |
846 | call quicksort |
846 | call quicksort |
847 | pop edx eax |
847 | pop edx eax |
848 | call quicksort |
848 | call quicksort |
849 | .exit: |
849 | .exit: |
850 | ret |
850 | ret |
851 | insertsort: |
851 | insertsort: |
852 | mov esi,eax |
852 | mov esi,eax |
853 | .start: |
853 | .start: |
854 | add esi,8 |
854 | add esi,8 |
855 | cmp esi,edx |
855 | cmp esi,edx |
856 | ja .exit |
856 | ja .exit |
857 | mov ebx,[trizdd+esi] |
857 | mov ebx,[trizdd+esi] |
858 | if Ext=NON |
858 | if Ext=NON |
859 | mov ecx,[trizdd+esi-4] |
859 | mov ecx,[trizdd+esi-4] |
860 | else |
860 | else |
861 | movq mm1,[trizdq+esi-4] |
861 | movq mm1,[trizdq+esi-4] |
862 | end if |
862 | end if |
863 | mov edi,esi |
863 | mov edi,esi |
864 | @@: |
864 | @@: |
865 | cmp edi,eax |
865 | cmp edi,eax |
866 | jna @f |
866 | jna @f |
867 | cmp [trizdd+edi-8],ebx |
867 | cmp [trizdd+edi-8],ebx |
868 | jg @f ; direction |
868 | jg @f ; direction |
869 | if Ext=NON |
869 | if Ext=NON |
870 | mov ebp,[trizdd+edi-8] |
870 | mov ebp,[trizdd+edi-8] |
871 | mov [trizdd+edi],ebp |
871 | mov [trizdd+edi],ebp |
872 | mov ebp,[trizdd+edi-12] |
872 | mov ebp,[trizdd+edi-12] |
873 | mov [trizdd+edi-4],ebp |
873 | mov [trizdd+edi-4],ebp |
874 | else |
874 | else |
875 | movq mm0,[trizdq+edi-12] |
875 | movq mm0,[trizdq+edi-12] |
876 | movq [trizdq+edi-4],mm0 |
876 | movq [trizdq+edi-4],mm0 |
877 | end if |
877 | end if |
878 | sub edi,8 |
878 | sub edi,8 |
879 | jmp @b |
879 | jmp @b |
880 | @@: |
880 | @@: |
881 | if Ext=NON |
881 | if Ext=NON |
882 | mov [trizdd+edi],ebx |
882 | mov [trizdd+edi],ebx |
883 | mov [trizdd+edi-4],ecx |
883 | mov [trizdd+edi-4],ecx |
884 | else |
884 | else |
885 | movq [trizdq+edi-4],mm1 |
885 | movq [trizdq+edi-4],mm1 |
886 | end if |
886 | end if |
887 | jmp .start |
887 | jmp .start |
888 | .exit: |
888 | .exit: |
889 | ret |
889 | ret |
890 | end_sort: |
890 | end_sort: |
891 | ; translate triangles_with_z to sorted_triangles |
891 | ; translate triangles_with_z to sorted_triangles |
892 | mov esi,triangles_with_z |
892 | mov esi,triangles_with_z |
893 | ; mov edi,sorted_triangles |
893 | ; mov edi,sorted_triangles |
894 | mov edi,triangles |
894 | mov edi,triangles |
895 | again_copy: |
895 | again_copy: |
896 | if Ext=NON |
896 | if Ext=NON |
897 | movsd |
897 | movsd |
898 | movsw |
898 | movsw |
899 | add esi,2 |
899 | add esi,2 |
900 | else |
900 | else |
901 | movq mm0,[esi] |
901 | movq mm0,[esi] |
902 | movq [edi],mm0 |
902 | movq [edi],mm0 |
903 | add esi,8 |
903 | add esi,8 |
904 | add edi,6 |
904 | add edi,6 |
905 | end if |
905 | end if |
906 | cmp dword[esi],-1 |
906 | cmp dword[esi],-1 |
907 | jne again_copy |
907 | jne again_copy |
908 | ; if Ext=MMX |
908 | ; if Ext=MMX |
909 | ; emms |
909 | ; emms |
910 | ; end if |
910 | ; end if |
911 | movsd ; copy end mark too |
911 | movsd ; copy end mark too |
912 | ret |
912 | ret |
913 | 913 | ||
914 | clrscr: |
914 | clrscr: |
915 | mov edi,screen |
915 | mov edi,screen |
916 | mov ecx,SIZE_X*SIZE_Y*3/4 |
916 | mov ecx,SIZE_X*SIZE_Y*3/4 |
917 | xor eax,eax |
917 | xor eax,eax |
918 | if Ext=NON |
918 | if Ext=NON |
919 | rep stosd |
919 | rep stosd |
920 | else |
920 | else |
921 | pxor mm0,mm0 |
921 | pxor mm0,mm0 |
922 | @@: |
922 | @@: |
923 | movq [edi+00],mm0 |
923 | movq [edi+00],mm0 |
924 | movq [edi+08],mm0 |
924 | movq [edi+08],mm0 |
925 | movq [edi+16],mm0 |
925 | movq [edi+16],mm0 |
926 | movq [edi+24],mm0 |
926 | movq [edi+24],mm0 |
927 | add edi,32 |
927 | add edi,32 |
928 | sub ecx,8 |
928 | sub ecx,8 |
929 | jnc @b |
929 | jnc @b |
930 | end if |
930 | end if |
931 | ret |
931 | ret |
932 | 932 | ||
933 | calculate_angle: |
933 | calculate_angle: |
934 | fninit |
934 | fninit |
935 | ; fldpi |
935 | ; fldpi |
936 | ; fidiv [i180] |
936 | ; fidiv [i180] |
937 | fld [piD180] |
937 | fld [piD180] |
938 | fimul [angle_counter] |
938 | fimul [angle_counter] |
939 | fsincos |
939 | fsincos |
940 | fstp [sinbeta] |
940 | fstp [sinbeta] |
941 | fstp [cosbeta] |
941 | fstp [cosbeta] |
942 | inc [angle_counter] |
942 | inc [angle_counter] |
943 | cmp [angle_counter],360 |
943 | cmp [angle_counter],360 |
944 | jne end_calc_angle |
944 | jne end_calc_angle |
945 | mov [angle_counter],0 |
945 | mov [angle_counter],0 |
946 | end_calc_angle: |
946 | end_calc_angle: |
947 | ret |
947 | ret |
948 | 948 | ||
949 | rotate_points: |
949 | rotate_points: |
950 | fninit |
950 | fninit |
951 | mov ebx,points_rotated |
951 | mov ebx,points_rotated |
952 | again_r: |
952 | again_r: |
953 | cmp [r_flag],1 |
953 | cmp [r_flag],1 |
954 | je .z_rot |
954 | je .z_rot |
955 | cmp [r_flag],2 |
955 | cmp [r_flag],2 |
956 | je .x_rot |
956 | je .x_rot |
957 | .y_rot: |
957 | .y_rot: |
958 | mov eax,[ebx+2] ;z |
958 | mov eax,[ebx+2] ;z |
959 | mov ax,word[ebx] ;x |
959 | mov ax,word[ebx] ;x |
960 | sub eax,dword[xo] |
960 | sub eax,dword[xo] |
961 | mov dword[xsub],eax |
961 | mov dword[xsub],eax |
962 | fld [sinbeta] |
962 | fld [sinbeta] |
963 | fimul [zsub] |
963 | fimul [zsub] |
964 | fchs |
964 | fchs |
965 | fld [cosbeta] |
965 | fld [cosbeta] |
966 | fimul [xsub] |
966 | fimul [xsub] |
967 | faddp |
967 | faddp |
968 | fiadd [xo] |
968 | fiadd [xo] |
969 | fistp word[ebx] ;x |
969 | fistp word[ebx] ;x |
970 | fld [sinbeta] |
970 | fld [sinbeta] |
971 | fimul [xsub] |
971 | fimul [xsub] |
972 | fld [cosbeta] |
972 | fld [cosbeta] |
973 | fimul [zsub] |
973 | fimul [zsub] |
974 | faddp |
974 | faddp |
975 | fiadd [zo] |
975 | fiadd [zo] |
976 | fistp word[ebx+4] ;z |
976 | fistp word[ebx+4] ;z |
977 | jmp .end_rot |
977 | jmp .end_rot |
978 | .z_rot: |
978 | .z_rot: |
979 | mov ax,word[ebx] |
979 | mov ax,word[ebx] |
980 | sub ax,word[xo] ;need optimization |
980 | sub ax,word[xo] ;need optimization |
981 | mov [xsub],ax |
981 | mov [xsub],ax |
982 | mov ax,word[ebx+2] |
982 | mov ax,word[ebx+2] |
983 | sub ax,word[yo] |
983 | sub ax,word[yo] |
984 | mov [ysub],ax |
984 | mov [ysub],ax |
985 | fld [sinbeta] |
985 | fld [sinbeta] |
986 | fimul [ysub] |
986 | fimul [ysub] |
987 | fld [cosbeta] |
987 | fld [cosbeta] |
988 | fimul [xsub] |
988 | fimul [xsub] |
989 | faddp |
989 | faddp |
990 | fiadd [xo] |
990 | fiadd [xo] |
991 | fistp word[ebx] |
991 | fistp word[ebx] |
992 | fld [cosbeta] |
992 | fld [cosbeta] |
993 | fimul [ysub] |
993 | fimul [ysub] |
994 | fld [sinbeta] |
994 | fld [sinbeta] |
995 | fimul [xsub] |
995 | fimul [xsub] |
996 | fchs |
996 | fchs |
997 | faddp |
997 | faddp |
998 | fiadd [yo] |
998 | fiadd [yo] |
999 | fistp word[ebx+2] |
999 | fistp word[ebx+2] |
1000 | jmp .end_rot |
1000 | jmp .end_rot |
1001 | .x_rot: |
1001 | .x_rot: |
1002 | mov ax,word[ebx+2] |
1002 | mov ax,word[ebx+2] |
1003 | sub ax,[yo] |
1003 | sub ax,[yo] |
1004 | mov [ysub],ax |
1004 | mov [ysub],ax |
1005 | mov ax,word[ebx+4] |
1005 | mov ax,word[ebx+4] |
1006 | sub ax,word[zo] |
1006 | sub ax,word[zo] |
1007 | mov [zsub],ax |
1007 | mov [zsub],ax |
1008 | fld [sinbeta] |
1008 | fld [sinbeta] |
1009 | fimul [zsub] |
1009 | fimul [zsub] |
1010 | fld [cosbeta] |
1010 | fld [cosbeta] |
1011 | fimul [ysub] |
1011 | fimul [ysub] |
1012 | faddp |
1012 | faddp |
1013 | fiadd [yo] |
1013 | fiadd [yo] |
1014 | fistp word[ebx+2];y |
1014 | fistp word[ebx+2];y |
1015 | fld [cosbeta] |
1015 | fld [cosbeta] |
1016 | fimul [zsub] |
1016 | fimul [zsub] |
1017 | fld [sinbeta] |
1017 | fld [sinbeta] |
1018 | fimul [ysub] |
1018 | fimul [ysub] |
1019 | fchs |
1019 | fchs |
1020 | faddp |
1020 | faddp |
1021 | fiadd [zo] |
1021 | fiadd [zo] |
1022 | fistp word[ebx+4] |
1022 | fistp word[ebx+4] |
1023 | .end_rot: |
1023 | .end_rot: |
1024 | add ebx,6 |
1024 | add ebx,6 |
1025 | cmp dword[ebx],-1 |
1025 | cmp dword[ebx],-1 |
1026 | jne again_r |
1026 | jne again_r |
1027 | ret |
1027 | ret |
1028 | 1028 | ||
1029 | draw_triangles: |
1029 | draw_triangles: |
1030 | mov esi,triangles |
1030 | mov esi,triangles |
1031 | .again_dts: |
1031 | .again_dts: |
1032 | mov ebp,points_rotated |
1032 | mov ebp,points_rotated |
1033 | if Ext=NON |
1033 | if Ext=NON |
1034 | movzx eax,word[esi] |
1034 | movzx eax,word[esi] |
1035 | mov [point_index1],ax |
1035 | mov [point_index1],ax |
1036 | lea eax,[eax*3] |
1036 | lea eax,[eax*3] |
1037 | add eax,eax |
1037 | add eax,eax |
1038 | push ebp |
1038 | push ebp |
1039 | add ebp,eax |
1039 | add ebp,eax |
1040 | mov eax,[ebp] |
1040 | mov eax,[ebp] |
1041 | mov dword[xx1],eax |
1041 | mov dword[xx1],eax |
1042 | mov eax,[ebp+4] |
1042 | mov eax,[ebp+4] |
1043 | mov [zz1],ax |
1043 | mov [zz1],ax |
1044 | pop ebp |
1044 | pop ebp |
1045 | 1045 | ||
1046 | 1046 | ||
1047 | movzx eax,word[esi+2] |
1047 | movzx eax,word[esi+2] |
1048 | mov [point_index2],ax |
1048 | mov [point_index2],ax |
1049 | lea eax,[eax*3] |
1049 | lea eax,[eax*3] |
1050 | add eax,eax |
1050 | add eax,eax |
1051 | push ebp |
1051 | push ebp |
1052 | add ebp,eax |
1052 | add ebp,eax |
1053 | mov eax,[ebp] |
1053 | mov eax,[ebp] |
1054 | mov dword[xx2],eax |
1054 | mov dword[xx2],eax |
1055 | mov eax,[ebp+4] |
1055 | mov eax,[ebp+4] |
1056 | mov [zz2],ax |
1056 | mov [zz2],ax |
1057 | pop ebp |
1057 | pop ebp |
1058 | 1058 | ||
1059 | 1059 | ||
1060 | movzx eax,word[esi+4] ; xyz3 = [ebp+[esi+4]*6] |
1060 | movzx eax,word[esi+4] ; xyz3 = [ebp+[esi+4]*6] |
1061 | mov [point_index3],ax |
1061 | mov [point_index3],ax |
1062 | lea eax,[eax*3] |
1062 | lea eax,[eax*3] |
1063 | add eax,eax |
1063 | add eax,eax |
1064 | ; push ebp |
1064 | ; push ebp |
1065 | add ebp,eax |
1065 | add ebp,eax |
1066 | mov eax,[ebp] |
1066 | mov eax,[ebp] |
1067 | mov dword[xx3],eax |
1067 | mov dword[xx3],eax |
1068 | mov eax,[ebp+4] |
1068 | mov eax,[ebp+4] |
1069 | mov [zz3],ax |
1069 | mov [zz3],ax |
1070 | else |
1070 | else |
1071 | mov eax,dword[esi] ; don't know MMX |
1071 | mov eax,dword[esi] ; don't know MMX |
1072 | mov dword[point_index1],eax |
1072 | mov dword[point_index1],eax |
1073 | ; shr eax,16 |
1073 | ; shr eax,16 |
1074 | ; mov [point_index2],ax |
1074 | ; mov [point_index2],ax |
1075 | mov ax,word[esi+4] |
1075 | mov ax,word[esi+4] |
1076 | mov [point_index3],ax |
1076 | mov [point_index3],ax |
1077 | movq mm0,[esi] |
1077 | movq mm0,[esi] |
1078 | pmullw mm0,qword[const6] |
1078 | pmullw mm0,qword[const6] |
1079 | movd eax,mm0 |
1079 | movd eax,mm0 |
1080 | psrlq mm0,16 |
1080 | psrlq mm0,16 |
1081 | movd ebx,mm0 |
1081 | movd ebx,mm0 |
1082 | psrlq mm0,16 |
1082 | psrlq mm0,16 |
1083 | movd ecx,mm0 |
1083 | movd ecx,mm0 |
1084 | and eax,0FFFFh |
1084 | and eax,0FFFFh |
1085 | and ebx,0FFFFh |
1085 | and ebx,0FFFFh |
1086 | and ecx,0FFFFh |
1086 | and ecx,0FFFFh |
1087 | movq mm0,[ebp+eax] |
1087 | movq mm0,[ebp+eax] |
1088 | movq mm1,[ebp+ebx] |
1088 | movq mm1,[ebp+ebx] |
1089 | movq mm2,[ebp+ecx] |
1089 | movq mm2,[ebp+ecx] |
1090 | movq qword[xx1],mm0 |
1090 | movq qword[xx1],mm0 |
1091 | movq qword[xx2],mm1 |
1091 | movq qword[xx2],mm1 |
1092 | movq qword[xx3],mm2 |
1092 | movq qword[xx3],mm2 |
1093 | ; emms |
1093 | ; emms |
1094 | end if |
1094 | end if |
1095 | push esi |
1095 | push esi |
1096 | ; culling |
1096 | ; culling |
1097 | fninit |
1097 | fninit |
1098 | mov esi,point_index1 |
1098 | mov esi,point_index1 |
1099 | mov ecx,3 |
1099 | mov ecx,3 |
1100 | @@: |
1100 | @@: |
1101 | movzx eax,word[esi] |
1101 | movzx eax,word[esi] |
1102 | lea eax,[eax*3] |
1102 | lea eax,[eax*3] |
1103 | shl eax,2 |
1103 | shl eax,2 |
1104 | lea eax,[eax+point_normals_rotated] |
1104 | lea eax,[eax+point_normals_rotated] |
1105 | fld dword[eax+8] ; I check Z element of normal vector |
1105 | fld dword[eax+8] ; I check Z element of normal vector |
1106 | ftst |
1106 | ftst |
1107 | fstsw ax |
1107 | fstsw ax |
1108 | sahf |
1108 | sahf |
1109 | jb @f |
1109 | jb @f |
1110 | ffree st |
1110 | ffree st |
1111 | loop @b |
1111 | loop @b |
1112 | jmp .end_draw |
1112 | jmp .end_draw |
1113 | @@: |
1113 | @@: |
1114 | ffree st ;is visable |
1114 | ffree st ;is visable |
1115 | 1115 | ||
1116 | cmp [dr_flag],0 ; draw type flag |
1116 | cmp [dr_flag],0 ; draw type flag |
1117 | je .flat_draw |
1117 | je .flat_draw |
1118 | cmp [dr_flag],2 |
1118 | cmp [dr_flag],2 |
1119 | je .env_mapping |
1119 | je .env_mapping |
1120 | cmp [dr_flag],3 |
1120 | cmp [dr_flag],3 |
1121 | je .bump_mapping |
1121 | je .bump_mapping |
1122 | 1122 | ||
1123 | cmp [catmull_flag],1 |
1123 | cmp [catmull_flag],1 |
1124 | je @f |
1124 | je @f |
1125 | 1125 | ||
1126 | movzx edi,[point_index3] ; do gouraud shading catmull off |
1126 | movzx edi,[point_index3] ; do gouraud shading catmull off |
1127 | lea edi,[edi*3] |
1127 | lea edi,[edi*3] |
1128 | lea edi,[points_color+edi*2] |
1128 | lea edi,[points_color+edi*2] |
1129 | push word[edi] |
1129 | push word[edi] |
1130 | push word[edi+2] |
1130 | push word[edi+2] |
1131 | push word[edi+4] |
1131 | push word[edi+4] |
1132 | movzx edi,[point_index2] |
1132 | movzx edi,[point_index2] |
1133 | lea edi,[edi*3] |
1133 | lea edi,[edi*3] |
1134 | lea edi,[points_color+edi*2] |
1134 | lea edi,[points_color+edi*2] |
1135 | push word[edi] |
1135 | push word[edi] |
1136 | push word[edi+2] |
1136 | push word[edi+2] |
1137 | push word[edi+4] |
1137 | push word[edi+4] |
1138 | movzx edi,[point_index1] |
1138 | movzx edi,[point_index1] |
1139 | lea edi,[edi*3] |
1139 | lea edi,[edi*3] |
1140 | lea edi,[points_color+edi*2] |
1140 | lea edi,[points_color+edi*2] |
1141 | push word[edi] |
1141 | push word[edi] |
1142 | push word[edi+2] |
1142 | push word[edi+2] |
1143 | push word[edi+4] |
1143 | push word[edi+4] |
1144 | jmp .both_draw |
1144 | jmp .both_draw |
1145 | @@: |
1145 | @@: |
1146 | movzx edi,[point_index3] ; do gouraud shading catmull on |
1146 | movzx edi,[point_index3] ; do gouraud shading catmull on |
1147 | lea edi,[edi*3] |
1147 | lea edi,[edi*3] |
1148 | lea edi,[points_color+edi*2] |
1148 | lea edi,[points_color+edi*2] |
1149 | push [zz3] |
1149 | push [zz3] |
1150 | push word[edi] |
1150 | push word[edi] |
1151 | push word[edi+2] |
1151 | push word[edi+2] |
1152 | push word[edi+4] |
1152 | push word[edi+4] |
1153 | movzx edi,[point_index2] |
1153 | movzx edi,[point_index2] |
1154 | lea edi,[edi*3] |
1154 | lea edi,[edi*3] |
1155 | lea edi,[points_color+edi*2] |
1155 | lea edi,[points_color+edi*2] |
1156 | push [zz2] |
1156 | push [zz2] |
1157 | push word[edi] |
1157 | push word[edi] |
1158 | push word[edi+2] |
1158 | push word[edi+2] |
1159 | push word[edi+4] |
1159 | push word[edi+4] |
1160 | movzx edi,[point_index1] |
1160 | movzx edi,[point_index1] |
1161 | lea edi,[edi*3] |
1161 | lea edi,[edi*3] |
1162 | lea edi,[points_color+edi*2] |
1162 | lea edi,[points_color+edi*2] |
1163 | push [zz1] |
1163 | push [zz1] |
1164 | push word[edi] |
1164 | push word[edi] |
1165 | push word[edi+2] |
1165 | push word[edi+2] |
1166 | push word[edi+4] |
1166 | push word[edi+4] |
1167 | 1167 | ||
1168 | ; movzx edi,[point_index3] ;gouraud shading according to light vector |
1168 | ; movzx edi,[point_index3] ;gouraud shading according to light vector |
1169 | ; lea edi,[edi*3] |
1169 | ; lea edi,[edi*3] |
1170 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
1170 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
1171 | ; mov esi,light_vector |
1171 | ; mov esi,light_vector |
1172 | ; call dot_product |
1172 | ; call dot_product |
1173 | ; fabs |
1173 | ; fabs |
1174 | ; fimul [max_color_r] |
1174 | ; fimul [max_color_r] |
1175 | ; fistp [temp_col] |
1175 | ; fistp [temp_col] |
1176 | ; and [temp_col],0x00ff |
1176 | ; and [temp_col],0x00ff |
1177 | ; push [temp_col] |
1177 | ; push [temp_col] |
1178 | ; push [temp_col] |
1178 | ; push [temp_col] |
1179 | ; push [temp_col] |
1179 | ; push [temp_col] |
1180 | 1180 | ||
1181 | ; movzx edi,[point_index2] |
1181 | ; movzx edi,[point_index2] |
1182 | ; lea edi,[edi*3] |
1182 | ; lea edi,[edi*3] |
1183 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
1183 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
1184 | ; mov esi,light_vector |
1184 | ; mov esi,light_vector |
1185 | ; call dot_product |
1185 | ; call dot_product |
1186 | ; fabs |
1186 | ; fabs |
1187 | ; fimul [max_color_r] |
1187 | ; fimul [max_color_r] |
1188 | ; fistp [temp_col] |
1188 | ; fistp [temp_col] |
1189 | ; and [temp_col],0x00ff |
1189 | ; and [temp_col],0x00ff |
1190 | ; push [temp_col] |
1190 | ; push [temp_col] |
1191 | ; push [temp_col] |
1191 | ; push [temp_col] |
1192 | ; push [temp_col] |
1192 | ; push [temp_col] |
1193 | 1193 | ||
1194 | ; movzx edi,[point_index1] |
1194 | ; movzx edi,[point_index1] |
1195 | ; lea edi,[edi*3] |
1195 | ; lea edi,[edi*3] |
1196 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
1196 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
1197 | ; mov esi,light_vector |
1197 | ; mov esi,light_vector |
1198 | ; call dot_product |
1198 | ; call dot_product |
1199 | ; fabs |
1199 | ; fabs |
1200 | ; fimul [max_color_r] |
1200 | ; fimul [max_color_r] |
1201 | ; fistp [temp_col] |
1201 | ; fistp [temp_col] |
1202 | ; and [temp_col],0x00ff |
1202 | ; and [temp_col],0x00ff |
1203 | ; push [temp_col] |
1203 | ; push [temp_col] |
1204 | ; push [temp_col] |
1204 | ; push [temp_col] |
1205 | ; push [temp_col] |
1205 | ; push [temp_col] |
1206 | 1206 | ||
1207 | ; xor edx,edx ; draw acording to position |
1207 | ; xor edx,edx ; draw acording to position |
1208 | ; mov ax,[zz3] |
1208 | ; mov ax,[zz3] |
1209 | ; add ax,128 |
1209 | ; add ax,128 |
1210 | ; neg al |
1210 | ; neg al |
1211 | ; and ax,0x00ff |
1211 | ; and ax,0x00ff |
1212 | ; push ax |
1212 | ; push ax |
1213 | ; neg al |
1213 | ; neg al |
1214 | ; push ax |
1214 | ; push ax |
1215 | ; mov dx,[yy3] |
1215 | ; mov dx,[yy3] |
1216 | ; and dx,0x00ff |
1216 | ; and dx,0x00ff |
1217 | ; push dx |
1217 | ; push dx |
1218 | ; mov ax,[zz2] |
1218 | ; mov ax,[zz2] |
1219 | ; add ax,128 |
1219 | ; add ax,128 |
1220 | ; neg al |
1220 | ; neg al |
1221 | ; and ax,0x00ff |
1221 | ; and ax,0x00ff |
1222 | ; push ax |
1222 | ; push ax |
1223 | ; neg al |
1223 | ; neg al |
1224 | ; push ax |
1224 | ; push ax |
1225 | ; mov dx,[yy2] |
1225 | ; mov dx,[yy2] |
1226 | ; and dx,0x00ff |
1226 | ; and dx,0x00ff |
1227 | ; push dx |
1227 | ; push dx |
1228 | ; mov ax,[zz1] |
1228 | ; mov ax,[zz1] |
1229 | ; add ax,128 |
1229 | ; add ax,128 |
1230 | ; neg al |
1230 | ; neg al |
1231 | ; and ax,0x00ff |
1231 | ; and ax,0x00ff |
1232 | ; push ax |
1232 | ; push ax |
1233 | ; neg al |
1233 | ; neg al |
1234 | ; push ax |
1234 | ; push ax |
1235 | ; mov dx,[yy1] |
1235 | ; mov dx,[yy1] |
1236 | ; and dx,0x00ff |
1236 | ; and dx,0x00ff |
1237 | ; push dx |
1237 | ; push dx |
1238 | .both_draw: |
1238 | .both_draw: |
1239 | mov eax,dword[xx1] |
1239 | mov eax,dword[xx1] |
1240 | ror eax,16 |
1240 | ror eax,16 |
1241 | mov ebx,dword[xx2] |
1241 | mov ebx,dword[xx2] |
1242 | ror ebx,16 |
1242 | ror ebx,16 |
1243 | mov ecx,dword[xx3] |
1243 | mov ecx,dword[xx3] |
1244 | ror ecx,16 |
1244 | ror ecx,16 |
1245 | lea edi,[screen] |
1245 | lea edi,[screen] |
1246 | cmp [catmull_flag],0 |
1246 | cmp [catmull_flag],0 |
1247 | je @f |
1247 | je @f |
1248 | lea esi,[Z_buffer] |
1248 | lea esi,[Z_buffer] |
1249 | call gouraud_triangle_z |
1249 | call gouraud_triangle_z |
1250 | jmp .end_draw |
1250 | jmp .end_draw |
1251 | @@: |
1251 | @@: |
1252 | call gouraud_triangle |
1252 | call gouraud_triangle |
1253 | jmp .end_draw |
1253 | jmp .end_draw |
1254 | 1254 | ||
1255 | .flat_draw: |
1255 | .flat_draw: |
1256 | movzx edi,[point_index3] |
1256 | movzx edi,[point_index3] |
1257 | lea edi,[edi*3] |
1257 | lea edi,[edi*3] |
1258 | lea edi,[points_color+edi*2] |
1258 | lea edi,[points_color+edi*2] |
1259 | movzx eax,word[edi] |
1259 | movzx eax,word[edi] |
1260 | movzx ebx,word[edi+2] |
1260 | movzx ebx,word[edi+2] |
1261 | movzx ecx,word[edi+4] |
1261 | movzx ecx,word[edi+4] |
1262 | movzx edi,[point_index2] |
1262 | movzx edi,[point_index2] |
1263 | lea edi,[edi*3] |
1263 | lea edi,[edi*3] |
1264 | lea edi,[points_color+edi*2] |
1264 | lea edi,[points_color+edi*2] |
1265 | add ax,word[edi] |
1265 | add ax,word[edi] |
1266 | add bx,word[edi+2] |
1266 | add bx,word[edi+2] |
1267 | add cx,word[edi+4] |
1267 | add cx,word[edi+4] |
1268 | movzx edi,[point_index1] |
1268 | movzx edi,[point_index1] |
1269 | lea edi,[edi*3] |
1269 | lea edi,[edi*3] |
1270 | lea edi,[points_color+edi*2] |
1270 | lea edi,[points_color+edi*2] |
1271 | add ax,word[edi] |
1271 | add ax,word[edi] |
1272 | add bx,word[edi+2] |
1272 | add bx,word[edi+2] |
1273 | add cx,word[edi+4] |
1273 | add cx,word[edi+4] |
1274 | cwd |
1274 | cwd |
1275 | idiv [i3] |
1275 | idiv [i3] |
1276 | mov di,ax |
1276 | mov di,ax |
1277 | shl edi,16 |
1277 | shl edi,16 |
1278 | mov ax,bx |
1278 | mov ax,bx |
1279 | cwd |
1279 | cwd |
1280 | idiv [i3] |
1280 | idiv [i3] |
1281 | mov di,ax |
1281 | mov di,ax |
1282 | shl di,8 |
1282 | shl di,8 |
1283 | mov ax,cx |
1283 | mov ax,cx |
1284 | cwd |
1284 | cwd |
1285 | idiv [i3] |
1285 | idiv [i3] |
1286 | mov edx,edi |
1286 | mov edx,edi |
1287 | mov dl,al |
1287 | mov dl,al |
1288 | and edx,0x00ffffff |
1288 | and edx,0x00ffffff |
1289 | 1289 | ||
1290 | 1290 | ||
1291 | ; mov ax,[zz1] ; z position depend draw |
1291 | ; mov ax,[zz1] ; z position depend draw |
1292 | ; add ax,[zz2] |
1292 | ; add ax,[zz2] |
1293 | ; add ax,[zz3] |
1293 | ; add ax,[zz3] |
1294 | ; cwd |
1294 | ; cwd |
1295 | ; idiv [i3] ; = -((a+b+c)/3+130) |
1295 | ; idiv [i3] ; = -((a+b+c)/3+130) |
1296 | ; add ax,130 |
1296 | ; add ax,130 |
1297 | ; neg al |
1297 | ; neg al |
1298 | ; xor edx,edx |
1298 | ; xor edx,edx |
1299 | ; mov ah,al ;set color according to z position |
1299 | ; mov ah,al ;set color according to z position |
1300 | ; shl eax,8 |
1300 | ; shl eax,8 |
1301 | ; mov edx,eax |
1301 | ; mov edx,eax |
1302 | 1302 | ||
1303 | mov eax,dword[xx1] |
1303 | mov eax,dword[xx1] |
1304 | ror eax,16 |
1304 | ror eax,16 |
1305 | mov ebx,dword[xx2] |
1305 | mov ebx,dword[xx2] |
1306 | ror ebx,16 |
1306 | ror ebx,16 |
1307 | mov ecx,dword[xx3] |
1307 | mov ecx,dword[xx3] |
1308 | ror ecx,16 |
1308 | ror ecx,16 |
1309 | ; mov edi,screen |
1309 | ; mov edi,screen |
1310 | lea edi,[screen] |
1310 | lea edi,[screen] |
1311 | cmp [catmull_flag],0 |
1311 | cmp [catmull_flag],0 |
1312 | je @f |
1312 | je @f |
1313 | lea esi,[Z_buffer] |
1313 | lea esi,[Z_buffer] |
1314 | push word[zz3] |
1314 | push word[zz3] |
1315 | push word[zz2] |
1315 | push word[zz2] |
1316 | push word[zz1] |
1316 | push word[zz1] |
1317 | call flat_triangle_z |
1317 | call flat_triangle_z |
1318 | jmp .end_draw |
1318 | jmp .end_draw |
1319 | @@: |
1319 | @@: |
1320 | call draw_triangle |
1320 | call draw_triangle |
1321 | jmp .end_draw |
1321 | jmp .end_draw |
1322 | .env_mapping: |
1322 | .env_mapping: |
1323 | ; fninit |
1323 | ; fninit |
1324 | cmp [catmull_flag],0 |
1324 | cmp [catmull_flag],0 |
1325 | je @f |
1325 | je @f |
1326 | push [zz3] |
1326 | push [zz3] |
1327 | push [zz2] |
1327 | push [zz2] |
1328 | push [zz1] |
1328 | push [zz1] |
1329 | @@: |
1329 | @@: |
1330 | mov esi,point_index1 |
1330 | mov esi,point_index1 |
1331 | sub esp,12 |
1331 | sub esp,12 |
1332 | mov edi,esp |
1332 | mov edi,esp |
1333 | mov ecx,3 |
1333 | mov ecx,3 |
1334 | @@: |
1334 | @@: |
1335 | movzx eax,word[esi] |
1335 | movzx eax,word[esi] |
1336 | lea eax,[eax*3] |
1336 | lea eax,[eax*3] |
1337 | shl eax,2 |
1337 | shl eax,2 |
1338 | add eax,point_normals_rotated |
1338 | add eax,point_normals_rotated |
1339 | ; texture x=(rotated point normal -> x * 255)+255 |
1339 | ; texture x=(rotated point normal -> x * 255)+255 |
1340 | fld dword[eax] |
1340 | fld dword[eax] |
1341 | fimul [correct_tex] |
1341 | fimul [correct_tex] |
1342 | fiadd [correct_tex] |
1342 | fiadd [correct_tex] |
1343 | fistp word[edi] |
1343 | fistp word[edi] |
1344 | ; texture y=(rotated point normal -> y * 255)+255 |
1344 | ; texture y=(rotated point normal -> y * 255)+255 |
1345 | fld dword[eax+4] |
1345 | fld dword[eax+4] |
1346 | fimul [correct_tex] |
1346 | fimul [correct_tex] |
1347 | fiadd [correct_tex] |
1347 | fiadd [correct_tex] |
1348 | fistp word[edi+2] |
1348 | fistp word[edi+2] |
1349 | 1349 | ||
1350 | add edi,4 |
1350 | add edi,4 |
1351 | add esi,2 |
1351 | add esi,2 |
1352 | loop @b |
1352 | loop @b |
1353 | 1353 | ||
1354 | mov eax,dword[xx1] |
1354 | mov eax,dword[xx1] |
1355 | ror eax,16 |
1355 | ror eax,16 |
1356 | mov ebx,dword[xx2] |
1356 | mov ebx,dword[xx2] |
1357 | ror ebx,16 |
1357 | ror ebx,16 |
1358 | mov ecx,dword[xx3] |
1358 | mov ecx,dword[xx3] |
1359 | ror ecx,16 |
1359 | ror ecx,16 |
1360 | mov edi,screen |
1360 | mov edi,screen |
1361 | mov esi,envmap |
1361 | mov esi,envmap |
1362 | cmp [catmull_flag],0 |
1362 | cmp [catmull_flag],0 |
1363 | je @f |
1363 | je @f |
1364 | mov edx,Z_buffer |
1364 | mov edx,Z_buffer |
1365 | call tex_triangle_z |
1365 | call tex_triangle_z |
1366 | jmp .end_draw |
1366 | jmp .end_draw |
1367 | @@: |
1367 | @@: |
1368 | call tex_triangle |
1368 | call tex_triangle |
1369 | jmp .end_draw |
1369 | jmp .end_draw |
1370 | .bump_mapping: |
1370 | .bump_mapping: |
1371 | ; fninit |
1371 | ; fninit |
1372 | cmp [catmull_flag],0 |
1372 | cmp [catmull_flag],0 |
1373 | je @f |
1373 | je @f |
1374 | push Z_buffer |
1374 | push Z_buffer |
1375 | push [zz3] |
1375 | push [zz3] |
1376 | push [zz2] |
1376 | push [zz2] |
1377 | push [zz1] |
1377 | push [zz1] |
1378 | @@: |
1378 | @@: |
1379 | mov esi,point_index1 |
1379 | mov esi,point_index1 |
1380 | sub esp,12 |
1380 | sub esp,12 |
1381 | mov edi,esp |
1381 | mov edi,esp |
1382 | mov ecx,3 |
1382 | mov ecx,3 |
1383 | @@: |
1383 | @@: |
1384 | movzx eax,word[esi] |
1384 | movzx eax,word[esi] |
1385 | lea eax,[eax*3] |
1385 | lea eax,[eax*3] |
1386 | shl eax,2 |
1386 | shl eax,2 |
1387 | add eax,point_normals_rotated |
1387 | add eax,point_normals_rotated |
1388 | ; texture x=(rotated point normal -> x * 255)+255 |
1388 | ; texture x=(rotated point normal -> x * 255)+255 |
1389 | fld dword[eax] |
1389 | fld dword[eax] |
1390 | fimul [correct_tex] |
1390 | fimul [correct_tex] |
1391 | fiadd [correct_tex] |
1391 | fiadd [correct_tex] |
1392 | fistp word[edi] |
1392 | fistp word[edi] |
1393 | ; texture y=(rotated point normal -> y * 255)+255 |
1393 | ; texture y=(rotated point normal -> y * 255)+255 |
1394 | fld dword[eax+4] |
1394 | fld dword[eax+4] |
1395 | fimul [correct_tex] |
1395 | fimul [correct_tex] |
1396 | fiadd [correct_tex] |
1396 | fiadd [correct_tex] |
1397 | fistp word[edi+2] |
1397 | fistp word[edi+2] |
1398 | 1398 | ||
1399 | add edi,4 |
1399 | add edi,4 |
1400 | add esi,2 |
1400 | add esi,2 |
1401 | loop @b |
1401 | loop @b |
1402 | 1402 | ||
1403 | movzx esi,[point_index3] |
1403 | movzx esi,[point_index3] |
1404 | shl esi,2 |
1404 | shl esi,2 |
1405 | add esi,tex_points |
1405 | add esi,tex_points |
1406 | push dword[esi] |
1406 | push dword[esi] |
1407 | movzx esi,[point_index2] |
1407 | movzx esi,[point_index2] |
1408 | shl esi,2 |
1408 | shl esi,2 |
1409 | add esi,tex_points |
1409 | add esi,tex_points |
1410 | ; lea esi,[esi*3] |
1410 | ; lea esi,[esi*3] |
1411 | ; lea esi,[points+2+esi*2] |
1411 | ; lea esi,[points+2+esi*2] |
1412 | push dword[esi] |
1412 | push dword[esi] |
1413 | ; push dword[xx2] |
1413 | ; push dword[xx2] |
1414 | movzx esi,[point_index1] |
1414 | movzx esi,[point_index1] |
1415 | shl esi,2 |
1415 | shl esi,2 |
1416 | add esi,tex_points |
1416 | add esi,tex_points |
1417 | ; lea esi,[esi*3] |
1417 | ; lea esi,[esi*3] |
1418 | ; lea esi,[points+2+esi*2] |
1418 | ; lea esi,[points+2+esi*2] |
1419 | push dword[esi] |
1419 | push dword[esi] |
1420 | ; push dword[xx1] |
1420 | ; push dword[xx1] |
1421 | 1421 | ||
1422 | mov eax,dword[xx1] |
1422 | mov eax,dword[xx1] |
1423 | ror eax,16 |
1423 | ror eax,16 |
1424 | mov ebx,dword[xx2] |
1424 | mov ebx,dword[xx2] |
1425 | ror ebx,16 |
1425 | ror ebx,16 |
1426 | mov ecx,dword[xx3] |
1426 | mov ecx,dword[xx3] |
1427 | ror ecx,16 |
1427 | ror ecx,16 |
1428 | mov edi,screen |
1428 | mov edi,screen |
1429 | mov esi,envmap |
1429 | mov esi,envmap |
1430 | mov edx,bumpmap ;BUMP_MAPPING |
1430 | mov edx,bumpmap ;BUMP_MAPPING |
1431 | 1431 | ||
1432 | cmp [catmull_flag],0 |
1432 | cmp [catmull_flag],0 |
1433 | je @f |
1433 | je @f |
1434 | call bump_triangle_z |
1434 | call bump_triangle_z |
1435 | jmp .end_draw |
1435 | jmp .end_draw |
1436 | @@: |
1436 | @@: |
1437 | call bump_triangle |
1437 | call bump_triangle |
1438 | 1438 | ||
1439 | .end_draw: |
1439 | .end_draw: |
1440 | pop esi |
1440 | pop esi |
1441 | add esi,6 |
1441 | add esi,6 |
1442 | cmp dword[esi],-1 |
1442 | cmp dword[esi],-1 |
1443 | jne .again_dts |
1443 | jne .again_dts |
1444 | ret |
1444 | ret |
1445 | translate_points: |
1445 | translate_points: |
1446 | ; fninit |
1446 | ; fninit |
1447 | ; mov ebx,points_rotated |
1447 | ; mov ebx,points_rotated |
1448 | ; again_trans: |
1448 | ; again_trans: |
1449 | ; fild word[ebx+4] ;z1 |
1449 | ; fild word[ebx+4] ;z1 |
1450 | ; fmul [sq] |
1450 | ; fmul [sq] |
1451 | ; fld st |
1451 | ; fld st |
1452 | ; fiadd word[ebx] ;x1 |
1452 | ; fiadd word[ebx] ;x1 |
1453 | ; fistp word[ebx] |
1453 | ; fistp word[ebx] |
1454 | ; fchs |
1454 | ; fchs |
1455 | ; fiadd word[ebx+2] ;y1 |
1455 | ; fiadd word[ebx+2] ;y1 |
1456 | ; fistp word[ebx+2] ;y1 |
1456 | ; fistp word[ebx+2] ;y1 |
1457 | 1457 | ||
1458 | ; add ebx,6 |
1458 | ; add ebx,6 |
1459 | ; cmp dword[ebx],-1 |
1459 | ; cmp dword[ebx],-1 |
1460 | ; jne again_trans |
1460 | ; jne again_trans |
1461 | ;ret |
1461 | ;ret |
1462 | translate_perspective_points: ;translate points from 3d to 2d using |
1462 | translate_perspective_points: ;translate points from 3d to 2d using |
1463 | fninit ;perspective equations |
1463 | fninit ;perspective equations |
1464 | mov ebx,points_rotated |
1464 | mov ebx,points_rotated |
1465 | .again_trans: |
1465 | .again_trans: |
1466 | fild word[ebx] |
1466 | fild word[ebx] |
1467 | fisub [xobs] |
1467 | fisub [xobs] |
1468 | fimul [zobs] |
1468 | fimul [zobs] |
1469 | fild word[ebx+4] |
1469 | fild word[ebx+4] |
1470 | fisub [zobs] |
1470 | fisub [zobs] |
1471 | fdivp |
1471 | fdivp |
1472 | fiadd [xobs] |
1472 | fiadd [xobs] |
1473 | fistp word[ebx] |
1473 | fistp word[ebx] |
1474 | fild word[ebx+2] |
1474 | fild word[ebx+2] |
1475 | fisub [yobs] |
1475 | fisub [yobs] |
1476 | fimul [zobs] |
1476 | fimul [zobs] |
1477 | fild word[ebx+4] |
1477 | fild word[ebx+4] |
1478 | fisub [zobs] |
1478 | fisub [zobs] |
1479 | fdivp |
1479 | fdivp |
1480 | fchs |
1480 | fchs |
1481 | fiadd [yobs] |
1481 | fiadd [yobs] |
1482 | fistp word[ebx+2] |
1482 | fistp word[ebx+2] |
1483 | add ebx,6 |
1483 | add ebx,6 |
1484 | cmp dword[ebx],-1 |
1484 | cmp dword[ebx],-1 |
1485 | jne .again_trans |
1485 | jne .again_trans |
1486 | ret |
1486 | ret |
1487 | 1487 | ||
1488 | 1488 | ||
1489 | copy_points: |
1489 | copy_points: |
1490 | mov esi,points |
1490 | mov esi,points |
1491 | mov edi,points_rotated |
1491 | mov edi,points_rotated |
1492 | mov ecx,points_count*3+2 |
1492 | mov ecx,points_count*3+2 |
1493 | rep movsw |
1493 | rep movsw |
1494 | ret |
1494 | ret |
1495 | 1495 | ||
1496 | 1496 | ||
1497 | 1497 | ||
1498 | read_from_file: |
1498 | read_from_file: |
1499 | mov edi,triangles |
1499 | mov edi,triangles |
1500 | xor ebx,ebx |
1500 | xor ebx,ebx |
1501 | xor ebp,ebp |
1501 | xor ebp,ebp |
1502 | mov esi,SourceFile |
1502 | mov esi,SourceFile |
1503 | cmp [esi],word 4D4Dh |
1503 | cmp [esi],word 4D4Dh |
1504 | jne .exit ;Must be legal .3DS file |
1504 | jne .exit ;Must be legal .3DS file |
1505 | cmp dword[esi+2],EndFile-SourceFile |
1505 | cmp dword[esi+2],EndFile-SourceFile |
1506 | jne .exit ;This must tell the length |
1506 | jne .exit ;This must tell the length |
1507 | add esi,6 |
1507 | add esi,6 |
1508 | @@: |
1508 | @@: |
1509 | cmp [esi],word 3D3Dh |
1509 | cmp [esi],word 3D3Dh |
1510 | je @f |
1510 | je @f |
1511 | add esi,[esi+2] |
1511 | add esi,[esi+2] |
1512 | jmp @b |
1512 | jmp @b |
1513 | @@: |
1513 | @@: |
1514 | add esi,6 |
1514 | add esi,6 |
1515 | .find4k: |
1515 | .find4k: |
1516 | cmp [esi],word 4000h |
1516 | cmp [esi],word 4000h |
1517 | je @f |
1517 | je @f |
1518 | add esi,[esi+2] |
1518 | add esi,[esi+2] |
1519 | cmp esi,EndFile |
1519 | cmp esi,EndFile |
1520 | jc .find4k |
1520 | jc .find4k |
1521 | jmp .exit |
1521 | jmp .exit |
1522 | @@: |
1522 | @@: |
1523 | add esi,6 |
1523 | add esi,6 |
1524 | @@: |
1524 | @@: |
1525 | cmp [esi],byte 0 |
1525 | cmp [esi],byte 0 |
1526 | je @f |
1526 | je @f |
1527 | inc esi |
1527 | inc esi |
1528 | jmp @b |
1528 | jmp @b |
1529 | @@: |
1529 | @@: |
1530 | inc esi |
1530 | inc esi |
1531 | @@: |
1531 | @@: |
1532 | cmp [esi],word 4100h |
1532 | cmp [esi],word 4100h |
1533 | je @f |
1533 | je @f |
1534 | add esi,[esi+2] |
1534 | add esi,[esi+2] |
1535 | jmp @b |
1535 | jmp @b |
1536 | @@: |
1536 | @@: |
1537 | add esi,6 |
1537 | add esi,6 |
1538 | @@: |
1538 | @@: |
1539 | cmp [esi],word 4110h |
1539 | cmp [esi],word 4110h |
1540 | je @f |
1540 | je @f |
1541 | add esi,[esi+2] |
1541 | add esi,[esi+2] |
1542 | jmp @b |
1542 | jmp @b |
1543 | @@: |
1543 | @@: |
1544 | movzx ecx,word[esi+6] |
1544 | movzx ecx,word[esi+6] |
1545 | mov [points_count_var],cx |
1545 | mov [points_count_var],cx |
1546 | mov edx,ecx |
1546 | mov edx,ecx |
1547 | add esi,8 |
1547 | add esi,8 |
1548 | @@: |
1548 | @@: |
1549 | fld dword[esi+4] |
1549 | fld dword[esi+4] |
1550 | fmul [sscale] |
1550 | fmul [sscale] |
1551 | fadd [xoffset] |
1551 | fadd [xoffset] |
1552 | fld dword[esi+8] |
1552 | fld dword[esi+8] |
1553 | fchs |
1553 | fchs |
1554 | fmul [sscale] |
1554 | fmul [sscale] |
1555 | fadd [yoffset] |
1555 | fadd [yoffset] |
1556 | fld dword[esi+0] |
1556 | fld dword[esi+0] |
1557 | fchs |
1557 | fchs |
1558 | fmul [sscale] |
1558 | fmul [sscale] |
1559 | fistp word[points+ebx+4] |
1559 | fistp word[points+ebx+4] |
1560 | fistp word[points+ebx+2] |
1560 | fistp word[points+ebx+2] |
1561 | fistp word[points+ebx+0] |
1561 | fistp word[points+ebx+0] |
1562 | add ebx,6 |
1562 | add ebx,6 |
1563 | add esi,12 |
1563 | add esi,12 |
1564 | dec ecx |
1564 | dec ecx |
1565 | jnz @b |
1565 | jnz @b |
1566 | @@: |
1566 | @@: |
1567 | mov dword[points+ebx],-1 |
1567 | mov dword[points+ebx],-1 |
1568 | @@: |
1568 | @@: |
1569 | cmp [esi],word 4120h |
1569 | cmp [esi],word 4120h |
1570 | je @f |
1570 | je @f |
1571 | add esi,[esi+2] |
1571 | add esi,[esi+2] |
1572 | jmp @b |
1572 | jmp @b |
1573 | @@: |
1573 | @@: |
1574 | movzx ecx,word[esi+6] |
1574 | movzx ecx,word[esi+6] |
1575 | mov [triangles_count_var],cx |
1575 | mov [triangles_count_var],cx |
1576 | add esi,8 |
1576 | add esi,8 |
1577 | ;mov edi,triangles |
1577 | ;mov edi,triangles |
1578 | @@: |
1578 | @@: |
1579 | movsd |
1579 | movsd |
1580 | movsw |
1580 | movsw |
1581 | add word[edi-6],bp |
1581 | add word[edi-6],bp |
1582 | add word[edi-4],bp |
1582 | add word[edi-4],bp |
1583 | add word[edi-2],bp |
1583 | add word[edi-2],bp |
1584 | add esi,2 |
1584 | add esi,2 |
1585 | dec ecx |
1585 | dec ecx |
1586 | jnz @b |
1586 | jnz @b |
1587 | add ebp,edx |
1587 | add ebp,edx |
1588 | jmp .find4k |
1588 | jmp .find4k |
1589 | 1589 | ||
1590 | .exit: |
1590 | .exit: |
1591 | mov dword[edi],-1 |
1591 | mov dword[edi],-1 |
1592 | ret |
1592 | ret |
1593 | 1593 | ||
1594 | 1594 | ||
1595 | ; ********************************************* |
1595 | ; ********************************************* |
1596 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
1596 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
1597 | ; ********************************************* |
1597 | ; ********************************************* |
1598 | draw_window: |
1598 | draw_window: |
1599 | 1599 | ||
1600 | mov eax,12 ; function 12:tell os about windowdraw |
1600 | mov eax,12 ; function 12:tell os about windowdraw |
1601 | mov ebx,1 ; 1, start of draw |
1601 | mov ebx,1 ; 1, start of draw |
1602 | int 0x40 |
1602 | int 0x40 |
1603 | 1603 | ||
1604 | ; SKIN WIDTH |
1604 | ; SKIN WIDTH |
1605 | mov eax,48 |
1605 | mov eax,48 |
1606 | mov ebx,4 |
1606 | mov ebx,4 |
1607 | int 0x40 |
1607 | int 0x40 |
1608 | mov esi, eax |
1608 | mov esi, eax |
1609 | 1609 | ||
1610 | ; DRAW WINDOW |
1610 | ; DRAW WINDOW |
1611 | mov eax,0 ; function 0 : define and draw window |
1611 | mov eax,0 ; function 0 : define and draw window |
1612 | mov ebx,100*65536+SIZE_X+9+80 ; [x start] *65536 + [x size] |
1612 | mov ebx,100*65536+SIZE_X+9+80 ; [x start] *65536 + [x size] |
1613 | mov ecx,100*65536+SIZE_Y+4 ; [y start] *65536 + [y size] |
1613 | mov ecx,100*65536+SIZE_Y+4 ; [y start] *65536 + [y size] |
1614 | add ecx, esi |
1614 | add ecx, esi |
1615 | mov edx,0x74000000 ; color of work area RRGGBB,8->color gl |
1615 | mov edx,0x74000000 ; color of work area RRGGBB,8->color gl |
1616 | mov edi,labelt |
1616 | mov edi,labelt |
1617 | int 0x40 |
1617 | int 0x40 |
1618 | 1618 | ||
1619 | ; BLACK BAR |
1619 | ; BLACK BAR |
1620 | mov eax,13 ; function 8 : define and draw button |
1620 | mov eax,13 ; function 8 : define and draw button |
1621 | mov ebx,SIZE_X*65536+80 ; [x start] *65536 + [x size] |
1621 | mov ebx,SIZE_X*65536+80 ; [x start] *65536 + [x size] |
1622 | mov ecx,0*65536+SIZE_Y ; [y start] *65536 + [y size] |
1622 | mov ecx,0*65536+SIZE_Y ; [y start] *65536 + [y size] |
1623 | mov edx,0 ; color RRGGBB |
1623 | mov edx,0 ; color RRGGBB |
1624 | int 0x40 |
1624 | int 0x40 |
1625 | 1625 | ||
1626 | ; ROTARY BUTTON |
1626 | ; ROTARY BUTTON |
1627 | mov eax,8 ; function 8 : define and draw button |
1627 | mov eax,8 ; function 8 : define and draw button |
1628 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1628 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1629 | mov ecx,25*65536+12 ; [y start] *65536 + [y size] |
1629 | mov ecx,25*65536+12 ; [y start] *65536 + [y size] |
1630 | mov edx,2 ; button id |
1630 | mov edx,2 ; button id |
1631 | mov esi,0x6688dd ; button color RRGGBB |
1631 | mov esi,0x6688dd ; button color RRGGBB |
1632 | int 0x40 |
1632 | int 0x40 |
1633 | ; ROTARY LABEL |
1633 | ; ROTARY LABEL |
1634 | mov eax,4 ; function 4 : write text to window |
1634 | mov eax,4 ; function 4 : write text to window |
1635 | mov ebx,(SIZE_X+12)*65536+28 ; [x start] *65536 + [y start] |
1635 | mov ebx,(SIZE_X+12)*65536+28 ; [x start] *65536 + [y start] |
1636 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1636 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1637 | mov edx,labelrot ; pointer to text beginning |
1637 | mov edx,labelrot ; pointer to text beginning |
1638 | mov esi,labelrotend-labelrot ; text length |
1638 | mov esi,labelrotend-labelrot ; text length |
1639 | int 0x40 |
1639 | int 0x40 |
1640 | 1640 | ||
1641 | ; DRAW MODE BUTTON |
1641 | ; DRAW MODE BUTTON |
1642 | mov eax,8 ; function 8 : define and draw button |
1642 | mov eax,8 ; function 8 : define and draw button |
1643 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1643 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1644 | mov ecx,(25+15)*65536+12 ; [y start] *65536 + [y size] |
1644 | mov ecx,(25+15)*65536+12 ; [y start] *65536 + [y size] |
1645 | mov edx,3 ; button id |
1645 | mov edx,3 ; button id |
1646 | mov esi,0x6688dd ; button color RRGGBB |
1646 | mov esi,0x6688dd ; button color RRGGBB |
1647 | int 0x40 |
1647 | int 0x40 |
1648 | ; DRAW MODE LABEL |
1648 | ; DRAW MODE LABEL |
1649 | mov eax,4 ; function 4 : write text to window |
1649 | mov eax,4 ; function 4 : write text to window |
1650 | mov ebx,(SIZE_X+12)*65536+28+15 ; [x start] *65536 + [y start] |
1650 | mov ebx,(SIZE_X+12)*65536+28+15 ; [x start] *65536 + [y start] |
1651 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1651 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1652 | mov edx,labeldrmod ; pointer to text beginning |
1652 | mov edx,labeldrmod ; pointer to text beginning |
1653 | mov esi,labeldrmodend-labeldrmod ; text length |
1653 | mov esi,labeldrmodend-labeldrmod ; text length |
1654 | int 0x40 |
1654 | int 0x40 |
1655 | 1655 | ||
1656 | ; SPEED BUTTON |
1656 | ; SPEED BUTTON |
1657 | mov eax,8 ; function 8 : define and draw button |
1657 | mov eax,8 ; function 8 : define and draw button |
1658 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1658 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1659 | mov ecx,(25+15*2)*65536+12 ; [y start] *65536 + [y size] |
1659 | mov ecx,(25+15*2)*65536+12 ; [y start] *65536 + [y size] |
1660 | mov edx,4 ; button id |
1660 | mov edx,4 ; button id |
1661 | mov esi,0x6688dd ; button color RRGGBB |
1661 | mov esi,0x6688dd ; button color RRGGBB |
1662 | int 0x40 |
1662 | int 0x40 |
1663 | ; SPEED MODE LABEL |
1663 | ; SPEED MODE LABEL |
1664 | mov eax,4 ; function 4 : write text to window |
1664 | mov eax,4 ; function 4 : write text to window |
1665 | mov ebx,(SIZE_X+12)*65536+(28+15*2) ; [x start] *65536 + [y start] |
1665 | mov ebx,(SIZE_X+12)*65536+(28+15*2) ; [x start] *65536 + [y start] |
1666 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1666 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1667 | mov edx,labelspeedmod ; pointer to text beginning |
1667 | mov edx,labelspeedmod ; pointer to text beginning |
1668 | mov esi,labelspeedmodend-labelspeedmod ; text length |
1668 | mov esi,labelspeedmodend-labelspeedmod ; text length |
1669 | int 0x40 |
1669 | int 0x40 |
1670 | 1670 | ||
1671 | ; SCALE- BUTTON |
1671 | ; SCALE- BUTTON |
1672 | mov eax,8 ; function 8 : define and draw button |
1672 | mov eax,8 ; function 8 : define and draw button |
1673 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1673 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1674 | mov ecx,(25+15*3)*65536+12 ; [y start] *65536 + [y size] |
1674 | mov ecx,(25+15*3)*65536+12 ; [y start] *65536 + [y size] |
1675 | mov edx,5 ; button id |
1675 | mov edx,5 ; button id |
1676 | mov esi,0x6688dd ; button color RRGGBB |
1676 | mov esi,0x6688dd ; button color RRGGBB |
1677 | int 0x40 |
1677 | int 0x40 |
1678 | ; SCALE- MODE LABEL |
1678 | ; SCALE- MODE LABEL |
1679 | mov eax,4 ; function 4 : write text to window |
1679 | mov eax,4 ; function 4 : write text to window |
1680 | mov ebx,(SIZE_X+12)*65536+(28+15*3) ; [x start] *65536 + [y start] |
1680 | mov ebx,(SIZE_X+12)*65536+(28+15*3) ; [x start] *65536 + [y start] |
1681 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1681 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1682 | mov edx,labelzoomout ; pointer to text beginning |
1682 | mov edx,labelzoomout ; pointer to text beginning |
1683 | mov esi,labelzoomoutend-labelzoomout ; text length |
1683 | mov esi,labelzoomoutend-labelzoomout ; text length |
1684 | int 0x40 |
1684 | int 0x40 |
1685 | 1685 | ||
1686 | ; SCALE+ BUTTON |
1686 | ; SCALE+ BUTTON |
1687 | mov eax,8 ; function 8 : define and draw button |
1687 | mov eax,8 ; function 8 : define and draw button |
1688 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1688 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1689 | mov ecx,(25+15*4)*65536+12 ; [y start] *65536 + [y size] |
1689 | mov ecx,(25+15*4)*65536+12 ; [y start] *65536 + [y size] |
1690 | mov edx,6 ; button id |
1690 | mov edx,6 ; button id |
1691 | mov esi,0x6688dd ; button color RRGGBB |
1691 | mov esi,0x6688dd ; button color RRGGBB |
1692 | int 0x40 |
1692 | int 0x40 |
1693 | ; SCALE+ MODE LABEL |
1693 | ; SCALE+ MODE LABEL |
1694 | mov eax,4 ; function 4 : write text to window |
1694 | mov eax,4 ; function 4 : write text to window |
1695 | mov ebx,(SIZE_X+12)*65536+(28+15*4) ; [x start] *65536 + [y start] |
1695 | mov ebx,(SIZE_X+12)*65536+(28+15*4) ; [x start] *65536 + [y start] |
1696 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1696 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1697 | mov edx,labelzoomin ; pointer to text beginning |
1697 | mov edx,labelzoomin ; pointer to text beginning |
1698 | mov esi,labelzoominend-labelzoomin ; text length |
1698 | mov esi,labelzoominend-labelzoomin ; text length |
1699 | int 0x40 |
1699 | int 0x40 |
1700 | ; ADD VECTOR LABEL |
1700 | ; ADD VECTOR LABEL |
1701 | mov eax,4 ; function 4 : write text to window |
1701 | mov eax,4 ; function 4 : write text to window |
1702 | mov ebx,(SIZE_X+12)*65536+(28+15*5) ; [x start] *65536 + [y start] |
1702 | mov ebx,(SIZE_X+12)*65536+(28+15*5) ; [x start] *65536 + [y start] |
1703 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1703 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1704 | mov edx,labelvector ; pointer to text beginning |
1704 | mov edx,labelvector ; pointer to text beginning |
1705 | mov esi,labelvectorend-labelvector ; text length |
1705 | mov esi,labelvectorend-labelvector ; text length |
1706 | int 0x40 |
1706 | int 0x40 |
1707 | ; VECTOR Y- BUTTON |
1707 | ; VECTOR Y- BUTTON |
1708 | mov eax,8 ; function 8 : define and draw button |
1708 | mov eax,8 ; function 8 : define and draw button |
1709 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1709 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1710 | mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] |
1710 | mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] |
1711 | mov edx,7 ; button id |
1711 | mov edx,7 ; button id |
1712 | mov esi,0x6688dd ; button color RRGGBB |
1712 | mov esi,0x6688dd ; button color RRGGBB |
1713 | int 0x40 |
1713 | int 0x40 |
1714 | ;VECTOR Y- LABEL |
1714 | ;VECTOR Y- LABEL |
1715 | mov eax,4 ; function 4 : write text to window |
1715 | mov eax,4 ; function 4 : write text to window |
1716 | mov ebx,(SIZE_X+12+20)*65536+(28+15*6) ; [x start] *65536 + [y start] |
1716 | mov ebx,(SIZE_X+12+20)*65536+(28+15*6) ; [x start] *65536 + [y start] |
1717 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1717 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1718 | mov edx,labelyminus ; pointer to text beginning |
1718 | mov edx,labelyminus ; pointer to text beginning |
1719 | mov esi,labelyminusend-labelyminus ; text length |
1719 | mov esi,labelyminusend-labelyminus ; text length |
1720 | int 0x40 |
1720 | int 0x40 |
1721 | ; VECTOR Z+ BUTTON |
1721 | ; VECTOR Z+ BUTTON |
1722 | mov eax,8 ; function 8 : define and draw button |
1722 | mov eax,8 ; function 8 : define and draw button |
1723 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1723 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1724 | mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] |
1724 | mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] |
1725 | mov edx,8 ; button id |
1725 | mov edx,8 ; button id |
1726 | mov esi,0x6688dd ; button color RRGGBB |
1726 | mov esi,0x6688dd ; button color RRGGBB |
1727 | int 0x40 |
1727 | int 0x40 |
1728 | ;VECTOR Z+ LABEL |
1728 | ;VECTOR Z+ LABEL |
1729 | mov eax,4 ; function 4 : write text to window |
1729 | mov eax,4 ; function 4 : write text to window |
1730 | mov ebx,(SIZE_X+12+41)*65536+(28+15*6) ; [x start] *65536 + [y start] |
1730 | mov ebx,(SIZE_X+12+41)*65536+(28+15*6) ; [x start] *65536 + [y start] |
1731 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1731 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1732 | mov edx,labelzplus ; pointer to text beginning |
1732 | mov edx,labelzplus ; pointer to text beginning |
1733 | mov esi,labelzplusend-labelzplus ; text length |
1733 | mov esi,labelzplusend-labelzplus ; text length |
1734 | int 0x40 |
1734 | int 0x40 |
1735 | ; VECTOR x- BUTTON |
1735 | ; VECTOR x- BUTTON |
1736 | mov eax,8 ; function 8 : define and draw button |
1736 | mov eax,8 ; function 8 : define and draw button |
1737 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1737 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1738 | mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] |
1738 | mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] |
1739 | mov edx,9 ; button id |
1739 | mov edx,9 ; button id |
1740 | mov esi,0x6688dd ; button color RRGGBB |
1740 | mov esi,0x6688dd ; button color RRGGBB |
1741 | int 0x40 |
1741 | int 0x40 |
1742 | ;VECTOR x- LABEL |
1742 | ;VECTOR x- LABEL |
1743 | mov eax,4 ; function 4 : write text to window |
1743 | mov eax,4 ; function 4 : write text to window |
1744 | mov ebx,(SIZE_X+12)*65536+(28+15*7) ; [x start] *65536 + [y start] |
1744 | mov ebx,(SIZE_X+12)*65536+(28+15*7) ; [x start] *65536 + [y start] |
1745 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1745 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1746 | mov edx,labelxminus ; pointer to text beginning |
1746 | mov edx,labelxminus ; pointer to text beginning |
1747 | mov esi,labelxminusend-labelxminus ; text length |
1747 | mov esi,labelxminusend-labelxminus ; text length |
1748 | int 0x40 |
1748 | int 0x40 |
1749 | ; VECTOR x+ BUTTON |
1749 | ; VECTOR x+ BUTTON |
1750 | mov eax,8 ; function 8 : define and draw button |
1750 | mov eax,8 ; function 8 : define and draw button |
1751 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1751 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1752 | mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] |
1752 | mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] |
1753 | mov edx,10 ; button id |
1753 | mov edx,10 ; button id |
1754 | mov esi,0x6688dd ; button color RRGGBB |
1754 | mov esi,0x6688dd ; button color RRGGBB |
1755 | int 0x40 |
1755 | int 0x40 |
1756 | ;VECTOR x+ LABEL |
1756 | ;VECTOR x+ LABEL |
1757 | mov eax,4 ; function 4 : write text to window |
1757 | mov eax,4 ; function 4 : write text to window |
1758 | mov ebx,(SIZE_X+12+41)*65536+(28+15*7) ; [x start] *65536 + [y start] |
1758 | mov ebx,(SIZE_X+12+41)*65536+(28+15*7) ; [x start] *65536 + [y start] |
1759 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1759 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1760 | mov edx,labelxplus ; pointer to text beginning |
1760 | mov edx,labelxplus ; pointer to text beginning |
1761 | mov esi,labelxplusend-labelxplus ; text length |
1761 | mov esi,labelxplusend-labelxplus ; text length |
1762 | int 0x40 |
1762 | int 0x40 |
1763 | ; VECTOR z- BUTTON |
1763 | ; VECTOR z- BUTTON |
1764 | mov eax,8 ; function 8 : define and draw button |
1764 | mov eax,8 ; function 8 : define and draw button |
1765 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1765 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1766 | mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] |
1766 | mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] |
1767 | mov edx,11 ; button id |
1767 | mov edx,11 ; button id |
1768 | mov esi,0x6688dd ; button color RRGGBB |
1768 | mov esi,0x6688dd ; button color RRGGBB |
1769 | int 0x40 |
1769 | int 0x40 |
1770 | ;VECTOR z- LABEL |
1770 | ;VECTOR z- LABEL |
1771 | mov eax,4 ; function 4 : write text to window |
1771 | mov eax,4 ; function 4 : write text to window |
1772 | mov ebx,(SIZE_X+12)*65536+(28+15*8) ; [x start] *65536 + [y start] |
1772 | mov ebx,(SIZE_X+12)*65536+(28+15*8) ; [x start] *65536 + [y start] |
1773 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1773 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1774 | mov edx,labelzminus ; pointer to text beginning |
1774 | mov edx,labelzminus ; pointer to text beginning |
1775 | mov esi,labelzminusend-labelzminus ; text length |
1775 | mov esi,labelzminusend-labelzminus ; text length |
1776 | int 0x40 |
1776 | int 0x40 |
1777 | ;VECTOR Y+ BUTTON |
1777 | ;VECTOR Y+ BUTTON |
1778 | mov eax,8 ; function 8 : define and draw button |
1778 | mov eax,8 ; function 8 : define and draw button |
1779 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1779 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1780 | mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] |
1780 | mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] |
1781 | mov edx,12 ; button id |
1781 | mov edx,12 ; button id |
1782 | mov esi,0x6688dd ; button color RRGGBB |
1782 | mov esi,0x6688dd ; button color RRGGBB |
1783 | int 0x40 |
1783 | int 0x40 |
1784 | ;VECTOR Y+ LABEL |
1784 | ;VECTOR Y+ LABEL |
1785 | mov eax,4 ; function 4 : write text to window |
1785 | mov eax,4 ; function 4 : write text to window |
1786 | mov ebx,(SIZE_X+12+20)*65536+(28+15*8) ; [x start] *65536 + [y start] |
1786 | mov ebx,(SIZE_X+12+20)*65536+(28+15*8) ; [x start] *65536 + [y start] |
1787 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1787 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1788 | mov edx,labelyplus ; pointer to text beginning |
1788 | mov edx,labelyplus ; pointer to text beginning |
1789 | mov esi,labelyplusend-labelyplus ; text length |
1789 | mov esi,labelyplusend-labelyplus ; text length |
1790 | int 0x40 |
1790 | int 0x40 |
1791 | ; LEAD COLOR LABEL |
1791 | ; LEAD COLOR LABEL |
1792 | mov eax,4 ; function 4 : write text to window |
1792 | mov eax,4 ; function 4 : write text to window |
1793 | mov ebx,(SIZE_X+12)*65536+(28+15*9) ; [x start] *65536 + [y start] |
1793 | mov ebx,(SIZE_X+12)*65536+(28+15*9) ; [x start] *65536 + [y start] |
1794 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1794 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1795 | mov edx,labelmaincolor ; pointer to text beginning |
1795 | mov edx,labelmaincolor ; pointer to text beginning |
1796 | mov esi,labelmaincolorend-labelmaincolor ; text length |
1796 | mov esi,labelmaincolorend-labelmaincolor ; text length |
1797 | int 0x40 |
1797 | int 0x40 |
1798 | 1798 | ||
1799 | ;RED+ BUTTON |
1799 | ;RED+ BUTTON |
1800 | mov eax,8 ; function 8 : define and draw button |
1800 | mov eax,8 ; function 8 : define and draw button |
1801 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1801 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1802 | mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] |
1802 | mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] |
1803 | mov edx,13 ; button id |
1803 | mov edx,13 ; button id |
1804 | mov esi,0x6688dd ; button color RRGGBB |
1804 | mov esi,0x6688dd ; button color RRGGBB |
1805 | int 0x40 |
1805 | int 0x40 |
1806 | ;RED+ LABEL |
1806 | ;RED+ LABEL |
1807 | mov eax,4 ; function 4 : write text to window |
1807 | mov eax,4 ; function 4 : write text to window |
1808 | mov ebx,(SIZE_X+12)*65536+(28+15*10) ; [x start] *65536 + [y start] |
1808 | mov ebx,(SIZE_X+12)*65536+(28+15*10) ; [x start] *65536 + [y start] |
1809 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1809 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1810 | mov edx,labelredplus ; pointer to text beginning |
1810 | mov edx,labelredplus ; pointer to text beginning |
1811 | mov esi,labelredplusend-labelredplus ; text length |
1811 | mov esi,labelredplusend-labelredplus ; text length |
1812 | int 0x40 |
1812 | int 0x40 |
1813 | ;GREEN+ BUTTON |
1813 | ;GREEN+ BUTTON |
1814 | mov eax,8 ; function 8 : define and draw button |
1814 | mov eax,8 ; function 8 : define and draw button |
1815 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1815 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1816 | mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] |
1816 | mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] |
1817 | mov edx,14 ; button id |
1817 | mov edx,14 ; button id |
1818 | mov esi,0x6688dd ; button color RRGGBB |
1818 | mov esi,0x6688dd ; button color RRGGBB |
1819 | int 0x40 |
1819 | int 0x40 |
1820 | ;GREEN+ LABEL |
1820 | ;GREEN+ LABEL |
1821 | mov eax,4 ; function 4 : write text to window |
1821 | mov eax,4 ; function 4 : write text to window |
1822 | mov ebx,(SIZE_X+12+20)*65536+(28+15*10) ; [x start] *65536 + [y start] |
1822 | mov ebx,(SIZE_X+12+20)*65536+(28+15*10) ; [x start] *65536 + [y start] |
1823 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1823 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1824 | mov edx,labelgreenplus ; pointer to text beginning |
1824 | mov edx,labelgreenplus ; pointer to text beginning |
1825 | mov esi,labelgreenplusend-labelgreenplus ; text length |
1825 | mov esi,labelgreenplusend-labelgreenplus ; text length |
1826 | int 0x40 |
1826 | int 0x40 |
1827 | ;BLUE+ BUTTON |
1827 | ;BLUE+ BUTTON |
1828 | mov eax,8 ; function 8 : define and draw button |
1828 | mov eax,8 ; function 8 : define and draw button |
1829 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1829 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1830 | mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] |
1830 | mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] |
1831 | mov edx,15 ; button id |
1831 | mov edx,15 ; button id |
1832 | mov esi,0x6688dd ; button color RRGGBB |
1832 | mov esi,0x6688dd ; button color RRGGBB |
1833 | int 0x40 |
1833 | int 0x40 |
1834 | ;BLUE+ LABEL |
1834 | ;BLUE+ LABEL |
1835 | mov eax,4 ; function 4 : write text to window |
1835 | mov eax,4 ; function 4 : write text to window |
1836 | mov ebx,(SIZE_X+12+41)*65536+(28+15*10) ; [x start] *65536 + [y start] |
1836 | mov ebx,(SIZE_X+12+41)*65536+(28+15*10) ; [x start] *65536 + [y start] |
1837 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1837 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1838 | mov edx,labelblueplus ; pointer to text beginning |
1838 | mov edx,labelblueplus ; pointer to text beginning |
1839 | mov esi,labelblueplusend-labelblueplus ; text length |
1839 | mov esi,labelblueplusend-labelblueplus ; text length |
1840 | int 0x40 |
1840 | int 0x40 |
1841 | ;RED- BUTTON |
1841 | ;RED- BUTTON |
1842 | mov eax,8 ; function 8 : define and draw button |
1842 | mov eax,8 ; function 8 : define and draw button |
1843 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1843 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
1844 | mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] |
1844 | mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] |
1845 | mov edx,16 ; button id |
1845 | mov edx,16 ; button id |
1846 | mov esi,0x6688dd ; button color RRGGBB |
1846 | mov esi,0x6688dd ; button color RRGGBB |
1847 | int 0x40 |
1847 | int 0x40 |
1848 | ;RED- LABEL |
1848 | ;RED- LABEL |
1849 | mov eax,4 ; function 4 : write text to window |
1849 | mov eax,4 ; function 4 : write text to window |
1850 | mov ebx,(SIZE_X+12)*65536+(28+15*11) ; [x start] *65536 + [y start] |
1850 | mov ebx,(SIZE_X+12)*65536+(28+15*11) ; [x start] *65536 + [y start] |
1851 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1851 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1852 | mov edx,labelredminus ; pointer to text beginning |
1852 | mov edx,labelredminus ; pointer to text beginning |
1853 | mov esi,labelredminusend-labelredminus ; text length |
1853 | mov esi,labelredminusend-labelredminus ; text length |
1854 | int 0x40 |
1854 | int 0x40 |
1855 | ;GREEN- BUTTON |
1855 | ;GREEN- BUTTON |
1856 | mov eax,8 ; function 8 : define and draw button |
1856 | mov eax,8 ; function 8 : define and draw button |
1857 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1857 | mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] |
1858 | mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] |
1858 | mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] |
1859 | mov edx,17 ; button id |
1859 | mov edx,17 ; button id |
1860 | mov esi,0x6688dd ; button color RRGGBB |
1860 | mov esi,0x6688dd ; button color RRGGBB |
1861 | int 0x40 |
1861 | int 0x40 |
1862 | ;GREEN- LABEL |
1862 | ;GREEN- LABEL |
1863 | mov eax,4 ; function 4 : write text to window |
1863 | mov eax,4 ; function 4 : write text to window |
1864 | mov ebx,(SIZE_X+12+20)*65536+(28+15*11) ; [x start] *65536 + [y start] |
1864 | mov ebx,(SIZE_X+12+20)*65536+(28+15*11) ; [x start] *65536 + [y start] |
1865 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1865 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1866 | mov edx,labelgreenminus ; pointer to text beginning |
1866 | mov edx,labelgreenminus ; pointer to text beginning |
1867 | mov esi,labelgreenminusend-labelgreenminus ; text length |
1867 | mov esi,labelgreenminusend-labelgreenminus ; text length |
1868 | int 0x40 |
1868 | int 0x40 |
1869 | ;BLUE- BUTTON |
1869 | ;BLUE- BUTTON |
1870 | mov eax,8 ; function 8 : define and draw button |
1870 | mov eax,8 ; function 8 : define and draw button |
1871 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1871 | mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] |
1872 | mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] |
1872 | mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] |
1873 | mov edx,18 ; button id |
1873 | mov edx,18 ; button id |
1874 | mov esi,0x6688dd ; button color RRGGBB |
1874 | mov esi,0x6688dd ; button color RRGGBB |
1875 | int 0x40 |
1875 | int 0x40 |
1876 | ;BLUE- LABEL |
1876 | ;BLUE- LABEL |
1877 | mov eax,4 ; function 4 : write text to window |
1877 | mov eax,4 ; function 4 : write text to window |
1878 | mov ebx,(SIZE_X+12+41)*65536+(28+15*11) ; [x start] *65536 + [y start] |
1878 | mov ebx,(SIZE_X+12+41)*65536+(28+15*11) ; [x start] *65536 + [y start] |
1879 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1879 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1880 | mov edx,labelblueminus ; pointer to text beginning |
1880 | mov edx,labelblueminus ; pointer to text beginning |
1881 | mov esi,labelblueminusend-labelblueminus ; text length |
1881 | mov esi,labelblueminusend-labelblueminus ; text length |
1882 | int 0x40 |
1882 | int 0x40 |
1883 | ; Catmull LABEL |
1883 | ; Catmull LABEL |
1884 | mov eax,4 ; function 4 : write text to window |
1884 | mov eax,4 ; function 4 : write text to window |
1885 | mov ebx,(SIZE_X+12)*65536+(28+15*12) ; [x start] *65536 + [y start] |
1885 | mov ebx,(SIZE_X+12)*65536+(28+15*12) ; [x start] *65536 + [y start] |
1886 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1886 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1887 | mov edx,labelcatmullmod ; pointer to text beginning |
1887 | mov edx,labelcatmullmod ; pointer to text beginning |
1888 | mov esi,labelcatmullmodend-labelcatmullmod ; text length |
1888 | mov esi,labelcatmullmodend-labelcatmullmod ; text length |
1889 | int 0x40 |
1889 | int 0x40 |
1890 | ; on/off BUTTON |
1890 | ; on/off BUTTON |
1891 | mov eax,8 ; function 8 : define and draw button |
1891 | mov eax,8 ; function 8 : define and draw button |
1892 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1892 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
1893 | mov ecx,(25+15*13)*65536+12 ; [y start] *65536 + [y size] |
1893 | mov ecx,(25+15*13)*65536+12 ; [y start] *65536 + [y size] |
1894 | mov edx,19 ; button id |
1894 | mov edx,19 ; button id |
1895 | mov esi,0x6688dd ; button color RRGGBB |
1895 | mov esi,0x6688dd ; button color RRGGBB |
1896 | int 0x40 |
1896 | int 0x40 |
1897 | ; on/off LABEL |
1897 | ; on/off LABEL |
1898 | mov eax,4 ; function 4 : write text to window |
1898 | mov eax,4 ; function 4 : write text to window |
1899 | mov ebx,(SIZE_X+12)*65536+(28+15*13) ; [x start] *65536 + [y start] |
1899 | mov ebx,(SIZE_X+12)*65536+(28+15*13) ; [x start] *65536 + [y start] |
1900 | mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1900 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
1901 | mov edx,labelonoff ; pointer to text beginning |
1901 | mov edx,labelonoff ; pointer to text beginning |
1902 | mov esi,labelonoffend-labelonoff ; text length |
1902 | mov esi,labelonoffend-labelonoff ; text length |
1903 | int 0x40 |
1903 | int 0x40 |
1904 | 1904 | ||
1905 | 1905 | ||
1906 | mov eax,12 ; function 12:tell os about windowdraw |
1906 | mov eax,12 ; function 12:tell os about windowdraw |
1907 | mov ebx,2 ; 2, end of draw |
1907 | mov ebx,2 ; 2, end of draw |
1908 | int 0x40 |
1908 | int 0x40 |
1909 | 1909 | ||
1910 | ret |
1910 | ret |
1911 | 1911 | ||
1912 | 1912 | ||
1913 | ; DATA AREA |
1913 | ; DATA AREA |
1914 | i3 dw 3 |
1914 | i3 dw 3 |
1915 | light_vector dd 0.0,0.0,-1.0 |
1915 | light_vector dd 0.0,0.0,-1.0 |
1916 | ; debug_vector dd 0.0,2.0,2.0 ;--debug |
1916 | ; debug_vector dd 0.0,2.0,2.0 ;--debug |
1917 | ; debug_vector1 dd 0.0,0.0,0.0 |
1917 | ; debug_vector1 dd 0.0,0.0,0.0 |
1918 | ; debug_points dw 1,1,1,3,4,20 |
1918 | ; debug_points dw 1,1,1,3,4,20 |
1919 | ; debug_dd dw ? |
1919 | ; debug_dd dw ? |
1920 | ; debug_dwd dd 65535 |
1920 | ; debug_dwd dd 65535 |
1921 | ; debug_counter dw 0 |
1921 | ; debug_counter dw 0 |
1922 | dot_max dd 1.0 ; dot product max and min |
1922 | dot_max dd 1.0 ; dot product max and min |
1923 | dot_min dd 0.0 |
1923 | dot_min dd 0.0 |
1924 | env_const dd 1.2 |
1924 | env_const dd 1.2 |
1925 | correct_tex dw 255 |
1925 | correct_tex dw 255 |
1926 | max_color_r dw 255 |
1926 | max_color_r dw 255 |
1927 | max_color_g dw 25 |
1927 | max_color_g dw 25 |
1928 | max_color_b dw 35 |
1928 | max_color_b dw 35 |
1929 | xobs dw SIZE_X / 2 ;200 ;observer |
1929 | xobs dw SIZE_X / 2 ;200 ;observer |
1930 | yobs dw SIZE_Y / 2 ;200 ;coordinates |
1930 | yobs dw SIZE_Y / 2 ;200 ;coordinates |
1931 | zobs dw -500 |
1931 | zobs dw -500 |
1932 | 1932 | ||
1933 | 1933 | ||
1934 | angle_counter dw 0 |
1934 | angle_counter dw 0 |
1935 | piD180 dd 0.017453292519943295769236907684886 |
1935 | piD180 dd 0.017453292519943295769236907684886 |
1936 | ; sq dd 0.70710678118654752440084436210485 |
1936 | ; sq dd 0.70710678118654752440084436210485 |
1937 | const6 dw 6,6,6,6 |
1937 | const6 dw 6,6,6,6 |
1938 | xo dw 150;87 ; rotary point coodinates |
1938 | xo dw 150;87 ; rotary point coodinates |
1939 | zo dw 0 |
1939 | zo dw 0 |
1940 | yo dw 100 |
1940 | yo dw 100 |
1941 | xoffset dd 150.0 |
1941 | xoffset dd 150.0 |
1942 | yoffset dd 170.0 |
1942 | yoffset dd 170.0 |
1943 | sscale dd 8.0 ; real scale |
1943 | sscale dd 8.0 ; real scale |
1944 | vect_x dw 0 |
1944 | vect_x dw 0 |
1945 | vect_y dw 0 |
1945 | vect_y dw 0 |
1946 | vect_z dw 0 |
1946 | vect_z dw 0 |
1947 | 1947 | ||
1948 | 1948 | ||
1949 | r_flag db 0 ; rotary flag |
1949 | r_flag db 0 ; rotary flag |
1950 | dr_flag db 2 ; drawing mode flag |
1950 | dr_flag db 2 ; drawing mode flag |
1951 | speed_flag db 0 |
1951 | speed_flag db 0 |
1952 | catmull_flag db 1 |
1952 | catmull_flag db 1 |
1953 | SourceFile file 'hrt.3ds' |
1953 | SourceFile file 'hrt.3ds' |
1954 | EndFile: |
1954 | EndFile: |
1955 | labelrot: |
1955 | labelrot: |
1956 | db 'rotary' |
1956 | db 'rotary' |
1957 | labelrotend: |
1957 | labelrotend: |
1958 | labeldrmod: |
1958 | labeldrmod: |
1959 | db 'shd. mode' |
1959 | db 'shd. mode' |
1960 | labeldrmodend: |
1960 | labeldrmodend: |
1961 | labelspeedmod: |
1961 | labelspeedmod: |
1962 | db 'speed' |
1962 | db 'speed' |
1963 | labelspeedmodend: |
1963 | labelspeedmodend: |
1964 | labelzoomout: |
1964 | labelzoomout: |
1965 | db 'zoom out' |
1965 | db 'zoom out' |
1966 | labelzoomoutend: |
1966 | labelzoomoutend: |
1967 | labelzoomin: |
1967 | labelzoomin: |
1968 | db 'zoom in' |
1968 | db 'zoom in' |
1969 | labelzoominend: |
1969 | labelzoominend: |
1970 | labelvector: |
1970 | labelvector: |
1971 | db 'add vector' |
1971 | db 'add vector' |
1972 | labelvectorend: |
1972 | labelvectorend: |
1973 | labelyminus: |
1973 | labelyminus: |
1974 | db 'y -' |
1974 | db 'y -' |
1975 | labelyminusend: |
1975 | labelyminusend: |
1976 | labelzplus: |
1976 | labelzplus: |
1977 | db 'z +' |
1977 | db 'z +' |
1978 | labelzplusend: |
1978 | labelzplusend: |
1979 | labelxminus: |
1979 | labelxminus: |
1980 | db 'x -' |
1980 | db 'x -' |
1981 | labelxminusend: |
1981 | labelxminusend: |
1982 | labelxplus: |
1982 | labelxplus: |
1983 | db 'x +' |
1983 | db 'x +' |
1984 | labelxplusend: |
1984 | labelxplusend: |
1985 | labelzminus: |
1985 | labelzminus: |
1986 | db 'z -' |
1986 | db 'z -' |
1987 | labelzminusend: |
1987 | labelzminusend: |
1988 | labelyplus: |
1988 | labelyplus: |
1989 | db 'y +' |
1989 | db 'y +' |
1990 | labelyplusend: |
1990 | labelyplusend: |
1991 | labelmaincolor: |
1991 | labelmaincolor: |
1992 | db 'main color' |
1992 | db 'main color' |
1993 | labelmaincolorend: |
1993 | labelmaincolorend: |
1994 | labelredplus: |
1994 | labelredplus: |
1995 | db 'r +' |
1995 | db 'r +' |
1996 | labelredplusend: |
1996 | labelredplusend: |
1997 | labelgreenplus: |
1997 | labelgreenplus: |
1998 | db 'g +' |
1998 | db 'g +' |
1999 | labelgreenplusend: |
1999 | labelgreenplusend: |
2000 | labelblueplus: |
2000 | labelblueplus: |
2001 | db 'b +' |
2001 | db 'b +' |
2002 | labelblueplusend: |
2002 | labelblueplusend: |
2003 | labelredminus: |
2003 | labelredminus: |
2004 | db 'r -' |
2004 | db 'r -' |
2005 | labelredminusend: |
2005 | labelredminusend: |
2006 | labelgreenminus: |
2006 | labelgreenminus: |
2007 | db 'g -' |
2007 | db 'g -' |
2008 | labelgreenminusend: |
2008 | labelgreenminusend: |
2009 | labelblueminus: |
2009 | labelblueminus: |
2010 | db 'b -' |
2010 | db 'b -' |
2011 | labelblueminusend: |
2011 | labelblueminusend: |
2012 | labelcatmullmod: |
2012 | labelcatmullmod: |
2013 | db 'catmull' |
2013 | db 'catmull' |
2014 | labelcatmullmodend: |
2014 | labelcatmullmodend: |
2015 | labelonoff: |
2015 | labelonoff: |
2016 | db 'on/off' |
2016 | db 'on/off' |
2017 | labelonoffend: |
2017 | labelonoffend: |
2018 | labelt: |
2018 | labelt: |
2019 | db 'Ave cruce salus mea',0 |
2019 | db 'Ave cruce salus mea',0 |
2020 | align 8 |
2020 | align 8 |
2021 | @col dd ? |
2021 | @col dd ? |
2022 | @y1 dw ? |
2022 | @y1 dw ? |
2023 | @x1 dw ?;+8 |
2023 | @x1 dw ?;+8 |
2024 | @y2 dw ? |
2024 | @y2 dw ? |
2025 | @x2 dw ? |
2025 | @x2 dw ? |
2026 | @y3 dw ? |
2026 | @y3 dw ? |
2027 | @x3 dw ?;+16 |
2027 | @x3 dw ?;+16 |
2028 | 2028 | ||
2029 | @dx12 dd ? |
2029 | @dx12 dd ? |
2030 | @dx13 dd ?;+24 |
2030 | @dx13 dd ?;+24 |
2031 | @dx23 dd ? |
2031 | @dx23 dd ? |
2032 | 2032 | ||
2033 | sinbeta dd ?;+32 |
2033 | sinbeta dd ?;+32 |
2034 | cosbeta dd ? |
2034 | cosbeta dd ? |
2035 | 2035 | ||
2036 | xsub dw ? |
2036 | xsub dw ? |
2037 | zsub dw ?;+40 |
2037 | zsub dw ?;+40 |
2038 | ysub dw ? |
2038 | ysub dw ? |
2039 | 2039 | ||
2040 | xx1 dw ? |
2040 | xx1 dw ? |
2041 | yy1 dw ? |
2041 | yy1 dw ? |
2042 | zz1 dw ?;+48 |
2042 | zz1 dw ?;+48 |
2043 | xx2 dw ? |
2043 | xx2 dw ? |
2044 | yy2 dw ? |
2044 | yy2 dw ? |
2045 | zz2 dw ? |
2045 | zz2 dw ? |
2046 | xx3 dw ?;+56 |
2046 | xx3 dw ?;+56 |
2047 | yy3 dw ? |
2047 | yy3 dw ? |
2048 | zz3 dw ? |
2048 | zz3 dw ? |
2049 | scale dd ? ; help scale variable |
2049 | scale dd ? ; help scale variable |
2050 | ;screen dd ? ;pointer to screen buffer |
2050 | ;screen dd ? ;pointer to screen buffer |
2051 | triangles_count_var dw ? |
2051 | triangles_count_var dw ? |
2052 | points_count_var dw ? |
2052 | points_count_var dw ? |
2053 | 2053 | ||
2054 | 2054 | ||
2055 | point_index1 dw ? ;-\ |
2055 | point_index1 dw ? ;-\ |
2056 | point_index2 dw ? ; } don't change order |
2056 | point_index2 dw ? ; } don't change order |
2057 | point_index3 dw ? ;-/ |
2057 | point_index3 dw ? ;-/ |
2058 | temp_col dw ? |
2058 | temp_col dw ? |
2059 | high dd ? |
2059 | high dd ? |
2060 | align 8 |
2060 | align 8 |
2061 | buffer dq ? |
2061 | buffer dq ? |
2062 | 2062 | ||
2063 | ;err dd ? |
2063 | ;err dd ? |
2064 | drr dd ? |
2064 | drr dd ? |
2065 | xx dd ? |
2065 | xx dd ? |
2066 | yy dd ? |
2066 | yy dd ? |
2067 | xst dd ? |
2067 | xst dd ? |
2068 | yst dd ? |
2068 | yst dd ? |
2069 | align 16 |
2069 | align 16 |
2070 | points: |
2070 | points: |
2071 | rw (EndFile-SourceFile)/12*3 |
2071 | rw (EndFile-SourceFile)/12*3 |
2072 | points_count = ($-points)/6 |
2072 | points_count = ($-points)/6 |
2073 | triangles: |
2073 | triangles: |
2074 | rw (EndFile-SourceFile)/12*3 |
2074 | rw (EndFile-SourceFile)/12*3 |
2075 | triangles_count = ($-triangles)/6 |
2075 | triangles_count = ($-triangles)/6 |
2076 | 2076 | ||
2077 | align 16 |
2077 | align 16 |
2078 | points_rotated rw points_count*3 + 2 |
2078 | points_rotated rw points_count*3 + 2 |
2079 | align 16 |
2079 | align 16 |
2080 | label trizdd dword |
2080 | label trizdd dword |
2081 | label trizdq qword |
2081 | label trizdq qword |
2082 | triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position |
2082 | triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position |
2083 | align 16 |
2083 | align 16 |
2084 | triangles_normals rb triangles_count * 12 ; |
2084 | triangles_normals rb triangles_count * 12 ; |
2085 | point_normals rb points_count * 12 ;one 3dvector - triple float dword x,y,z |
2085 | point_normals rb points_count * 12 ;one 3dvector - triple float dword x,y,z |
2086 | align 16 |
2086 | align 16 |
2087 | point_normals_rotated rb points_count * 12 |
2087 | point_normals_rotated rb points_count * 12 |
2088 | align 16 |
2088 | align 16 |
2089 | vectors rb 24 |
2089 | vectors rb 24 |
2090 | points_color rb 6*points_count ; each color as word |
2090 | points_color rb 6*points_count ; each color as word |
2091 | ; sorted_triangles rw triangles_count*3 + 2 |
2091 | ; sorted_triangles rw triangles_count*3 + 2 |
2092 | ;align 16 |
2092 | ;align 16 |
2093 | bumpmap rb TEXTURE_SIZE + 1 |
2093 | bumpmap rb TEXTURE_SIZE + 1 |
2094 | envmap rb (TEXTURE_SIZE +1) * 3 |
2094 | envmap rb (TEXTURE_SIZE +1) * 3 |
2095 | tex_points rb points_count * 4 ; bump_map points |
2095 | tex_points rb points_count * 4 ; bump_map points |
2096 | ; each point word x, word y |
2096 | ; each point word x, word y |
2097 | screen rb SIZE_X * SIZE_Y * 3 ; screen buffer |
2097 | screen rb SIZE_X * SIZE_Y * 3 ; screen buffer |
2098 | Z_buffer rb SIZE_X * SIZE_Y * 4 |
2098 | Z_buffer rb SIZE_X * SIZE_Y * 4 |
2099 | memStack rb 1000 ;memory area for stack |
2099 | memStack rb 1000 ;memory area for stack |
2100 | I_END: |
2100 | I_END: |