Rev 5486 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1245 | hidnplayr | 1 | |
5486 | leency | 2 | ; compiler : FASM |
1819 | yogev_ezra | 3 | ; system : KolibriOS |
4 | ; author : Macgub aka Maciej Guba |
||
1245 | hidnplayr | 5 | ; email : macgub3@wp.pl |
6 | ; web : www.macgub.hekko.pl |
||
1819 | yogev_ezra | 7 | ; Fell free to use this intro in your own distribution of KolibriOS/MenuetOS. |
1245 | hidnplayr | 8 | ; Special greetings to all MenuetOS maniax in the world. |
9 | ; I hope because my intros Christian Belive will be near to each of You. |
||
10 | |||
11 | |||
12 | |||
13 | ; madis.kalme@mail.ee |
||
14 | ; I tried optimizing it a bit, but don't know if it was successful. The objects |
||
15 | ; can be: |
||
16 | ; 1) Read from a file (*.3DS standard) |
||
17 | ; 2) Written in manually (at the end of the code) |
||
18 | ;include 'proc32.inc' |
||
19 | |||
20 | |||
21 | SIZE_Y equ 512 ; ///// I want definitely |
||
2736 | leency | 22 | TIMEOUT equ 10 ; ------ say: |
23 | ROUND equ 10 ; \ @ @/ keep smiling every |
||
24 | TEX_X equ 512 ; texture width ; \ ./ / day. |
||
25 | TEX_Y equ 512 ; height ; \/ / |
||
26 | TEX_SHIFT equ 9 ; texture width shifting ; __||__ / |
||
27 | TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 ; /| | |
||
28 | TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} ; / \ / |
||
29 | FLUENTLY = 0 ; / | | |
||
30 | SHIFTING = 1 ; ------ |
||
31 | CATMULL_SHIFT equ 8 ; | | |
||
32 | LIGHT_SIZE equ 22 ; | | |
||
33 | NON = 0 ; -/ \- |
||
34 | MMX = 1 |
||
1245 | hidnplayr | 35 | SSE = 2 |
36 | SSE2 = 3 |
||
1979 | yogev_ezra | 37 | Ext = SSE2 ;Ext={ NON | MMX | SSE | SSE2 } |
2881 | leency | 38 | |
1245 | hidnplayr | 39 | |
40 | USE_LFN = 1 |
||
41 | |||
42 | |||
43 | org 0x0 |
||
44 | db 'MENUET01' ; 8 byte id |
||
45 | dd 0x01 ; header version |
||
46 | dd START ; start of code |
||
47 | dd I_END ; size of image |
||
48 | dd MEM_END ; memory for app |
||
49 | dd MEM_END ; esp |
||
50 | dd I_Param ; I_Param |
||
51 | dd 0x0 ; I_Icon |
||
52 | |||
53 | |||
54 | cld |
||
55 | call alloc_buffer_mem |
||
56 | call read_param |
||
57 | call read_from_disk ; read, if all is ok eax = 0 |
||
58 | cmp eax,0 |
||
59 | jne .gen |
||
60 | mov esi,[fptr] |
||
5486 | leency | 61 | cmp [esi],word 4D4Dh |
62 | jne .asc |
||
63 | call read_tp_variables ; init points and triangles count variables |
||
1245 | hidnplayr | 64 | cmp eax,0 |
65 | je .gen |
||
66 | jmp .malloc |
||
67 | .gen: |
||
68 | if USE_LFN |
||
69 | mov [triangles_count_var],1000 |
||
70 | mov [points_count_var],1000 |
||
71 | call alloc_mem_for_tp |
||
72 | end if |
||
73 | call generate_object |
||
74 | jmp .opt |
||
75 | .asc: |
||
5486 | leency | 76 | mov [triangles_count_var],10000 |
77 | mov [points_count_var],10000 |
||
78 | call alloc_mem_for_tp |
||
79 | call read_asc |
||
80 | jmp .opt |
||
81 | .malloc: |
||
1245 | hidnplayr | 82 | if USE_LFN |
83 | call alloc_mem_for_tp |
||
84 | end if |
||
85 | call read_from_file |
||
86 | .opt: |
||
87 | call optimize_object1 ; proc in file b_procs.asm |
||
88 | ; set point(0,0,0) in center and calc all coords |
||
89 | ; to be in <-1.0,1.0> |
||
90 | call normalize_all_light_vectors |
||
91 | call init_triangles_normals2 |
||
92 | call init_point_normals |
||
93 | call init_envmap2 |
||
1931 | yogev_ezra | 94 | call init_envmap_cub |
1245 | hidnplayr | 95 | call generate_texture2 |
96 | call init_sincos_tab |
||
97 | |||
98 | |||
99 | mov edi,bumpmap |
||
100 | call calc_bumpmap |
||
101 | call calc_bumpmap_coords ; bump and texture mapping |
||
102 | call draw_window |
||
103 | |||
104 | |||
105 | |||
106 | |||
107 | mov ebx,TIMEOUT |
||
108 | cmp [speed_flag],1 |
||
109 | jne .skip |
||
110 | mov eax,11 |
||
111 | .skip: |
||
112 | int 0x40 |
||
113 | |||
114 | |||
115 | je red |
||
116 | cmp eax,2 ; key in buffer ? |
||
117 | je key |
||
118 | cmp eax,3 ; button in buffer ? |
||
119 | je button |
||
120 | |||
121 | |||
122 | |||
123 | |||
124 | call draw_window |
||
125 | |||
126 | |||
127 | |||
128 | |||
129 | mov eax,2 ; just read it and ignore |
||
130 | int 0x40 |
||
131 | jmp noclose |
||
132 | |||
133 | |||
134 | mov eax,17 ; get id |
||
135 | int 0x40 |
||
136 | |||
137 | |||
138 | jne @f |
||
139 | |||
140 | |||
141 | int 0x40 |
||
142 | @@: |
||
143 | cmp ah,30 |
||
144 | jge add_vec_buttons |
||
145 | call update_flags ; update flags and write labels of flags |
||
146 | |||
147 | |||
148 | cmp ah,3 ; ah = 3 -> shading model |
||
149 | jne .next_m6 |
||
150 | cmp [dr_flag],2 |
||
151 | jne @f |
||
152 | ; call init_envmap2 ; <----! this don't works in env mode |
||
1931 | yogev_ezra | 153 | ; and more than ~18 kb objects |
154 | ; call init_envmap_cub2 |
||
1245 | hidnplayr | 155 | @@: |
156 | cmp [dr_flag],4 |
||
157 | jne @f |
||
158 | call generate_texture2 |
||
159 | |||
160 | |||
161 | .next_m6: |
||
162 | ; ah = 5 -> scale- |
||
163 | cmp ah,5 |
||
164 | jne @f |
||
165 | mov [scale],0.7 |
||
166 | fninit |
||
167 | fld [rsscale] |
||
168 | fmul [scale] |
||
169 | fstp [rsscale] |
||
170 | |||
171 | |||
172 | cmp ah,6 ; ah = 6 -> scale+ |
||
173 | jne @f |
||
174 | mov [scale],1.3 |
||
175 | fninit |
||
176 | fld [rsscale] |
||
177 | fmul [scale] |
||
178 | fstp [rsscale] |
||
179 | |||
180 | |||
181 | cmp ah,9 ; lights random ; 'flat' 0 |
||
182 | jne .next_m5 ; 'grd ' 1 |
||
183 | call make_random_lights ; 'env ' 2 |
||
184 | call normalize_all_light_vectors ; 'bump' 3 |
||
185 | call do_color_buffer ; intit color_map ; 'tex ' 4 |
||
186 | ; cmp [emboss_flag],1 ; 'pos ' 5 |
||
1931 | yogev_ezra | 187 | ; je @f ; 'dots' 6 |
188 | ; cmp [dr_flag],8 |
||
189 | ; jge @f |
||
190 | ; cmp [dr_flag],2 ; 'txgr' 7 |
||
191 | ; jl .next_m5 ; '2tex' 8 |
||
192 | ; cmp [dr_flag],3 ; 'btex' 9 |
||
193 | ; jg .next_m5 |
||
194 | ; @@: |
||
195 | call init_envmap2 ; update env map if shading model = environment or bump |
||
1245 | hidnplayr | 196 | .next_m5: |
197 | cmp ah,11 |
||
198 | je @f |
||
199 | cmp ah,12 |
||
200 | je @f |
||
201 | cmp ah,13 |
||
202 | jne .next_m4 |
||
203 | @@: |
||
204 | call mirror |
||
205 | .next_m4: |
||
206 | cmp ah,14 |
||
207 | jne @f |
||
208 | call exchange |
||
209 | @@: |
||
210 | cmp ah,15 |
||
211 | jne @f |
||
212 | cmp [emboss_flag],1 |
||
213 | call init_envmap2 |
||
214 | @@: |
||
215 | ; cmp ah,17 |
||
216 | ; jne .next_m |
||
217 | ; cmp [move_flag],2 |
||
218 | ; jne @f |
||
219 | ; call draw_window ; redraw other labels to navigation buttons |
||
220 | ; @@: |
||
221 | ; cmp [move_flag],0 |
||
222 | ; jne .next_m |
||
223 | ; call draw_window ; redraw other labels to navigation buttons |
||
224 | .next_m: |
||
225 | cmp ah,18 |
||
226 | jne .next_m2 |
||
227 | if USE_LFN |
||
1776 | yogev_ezra | 228 | mov [re_alloc_flag],1 ; reallocate memory |
229 | mov [triangles_count_var],1000 |
||
230 | mov [points_count_var],1000 |
||
231 | call alloc_mem_for_tp |
||
232 | mov [re_alloc_flag],0 |
||
233 | end if |
||
234 | mov bl,[generator_flag] |
||
1245 | hidnplayr | 235 | or bl,bl |
236 | jz .next_m2 |
||
237 | cmp bl,1 |
||
238 | jne @f |
||
239 | call generate_object |
||
240 | jmp .calc_norm |
||
241 | @@: |
||
242 | cmp bl,4 |
||
243 | jg @f |
||
244 | movzx ax,bl ; ax < - object number |
||
245 | call generate_object2 |
||
246 | jmp .calc_norm |
||
247 | @@: |
||
248 | call generate_object3 |
||
249 | .calc_norm: |
||
250 | call optimize_object1 |
||
251 | call init_triangles_normals2 |
||
252 | call init_point_normals |
||
253 | call calc_bumpmap_coords ; bump and texture mapping |
||
254 | |||
255 | |||
256 | cmp ah,19 |
||
257 | je @f |
||
258 | cmp ah,20 |
||
259 | jne .next_m3 |
||
260 | @@: |
||
261 | mov edi,bumpmap |
||
262 | call calc_bumpmap |
||
263 | .next_m3: |
||
1776 | yogev_ezra | 264 | cmp ah,21 ; re map bumps, texture coordinates |
265 | jne @f |
||
266 | call calc_bumpmap_coords |
||
267 | @@: |
||
268 | jmp noclose |
||
1245 | hidnplayr | 269 | |
270 | |||
271 | |||
272 | add_vec_buttons: ; can move: object, camera,.. list is open |
||
273 | ; |
||
274 | cmp ah,30 |
||
275 | jne .next |
||
276 | cmp [move_flag],0 |
||
2984 | leency | 277 | jne @f |
278 | ; cmp [move_flag],2 |
||
1245 | hidnplayr | 279 | ; je .set_light1 |
280 | sub [vect_y],10 |
||
281 | jmp .next |
||
282 | @@: |
||
283 | cmp [move_flag],1 |
||
2984 | leency | 284 | jne @f |
285 | sub [yobs],10 ; observator = camera position |
||
1245 | hidnplayr | 286 | jmp .next |
287 | @@: |
||
2984 | leency | 288 | sub [sin_amplitude],10 |
289 | ;-------------------------------------------------- |
||
1245 | hidnplayr | 290 | ; .set_light1: ; r - |
291 | ; movzx ebx,[light_no_flag] ; * 22 |
||
292 | ; mov ecx,ebx |
||
293 | ; shl ebx,4 |
||
294 | ; shl ecx,1 |
||
295 | ; add ebx,ecx |
||
296 | ; shl ecx,1 |
||
297 | ; add ebx,ecx |
||
298 | ; add ebx,lights+6 ; 6 -> light vector size |
||
299 | ; |
||
300 | ; movzx ecx,[light_comp_flag] |
||
301 | ; lea ecx,[ecx*3} |
||
302 | ; add ebx,ecx ; ebx -> color to set |
||
303 | |||
304 | |||
305 | .next: |
||
306 | cmp ah,31 |
||
307 | jne .next1 |
||
308 | cmp [move_flag],1 |
||
309 | je @f |
||
310 | add [vect_z],10 |
||
311 | jmp .next1 |
||
312 | @@: |
||
313 | add [zobs],10 ; observator = camera position |
||
314 | .next1: |
||
315 | cmp ah,33 |
||
316 | jne .next2 |
||
317 | cmp [move_flag],0 |
||
2984 | leency | 318 | jne @f |
319 | sub [vect_x],10 |
||
1245 | hidnplayr | 320 | jmp .next2 |
321 | @@: |
||
322 | cmp [move_flag],1 |
||
2984 | leency | 323 | jne @f |
324 | sub [xobs],10 ; observator = camera position |
||
1245 | hidnplayr | 325 | jmp .next2 |
2984 | leency | 326 | @@: |
327 | fninit |
||
328 | fld [sin_frq] |
||
329 | fsub [sin_delta] |
||
330 | fstp [sin_frq] |
||
331 | .next2: |
||
1245 | hidnplayr | 332 | cmp ah,32 |
333 | jne .next3 |
||
334 | cmp [move_flag],0 |
||
2984 | leency | 335 | jne @f |
336 | add [vect_x],10 |
||
1245 | hidnplayr | 337 | jmp .next3 |
338 | @@: |
||
339 | cmp [move_flag],1 |
||
2984 | leency | 340 | jne @f |
341 | add [xobs],10 ; observator = camera position |
||
1245 | hidnplayr | 342 | jmp .next3 |
2984 | leency | 343 | @@: |
344 | fninit |
||
345 | fld [sin_frq] ; change wave effect frequency |
||
346 | fadd [sin_delta] |
||
347 | fstp [sin_frq] |
||
348 | .next3: |
||
1245 | hidnplayr | 349 | cmp ah,34 |
350 | jne .next4 |
||
351 | cmp [move_flag],1 |
||
352 | je @f |
||
353 | |||
354 | |||
355 | jmp .next4 |
||
356 | @@: |
||
357 | sub [zobs],10 ; observator = camera position |
||
358 | .next4: |
||
359 | cmp ah,35 |
||
360 | jne .next5 |
||
361 | cmp [move_flag],0 |
||
2984 | leency | 362 | jne @f |
363 | ; call add_vector |
||
1245 | hidnplayr | 364 | add [vect_y],10 |
365 | jmp .next5 |
||
366 | @@: |
||
367 | cmp [move_flag],1 |
||
2984 | leency | 368 | jne @f |
369 | add [yobs],10 ; observator = camera position |
||
1245 | hidnplayr | 370 | jmp .next5 |
2984 | leency | 371 | @@: |
372 | add [sin_amplitude],10 |
||
373 | .next5: |
||
1245 | hidnplayr | 374 | |
375 | |||
376 | |||
377 | |||
378 | |||
379 | |||
380 | jne .no_x |
||
381 | inc [angle_x] |
||
382 | and [angle_x],0xff |
||
383 | mov [angle_z],0 |
||
384 | jmp .end_rot |
||
385 | |||
386 | |||
387 | cmp [r_flag],0 |
||
388 | jne .no_y |
||
389 | inc [angle_y] |
||
390 | and [angle_y],0xff |
||
391 | mov [angle_z],0 |
||
392 | jmp .end_rot |
||
393 | |||
394 | |||
395 | cmp [r_flag],1 |
||
396 | jne .end_rot |
||
397 | mov cx,[angle_x] |
||
398 | inc cx |
||
399 | and cx,0xff |
||
400 | mov [angle_z],0 |
||
401 | mov [angle_y],cx |
||
402 | mov [angle_x],cx |
||
403 | .end_rot: |
||
404 | |||
405 | |||
406 | mov edi,matrix |
||
407 | call make_rotation_matrix |
||
408 | RDTSC |
||
1931 | yogev_ezra | 409 | push eax |
410 | mov esi,[points_normals_ptr] |
||
1245 | hidnplayr | 411 | mov edi,[points_normals_rot_ptr] |
412 | mov ebx,matrix |
||
413 | movzx ecx,[points_count_var] |
||
414 | call rotary |
||
415 | |||
416 | |||
417 | call add_scale_to_matrix |
||
418 | |||
419 | |||
420 | mov edi,[points_rotated_ptr] |
||
421 | mov ebx,matrix |
||
422 | movzx ecx,[points_count_var] |
||
423 | call rotary |
||
424 | |||
425 | |||
426 | ; pop ebx |
||
427 | ; sub eax,ebx |
||
428 | ; sub eax,41 |
||
429 | ; push eax |
||
430 | |||
431 | |||
432 | mov edi,[points_translated_ptr] |
||
433 | movzx ecx,[points_count_var] |
||
434 | call translate_points |
||
435 | |||
436 | |||
437 | ; jne @f |
||
438 | ; call calc_attenuation_light |
||
439 | ; @@: |
||
440 | cmp [fire_flag],0 |
||
441 | jne @f |
||
442 | call clrscr ; clear the screen |
||
443 | @@: |
||
444 | cmp [catmull_flag],1 ;non sort if Catmull = on |
||
445 | je .no_sort |
||
446 | call sort_triangles |
||
447 | .no_sort: |
||
448 | cmp [dr_flag],7 ; fill if 2tex and texgrd |
||
449 | jge @f |
||
450 | cmp [catmull_flag],0 ;non fill if Catmull = off |
||
451 | je .non_f |
||
452 | cmp [dr_flag],6 ; non fill if dots |
||
453 | je .non_f |
||
454 | @@: |
||
455 | call fill_Z_buffer ; make background |
||
456 | .non_f: |
||
457 | ; RDTSC |
||
1931 | yogev_ezra | 458 | ; push eax |
459 | cmp [dr_flag],6 |
||
1245 | hidnplayr | 460 | jne @f |
461 | call draw_dots |
||
462 | jmp .blurrr |
||
463 | @@: |
||
464 | call draw_triangles ; draw all triangles from the list |
||
465 | .blurrr: |
||
466 | cmp [sinus_flag],0 |
||
2984 | leency | 467 | je @f |
468 | call do_sinus |
||
469 | @@: |
||
470 | cmp [fire_flag],0 |
||
1245 | hidnplayr | 471 | jne @f |
472 | cmp [blur_flag],0 |
||
473 | je .no_blur ; no blur, no fire |
||
474 | movzx ecx,[blur_flag] |
||
475 | call blur_screen ; blur and fire |
||
476 | jmp .no_blur |
||
477 | @@: |
||
478 | cmp [emboss_flag],0 |
||
479 | jne .emb ; if emboss=true -> no fire |
||
480 | movzx ecx,[fire_flag] |
||
481 | call blur_screen ; blur and fire |
||
482 | .no_blur: ; no blur, no fire |
||
483 | cmp [emboss_flag],0 |
||
484 | je @f |
||
485 | .emb: |
||
486 | call do_emboss |
||
487 | |||
488 | |||
489 | |||
490 | |||
491 | |||
2736 | leency | 492 | je .no_inc_bright |
493 | movzx ebx,[inc_bright_flag] |
||
494 | shl ebx,4 |
||
495 | mov esi,screen |
||
496 | mov ecx,SIZE_X*SIZE_Y*3 |
||
497 | if (Ext = MMX)|(Ext = SSE) |
||
498 | mov bh,bl |
||
499 | push bx |
||
500 | shl ebx,16 |
||
501 | pop bx |
||
502 | push ebx |
||
503 | push ebx |
||
504 | movq mm0,[esp] |
||
505 | add esp,8 |
||
506 | else if Ext >= SSE2 |
||
507 | mov bh,bl |
||
508 | push bx |
||
509 | shl ebx,16 |
||
510 | pop bx |
||
511 | movd xmm0,ebx |
||
512 | shufps xmm0,xmm0,0 |
||
513 | end if |
||
514 | .oop: |
||
515 | if Ext=NON |
||
516 | lodsb |
||
517 | add al,bl |
||
518 | jnc @f |
||
519 | mov byte[esi-1],255 |
||
520 | loop .oop |
||
521 | @@: |
||
522 | mov [esi-1],al |
||
523 | loop .oop |
||
524 | else if (Ext=MMX)|(Ext=SSE) |
||
525 | movq mm1,[esi] |
||
526 | movq mm2,[esi+8] |
||
527 | paddusb mm1,mm0 |
||
528 | paddusb mm2,mm0 |
||
529 | movq [esi],mm1 |
||
530 | movq [esi+8],mm2 |
||
531 | add esi,16 |
||
532 | sub ecx,16 |
||
533 | jnz .oop |
||
534 | else |
||
535 | movaps xmm1,[esi] |
||
536 | paddusb xmm1,xmm0 |
||
537 | movaps [esi],xmm1 |
||
538 | add esi,16 |
||
539 | sub ecx,16 |
||
540 | jnz .oop |
||
541 | end if |
||
542 | |||
543 | |||
544 | |||
545 | |||
546 | |||
547 | je .no_dec_bright |
||
548 | movzx ebx,[dec_bright_flag] |
||
549 | shl ebx,4 |
||
550 | mov esi,screen |
||
551 | mov ecx,SIZE_X*SIZE_Y*3 |
||
552 | if (Ext = MMX)|(Ext = SSE) |
||
553 | mov bh,bl |
||
554 | push bx |
||
555 | shl ebx,16 |
||
556 | pop bx |
||
557 | push ebx |
||
558 | push ebx |
||
559 | movq mm0,[esp] |
||
560 | add esp,8 |
||
561 | else if Ext >=SSE2 |
||
562 | mov bh,bl |
||
563 | push bx |
||
564 | shl ebx,16 |
||
565 | pop bx |
||
566 | movd xmm0,ebx |
||
567 | shufps xmm0,xmm0,0 |
||
568 | end if |
||
569 | .oop1: |
||
570 | if Ext=NON |
||
571 | lodsb |
||
572 | sub al,bl |
||
573 | jb @f |
||
574 | mov [esi-1],al |
||
575 | loop .oop1 |
||
576 | @@: |
||
577 | mov byte[esi-1],0 |
||
578 | loop .oop1 |
||
579 | else if (Ext = MMX)|(Ext=SSE) |
||
580 | movq mm1,[esi] |
||
581 | psubusb mm1,mm0 |
||
582 | movq [esi],mm1 |
||
583 | add esi,8 |
||
584 | sub ecx,8 |
||
585 | jnz .oop1 |
||
586 | else |
||
587 | movaps xmm1,[esi] |
||
588 | psubusb xmm1,xmm0 |
||
589 | movaps [esi],xmm1 |
||
590 | add esi,16 |
||
591 | sub ecx,16 |
||
592 | jnz .oop1 |
||
593 | end if |
||
594 | .no_dec_bright: |
||
595 | ;======================================commmented==================== |
||
596 | if 0 |
||
597 | if Ext >= SSE |
||
598 | cmp [max_flag],0 |
||
599 | je .no_max |
||
600 | ;movzx ebx,[max_flag] |
||
601 | .again_max: |
||
602 | ; push ecx |
||
603 | mov edi,screen |
||
604 | mov ecx,SIZE_X*3/4 |
||
605 | ; ; pxor mm5,mm5 |
||
606 | xor eax,eax |
||
607 | rep stosd |
||
608 | |||
609 | |||
610 | .calc_max: |
||
611 | @@: |
||
612 | movq mm0,[edi+SIZE_X*3] |
||
613 | movq mm1,[edi-SIZE_X*3] |
||
614 | movq mm2,[edi-3] |
||
615 | movq mm3,[edi+3] |
||
616 | |||
617 | |||
618 | pmaxub mm2,mm3 |
||
619 | pmaxub mm0,mm2 |
||
620 | |||
621 | |||
622 | add edi,8 |
||
623 | loop @b |
||
624 | |||
625 | |||
626 | mov ecx,SIZE_X*3/4 |
||
627 | rep stosd |
||
628 | end if |
||
629 | |||
630 | |||
631 | |||
632 | |||
633 | cmp [min_flag],0 |
||
634 | je .no_min |
||
635 | ; push ecx |
||
636 | mov edi,screen |
||
637 | mov ecx,SIZE_X*3/4 |
||
638 | ; ; pxor mm5,mm5 |
||
639 | xor eax,eax |
||
640 | rep stosd |
||
641 | |||
642 | |||
643 | @@: |
||
644 | movq mm0,[edi+SIZE_X*3] |
||
645 | movq mm1,[edi-SIZE_X*3] |
||
646 | movq mm2,[edi-3] |
||
647 | movq mm3,[edi+3] |
||
648 | |||
649 | |||
650 | pminub mm2,mm3 |
||
651 | pminub mm0,mm2 |
||
652 | |||
653 | |||
654 | add edi,8 |
||
655 | loop @b |
||
656 | |||
657 | |||
658 | |||
659 | |||
660 | rep stosd |
||
661 | end if |
||
662 | .no_min: |
||
663 | end if |
||
664 | |||
2984 | leency | 665 | |
1245 | hidnplayr | 666 | sub eax,[esp] |
667 | sub eax,41 |
||
668 | ; pop eax |
||
669 | |||
670 | |||
671 | .dc: |
||
672 | xor edx,edx |
||
673 | mov edi,10 |
||
674 | div edi |
||
675 | add dl,30h |
||
676 | mov [STRdata+ecx-1],dl |
||
677 | loop .dc |
||
678 | pop eax |
||
679 | |||
680 | |||
681 | mov ebx,screen |
||
682 | mov ecx,SIZE_X shl 16 + SIZE_Y |
||
683 | mov edx,5 shl 16 + 25 |
||
2984 | leency | 684 | int 0x40 |
1245 | hidnplayr | 685 | |
686 | |||
2736 | leency | 687 | mov ebx,530*65536+60 |
688 | mov ecx,510*65536+9 |
||
689 | xor edx,edx |
||
690 | int 40h |
||
691 | |||
692 | |||
1245 | hidnplayr | 693 | mov ebx,530*65536+510 ; [x start] *65536 + [y start] |
3066 | leency | 694 | mov ecx,0x00888888 |
2736 | leency | 695 | mov edx,STRdata ; pointer to text beginning |
1245 | hidnplayr | 696 | mov esi,10 ; text length |
697 | int 40h |
||
698 | |||
699 | |||
700 | |||
2881 | leency | 701 | |
1245 | hidnplayr | 702 | |
2881 | leency | 703 | |
1245 | hidnplayr | 704 | |
705 | |||
706 | ;-------------------------PROCEDURES--------------------------------------------- |
||
707 | ;-------------------------------------------------------------------------------- |
||
708 | include "TEX3.INC" |
||
1728 | clevermous | 709 | include "FLAT_CAT.INC" |
710 | include "TEX_CAT.INC" |
||
711 | include "BUMP_CAT.INC" |
||
712 | include "3DMATH.INC" |
||
713 | include "GRD_LINE.INC" |
||
2881 | leency | 714 | include "GRD3.INC" |
1728 | clevermous | 715 | include "FLAT3.INC" |
716 | include "BUMP3.INC" |
||
717 | include "B_PROCS.INC" |
||
718 | include "A_PROCS.INC" |
||
719 | include "GRD_CAT.INC" |
||
720 | include "BUMP_TEX.INC" |
||
721 | include "GRD_TEX.INC" |
||
722 | include "TWO_TEX.INC" |
||
723 | include "ASC.INC" |
||
5486 | leency | 724 | |
1245 | hidnplayr | 725 | |
2736 | leency | 726 | |
2881 | leency | 727 | |
1245 | hidnplayr | 728 | movzx ecx,[size_x] |
729 | movzx eax,[size_y] |
||
730 | mul ecx |
||
731 | lea ecx,[eax*3] |
||
732 | push ecx |
||
733 | shl eax,2 |
||
734 | add ecx,eax |
||
735 | add ecx,MEM_END |
||
736 | mov ebx,1 |
||
737 | mov eax,64 ; allocate mem - resize app mem |
||
738 | int 0x40 |
||
739 | mov [screen_ptr],MEM_END |
||
740 | mov [Zbuffer_ptr],MEM_END |
||
741 | pop ecx |
||
742 | add [Zbuffer_ptr],ecx |
||
743 | ret |
||
744 | |||
745 | |||
746 | ; updates flags and writing flag description |
||
747 | ; in ah - button number |
||
748 | push ax |
||
749 | mov edi,menu |
||
750 | .ch_another: |
||
751 | cmp ah,byte[edi] ; ah = button id |
||
752 | jne @f |
||
753 | mov bl,byte[edi+11] ; max_flag + 1 |
||
754 | cmp bl,255 |
||
755 | je .no_write |
||
756 | inc byte[edi+12] ; flag |
||
757 | cmp byte[edi+12],bl |
||
758 | jne .write |
||
759 | mov byte[edi+12],0 |
||
760 | jmp .write |
||
761 | @@: |
||
762 | add edi,17 |
||
763 | cmp byte[edi],-1 |
||
764 | jne .ch_another |
||
765 | .write: |
||
766 | ; clreol {pascal never dies} |
||
767 | ; * eax = 13 - function number |
||
768 | ; * ebx = [coordinate on axis x]*65536 + [size on axis x] |
||
769 | ; * ecx = [coordinate on axis y]*65536 + [size on axis y] |
||
770 | ; * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill |
||
771 | |||
772 | |||
773 | movzx ecx,byte[edi] |
||
774 | sub cl,2 |
||
775 | lea ecx,[ecx*3] |
||
776 | lea ecx,[ecx*5] |
||
777 | add ecx,28 |
||
778 | shl ecx,16 |
||
779 | add ecx,14 ; ecx = [coord y]*65536 + [size y] |
||
780 | mov ebx,(SIZE_X+12+70)*65536+25 ; [x start] *65536 + [size x] |
||
781 | mov edx,0x00000000 ; color 0x00RRGGBB |
||
782 | int 0x40 |
||
783 | |||
784 | |||
785 | movzx ebx,byte[edi] |
||
786 | sub bl,2 |
||
787 | lea ebx,[ebx*3] |
||
788 | lea ebx,[ebx*5] |
||
789 | add ebx,(SIZE_X+12+70)*65536+28 ; [x start] *65536 + [y start] |
||
790 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 791 | movzx edx,byte[edi+12] ; current flag |
1245 | hidnplayr | 792 | shl edx,2 ; * 4 = text length |
793 | add edx,dword[edi+13] ; pointer to text beginning |
||
794 | mov esi,4 ; text length - |
||
795 | ; flag description 4 characters |
||
796 | int 0x40 |
||
797 | |||
798 | |||
799 | pop ax |
||
800 | ret |
||
801 | normalize_all_light_vectors: |
||
802 | mov edi,lights |
||
803 | @@: |
||
804 | call normalize_vector ; 3dmath.inc |
||
805 | add edi,LIGHT_SIZE |
||
806 | cmp edi,lightsend ;ecx |
||
807 | jl @b |
||
808 | ret |
||
809 | |||
810 | |||
811 | ;macro .comment222 |
||
812 | ; ; planar mapping |
||
813 | ; mov esi,points |
||
814 | ; mov edi,tex_points |
||
815 | ; @@: |
||
816 | ; add esi,2 |
||
817 | ; movsd |
||
818 | ; cmp dword[esi],dword -1 |
||
819 | ; jne @b |
||
820 | |||
821 | |||
822 | |||
823 | |||
824 | ; sub esp,4 |
||
825 | |||
826 | |||
1776 | yogev_ezra | 827 | fldpi |
1245 | hidnplayr | 828 | fadd st,st |
829 | mov esi,[points_ptr] |
||
830 | mov edi,tex_points |
||
831 | movzx ecx,[points_count_var] |
||
832 | inc ecx |
||
833 | ; cmp [map_tex_flag],1 |
||
1776 | yogev_ezra | 834 | ; jne .cylindric |
835 | ; spherical mapping around y axle |
||
836 | |||
1245 | hidnplayr | 837 | |
838 | fld dword[esi] ; x coord |
||
839 | fld dword[esi+8] ; z coord |
||
840 | fpatan ; arctg(st1/st) |
||
841 | ; fdiv .Pi2 |
||
842 | fdiv st0,st1 |
||
843 | fimul [tex_x_div2] |
||
844 | fiadd [tex_x_div2] |
||
845 | fistp word[edi] ; x |
||
846 | |||
847 | |||
848 | fld dword[esi] ; x |
||
849 | fmul st,st0 |
||
850 | fld dword[esi+4] ; y |
||
851 | fmul st,st0 |
||
852 | fld dword[esi+8] ; z |
||
853 | fmul st,st0 |
||
854 | faddp |
||
855 | faddp |
||
856 | fsqrt |
||
857 | fpatan |
||
858 | fldpi |
||
859 | fdivp |
||
860 | fimul [tex_y_div2] |
||
861 | fiadd [tex_y_div2] |
||
862 | fistp word[edi+2] ; y |
||
863 | |||
864 | |||
865 | add edi,4 |
||
866 | loop @b |
||
867 | ffree st0 |
||
868 | ; jmp .end_map |
||
1776 | yogev_ezra | 869 | ; .cylindric: |
870 | ; fld dword[esi] ; around y axle |
||
871 | ; fld dword[esi+8] |
||
872 | ; fpatan |
||
873 | ; fdiv st0,st1 |
||
874 | ; fimul [tex_x_div2] |
||
875 | ; fiadd [tex_x_div2] |
||
876 | ; fistp word[edi] |
||
877 | |||
1245 | hidnplayr | 878 | |
1776 | yogev_ezra | 879 | ; fimul [tex_y_div2] |
880 | ; fiadd [tex_y_div2] |
||
881 | ; fistp word[edi+2] |
||
882 | |||
883 | |||
884 | ; add edi,4 |
||
885 | ; loop .cylindric |
||
886 | ; ffree st0 |
||
887 | ;; mov esp,ebp |
||
888 | ; .end_map: |
||
889 | ret |
||
1245 | hidnplayr | 890 | |
891 | |||
892 | |||
893 | ;env_map 512 x 512 x 3 bytes |
||
894 | .temp equ word [ebp-2] |
||
895 | .nEy equ word [ebp-4] |
||
896 | .nEx equ word [ebp-6] |
||
897 | .col_r equ [ebp-8] |
||
898 | .col_g equ [ebp-9] |
||
899 | .col_b equ [ebp-10] |
||
900 | |||
901 | |||
902 | mov ebp,esp |
||
903 | sub esp,20 |
||
904 | mov edi,envmap |
||
905 | fninit |
||
906 | |||
907 | |||
908 | .ie_ver: |
||
909 | mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x |
||
910 | .ie_hor: |
||
911 | xor ebx,ebx |
||
912 | mov dword .col_b, 0 |
||
913 | .light: |
||
914 | lea esi,[lights+ebx] |
||
915 | fld dword[esi] ; light vector x cooficient |
||
916 | fimul [tex_x_div2] ;[i256] |
||
917 | mov .temp,cx |
||
918 | fisubr .temp |
||
919 | fistp .nEx |
||
920 | fld dword[esi+4] ; light vector y cooficient |
||
921 | fimul [tex_y_div2] ;[i256] |
||
922 | mov .temp,dx |
||
923 | fisubr .temp |
||
924 | fistp .nEy |
||
925 | |||
926 | |||
927 | jl .update_counters |
||
928 | cmp .nEy,- TEX_Y / 2 ;256 |
||
929 | jl .update_counters |
||
930 | cmp .nEx,TEX_X / 2 ;256 |
||
931 | jg .update_counters |
||
932 | cmp .nEy,TEX_Y / 2 ;256 |
||
933 | jg .update_counters |
||
934 | |||
935 | |||
936 | fmul st,st0 |
||
937 | fild .nEy |
||
938 | fmul st,st0 |
||
939 | faddp |
||
940 | fsqrt |
||
941 | fisubr [i256] |
||
942 | fmul [env_const] |
||
943 | fidiv [i256] ; st - 'virtual' dot product |
||
944 | |||
945 | |||
946 | fstsw ax |
||
947 | sahf |
||
948 | jb @f |
||
949 | ffree st |
||
950 | fld1 ;[dot_max] |
||
951 | @@: |
||
952 | fcom [dot_min] |
||
953 | fstsw ax |
||
954 | sahf |
||
955 | ja @f |
||
956 | ffree st |
||
957 | fldz ;[dot_min] |
||
958 | @@: |
||
959 | push ebp |
||
960 | movzx ax,byte[esi+21] |
||
961 | push ax ;- shines |
||
962 | mov al,byte[esi+14] ; b orginal color |
||
963 | push ax |
||
964 | mov al,byte[esi+13] ; g |
||
965 | push ax |
||
966 | mov al,byte[esi+12] ; r |
||
967 | push ax |
||
968 | mov al,byte[esi+20] ; b max color |
||
969 | push ax |
||
970 | mov al,byte[esi+19] ; g |
||
971 | push ax |
||
972 | mov al,byte[esi+18] ; r |
||
973 | push ax |
||
974 | mov al,byte[esi+17] ; b min col |
||
975 | push ax |
||
976 | mov al,byte[esi+16] ; g |
||
977 | push ax |
||
978 | mov al,byte[esi+15] ; r |
||
979 | push ax |
||
980 | push eax ; earlier - dot pr |
||
981 | ; fstp .dot_product |
||
982 | ; push .dot_product |
||
983 | call calc_one_col |
||
984 | pop ebp |
||
985 | ; eax-0x00rrggbb |
||
986 | cmp al,.col_b |
||
987 | jbe @f |
||
988 | mov .col_b,al |
||
989 | @@: ; eax - ggbb00rr |
||
990 | shr ax,8 |
||
991 | cmp al,.col_g |
||
992 | jbe @f |
||
993 | mov .col_g,al |
||
994 | @@: ; eax - bb0000gg |
||
995 | shr eax,16 |
||
996 | cmp al,.col_r |
||
997 | jbe @f |
||
998 | mov .col_r,al |
||
999 | @@: |
||
1000 | .update_counters: ; update and jump when neccesery |
||
1001 | add ebx,LIGHT_SIZE |
||
1002 | cmp bx,[all_lights_size] |
||
1003 | jl .light ; next_light |
||
1004 | mov eax,dword .col_b |
||
1005 | stosd |
||
1006 | dec edi |
||
1007 | |||
1008 | |||
1009 | cmp cx,TEX_X / 2 ;256 |
||
1010 | jne .ie_hor |
||
1011 | |||
1012 | |||
1013 | cmp dx,TEX_Y / 2 ;256 |
||
1014 | jne .ie_ver |
||
1015 | |||
1016 | |||
1017 | pop ebp |
||
1018 | ret |
||
1019 | |||
1020 | |||
1931 | yogev_ezra | 1021 | |
1022 | |||
1245 | hidnplayr | 1023 | ;env_map 512 x 512 x 3 bytes ; many lights using |
1024 | .temp equ word [ebp-2] |
||
1025 | .nz equ dword [ebp-6] ; dword |
||
1026 | .ny equ dword [ebp-10] |
||
1027 | .nx equ dword [ebp-14] |
||
1028 | .col_r equ [ebp-16] |
||
1029 | .col_g equ [ebp-17] |
||
1030 | .col_b equ [ebp-18] |
||
1031 | |||
1032 | |||
1033 | mov ebp,esp |
||
1034 | sub esp,20 |
||
1035 | mov edi,color_map |
||
1036 | fninit |
||
1037 | |||
1038 | |||
1039 | .ie_ver: |
||
1040 | mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x |
||
1041 | .ie_hor: |
||
1042 | mov .temp,cx |
||
1043 | fild .temp |
||
1044 | fidiv [i256] ;st = Nx - vector normal x cooficient |
||
1045 | fst .nx |
||
1046 | fmul st,st0 |
||
1047 | mov .temp,dx |
||
1048 | fild .temp |
||
1049 | fidiv [i256] ; st = Ny - vector normal y coeficient |
||
1050 | fst .ny |
||
1051 | fmul st,st0 |
||
1052 | faddp |
||
1053 | fld1 |
||
1054 | fchs |
||
1055 | faddp |
||
1056 | fabs |
||
1057 | fsqrt |
||
1058 | fchs |
||
1059 | fstp .nz ; st - Nz - vect normal z coeficient |
||
1060 | xor ebx,ebx |
||
1061 | mov dword .col_b, 0 |
||
1062 | .light: |
||
1063 | push edi ;env_map |
||
1064 | lea esi,[lights+ebx] |
||
1065 | lea edi,.nx |
||
1066 | call dot_product |
||
1067 | pop edi |
||
1068 | fcom [dot_min] |
||
1069 | fstsw ax |
||
1070 | sahf |
||
1071 | ja .env_ok1 ;compare with dot_max |
||
1072 | ffree st |
||
1073 | |||
1074 | |||
1075 | .env_ok1: |
||
1076 | fcom [dot_max] |
||
1077 | fstsw ax |
||
1078 | sahf |
||
1079 | jb .env_ok2 ; calc col |
||
1080 | ffree st |
||
1081 | jmp .update_counters |
||
1082 | .env_ok2: ;calc col |
||
1083 | push ebp |
||
1084 | movzx ax,byte[esi+21] |
||
1085 | push ax ;- shines |
||
1086 | mov al,byte[esi+14] ; b orginal color |
||
1087 | push ax |
||
1088 | mov al,byte[esi+13] ; g |
||
1089 | push ax |
||
1090 | mov al,byte[esi+12] ; r |
||
1091 | push ax |
||
1092 | mov al,byte[esi+20] ; b max color |
||
1093 | push ax |
||
1094 | mov al,byte[esi+19] ; g |
||
1095 | push ax |
||
1096 | mov al,byte[esi+18] ; r |
||
1097 | push ax |
||
1098 | mov al,byte[esi+17] ; b min col |
||
1099 | push ax |
||
1100 | mov al,byte[esi+16] ; g |
||
1101 | push ax |
||
1102 | mov al,byte[esi+15] ; r |
||
1103 | push ax |
||
1104 | push eax ; earlier - dot pr |
||
1105 | ; fstp .dot_product |
||
1106 | ; push .dot_product |
||
1107 | call calc_one_col |
||
1108 | pop ebp |
||
1109 | ; eax-0x00rrggbb |
||
1110 | cmp al,.col_b |
||
1111 | jbe @f |
||
1112 | mov .col_b,al |
||
1113 | @@: |
||
1114 | shr ax,8 |
||
1115 | cmp al,.col_g |
||
1116 | jbe @f |
||
1117 | mov .col_g,al |
||
1118 | @@: |
||
1119 | shr eax,16 |
||
1120 | cmp al,.col_r |
||
1121 | jbe @f |
||
1122 | mov .col_r,al |
||
1123 | @@: |
||
1124 | .update_counters: ; update and jump when neccesery |
||
1125 | add ebx,LIGHT_SIZE |
||
1126 | cmp bx,[all_lights_size] |
||
1127 | jl .light ; next_light |
||
1128 | mov eax,dword .col_b |
||
1129 | stosd |
||
1130 | dec edi |
||
1131 | |||
1132 | |||
1133 | cmp cx,TEX_X / 2 ;256 |
||
1134 | jne .ie_hor |
||
1135 | |||
1136 | |||
1137 | cmp dx,TEX_X / 2 ;256 |
||
1138 | jne .ie_ver |
||
1139 | |||
1140 | |||
1141 | mov esp,ebp |
||
1142 | pop ebp |
||
1143 | ret |
||
1144 | if 0 |
||
1145 | init_triangles_normals: |
||
1146 | mov ebx,triangles_normals |
||
1147 | mov ebp,triangles |
||
1148 | @@: |
||
1149 | push ebx |
||
1150 | mov ebx,vectors |
||
1151 | movzx esi,word[ebp] ; first point index |
||
1152 | lea esi,[esi*3] |
||
1153 | lea esi,[points+esi*2] ; esi - pointer to 1st 3d point |
||
1154 | movzx edi,word[ebp+2] ; second point index |
||
1155 | lea edi,[edi*3] |
||
1156 | lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point |
||
1157 | call make_vector |
||
1158 | add ebx,12 |
||
1159 | mov esi,edi |
||
1160 | movzx edi,word[ebp+4] ; third point index |
||
1161 | lea edi,[edi*3] |
||
1162 | lea edi,[points+edi*2] |
||
1163 | call make_vector |
||
1164 | mov edi,ebx ; edi - pointer to 2nd vector |
||
1165 | mov esi,ebx |
||
1166 | sub esi,12 ; esi - pointer to 1st vector |
||
1167 | pop ebx |
||
1168 | call cross_product |
||
1169 | mov edi,ebx |
||
1170 | call normalize_vector |
||
1171 | add ebp,6 |
||
1172 | add ebx,12 |
||
1173 | cmp dword[ebp],-1 |
||
1174 | jne @b |
||
1175 | ret |
||
1176 | end if |
||
1177 | init_point_normals: |
||
1178 | .x equ dword [ebp-4] |
||
1179 | .y equ dword [ebp-8] |
||
1180 | .z equ dword [ebp-12] |
||
1181 | .point_number equ word [ebp-26] |
||
1182 | .hit_faces equ word [ebp-28] |
||
1183 | |||
1184 | |||
1185 | mov ebp,esp |
||
1186 | sub esp,28 |
||
1187 | mov edi,[points_normals_ptr] |
||
1188 | mov .point_number,0 |
||
1189 | .ipn_loop: |
||
1190 | mov .hit_faces,0 |
||
1191 | mov .x,0 |
||
1192 | mov .y,0 |
||
1193 | mov .z,0 |
||
1194 | mov esi,[triangles_ptr] |
||
1195 | xor ecx,ecx ; ecx - triangle number |
||
1196 | .ipn_check_face: |
||
1197 | xor ebx,ebx ; ebx - 'position' in one triangle |
||
1198 | .ipn_check_vertex: |
||
1199 | movzx eax,word[esi+ebx] ; eax - point_number |
||
1200 | cmp ax,.point_number |
||
1201 | jne .ipn_next_vertex |
||
1202 | push esi |
||
1203 | mov esi,ecx |
||
1204 | lea esi,[esi*3] |
||
1205 | ; lea esi,[triangles_normals+esi*4] |
||
1206 | shl esi,2 |
||
1207 | add esi,[triangles_normals_ptr] |
||
1208 | |||
1209 | |||
1210 | fadd dword[esi+vec_x] ; vec_x this defined in 3dmath.asm - x cooficient |
||
1211 | fstp .x ; of normal vactor |
||
1212 | fld .y |
||
1213 | fadd dword[esi+vec_y] |
||
1214 | fstp .y |
||
1215 | fld .z |
||
1216 | fadd dword[esi+vec_z] |
||
1217 | fstp .z |
||
1218 | pop esi |
||
1219 | inc .hit_faces |
||
1220 | jmp .ipn_next_face |
||
1221 | .ipn_next_vertex: |
||
1222 | add ebx,2 |
||
1223 | cmp ebx,6 |
||
1224 | jne .ipn_check_vertex |
||
1225 | .ipn_next_face: |
||
1226 | add esi,6 |
||
1227 | inc ecx |
||
1228 | cmp cx,[triangles_count_var] |
||
1229 | jne .ipn_check_face |
||
1230 | |||
1231 | |||
1232 | fidiv .hit_faces |
||
1233 | fstp dword[edi+vec_x] |
||
1234 | fld .y |
||
1235 | fidiv .hit_faces |
||
1236 | fstp dword[edi+vec_y] |
||
1237 | fld .z |
||
1238 | fidiv .hit_faces |
||
1239 | fstp dword[edi+vec_z] |
||
1240 | call normalize_vector |
||
1241 | add edi,12 ;type vector 3d |
||
1242 | inc .point_number |
||
1243 | mov dx,.point_number |
||
1244 | cmp dx,[points_count_var] |
||
1245 | jne .ipn_loop |
||
1246 | |||
1247 | |||
1248 | ret |
||
1249 | ;=============================================================== |
||
1250 | |||
1251 | |||
1252 | mov ebx,[triangles_normals_ptr] |
||
1253 | mov ebp,[triangles_ptr] |
||
1254 | @@: |
||
1255 | push ebx |
||
1256 | mov ebx,vectors |
||
1257 | movzx esi,word[ebp] ; first point index |
||
1258 | lea esi,[esi*3] |
||
1259 | ; lea esi,[points+esi*2] ; esi - pointer to 1st 3d point |
||
1260 | shl esi,2 |
||
1261 | add esi,[points_ptr] |
||
1262 | movzx edi,word[ebp+2] ; first point index |
||
1263 | lea edi,[edi*3] |
||
1264 | shl edi,2 |
||
1265 | add edi,[points_ptr] |
||
1266 | ; movzx edi,word[ebp+2] ; second point index |
||
1267 | ; lea edi,[edi*3] |
||
1268 | ; lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point |
||
1269 | call make_vector_r |
||
1270 | add ebx,12 |
||
1271 | mov esi,edi |
||
1272 | movzx edi,word[ebp+4] ; third point index |
||
1273 | lea edi,[edi*3] |
||
1274 | shl edi,2 |
||
1275 | add edi,[points_ptr] |
||
1276 | ; lea edi,[points+edi*2] |
||
1277 | call make_vector_r |
||
1278 | mov edi,ebx ; edi - pointer to 2nd vector |
||
1279 | mov esi,ebx |
||
1280 | sub esi,12 ; esi - pointer to 1st vector |
||
1281 | pop ebx |
||
1282 | call cross_product |
||
1283 | mov edi,ebx |
||
1284 | call normalize_vector |
||
1285 | add ebp,6 |
||
1286 | add ebx,12 |
||
1287 | cmp dword[ebp],-1 |
||
1288 | jne @b |
||
1289 | ret |
||
1290 | |||
1291 | |||
1292 | |||
1293 | sort_triangles: |
||
1294 | mov esi,[triangles_ptr] |
||
1295 | mov edi,triangles_with_z |
||
1296 | mov ebp,[points_translated_ptr] |
||
1297 | |||
1298 | |||
1299 | movzx eax,word[esi] |
||
1300 | lea eax,[eax*3] |
||
1301 | movzx ecx,word[ebp+eax*2+4] |
||
1302 | |||
1303 | |||
1304 | lea eax,[eax*3] |
||
1305 | add cx,word[ebp+eax*2+4] |
||
1306 | |||
1307 | |||
1308 | lea eax,[eax*3] |
||
1309 | add cx,word[ebp+eax*2+4] |
||
1310 | |||
1311 | |||
1312 | ; cwd |
||
1313 | ; idiv word[i3] |
||
1314 | movsd ; store vertex coordinates |
||
1315 | movsw |
||
1316 | stosw ; middle vertex coordinate 'z' in triangles_with_z list |
||
1317 | cmp dword[esi],-1 |
||
1318 | jne make_triangle_with_z |
||
1319 | movsd ; copy end mark |
||
1320 | mov eax,4 |
||
1321 | lea edx,[edi-8-trizdd] |
||
1322 | ; lea edx, [edi-8] |
||
1323 | ; sub edx,[triangles_w_z_ptr] |
||
1324 | mov [high],edx |
||
1325 | call quicksort |
||
1326 | mov eax,4 |
||
1327 | mov edx,[high] |
||
1328 | call insertsort |
||
1329 | jmp end_sort |
||
1330 | |||
1331 | |||
1332 | mov ecx,edx |
||
1333 | sub ecx,eax |
||
1334 | cmp ecx,32 |
||
1335 | jc .exit |
||
1336 | lea ecx,[eax+edx] |
||
1337 | shr ecx,4 |
||
1338 | lea ecx,[ecx*8-4]; |
||
1339 | ; mov edi,[triangles_w_z_ptr] |
||
1340 | ; mov ebx,[edi+eax] |
||
1341 | ; mov esi,[edi+ecx] |
||
1342 | ; mov edi,[edi+edx] |
||
1343 | mov ebx,[trizdd+eax]; trizdd[l] |
||
1344 | mov esi,[trizdd+ecx]; trizdd[i] |
||
1345 | mov edi,[trizdd+edx]; trizdd[h] |
||
1346 | cmp ebx,esi |
||
1347 | jg @f ; direction NB! you need to negate these to invert the order |
||
1348 | if Ext=NON |
||
1349 | mov [trizdd+eax],esi |
||
1350 | mov [trizdd+ecx],ebx |
||
1351 | mov ebx,[trizdd+eax-4] |
||
1352 | mov esi,[trizdd+ecx-4] |
||
1353 | mov [trizdd+eax-4],esi |
||
1354 | mov [trizdd+ecx-4],ebx |
||
1355 | mov ebx,[trizdd+eax] |
||
1356 | mov esi,[trizdd+ecx] |
||
1357 | else |
||
1358 | ; push ebx |
||
1359 | ; mov ebx,[triangles_w_z_ptr] |
||
1360 | ; movq mm0,[ebx+eax-4] |
||
1361 | ; movq mm1,[ebx+ecx-4] |
||
1362 | ; movq [ebx+ecx-4],mm0 |
||
1363 | ; movq [ebx+eax-4],mm1 |
||
1364 | ; pop ebx |
||
1365 | movq mm0,[trizdq+eax-4] |
||
1366 | movq mm1,[trizdq+ecx-4] |
||
1367 | movq [trizdq+ecx-4],mm0 |
||
1368 | movq [trizdq+eax-4],mm1 |
||
1369 | xchg ebx,esi |
||
1370 | end if |
||
1371 | @@: |
||
1372 | cmp ebx,edi |
||
1373 | jg @f ; direction |
||
1374 | if Ext=NON |
||
1375 | mov [trizdd+eax],edi |
||
1376 | mov [trizdd+edx],ebx |
||
1377 | mov ebx,[trizdd+eax-4] |
||
1378 | mov edi,[trizdd+edx-4] |
||
1379 | mov [trizdd+eax-4],edi |
||
1380 | mov [trizdd+edx-4],ebx |
||
1381 | mov ebx,[trizdd+eax] |
||
1382 | mov edi,[trizdd+edx] |
||
1383 | else |
||
1384 | ; push ebx |
||
1385 | ; mov ebx,[triangles_w_z_ptr] |
||
1386 | ; movq mm0,[ebx+eax-4] |
||
1387 | ; movq mm1,[ebx+edx-4] |
||
1388 | ; movq [ebx+edx-4],mm0 |
||
1389 | ; movq [ebx+eax-4],mm1 |
||
1390 | movq mm0,[trizdq+eax-4] |
||
1391 | movq mm1,[trizdq+edx-4] |
||
1392 | movq [trizdq+edx-4],mm0 |
||
1393 | movq [trizdq+eax-4],mm1 |
||
1394 | ; pop ebx |
||
1395 | xchg ebx,edi |
||
1396 | end if |
||
1397 | @@: |
||
1398 | cmp esi,edi |
||
1399 | jg @f ; direction |
||
1400 | if Ext=NON |
||
1401 | mov [trizdd+ecx],edi |
||
1402 | mov [trizdd+edx],esi |
||
1403 | mov esi,[trizdd+ecx-4] |
||
1404 | mov edi,[trizdd+edx-4] |
||
1405 | mov [trizdd+ecx-4],edi |
||
1406 | mov [trizdd+edx-4],esi |
||
1407 | else |
||
1408 | ; push ebx |
||
1409 | ; mov ebx,[triangles_w_z_ptr] |
||
1410 | ; movq mm0,[ebx+ecx-4] |
||
1411 | ; movq mm1,[ebx+edx-4] |
||
1412 | ; movq [ebx+edx-4],mm0 |
||
1413 | ; movq [ebx+ecx-4],mm1 |
||
1414 | ; pop ebx |
||
1415 | |||
1416 | |||
1417 | movq mm1,[trizdq+edx-4] |
||
1418 | movq [trizdq+edx-4],mm0 |
||
1419 | movq [trizdq+ecx-4],mm1 |
||
1420 | xchg ebx,esi |
||
1421 | end if |
||
1422 | @@: |
||
1423 | mov ebp,eax ; direction |
||
1424 | add ebp,8 ; j |
||
1425 | if Ext=NON |
||
1426 | mov esi,[trizdd+ebp] |
||
1427 | mov edi,[trizdd+ecx] |
||
1428 | mov [trizdd+ebp],edi |
||
1429 | mov [trizdd+ecx],esi |
||
1430 | mov esi,[trizdd+ebp-4] |
||
1431 | mov edi,[trizdd+ecx-4] |
||
1432 | mov [trizdd+ecx-4],esi |
||
1433 | mov [trizdd+ebp-4],edi |
||
1434 | else |
||
1435 | ; push ebx |
||
1436 | ; mov ebx,[triangles_w_z_ptr] |
||
1437 | ; movq mm0,[ebx+ebp-4] |
||
1438 | ; movq mm1,[ebx+ecx-4] |
||
1439 | ; movq [ebx+ecx-4],mm0 |
||
1440 | ; movq [ebx+ebp-4],mm1 |
||
1441 | ; pop ebx |
||
1442 | |||
1443 | |||
1444 | movq mm1,[trizdq+ecx-4] |
||
1445 | movq [trizdq+ecx-4],mm0 |
||
1446 | movq [trizdq+ebp-4],mm1 |
||
1447 | end if |
||
1448 | mov ecx,edx ; i; direction |
||
1449 | mov ebx,[trizdd+ebp]; trizdd[j] |
||
1450 | ; mov ebx, [triangles_w_z_ptr] |
||
1451 | ; add ebx, ebp |
||
1452 | |||
1453 | |||
1454 | ; mov eax, [triangles_w_z_ptr] |
||
1455 | .loop: |
||
1456 | sub ecx,8 ; direction |
||
1457 | cmp [trizdd+ecx],ebx |
||
1458 | ; cmp [eax+ecx],ebx |
||
1459 | jl .loop ; direction |
||
1460 | @@: |
||
1461 | add ebp,8 ; direction |
||
1462 | cmp [trizdd+ebp],ebx |
||
1463 | ; cmp [eax+ebp],ebx |
||
1464 | jg @b ; direction |
||
1465 | cmp ebp,ecx |
||
1466 | jge @f ; direction |
||
1467 | if Ext=NON |
||
1468 | mov esi,[trizdd+ecx] |
||
1469 | mov edi,[trizdd+ebp] |
||
1470 | mov [trizdd+ebp],esi |
||
1471 | mov [trizdd+ecx],edi |
||
1472 | mov edi,[trizdd+ecx-4] |
||
1473 | mov esi,[trizdd+ebp-4] |
||
1474 | mov [trizdd+ebp-4],edi |
||
1475 | mov [trizdd+ecx-4],esi |
||
1476 | else |
||
1477 | ; movq mm0,[eax+ecx-4] |
||
1478 | ; movq mm1,[eax+ebp-4] |
||
1479 | ; movq [eax+ebp-4],mm0 |
||
1480 | ; movq [eax+ecx-4],mm1 |
||
1481 | movq mm0,[trizdq+ecx-4] |
||
1482 | movq mm1,[trizdq+ebp-4] |
||
1483 | movq [trizdq+ebp-4],mm0 |
||
1484 | movq [trizdq+ecx-4],mm1 |
||
1485 | end if |
||
1486 | jmp .loop |
||
1487 | ; pop eax |
||
1488 | @@: |
||
1489 | if Ext=NON |
||
1490 | mov esi,[trizdd+ecx] |
||
1491 | mov edi,[trizdd+eax+8] |
||
1492 | mov [trizdd+eax+8],esi |
||
1493 | mov [trizdd+ecx],edi |
||
1494 | mov edi,[trizdd+ecx-4] |
||
1495 | mov esi,[trizdd+eax+4] |
||
1496 | mov [trizdd+eax+4],edi |
||
1497 | mov [trizdd+ecx-4],esi |
||
1498 | else |
||
1499 | ; push edx |
||
1500 | ; mov edx,[triangles_w_z_ptr] |
||
1501 | ; movq mm0,[edx+ecx-4] |
||
1502 | ; movq mm1,[edx+eax+4]; dir |
||
1503 | ; movq [edx+eax+4],mm0; dir |
||
1504 | ; movq [edx+ecx-4],mm1 |
||
1505 | ; pop edx |
||
1506 | |||
1507 | |||
1508 | movq mm1,[trizdq+eax+4]; dir |
||
1509 | movq [trizdq+eax+4],mm0; dir |
||
1510 | movq [trizdq+ecx-4],mm1 |
||
1511 | end if |
||
1512 | add ecx,8 |
||
1513 | push ecx edx |
||
1514 | mov edx,ebp |
||
1515 | call quicksort |
||
1516 | pop edx eax |
||
1517 | call quicksort |
||
1518 | .exit: |
||
1519 | ret |
||
1520 | insertsort: |
||
1521 | mov esi,eax |
||
1522 | .start: |
||
1523 | add esi,8 |
||
1524 | cmp esi,edx |
||
1525 | ja .exit |
||
1526 | mov ebx,[trizdd+esi] |
||
1527 | ; mov ebx,[triangles_w_z_ptr] |
||
1528 | ; add ebx,esi |
||
1529 | if Ext=NON |
||
1530 | mov ecx,[trizdd+esi-4] |
||
1531 | else |
||
1532 | ; push ebx |
||
1533 | ; mov ebx,[triangles_w_z_ptr] |
||
1534 | ; movq mm1,[ebx+esi-4] |
||
1535 | movq mm1,[trizdq+esi-4] |
||
1536 | ; pop ebx |
||
1537 | end if |
||
1538 | mov edi,esi |
||
1539 | @@: |
||
1540 | cmp edi,eax |
||
1541 | jna @f |
||
1542 | ; push eax |
||
1543 | ; mov eax,[triangles_w_z_ptr] |
||
1544 | ; cmp [eax+edi-8],ebx |
||
1545 | ; pop eax |
||
1546 | cmp [trizdd+edi-8],ebx |
||
1547 | jg @f ; direction |
||
1548 | if Ext=NON |
||
1549 | mov ebp,[trizdd+edi-8] |
||
1550 | mov [trizdd+edi],ebp |
||
1551 | mov ebp,[trizdd+edi-12] |
||
1552 | mov [trizdd+edi-4],ebp |
||
1553 | else |
||
1554 | ; push eax |
||
1555 | ; mov eax,[triangles_w_z_ptr] |
||
1556 | ; movq mm0,[eax+edi-12] |
||
1557 | ; movq [eax+edi-4],mm0 |
||
1558 | movq mm0,[trizdq+edi-12] |
||
1559 | movq [trizdq+edi-4],mm0 |
||
1560 | ; pop eax |
||
1561 | end if |
||
1562 | sub edi,8 |
||
1563 | jmp @b |
||
1564 | @@: |
||
1565 | if Ext=NON |
||
1566 | mov [trizdd+edi],ebx |
||
1567 | mov [trizdd+edi-4],ecx |
||
1568 | else |
||
1569 | ; push eax |
||
1570 | ; mov eax,[triangles_w_z_ptr] |
||
1571 | ; movq [eax+edi-4],mm1 |
||
1572 | movq [trizdq+edi-4],mm1 |
||
1573 | ; pop eax |
||
1574 | end if |
||
1575 | jmp .start |
||
1576 | .exit: |
||
1577 | ret |
||
1578 | end_sort: |
||
1579 | ; translate triangles_with_z to sorted_triangles |
||
1580 | mov esi,triangles_with_z |
||
1581 | ; mov esi,[triangles_w_z_ptr] |
||
1582 | ; mov edi,sorted_triangles |
||
1583 | mov edi,[triangles_ptr] |
||
1584 | again_copy: |
||
1585 | if Ext=NON |
||
1586 | movsd |
||
1587 | movsw |
||
1588 | add esi,2 |
||
1589 | else |
||
1590 | movq mm0,[esi] |
||
1591 | movq [edi],mm0 |
||
1592 | add esi,8 |
||
1593 | add edi,6 |
||
1594 | end if |
||
1595 | cmp dword[esi],-1 |
||
1596 | jne again_copy |
||
1597 | ; if Ext=MMX |
||
1598 | ; emms |
||
1599 | ; end if |
||
1600 | movsd ; copy end mark too |
||
1601 | ret |
||
1602 | |||
1603 | |||
1604 | mov edi,screen |
||
1605 | mov ecx,SIZE_X*SIZE_Y*3/4 |
||
1606 | xor eax,eax |
||
1607 | if Ext=NON |
||
1608 | rep stosd |
||
1609 | else |
||
1610 | pxor mm0,mm0 |
||
1611 | @@: |
||
1612 | movq [edi+00],mm0 |
||
1613 | movq [edi+08],mm0 |
||
1614 | movq [edi+16],mm0 |
||
1615 | movq [edi+24],mm0 |
||
1616 | add edi,32 |
||
1617 | sub ecx,8 |
||
1618 | jnc @b |
||
1619 | end if |
||
1620 | ret |
||
1621 | |||
1622 | |||
1623 | |||
1624 | mov esi,[triangles_ptr] |
||
1625 | mov [edges_counter],0 |
||
2881 | leency | 1626 | .again_dts: |
1245 | hidnplayr | 1627 | mov ebp,[points_translated_ptr] |
1628 | if Ext=NON |
||
1629 | movzx eax,word[esi] |
||
1630 | mov [point_index1],ax |
||
1631 | lea eax,[eax*3] |
||
1632 | add eax,eax |
||
1633 | push ebp |
||
1634 | add ebp,eax |
||
1635 | mov eax,[ebp] |
||
1636 | mov dword[xx1],eax |
||
1637 | mov eax,[ebp+4] |
||
1638 | mov [zz1],ax |
||
1639 | pop ebp |
||
1640 | |||
1641 | |||
1642 | |||
1643 | mov [point_index2],ax |
||
1644 | lea eax,[eax*3] |
||
1645 | add eax,eax |
||
1646 | push ebp |
||
1647 | add ebp,eax |
||
1648 | mov eax,[ebp] |
||
1649 | mov dword[xx2],eax |
||
1650 | mov eax,[ebp+4] |
||
1651 | mov [zz2],ax |
||
1652 | pop ebp |
||
1653 | |||
1654 | |||
1655 | |||
1656 | mov [point_index3],ax |
||
1657 | lea eax,[eax*3] |
||
1658 | add eax,eax |
||
1659 | ; push ebp |
||
1660 | add ebp,eax |
||
1661 | mov eax,[ebp] |
||
1662 | mov dword[xx3],eax |
||
1663 | mov eax,[ebp+4] |
||
1664 | mov [zz3],ax |
||
1665 | else |
||
1666 | mov eax,dword[esi] ; don't know MMX |
||
1667 | mov dword[point_index1],eax |
||
1668 | ; shr eax,16 |
||
1669 | ; mov [point_index2],ax |
||
1670 | mov ax,word[esi+4] |
||
1671 | mov [point_index3],ax |
||
1672 | movq mm0,[esi] |
||
1673 | pmullw mm0,qword[const6] |
||
1674 | movd eax,mm0 |
||
1675 | psrlq mm0,16 |
||
1676 | movd ebx,mm0 |
||
1677 | psrlq mm0,16 |
||
1678 | movd ecx,mm0 |
||
1679 | and eax,0FFFFh |
||
1680 | and ebx,0FFFFh |
||
1681 | and ecx,0FFFFh |
||
1682 | movq mm0,[ebp+eax] |
||
1683 | movq mm1,[ebp+ebx] |
||
1684 | movq mm2,[ebp+ecx] |
||
1685 | movq qword[xx1],mm0 |
||
1686 | movq qword[xx2],mm1 |
||
1687 | movq qword[xx3],mm2 |
||
1688 | ; emms |
||
1689 | end if ; ********************************* |
||
1690 | push esi ; |
||
1691 | fninit ; DO culling AT FIRST |
||
1692 | cmp [culling_flag],1 ; (if culling_flag = 1) |
||
1693 | jne .no_culling |
||
1694 | mov esi,point_index1 ; ********************************* |
||
1695 | mov ecx,3 ; |
||
1696 | @@: |
||
1697 | movzx eax,word[esi] |
||
1698 | lea eax,[eax*3] |
||
1699 | shl eax,2 |
||
1700 | add eax,[points_normals_rot_ptr] |
||
1701 | ; lea eax,[eax+point_normals_rotated] |
||
1702 | fld dword[eax+8] ; ***************************** |
||
1703 | ftst ; CHECKING OF Z COOFICIENT OF |
||
1704 | fstsw ax ; NORMAL VECTOR |
||
1705 | sahf |
||
1706 | jb @f |
||
1707 | ffree st |
||
1708 | loop @b |
||
1709 | jmp .end_draw ; non visable |
||
1710 | @@: |
||
1711 | ffree st ;is visable |
||
1712 | .no_culling: |
||
1713 | cmp [dr_flag],0 ; draw type flag |
||
1714 | je .flat_draw |
||
1715 | cmp [dr_flag],2 |
||
1716 | je .env_mapping |
||
1717 | cmp [dr_flag],3 |
||
1718 | je .bump_mapping |
||
1719 | cmp [dr_flag],4 |
||
1720 | je .tex_mapping |
||
1721 | cmp [dr_flag],5 |
||
1722 | je .rainbow |
||
1723 | cmp [dr_flag],7 |
||
1724 | je .grd_tex |
||
1725 | cmp [dr_flag],8 |
||
1726 | je .two_tex |
||
1727 | cmp [dr_flag],9 |
||
1728 | je .bump_tex |
||
1729 | cmp [dr_flag],10 |
||
1730 | je .cubic_env_mapping |
||
1731 | cmp [dr_flag],11 |
||
2881 | leency | 1732 | je .draw_smooth_line |
1733 | ; **************** |
||
1245 | hidnplayr | 1734 | mov esi,point_index3 ; do Gouraud shading |
1735 | mov ecx,3 |
||
1736 | .again_grd_draw: |
||
1737 | movzx eax,word[esi] |
||
1738 | shl eax,2 |
||
1739 | lea eax,[eax*3] |
||
1740 | add eax,[points_normals_rot_ptr] |
||
1741 | ; texture x=(rotated point normal -> x * 255)+255 |
||
1742 | fld dword[eax] ; x cooficient of normal vector |
||
1743 | fimul [correct_tex] |
||
1744 | fiadd [correct_tex] |
||
1745 | fistp word[esp-2] |
||
1746 | ; texture y=(rotated point normal -> y * 255)+255 |
||
1747 | fld dword[eax+4] ; y cooficient |
||
1748 | fimul [correct_tex] |
||
1749 | fiadd [correct_tex] |
||
1750 | fistp word[esp-4] |
||
1751 | |||
1752 | |||
1753 | movzx ebx,word[esp-2] |
||
1754 | shl eax,TEX_SHIFT |
||
1755 | add eax,ebx |
||
1756 | lea eax,[eax*3+color_map] |
||
1757 | mov eax,dword[eax] |
||
1758 | cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
||
1759 | jne @f |
||
1760 | lea edx,[ecx*3] |
||
1761 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
||
1762 | @@: |
||
1763 | ror eax,16 ; eax -0xxxrrggbb -> 0xggbbxxrr |
||
1764 | xor ah,ah |
||
1765 | push ax ;r |
||
1766 | rol eax,8 ; eax-0xggbb00rr -> 0xbb00rrgg |
||
1767 | xor ah,ah |
||
1768 | push ax ;g |
||
1769 | shr eax,24 |
||
1770 | push ax ;b |
||
1771 | |||
1772 | |||
1773 | dec cx |
||
1774 | jnz .again_grd_draw |
||
1775 | jmp .both_draw |
||
1776 | |||
1777 | |||
1778 | ; lea edi,[edi*3] |
||
1779 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
||
1780 | ; mov esi,light_vector |
||
1781 | ; call dot_product |
||
1782 | ; fabs |
||
1783 | ; fimul [orginal_color_r] |
||
1784 | ; fistp [temp_col] |
||
1785 | ; and [temp_col],0x00ff |
||
1786 | ; push [temp_col] |
||
1787 | ; push [temp_col] |
||
1788 | ; push [temp_col] |
||
1789 | |||
1790 | |||
1791 | ; lea edi,[edi*3] |
||
1792 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
||
1793 | ; mov esi,light_vector |
||
1794 | ; call dot_product |
||
1795 | ; fabs |
||
1796 | ; fimul [orginal_color_r] |
||
1797 | ; fistp [temp_col] |
||
1798 | ; and [temp_col],0x00ff |
||
1799 | ; push [temp_col] |
||
1800 | ; push [temp_col] |
||
1801 | ; push [temp_col] |
||
1802 | |||
1803 | |||
1804 | ; lea edi,[edi*3] |
||
1805 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
||
1806 | ; mov esi,light_vector |
||
1807 | ; call dot_product |
||
1808 | ; fabs |
||
1809 | ; fimul [orginal_color_r] |
||
1810 | ; fistp [temp_col] |
||
1811 | ; and [temp_col],0x00ff |
||
1812 | ; push [temp_col] |
||
1813 | ; push [temp_col] |
||
1814 | ; push [temp_col] |
||
1815 | .rainbow: |
||
1816 | cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
||
1817 | jne @f |
||
1818 | push [zz3] |
||
1819 | @@: |
||
1820 | mov eax,dword[yy3] |
||
1821 | mov ebx,0x00ff00ff |
||
1822 | and eax,ebx |
||
1823 | push eax |
||
1824 | neg al |
||
1825 | push ax |
||
1826 | cmp [catmull_flag],1 |
||
1827 | jne @f |
||
1828 | push [zz2] |
||
1829 | @@: |
||
1830 | mov eax,dword[yy2] |
||
1831 | and eax,ebx |
||
1832 | push eax |
||
1833 | neg al |
||
1834 | push ax |
||
1835 | cmp [catmull_flag],1 |
||
1836 | jne @f |
||
1837 | push [zz1] |
||
1838 | @@: |
||
1839 | mov eax,dword[yy1] |
||
1840 | and eax,ebx |
||
1841 | push eax |
||
1842 | neg al |
||
1843 | push ax |
||
1844 | .both_draw: |
||
1845 | mov eax,dword[xx1] |
||
1846 | ror eax,16 |
||
1847 | mov ebx,dword[xx2] |
||
1848 | ror ebx,16 |
||
1849 | mov ecx,dword[xx3] |
||
1850 | ror ecx,16 |
||
1851 | lea edi,[screen] |
||
1852 | cmp [catmull_flag],0 |
||
1853 | je @f |
||
1854 | ; lea esi,[Z_buffer] |
||
1855 | mov esi,[Zbuffer_ptr] |
||
1856 | call gouraud_triangle_z |
||
1857 | jmp .end_draw |
||
1858 | @@: |
||
1859 | call gouraud_triangle |
||
1860 | jmp .end_draw |
||
1861 | |||
1862 | |||
1863 | ; FLAT DRAWING |
||
1864 | movzx eax,[point_index1] |
||
1865 | movzx ebx,[point_index2] |
||
1866 | movzx ecx,[point_index3] |
||
1867 | shl eax,2 |
||
1868 | shl ebx,2 |
||
1869 | shl ecx,2 |
||
1870 | lea eax,[eax*3] ;+point_normals_rotated] |
||
1871 | add eax,[points_normals_rot_ptr] |
||
1872 | lea ebx,[ebx*3] ;+point_normals_rotated] |
||
1873 | add ebx,[points_normals_rot_ptr] |
||
1874 | lea ecx,[ecx*3] ;+point_normals_rotated] |
||
1875 | add ecx,[points_normals_rot_ptr] |
||
1876 | fld dword[eax] ; x cooficient of normal vector |
||
1877 | fadd dword[ebx] |
||
1878 | fadd dword[ecx] |
||
1879 | fidiv [i3] |
||
1880 | fimul [correct_tex] |
||
1881 | fiadd [correct_tex] |
||
1882 | fistp dword[esp-4] ; x temp variables |
||
1883 | fld dword[eax+4] ; y cooficient of normal vector |
||
1884 | fadd dword[ebx+4] |
||
1885 | fadd dword[ecx+4] |
||
1886 | fidiv [i3] |
||
1887 | fimul [correct_tex] |
||
1888 | fiadd [correct_tex] |
||
1889 | fistp dword[esp-8] ; y |
||
1890 | mov edx,dword[esp-8] |
||
1891 | shl edx,TEX_SHIFT |
||
1892 | add edx,dword[esp-4] |
||
1893 | lea eax,[3*edx+color_map] |
||
1894 | mov edx,dword[eax] |
||
1895 | |||
1896 | |||
1897 | |||
1898 | |||
1899 | |||
1900 | |||
1901 | ; add ax,[zz2] |
||
1902 | ; add ax,[zz3] |
||
1903 | ; cwd |
||
1904 | ; idiv [i3] ; = -((a+b+c)/3+130) |
||
1905 | ; add ax,130 |
||
1906 | ; neg al |
||
1907 | ; xor edx,edx |
||
1908 | ; mov ah,al ;set color according to z position |
||
1909 | ; shl eax,8 |
||
1910 | ; mov edx,eax |
||
1911 | |||
1912 | |||
1913 | ror eax,16 |
||
1914 | mov ebx,dword[xx2] |
||
1915 | ror ebx,16 |
||
1916 | mov ecx,dword[xx3] |
||
1917 | ror ecx,16 |
||
1918 | ; mov edi,screen |
||
1919 | lea edi,[screen] |
||
1920 | cmp [catmull_flag],0 |
||
1921 | je @f |
||
1922 | ; lea esi,[Z_buffer] |
||
1923 | mov esi,[Zbuffer_ptr] |
||
1924 | push word[zz3] |
||
1925 | push word[zz2] |
||
1926 | push word[zz1] |
||
1927 | call flat_triangle_z |
||
1928 | jmp .end_draw |
||
1929 | @@: |
||
1930 | call draw_triangle |
||
1931 | jmp .end_draw |
||
1932 | .env_mapping: |
||
1933 | ; fninit |
||
1934 | cmp [catmull_flag],0 |
||
1935 | je @f |
||
1936 | push [zz3] |
||
1937 | push [zz2] |
||
1938 | push [zz1] |
||
1939 | @@: |
||
1940 | mov esi,point_index1 |
||
1941 | sub esp,12 |
||
1942 | mov edi,esp |
||
1943 | mov ecx,3 |
||
1944 | @@: |
||
1945 | movzx eax,word[esi] |
||
1946 | lea eax,[eax*3] |
||
1947 | shl eax,2 |
||
1948 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
||
1949 | ; # |
||
1950 | ; fld dword[eax] |
||
1951 | ; fmul dword[eax+4] |
||
1952 | ; fld1 |
||
1953 | ; fld1 |
||
1954 | ; faddp |
||
1955 | ; fmulp |
||
1956 | ; fimul [correct_tex] |
||
1957 | ; fiadd [correct_tex] |
||
1958 | ; fistp word[edi] |
||
1959 | ; mov word[edi+2],0 |
||
1960 | ;; fistp word[edi+2] |
||
1961 | ; # last change |
||
1962 | ; texture x=(rotated point normal -> x * 255)+255 |
||
1963 | fld dword[eax] |
||
1964 | fimul [correct_tex] |
||
1965 | fiadd [correct_tex] |
||
1966 | fistp word[edi] |
||
1967 | ; texture y=(rotated point normal -> y * 255)+255 |
||
1968 | fld dword[eax+4] |
||
1969 | fimul [correct_tex] |
||
1970 | fiadd [correct_tex] |
||
1971 | fistp word[edi+2] |
||
1972 | ; # end of last ch. |
||
1973 | add edi,4 |
||
1974 | add esi,2 |
||
1975 | loop @b |
||
1976 | |||
1977 | |||
1978 | ror eax,16 |
||
1979 | mov ebx,dword[xx2] |
||
1980 | ror ebx,16 |
||
1981 | mov ecx,dword[xx3] |
||
1982 | ror ecx,16 |
||
1983 | mov edi,screen |
||
1984 | mov esi,envmap |
||
1985 | cmp [catmull_flag],0 |
||
1986 | je @f |
||
1987 | ; mov edx,Z_buffer |
||
1988 | mov edx,[Zbuffer_ptr] |
||
1989 | call tex_triangle_z |
||
1990 | jmp .end_draw |
||
1991 | @@: |
||
1992 | call tex_triangle |
||
1993 | jmp .end_draw |
||
1994 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1995 | .cubic_env_mapping: |
||
1996 | ; fninit |
||
1997 | cmp [catmull_flag],0 |
||
1998 | je @f |
||
1999 | push [zz3] |
||
2000 | push [zz2] |
||
2001 | push [zz1] |
||
2002 | @@: |
||
2003 | mov esi,point_index1 |
||
2004 | sub esp,12 |
||
2005 | mov edi,esp |
||
2006 | mov ecx,3 |
||
2007 | @@: |
||
2008 | movzx eax,word[esi] |
||
2009 | lea eax,[eax*3] |
||
2010 | shl eax,2 |
||
2011 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
||
2012 | ; # |
||
2013 | fld dword[eax] |
||
2014 | fmul dword[eax+4] |
||
2015 | fld1 |
||
2016 | fld1 |
||
2017 | faddp |
||
2018 | fmulp |
||
2019 | fimul [correct_tex] |
||
2020 | fiadd [correct_tex] |
||
2021 | fistp word[edi] |
||
2022 | mov word[edi+2],0 |
||
2023 | ; fistp word[edi+2] |
||
2024 | ; # last change |
||
2025 | ; ; texture x=(rotated point normal -> x * 255)+255 |
||
2026 | ; fld dword[eax] |
||
2027 | ; fimul [correct_tex] |
||
2028 | ; fiadd [correct_tex] |
||
2029 | ; fistp word[edi] |
||
2030 | ; ; texture y=(rotated point normal -> y * 255)+255 |
||
2031 | ; fld dword[eax+4] |
||
2032 | ; fimul [correct_tex] |
||
2033 | ; fiadd [correct_tex] |
||
2034 | ; fistp word[edi+2] |
||
2035 | ; # end of last ch. |
||
2036 | add edi,4 |
||
2037 | add esi,2 |
||
2038 | loop @b |
||
2039 | |||
2040 | |||
2041 | ror eax,16 |
||
2042 | mov ebx,dword[xx2] |
||
2043 | ror ebx,16 |
||
2044 | mov ecx,dword[xx3] |
||
2045 | ror ecx,16 |
||
2046 | mov edi,screen |
||
2047 | mov esi,envmap_cub |
||
2048 | cmp [catmull_flag],0 |
||
2049 | je @f |
||
2050 | ; mov edx,Z_buffer |
||
2051 | mov edx,[Zbuffer_ptr] |
||
2052 | call tex_triangle_z |
||
2053 | jmp .end_draw |
||
2054 | @@: |
||
2055 | call tex_triangle |
||
2056 | jmp .end_draw |
||
2057 | |||
2058 | |||
2059 | |||
2060 | |||
2061 | ; fninit |
||
2062 | cmp [catmull_flag],0 |
||
2063 | je @f |
||
2064 | ; push Z_buffer |
||
2065 | push [Zbuffer_ptr] |
||
2066 | push [zz3] |
||
2067 | push [zz2] |
||
2068 | push [zz1] |
||
2069 | @@: |
||
2070 | mov esi,point_index1 |
||
2071 | sub esp,12 |
||
2072 | mov edi,esp |
||
2073 | mov ecx,3 |
||
2074 | @@: |
||
2075 | movzx eax,word[esi] |
||
2076 | lea eax,[eax*3] |
||
2077 | shl eax,2 |
||
2078 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
||
2079 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2080 | fld dword[eax] |
||
2081 | fimul [correct_tex] |
||
2082 | fiadd [correct_tex] |
||
2083 | fistp word[edi] |
||
2084 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2085 | fld dword[eax+4] |
||
2086 | fimul [correct_tex] |
||
2087 | fiadd [correct_tex] |
||
2088 | fistp word[edi+2] |
||
2089 | |||
2090 | |||
2091 | add esi,2 |
||
2092 | loop @b |
||
2093 | |||
2094 | |||
2095 | shl esi,2 |
||
2096 | add esi,tex_points |
||
2097 | push dword[esi] |
||
2098 | movzx esi,[point_index2] |
||
2099 | shl esi,2 |
||
2100 | add esi,tex_points |
||
2101 | ; lea esi,[esi*3] |
||
2102 | ; lea esi,[points+2+esi*2] |
||
2103 | push dword[esi] |
||
2104 | ; push dword[xx2] |
||
2105 | movzx esi,[point_index1] |
||
2106 | shl esi,2 |
||
2107 | add esi,tex_points |
||
2108 | ; lea esi,[esi*3] |
||
2109 | ; lea esi,[points+2+esi*2] |
||
2110 | push dword[esi] |
||
2111 | ; push dword[xx1] |
||
2112 | |||
2113 | |||
2114 | ror eax,16 |
||
2115 | mov ebx,dword[xx2] |
||
2116 | ror ebx,16 |
||
2117 | mov ecx,dword[xx3] |
||
2118 | ror ecx,16 |
||
2119 | mov edi,screen |
||
2120 | mov esi,envmap |
||
2121 | mov edx,bumpmap ;BUMP_MAPPING |
||
2122 | |||
2123 | |||
2124 | je @f |
||
2125 | call bump_triangle_z |
||
2126 | jmp .end_draw |
||
2127 | @@: |
||
2128 | call bump_triangle |
||
2129 | jmp .end_draw |
||
2130 | |||
2131 | |||
2132 | |||
2133 | |||
2134 | cmp [catmull_flag],0 |
||
2135 | je @f |
||
2136 | push [zz3] |
||
2137 | push [zz2] |
||
2138 | push [zz1] |
||
2139 | @@: |
||
2140 | movzx esi,[point_index3] ; tex map coords |
||
2141 | shl esi,2 |
||
2142 | add esi,tex_points |
||
2143 | push dword[esi] |
||
2144 | movzx esi,[point_index2] |
||
2145 | shl esi,2 |
||
2146 | add esi,tex_points |
||
2147 | push dword[esi] |
||
2148 | movzx esi,[point_index1] |
||
2149 | shl esi,2 |
||
2150 | add esi,tex_points |
||
2151 | push dword[esi] |
||
2152 | |||
2153 | |||
2154 | ror eax,16 |
||
2155 | mov ebx,dword[xx2] |
||
2156 | ror ebx,16 |
||
2157 | mov ecx,dword[xx3] |
||
2158 | ror ecx,16 |
||
2159 | mov edi,screen |
||
2160 | mov esi,texmap |
||
2161 | cmp [catmull_flag],0 |
||
2162 | je @f |
||
2163 | ; mov edx,Z_buffer |
||
2164 | mov edx,[Zbuffer_ptr] |
||
2165 | call tex_triangle_z |
||
2166 | ; call tex_plus_grd_trianlgle |
||
2167 | jmp .end_draw |
||
2168 | @@: |
||
2169 | call tex_triangle |
||
2170 | jmp .end_draw |
||
2171 | ; .ray: |
||
2172 | ; grd_triangle according to points index |
||
2173 | ; cmp [catmull_flag],0 |
||
2174 | ; je @f |
||
2175 | ; push [zz3] ; spot light with attenuation |
||
2176 | ; @@: |
||
2177 | ; movzx eax,[point_index3] ; env_map - points color list |
||
2178 | ; shl eax,1 ; each color as word, 0x00rr00gg00bb.. |
||
2179 | ; lea eax,[3*eax+bumpmap] |
||
2180 | ; push word[eax] |
||
2181 | ; push word[eax+2] |
||
2182 | ; push word[eax+4] |
||
2183 | ; cmp [catmull_flag],0 |
||
2184 | ; je @f |
||
2185 | ; push [zz2] |
||
2186 | ; @@: |
||
2187 | ; movzx eax,[point_index2] ; env_map - points color list |
||
2188 | ; shl eax,1 ; each color as word, 0x00rr00gg00bb.. |
||
2189 | ; lea eax,[eax*3+bumpmap] |
||
2190 | ; push word[eax] |
||
2191 | ; push word[eax+2] |
||
2192 | ; push word[eax+4] |
||
2193 | ; cmp [catmull_flag],0 |
||
2194 | ; je @f |
||
2195 | ; push [zz1] |
||
2196 | ; @@: |
||
2197 | ; movzx eax,[point_index1] ; env_map - points color list |
||
2198 | ; shl eax,1 ; each color as word, 0xrr00gg00bb00.. |
||
2199 | ; lea eax,[eax*3+bumpmap] |
||
2200 | ; push word[eax] |
||
2201 | ; push word[eax+2] |
||
2202 | ; push word[eax+4] |
||
2203 | ; jmp .both_draw |
||
2204 | |||
2205 | |||
2206 | push ebp |
||
2207 | mov ebp,esp |
||
2208 | sub esp,4 |
||
2209 | push ebp |
||
2210 | |||
2211 | |||
2212 | shl esi,2 |
||
2213 | add esi,tex_points |
||
2214 | push dword[esi] ; texture coords as first |
||
2215 | movzx esi,[point_index2] ; group of parameters |
||
2216 | shl esi,2 |
||
2217 | add esi,tex_points |
||
2218 | push dword[esi] |
||
2219 | movzx esi,[point_index1] |
||
2220 | shl esi,2 |
||
2221 | add esi,tex_points |
||
2222 | push dword[esi] |
||
2223 | |||
2224 | |||
2225 | mov ecx,3 |
||
2226 | |||
2227 | |||
2228 | |||
2229 | |||
2230 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
||
2231 | |||
2232 | |||
2233 | shl eax,2 |
||
2234 | lea eax,[eax*3] ;+point_normals_rotated] |
||
2235 | add eax,[points_normals_rot_ptr] |
||
2236 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2237 | fld dword[eax] ; x cooficient of normal vector |
||
2238 | fimul [correct_tex] |
||
2239 | fiadd [correct_tex] |
||
2240 | fistp word[ebp-2] |
||
2241 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2242 | fld dword[eax+4] ; y cooficient |
||
2243 | fimul [correct_tex] |
||
2244 | fiadd [correct_tex] |
||
2245 | fistp word[ebp-4] |
||
2246 | |||
2247 | |||
2248 | movzx ebx,word[ebp-2] |
||
2249 | shl eax,TEX_SHIFT |
||
2250 | add eax,ebx |
||
2251 | lea eax,[eax*3+color_map] |
||
2252 | mov eax,dword[eax] |
||
2253 | |||
2254 | |||
2255 | xor ah,ah |
||
2256 | push ax ;r |
||
2257 | rol eax,8 ; eax-0xggbb00rr -> 0xbb00rrgg |
||
2258 | xor ah,ah |
||
2259 | push ax ;g |
||
2260 | shr eax,24 |
||
2261 | push ax ;b |
||
2262 | |||
2263 | |||
2264 | dec cx |
||
2265 | jnz .aagain_grd_draw |
||
2266 | |||
2267 | |||
2268 | ror eax,16 |
||
2269 | mov ebx,dword[xx2] |
||
2270 | ror ebx,16 |
||
2271 | mov ecx,dword[xx3] |
||
2272 | ror ecx,16 |
||
2273 | mov edi,screen |
||
2274 | mov edx,texmap |
||
2275 | mov esi,[Zbuffer_ptr] |
||
2276 | |||
2277 | |||
2278 | |||
2279 | |||
2280 | mov esp,ebp |
||
2281 | pop ebp |
||
2282 | jmp .end_draw |
||
2283 | |||
2284 | |||
2285 | push [Zbuffer_ptr] |
||
2286 | |||
2287 | |||
2288 | push word[zz2] |
||
2289 | push word[zz1] |
||
2290 | |||
2291 | |||
2292 | shl esi,2 |
||
2293 | add esi,tex_points |
||
2294 | push dword[esi] |
||
2295 | movzx esi,[point_index2] |
||
2296 | shl esi,2 |
||
2297 | add esi,tex_points |
||
2298 | push dword[esi] |
||
2299 | movzx esi,[point_index1] |
||
2300 | shl esi,2 |
||
2301 | add esi,tex_points |
||
2302 | push dword[esi] |
||
2303 | |||
2304 | |||
2305 | sub esp,12 |
||
2306 | mov edi,esp |
||
2307 | mov ecx,3 |
||
2308 | @@: |
||
2309 | movzx eax,word[esi] |
||
2310 | lea eax,[eax*3] |
||
2311 | shl eax,2 |
||
2312 | add eax,[points_normals_rot_ptr] |
||
2313 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2314 | fld dword[eax] |
||
2315 | fimul [correct_tex] |
||
2316 | fiadd [correct_tex] |
||
2317 | fistp word[edi] |
||
2318 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2319 | fld dword[eax+4] |
||
2320 | fimul [correct_tex] |
||
2321 | fiadd [correct_tex] |
||
2322 | fistp word[edi+2] |
||
2323 | |||
2324 | |||
2325 | add esi,2 |
||
2326 | loop @b |
||
2327 | |||
2328 | |||
2329 | ror eax,16 |
||
2330 | mov ebx,dword[xx2] |
||
2331 | ror ebx,16 |
||
2332 | mov ecx,dword[xx3] |
||
2333 | ror ecx,16 |
||
2334 | mov edi,screen |
||
2335 | mov esi,texmap |
||
2336 | mov edx,envmap |
||
2337 | |||
2338 | |||
2339 | jmp .end_draw |
||
2340 | |||
2341 | |||
2342 | movzx esi,[point_index3] ; tex map coords |
||
2343 | shl esi,2 |
||
2344 | add esi,tex_points |
||
2345 | push dword[esi] |
||
2346 | movzx esi,[point_index2] |
||
2347 | shl esi,2 |
||
2348 | add esi,tex_points |
||
2349 | push dword[esi] |
||
2350 | movzx esi,[point_index1] |
||
2351 | shl esi,2 |
||
2352 | add esi,tex_points |
||
2353 | push dword[esi] |
||
2354 | |||
2355 | |||
2356 | |||
2357 | |||
2358 | xor edi,edi |
||
2359 | |||
2360 | |||
2361 | push word[zz2] |
||
2362 | push word[zz1] |
||
2363 | |||
2364 | |||
2365 | sub esp,12 |
||
2366 | mov edi,esp |
||
2367 | mov ecx,3 |
||
2368 | @@: |
||
2369 | movzx eax,word[esi] |
||
2370 | lea eax,[eax*3] |
||
2371 | shl eax,2 |
||
2372 | add eax,[points_normals_rot_ptr] |
||
2373 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2374 | fld dword[eax] |
||
2375 | fimul [correct_tex] |
||
2376 | fiadd [correct_tex] |
||
2377 | fistp word[edi] |
||
2378 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2379 | fld dword[eax+4] |
||
2380 | fimul [correct_tex] |
||
2381 | fiadd [correct_tex] |
||
2382 | fistp word[edi+2] |
||
2383 | |||
2384 | |||
2385 | add esi,2 |
||
2386 | loop @b |
||
2387 | |||
2388 | |||
2389 | ; push dword 127 shl 16 + 1 |
||
2390 | ; push dword 127 shl 16 + 127 |
||
2391 | |||
2392 | |||
2393 | shl esi,2 |
||
2394 | add esi,tex_points |
||
2395 | push dword[esi] |
||
2396 | movzx esi,[point_index2] |
||
2397 | shl esi,2 |
||
2398 | add esi,tex_points |
||
2399 | push dword[esi] |
||
2400 | |||
2401 | |||
2402 | shl esi,2 |
||
2403 | add esi,tex_points |
||
2404 | push dword[esi] |
||
2405 | |||
2406 | |||
2407 | ; push dword 127 shl 16 + 127 |
||
2408 | ; push dword 1 shl 16 + 1 ; bump coords |
||
2409 | |||
2410 | |||
2411 | ror eax,16 |
||
2412 | mov ebx,dword[xx2] |
||
2413 | ror ebx,16 |
||
2414 | mov ecx,dword[xx3] |
||
2415 | ror ecx,16 |
||
2416 | mov edi,screen |
||
2417 | mov esi,envmap |
||
2418 | mov edx,bumpmap |
||
2419 | |||
2420 | |||
2421 | |||
2422 | |||
2881 | leency | 2423 | |
2424 | |||
2425 | mov esi,point_index3 |
||
2426 | mov ecx,3 |
||
2427 | .again_line_param: |
||
2428 | movzx eax,word[esi] |
||
2429 | shl eax,2 |
||
2430 | lea eax,[eax*3] |
||
2431 | add eax,[points_normals_rot_ptr] |
||
2432 | ; texture ;x=(rotated point normal -> x * 255)+255 |
||
2433 | fld dword[eax] ; x cooficient of normal vector |
||
2434 | fimul [correct_tex] |
||
2435 | fiadd [correct_tex] |
||
2436 | fistp word[esp-2] |
||
2437 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2438 | fld dword[eax+4] ; y cooficient |
||
2439 | fimul [correct_tex] |
||
2440 | fiadd [correct_tex] |
||
2441 | fistp word[esp-4] |
||
2442 | |||
2443 | |||
2444 | movzx ebx,word[esp-2] |
||
2445 | shl eax,TEX_SHIFT |
||
2446 | add eax,ebx |
||
2447 | lea eax,[eax*3+color_map] |
||
2448 | mov eax,dword[eax] |
||
2449 | lea ebx,[ecx-1] |
||
2450 | shl ebx,2 |
||
2451 | mov [ebx+col1],eax |
||
2452 | |||
2453 | |||
2454 | dec ecx |
||
2455 | jnz .again_line_param |
||
2456 | |||
2457 | |||
3066 | leency | 2458 | ; add eax,[edges_counter] ; I mean chosing overlapped edges. |
2459 | ; mov bl,[eax] ; |
||
2460 | ; test bl,00000001b ; |
||
2461 | ; jz @f ; |
||
2462 | mov edi,screen |
||
2881 | leency | 2463 | mov esi,[Zbuffer_ptr] |
2464 | |||
2465 | |||
2466 | movzx bx,al |
||
2467 | push bx ; b |
||
2468 | movzx bx,ah |
||
2469 | push bx |
||
2470 | rol eax,16 |
||
2471 | xor ah,ah |
||
2472 | push ax |
||
2473 | push [zz1] |
||
2474 | push [yy1] |
||
2475 | push [xx1] |
||
2476 | |||
2477 | |||
2478 | movzx bx,al |
||
2479 | push bx ; b |
||
2480 | movzx bx,ah |
||
2481 | push bx |
||
2482 | rol eax,16 |
||
2483 | xor ah,ah |
||
2484 | push ax |
||
2485 | push [zz2] |
||
2486 | push [yy2] |
||
2487 | push [xx2] |
||
2488 | |||
2489 | |||
2490 | @@: |
||
2491 | ; mov eax,[edges_ptr] ; this not works correctly |
||
3066 | leency | 2492 | ; add eax,[edges_counter] |
2493 | ; mov bl,[eax] |
||
2494 | ; test bl,00000010b |
||
2495 | ; jz @f |
||
2496 | |||
2881 | leency | 2497 | |
2498 | mov esi,[Zbuffer_ptr] |
||
2499 | |||
2500 | |||
2501 | movzx bx,al |
||
2502 | push bx ; b |
||
2503 | movzx bx,ah |
||
2504 | push bx |
||
2505 | rol eax,16 |
||
2506 | xor ah,ah |
||
2507 | push ax |
||
2508 | push [zz1] |
||
2509 | push [yy1] |
||
2510 | push [xx1] |
||
2511 | |||
2512 | |||
2513 | movzx bx,al |
||
2514 | push bx ; b |
||
2515 | movzx bx,ah |
||
2516 | push bx |
||
2517 | rol eax,16 |
||
2518 | xor ah,ah |
||
2519 | push ax |
||
2520 | push [zz3] |
||
2521 | push [yy3] |
||
2522 | push [xx3] |
||
2523 | |||
2524 | |||
2525 | @@: |
||
2526 | |||
2527 | |||
3066 | leency | 2528 | ; add eax,[edges_counter] ; |
2529 | ; mov bl,[eax] ; |
||
2530 | ; test bl,00000100b ; |
||
2531 | ; jz @f ; |
||
2532 | |||
2881 | leency | 2533 | |
2534 | mov esi,[Zbuffer_ptr] |
||
2535 | |||
2536 | |||
2537 | movzx bx,al |
||
2538 | push bx ; b |
||
2539 | movzx bx,ah |
||
2540 | push bx |
||
2541 | rol eax,16 |
||
2542 | xor ah,ah |
||
2543 | push ax |
||
2544 | push [zz3] |
||
2545 | push [yy3] |
||
2546 | push [xx3] |
||
2547 | |||
2548 | |||
2549 | movzx bx,al |
||
2550 | push bx ; b |
||
2551 | movzx bx,ah |
||
2552 | push bx |
||
2553 | rol eax,16 |
||
2554 | xor ah,ah |
||
2555 | push ax |
||
2556 | push [zz2] |
||
2557 | push [yy2] |
||
2558 | push [xx2] |
||
2559 | |||
2560 | |||
2561 | @@: |
||
2562 | |||
2563 | |||
1245 | hidnplayr | 2564 | pop esi |
2565 | add esi,6 |
||
2566 | inc [edges_counter] |
||
2881 | leency | 2567 | cmp dword[esi],-1 |
1245 | hidnplayr | 2568 | jne .again_dts |
2569 | ret |
||
2570 | |||
2571 | |||
2572 | |||
2573 | mov eax,0x70000000 |
||
2574 | ; mov edi,Z_buffer |
||
2575 | mov edi,[Zbuffer_ptr] |
||
2576 | mov ecx,SIZE_X*SIZE_Y |
||
2577 | rep stosd |
||
2578 | ret |
||
2579 | |||
2580 | |||
3066 | leency | 2581 | ; and allocate memory |
2582 | xor ebx,ebx |
||
1245 | hidnplayr | 2583 | xor ebp,ebp |
2584 | mov [points_count_var],bx |
||
3066 | leency | 2585 | mov [triangles_count_var],bx |
2586 | if USE_LFN = 0 |
||
1245 | hidnplayr | 2587 | mov esi,SourceFile |
2588 | else |
||
2589 | mov esi,[fptr] |
||
2590 | end if |
||
2591 | |||
3066 | leency | 2592 | |
1245 | hidnplayr | 2593 | je @f ;Must be legal .3DS file |
3066 | leency | 2594 | xor eax,eax |
2595 | ret |
||
2596 | @@: |
||
2597 | mov eax,dword[esi+2] |
||
1245 | hidnplayr | 2598 | cmp eax,[fsize] ;This must tell the length |
3066 | leency | 2599 | je @f |
2600 | xor eax,eax |
||
2601 | ret |
||
2602 | @@: |
||
2603 | add eax,esi |
||
1245 | hidnplayr | 2604 | mov [EndFile],eax ; |
2605 | |||
2606 | |||
2607 | @@: |
||
2608 | cmp [esi],word 3D3Dh |
||
2609 | je @f |
||
2610 | add esi,[esi+2] |
||
2611 | jmp @b |
||
2612 | @@: |
||
2613 | add esi,6 |
||
2614 | .find4k: |
||
2615 | cmp [esi],word 4000h |
||
2616 | je @f |
||
2617 | add esi,[esi+2] |
||
2618 | cmp esi,[EndFile] |
||
2619 | jc .find4k |
||
2620 | jmp .exit |
||
2621 | @@: |
||
2622 | add esi,6 |
||
2623 | @@: |
||
2624 | cmp [esi],byte 0 |
||
2625 | je @f |
||
2626 | inc esi |
||
2627 | jmp @b |
||
2628 | @@: |
||
2629 | inc esi |
||
2630 | @@: |
||
2631 | cmp [esi],word 4100h |
||
2632 | je @f |
||
2633 | add esi,[esi+2] |
||
2634 | jmp @b |
||
2635 | @@: |
||
2636 | add esi,6 |
||
2637 | @@: |
||
2638 | cmp [esi],word 4110h |
||
2639 | je @f |
||
2640 | add esi,[esi+2] |
||
2641 | jmp @b |
||
2642 | @@: |
||
2643 | movzx ecx,word[esi+6] |
||
2644 | add [points_count_var],cx |
||
2645 | |||
2646 | |||
2647 | add esi,8 |
||
2648 | @@: |
||
2649 | |||
2650 | |||
2651 | add esi,12 |
||
2652 | ; dec ecx |
||
3066 | leency | 2653 | loop @b |
2654 | @@: |
||
1245 | hidnplayr | 2655 | |
3066 | leency | 2656 | |
1245 | hidnplayr | 2657 | cmp [esi],word 4120h |
2658 | je @f |
||
2659 | add esi,[esi+2] |
||
2660 | jmp @b |
||
2661 | @@: |
||
2662 | movzx ecx,word[esi+6] |
||
2663 | add [triangles_count_var],cx |
||
2664 | add esi,8 |
||
2665 | |||
3066 | leency | 2666 | |
1245 | hidnplayr | 2667 | add esi,8 |
3066 | leency | 2668 | dec ecx |
1245 | hidnplayr | 2669 | jnz @b |
2670 | ; xor ecx,ecx |
||
3066 | leency | 2671 | add ebp,edx |
1245 | hidnplayr | 2672 | jmp .find4k |
2673 | mov eax,-1 ;<---mark if OK |
||
2674 | .exit: |
||
2675 | ret |
||
2676 | |||
2677 | |||
3066 | leency | 2678 | fninit |
2679 | mov edi,[triangles_ptr] |
||
2680 | xor ebx,ebx |
||
1245 | hidnplayr | 2681 | xor ebp,ebp |
2682 | mov [points_count_var],0 |
||
3066 | leency | 2683 | mov [triangles_count_var],0 |
2684 | if USE_LFN = 0 |
||
1245 | hidnplayr | 2685 | mov esi,SourceFile |
2686 | else |
||
2687 | mov esi,[fptr] |
||
2688 | end if |
||
2689 | cmp [esi],word 4D4Dh |
||
2690 | jne .exit ;Must be legal .3DS file |
||
3066 | leency | 2691 | ; cmp dword[esi+2],EndFile-SourceFile |
2692 | ; jne .exit ;This must tell the length |
||
2693 | mov eax,dword[esi+2] |
||
1245 | hidnplayr | 2694 | ; cmp eax,[fsize] |
3066 | leency | 2695 | ; jne .exit |
2696 | |||
2697 | |||
1245 | hidnplayr | 2698 | mov [EndFile],eax ; |
2699 | |||
2700 | |||
2701 | @@: |
||
2702 | cmp [esi],word 3D3Dh |
||
2703 | je @f |
||
2704 | add esi,[esi+2] |
||
2705 | jmp @b |
||
2706 | @@: |
||
2707 | add esi,6 |
||
2708 | .find4k: |
||
2709 | cmp [esi],word 4000h |
||
2710 | je @f |
||
2711 | add esi,[esi+2] |
||
2712 | cmp esi,[EndFile] |
||
2713 | jc .find4k |
||
2714 | jmp .exit |
||
2715 | @@: |
||
2716 | add esi,6 |
||
2717 | @@: |
||
2718 | cmp [esi],byte 0 |
||
2719 | je @f |
||
2720 | inc esi |
||
2721 | jmp @b |
||
2722 | @@: |
||
2723 | inc esi |
||
2724 | @@: |
||
2725 | cmp [esi],word 4100h |
||
2726 | je @f |
||
2727 | add esi,[esi+2] |
||
2728 | jmp @b |
||
2729 | @@: |
||
2730 | add esi,6 |
||
2731 | @@: |
||
2732 | cmp [esi],word 4110h |
||
2733 | je @f |
||
2734 | add esi,[esi+2] |
||
2735 | jmp @b |
||
2736 | @@: |
||
2737 | movzx ecx,word[esi+6] |
||
2738 | add [points_count_var],cx |
||
2739 | |||
2740 | |||
2741 | add esi,8 |
||
2742 | @@: |
||
2743 | push edi |
||
3066 | leency | 2744 | mov edi,[points_ptr] |
2745 | push dword[esi+4] |
||
2746 | pop dword[edi+ebx*2+0] |
||
2747 | push dword[esi+8] |
||
2748 | pop dword[edi+ebx*2+4] |
||
2749 | push dword[esi+0] |
||
2750 | pop dword[edi+ebx*2+8] |
||
2751 | pop edi |
||
2752 | ; fld dword[esi+4] |
||
2753 | ; fstp dword[real_points+ebx*2+0] ; x |
||
2754 | ; fld dword[esi+8] |
||
2755 | ; fstp dword[real_points+ebx*2+4] ; y |
||
2756 | ; fld dword[esi+0] |
||
2757 | ; fstp dword[real_points+ebx*2+8] ; z |
||
2758 | |||
1245 | hidnplayr | 2759 | |
2760 | add esi,12 |
||
2761 | dec ecx |
||
3066 | leency | 2762 | jnz @b |
2763 | @@: |
||
1245 | hidnplayr | 2764 | ; mov dword[points+ebx],-1 |
3066 | leency | 2765 | push edi |
2766 | mov edi,[points_ptr] |
||
2767 | mov dword[edi+ebx*2],-1 ; end mark (not always in use) |
||
2768 | pop edi |
||
2769 | @@: |
||
1245 | hidnplayr | 2770 | cmp [esi],word 4120h |
2771 | je @f |
||
2772 | add esi,[esi+2] |
||
2773 | jmp @b |
||
2774 | @@: |
||
2775 | movzx ecx,word[esi+6] |
||
2776 | add [triangles_count_var],cx |
||
2777 | add esi,8 |
||
2778 | ;mov edi,triangles |
||
3066 | leency | 2779 | @@: |
1245 | hidnplayr | 2780 | movsd |
3066 | leency | 2781 | movsw |
2782 | add word[edi-6],bp |
||
2783 | add word[edi-4],bp |
||
2784 | add word[edi-2],bp |
||
2785 | add esi,2 |
||
2786 | dec ecx |
||
1245 | hidnplayr | 2787 | jnz @b |
2788 | add ebp,edx |
||
2789 | jmp .find4k |
||
2790 | mov eax,-1 ;<---mark if OK |
||
2791 | .exit: |
||
2792 | mov dword[edi],-1 |
||
3066 | leency | 2793 | ret |
1245 | hidnplayr | 2794 | |
2795 | |||
2796 | alloc_mem_for_tp: |
||
2797 | mov eax, 68 |
||
2798 | cmp [re_alloc_flag],1 |
||
1776 | yogev_ezra | 2799 | jz @f |
2800 | mov ebx, 12 |
||
1245 | hidnplayr | 2801 | jmp .alloc |
1776 | yogev_ezra | 2802 | @@: |
2803 | mov ebx,20 |
||
2804 | .alloc: |
||
2805 | |||
2881 | leency | 2806 | |
1245 | hidnplayr | 2807 | inc ecx |
2808 | lea ecx, [ecx*3] |
||
2809 | add ecx, ecx |
||
2810 | mov edx,[triangles_ptr] |
||
1776 | yogev_ezra | 2811 | int 0x40 ; -> allocate memory to triangles |
1245 | hidnplayr | 2812 | mov [triangles_ptr], eax ; -> eax = pointer to allocated mem |
2813 | |||
2814 | |||
3066 | leency | 2815 | ; movzx ecx, [triangles_count_var] |
2816 | ; inc ecx |
||
2817 | ; mov edx,[edges_ptr] |
||
2818 | ; int 0x40 ; -> allocate memory to edges |
||
2819 | ; mov [edges_ptr], eax ; -> eax = pointer to allocated mem |
||
2820 | |||
2881 | leency | 2821 | |
3066 | leency | 2822 | ; movzx ecx,[triangles_count_var] ; importand if object generated |
2823 | ; shr ecx,2 |
||
2824 | ; inc ecx |
||
2825 | ; mov edi,[edges_ptr] |
||
2826 | ; cld |
||
2827 | ; rep stosd |
||
2828 | |||
2881 | leency | 2829 | |
2984 | leency | 2830 | |
1245 | hidnplayr | 2831 | ; mov ebx, 12 |
2832 | ; movzx ecx, [triangles_count_var] |
||
2833 | ; shl ecx, 4 |
||
2834 | ; int 0x40 |
||
2835 | ; mov [triangles_w_z_ptr], eax ; for trainagles_with_z list |
||
2836 | ; ststic memory |
||
2837 | |||
2838 | |||
2839 | movzx ecx, [triangles_count_var] |
||
2840 | lea ecx, [3+ecx*3] |
||
2841 | shl ecx, 2 |
||
2842 | mov edx,[triangles_normals_ptr] |
||
1776 | yogev_ezra | 2843 | int 0x40 ; -> allocate memory for triangles normals |
1245 | hidnplayr | 2844 | mov [triangles_normals_ptr], eax ; -> eax = pointer to allocated mem |
2845 | |||
2846 | |||
2847 | movzx ecx, [points_count_var] |
||
2848 | lea ecx,[3+ecx*3] |
||
2849 | shl ecx, 2 |
||
2850 | mov edx,[points_normals_ptr] |
||
1776 | yogev_ezra | 2851 | int 0x40 |
1245 | hidnplayr | 2852 | mov [points_normals_ptr], eax |
2853 | |||
2854 | |||
2855 | ; mov ebx, 12 |
||
1776 | yogev_ezra | 2856 | movzx ecx, [points_count_var] |
1245 | hidnplayr | 2857 | lea ecx,[3+ecx*3] |
2858 | shl ecx, 2 |
||
2859 | mov edx,[points_normals_rot_ptr] |
||
1776 | yogev_ezra | 2860 | int 0x40 |
1245 | hidnplayr | 2861 | mov [points_normals_rot_ptr], eax |
2862 | |||
2863 | |||
2864 | mov edx,[points_ptr] |
||
1776 | yogev_ezra | 2865 | int 0x40 |
1245 | hidnplayr | 2866 | mov [points_ptr], eax |
2867 | |||
2868 | |||
2869 | mov edx,[points_rotated_ptr] |
||
1776 | yogev_ezra | 2870 | int 0x40 |
1245 | hidnplayr | 2871 | mov [points_rotated_ptr], eax |
2872 | |||
2873 | |||
2874 | movzx ecx, [points_count_var] |
||
2875 | inc ecx |
||
2876 | shl ecx, 3 |
||
2877 | mov edx,[points_translated_ptr] |
||
1776 | yogev_ezra | 2878 | int 0x40 |
1245 | hidnplayr | 2879 | mov [points_translated_ptr], eax |
2880 | ret |
||
2881 | end if |
||
2882 | |||
2883 | |||
2884 | |||
2885 | if USE_LFN |
||
2886 | ;- |
||
2887 | mov eax, 70 |
||
2888 | mov ebx, file_info |
||
2889 | mov dword[ebx], 5 ; -> subfunction number |
||
2890 | int 0x40 ; -> read file size |
||
2891 | mov ebx, [fptr] |
||
2892 | mov ebx, dword[ebx+32] |
||
2893 | inc ebx |
||
2894 | mov [fsize], ebx |
||
2895 | |||
2896 | |||
2897 | mov ebx, 11 |
||
2898 | int 0x40 ; -> create heap |
||
2899 | |||
2900 | |||
2901 | mov ebx, 12 |
||
2902 | mov ecx, [fsize] |
||
2903 | int 0x40 ; -> allocate memory for file |
||
2904 | mov [fptr], eax ; -> eax = pointer to allocated mem |
||
2905 | |||
2906 | |||
2907 | mov ebx, file_info |
||
2908 | mov dword[ebx],0 |
||
2909 | int 0x40 ; -> read file |
||
2910 | |||
2911 | |||
2912 | |||
2913 | |||
2914 | jnz @f |
||
2915 | xor eax,eax ;;;;--- |
||
2916 | @@: |
||
2917 | else |
||
2918 | mov eax,58 |
||
2919 | mov ebx,file_info |
||
2920 | int 0x40 |
||
2921 | |||
2922 | |||
2923 | shr eax,9 |
||
2924 | inc eax |
||
2925 | mov [fsize],eax |
||
2926 | ; mov ecx,ebx |
||
2927 | ; add ecx,MEM_END |
||
2928 | ; mov ebx,1 |
||
2929 | ; mov eax,64 ; allocate mem - resize app mem |
||
2930 | ; for points and triangles |
||
2931 | int 0x40 |
||
2932 | |||
2933 | |||
2934 | mov ebx,file_info |
||
2935 | int 0x40 |
||
2936 | end if |
||
2937 | ; eax = 0 -> ok file loaded |
||
2938 | ret |
||
2939 | read_param: |
||
2940 | mov esi,I_Param |
||
2941 | cmp dword[esi],0 |
||
2942 | je .end |
||
2943 | cmp byte[esi],'/' |
||
2944 | je .copy |
||
2945 | mov edi,esi |
||
2946 | mov ecx,25 ; 25 - would be enought |
||
2947 | repe scasb |
||
2948 | jne .end |
||
2949 | dec edi |
||
2950 | mov esi,edi |
||
2951 | .copy: |
||
2952 | mov edi,file_name |
||
2953 | mov ecx,50 |
||
2954 | rep movsd |
||
2955 | .end: |
||
2956 | ret |
||
2957 | buttons: ; draw some buttons (all but navigation and close ) |
||
2958 | mov edi,menu |
||
2959 | .again: |
||
2960 | mov eax,8 ; function 8 : define and draw button |
||
2961 | mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] |
||
2962 | movzx ecx,byte[edi] ; button id = position+2 |
||
2963 | sub cl,2 |
||
2964 | lea ecx,[ecx*5] |
||
2965 | lea ecx,[ecx*3] |
||
2966 | add ecx,25 |
||
2967 | shl ecx,16 |
||
2968 | add ecx,12 |
||
2969 | movzx edx,byte[edi] ; button id |
||
2970 | mov esi,0x6688dd ; button color RRGGBB |
||
2971 | int 0x40 |
||
2972 | ; BUTTON LABEL |
||
2973 | mov eax,4 ; function 4 : write text to window |
||
2974 | movzx ebx,byte[edi] |
||
2975 | sub bl,2 ; button id, according to position |
||
2976 | lea ebx,[ebx*3] |
||
2977 | lea ebx,[ebx*5] |
||
2978 | add ebx,(SIZE_X+12)*65536+28 ; [x start] *65536 + [y start] |
||
2979 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 2980 | lea edx,[edi+1] ; pointer to text beginning |
1245 | hidnplayr | 2981 | mov esi,10 ; text length |
2982 | int 0x40 |
||
2983 | cmp byte[edi+11],255 ; if max_flag=255 |
||
2984 | je @f ; skip |
||
2985 | ; flag description |
||
2986 | ; mov eax,4 ; function 4 : write text to window |
||
2987 | ; movzx ebx,byte[edi] |
||
2988 | ; sub bl,2 |
||
2989 | ; lea ebx,[ebx*3] |
||
2990 | ; lea ebx,[ebx*5] |
||
2991 | ; add ebx,(SIZE_X+12+70)*65536+28 ; [x start] *65536 + [y start] |
||
2992 | add ebx,70*65536 |
||
2993 | ; mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 2994 | movzx edx,byte[edi+12] ; current flag |
1245 | hidnplayr | 2995 | shl edx,2 ; * 4 = text length |
2996 | add edx,dword[edi+13] ; pointer to text beginning |
||
2997 | mov esi,4 ; text length |
||
2998 | int 0x40 |
||
2999 | |||
3000 | |||
3001 | add edi,17 |
||
3002 | cmp byte[edi],-1 |
||
3003 | jnz .again |
||
3004 | ret |
||
3005 | ; ********************************************* |
||
3006 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
3007 | ; ********************************************* |
||
3008 | draw_window: |
||
3009 | mov eax,12 ; function 12:tell os about windowdraw |
||
3010 | mov ebx,1 ; 1, start of draw |
||
3011 | int 0x40 |
||
3012 | |||
3013 | |||
3014 | mov eax,0 ; function 0 : define and draw window |
||
3015 | mov ebx,100*65536;+SIZE_X;+80+30 ; [x start] *65536 + [x size] |
||
3016 | mov ecx,100*65536;+SIZE_Y;+30 ; [y start] *65536 + [y size] |
||
3017 | mov bx,[size_x] |
||
3018 | add bx,115 |
||
2984 | leency | 3019 | mov cx,[size_y] |
1245 | hidnplayr | 3020 | add cx,30 |
3021 | mov edx,0x14000000 ; color of work area RRGGBB,8->color gl |
||
1776 | yogev_ezra | 3022 | mov edi,labelt ; WINDOW LABEL |
2024 | leency | 3023 | int 0x40 |
1245 | hidnplayr | 3024 | |
3025 | |||
3026 | |||
3027 | |||
3028 | |||
3029 | |||
3030 | mov eax,4 ; function 4 : write text to window |
||
3031 | mov ebx,(SIZE_X+12)*65536+(168+15*(13+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3032 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3033 | mov edx,labelvector ; pointer to text beginning |
1245 | hidnplayr | 3034 | mov esi,labelvectorend-labelvector ; text length |
3035 | ; cmp [move_flag],2 |
||
3036 | ; jne @f |
||
3037 | ; add edx,navigation_size |
||
3038 | ; @@: |
||
3039 | int 0x40 |
||
3040 | ; VECTOR Y- BUTTON |
||
3041 | mov eax,8 ; function 8 : define and draw button |
||
3042 | mov ebx,(SIZE_X+30)*65536+20 ; [x start] *65536 + [x size] |
||
3043 | mov ecx,(165+15*(14+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3044 | mov edx,30 ; button id |
||
3045 | mov esi,0x6688dd ; button color RRGGBB |
||
3046 | int 0x40 |
||
3047 | ;VECTOR Y- LABEL |
||
3048 | mov eax,4 ; function 4 : write text to window |
||
3049 | mov ebx,(SIZE_X+32)*65536+(168+15*(14+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3050 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3051 | mov edx,labelyminus ; pointer to text beginning |
1245 | hidnplayr | 3052 | mov esi,labelyminusend-labelyminus ; text length |
3053 | cmp [move_flag],2 |
||
3054 | ; jne @f |
||
3055 | ; add edx,navigation_size |
||
3056 | ; @@: |
||
3057 | int 0x40 |
||
3058 | ; VECTOR Z+ BUTTON |
||
3059 | mov eax,8 ; function 8 : define and draw button |
||
3060 | mov ebx,(SIZE_X+51)*65536+21 ; [x start] *65536 + [x size] |
||
3061 | mov ecx,(165+15*(14+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3062 | mov edx,31 ; button id |
||
3063 | mov esi,0x6688dd ; button color RRGGBB |
||
3064 | int 0x40 |
||
3065 | ;VECTOR Z+ LABEL |
||
3066 | mov eax,4 ; function 4 : write text to window |
||
3067 | mov ebx,(SIZE_X+53)*65536+(168+15*(14+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3068 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3069 | mov edx,labelzplus ; pointer to text beginning |
1245 | hidnplayr | 3070 | mov esi,labelzplusend-labelzplus ; text length |
3071 | ; cmp [move_flag],2 |
||
3072 | ; jne @f |
||
3073 | ; add edx,navigation_size |
||
3074 | ; @@: |
||
3075 | |||
3076 | |||
3077 | ; VECTOR x- BUTTON |
||
3078 | mov eax,8 ; function 8 : define and draw button |
||
3079 | mov ebx,(SIZE_X+10)*65536+21 ; [x start] *65536 + [x size] |
||
3080 | mov ecx,(165+15*(15+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3081 | mov edx,32 ; button id |
||
3082 | mov esi,0x6688dd ; button color RRGGBB |
||
3083 | int 0x40 |
||
3084 | ;VECTOR x- LABEL |
||
3085 | mov eax,4 ; function 4 : write text to window |
||
3086 | mov ebx,(SIZE_X+12)*65536+(168+15*(15+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3087 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3088 | mov edx,labelxminus ; pointer to text beginning |
1245 | hidnplayr | 3089 | mov esi,labelxminusend-labelxminus ; text length |
3090 | ; cmp [move_flag],2 |
||
3091 | ; jne @f |
||
3092 | ; add edx,navigation_size |
||
3093 | ; @@: |
||
3094 | int 0x40 |
||
3095 | ; VECTOR x+ BUTTON |
||
3096 | mov eax,8 ; function 8 : define and draw button |
||
3097 | mov ebx,(SIZE_X+51)*65536+21 ; [x start] *65536 + [x size] |
||
3098 | mov ecx,(165+15*(15+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3099 | mov edx,33 ; button id |
||
3100 | mov esi,0x6688dd ; button color RRGGBB |
||
3101 | int 0x40 |
||
3102 | ;VECTOR x+ LABEL |
||
3103 | mov eax,4 ; function 4 : write text to window |
||
3104 | mov ebx,(SIZE_X+53)*65536+(168+15*(15+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3105 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3106 | mov edx,labelxplus ; pointer to text beginning |
1245 | hidnplayr | 3107 | mov esi,labelxplusend-labelxplus ; text length |
3108 | ; cmp [move_flag],2 |
||
3109 | ; jne @f |
||
3110 | ; add edx,navigation_size |
||
3111 | ; @@: |
||
3112 | int 0x40 |
||
3113 | ; VECTOR z- BUTTON |
||
3114 | mov eax,8 ; function 8 : define and draw button |
||
3115 | mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] |
||
3116 | mov ecx,(25+140+15*(16+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3117 | mov edx,34 ; button id |
||
3118 | mov esi,0x6688dd ; button color RRGGBB |
||
3119 | int 0x40 |
||
3120 | ;VECTOR z- LABEL |
||
3121 | mov eax,4 ; function 4 : write text to window |
||
3122 | mov ebx,(SIZE_X+12)*65536+(168+15*(16+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3123 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3124 | mov edx,labelzminus ; pointer to text beginning |
1245 | hidnplayr | 3125 | mov esi,labelzminusend-labelzminus ; text length |
3126 | ; cmp [move_flag],2 |
||
3127 | ; jne @f |
||
3128 | ; add edx,navigation_size |
||
3129 | ; @@: |
||
3130 | int 0x40 |
||
3131 | ;VECTOR Y+ BUTTON |
||
3132 | mov eax,8 ; function 8 : define and draw button |
||
3133 | mov ebx,(SIZE_X+10+20)*65536+20 ; [x start] *65536 + [x size] |
||
3134 | mov ecx,(165+15*(16+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3135 | mov edx,35 ; button id |
||
3136 | mov esi,0x6688dd ; button color RRGGBB |
||
3137 | int 0x40 |
||
3138 | ;VECTOR Y+ LABEL |
||
3139 | mov eax,4 ; function 4 : write text to window |
||
3140 | mov ebx,(SIZE_X+32)*65536+(168+15*(16+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3141 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
5763 | leency | 3142 | mov edx,labelyplus ; pointer to text beginning |
1245 | hidnplayr | 3143 | mov esi,labelyplusend-labelyplus ; text length |
3144 | ; cmp [move_flag],2 |
||
3145 | ; jne @f |
||
3146 | ; add edx,navigation_size |
||
3147 | ; @@: |
||
3148 | int 0x40 |
||
3149 | |||
3150 | |||
3151 | mov ebx,2 ; 2, end of draw |
||
3152 | int 0x40 |
||
3153 | ret |
||
3154 | |||
3155 | |||
3156 | |||
3157 | |||
3158 | |||
1979 | yogev_ezra | 3159 | |
1245 | hidnplayr | 3160 | |
3161 |