Subversion Repositories Kolibri OS

Rev

Rev 8014 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2984 leency 1
do_sinus:
8014 leency 2
   .x      equ  [ebp-8]
3
   .y      equ  [ebp-12]
4
   .new_y  equ  [ebp-16]
5
   .temp   equ  [ebp-20]
2984 leency 6
   push    ebp
8014 leency 7
   mov     ebp,esp
8
   sub     esp,64
9
   mov     dword .x,0
10
   mov     dword .y,0
11
   mov     esi,[screen_ptr]
12
   mov     edi,[Zbuffer_ptr]
2984 leency 13
   push    edi
14
   ;  clear Zbuffer temporally used as image buffer
6619 leency 15
   movzx   ecx,word[size_x_var]
16
   movzx   eax,word[size_y_var]
17
   imul    ecx,eax  ;SIZE_X*SIZE_Y
8014 leency 18
   xor     eax,eax
2984 leency 19
   cld
8014 leency 20
   rep     stosd
21
   pop     edi
2984 leency 22
;   movzx   eax,[sinus_flag]
23
;   mov     edx,10
24
;   mul     edx
25
;   mov     [sin_amplitude],eax
26
;   mov     [sin_frq],eax
27
   fninit
28
;if Ext = SSE2
29
;   movups  xmm1,[const0123]   ; xmm1 - init values
30
;   mov     eax,0x000000ff
31
;   movd    xmm2,eax
32
;   shufps  xmm2,xmm2,0        ; xmm2 - mask value
33
;   mov     eax,4
34
;   movd    xmm3,eax
35
;   shufps  xmm3,xmm3,0
36
 .again:
37
if  0
38
   fild    dword .x
39
   fidiv   [sin_frq]
40
   fsin
41
   fimul   [sin_amplitude]
42
   fiadd   dword .y
43
   fistp   dword .new_y
44
else
45
   fild    dword .x
46
   fmul    [sin_frq]
47
   fistp   dword .temp
8014 leency 48
   mov     eax, .temp
2984 leency 49
;   mov     bx, [angle_x]
50
;   add     bx, [angle_y]
51
;   movzx   ebx,bx
52
;   shr     ebx,1       ; change phase
53
;   add     eax,ebx
54
 
55
 
8014 leency 56
   and     eax, 0x000000ff
2984 leency 57
 
58
;   cdq
59
 ;  mul     [sin_frq]
60
;   and      eax,0x000000ff
61
;   and     ax,0x00ff
62
;   cwde
63
 
8014 leency 64
   fld     dword [sin_tab+eax*4]
2984 leency 65
   fimul   dword [sin_amplitude]
66
   fiadd   dword .y
67
   fistp   dword .new_y
68
end if
8014 leency 69
   mov     eax,.new_y
70
   or      eax,eax
71
   jl      .skip
6619 leency 72
   movzx   ebx,word[size_y_var]
8014 leency 73
   cmp     eax,ebx  ;SIZE_Y
74
   jg      .skip
6619 leency 75
   movzx   edx,word[size_x_var]
8014 leency 76
   mul     edx
6619 leency 77
;   shl     eax,9
8014 leency 78
   add     eax,dword .x
8047 leency 79
 
8014 leency 80
   lea     ebx,[eax*3]
8047 leency 81
   cmp     [dr_flag],12 ; 32 bit col cause
82
   jne     @f
83
   add     ebx,eax
84
  @@:
8014 leency 85
   mov     eax,[esi]
86
   mov     [edi+ebx],eax
2984 leency 87
 .skip:
8014 leency 88
   add     esi,3
8047 leency 89
   cmp     [dr_flag],12
90
   jne     @f
91
   inc     esi
92
  @@:
8014 leency 93
   inc     dword .x
6619 leency 94
   movzx   edx,word[size_x_var]
8014 leency 95
   cmp     dword .x,edx  ;SIZE_X
96
   jl      .again
97
   mov     dword .x,0
98
   inc     dword .y
6619 leency 99
   movzx   edx,word[size_y_var]
8014 leency 100
   cmp     dword .y,edx   ;SIZE_Y
101
   jl      .again
2984 leency 102
 
103
   ; copy from temporary buffer -> Zbuffer to screen
8014 leency 104
   mov     esi,[Zbuffer_ptr]
105
   mov     edi,[screen_ptr]
6619 leency 106
   movzx   ecx,word[size_x_var]
107
   movzx   eax,word[size_y_var]
108
   imul    ecx,eax
8047 leency 109
   cmp         [dr_flag],12
110
   je          @f
8014 leency 111
   lea     ecx,[ecx*3]
112
   shr     ecx,2
6619 leency 113
 ;  mov     ecx,SIZE_X*SIZE_Y*3/4
8047 leency 114
  @@:
2984 leency 115
   cld
8014 leency 116
   rep     movsd
2984 leency 117
 
118
 
8014 leency 119
   mov     esp,ebp
120
   pop     ebp
2984 leency 121
ret
122
 
123
 
1245 hidnplayr 124
draw_dots:
8014 leency 125
   mov     esi,[points_translated_ptr]
126
   mov     ecx,[points_count_var]
1245 hidnplayr 127
 .drw:
128
 @@:
129
   lodsd
8014 leency 130
   add     esi,2           ; skip z
1245 hidnplayr 131
   movzx   ebx,ax
8014 leency 132
   shr     eax,16          ; bx = x , ax = y
133
   or      ax,ax
134
   jl      @f
135
   or      bx,bx
136
   jl      @f
137
   cmp     ax,[size_y_var]  ;SIZE_Y
138
   jge     @f
139
   cmp     bx,[size_x_var]  ;SIZE_X
140
   jge     @f
6619 leency 141
   movzx   edx,word[size_x_var]  ;SIZE_X      ; SIZE_X not only power of 2   -> 256,512,...
8014 leency 142
   mul     edx
143
   add     eax,ebx
144
   mov     edi,[screen_ptr]
145
   lea     eax,[eax*3]
146
   add     edi,eax
147
   xor     eax,eax
148
   not     eax
1245 hidnplayr 149
   stosd
150
 @@:
151
   loop    .drw
152
 
153
ret
154
 
6619 leency 155
do_emboss:   ; sse2 version only
156
if Ext >= SSE2
157
 movzx ecx,[bumps_deep_flag]
158
 inc   ecx
159
 call  blur_screen    ;blur n times
160
 
161
 mov   eax,[size_y_var]  ;load both x, y
162
 mov   ebx,eax
163
 shr   ebx,16
164
 cwde
165
 mul   ebx
166
 mov   ecx,eax
167
 sub   ecx,ebx
168
 sub   ecx,ebx
169
 mov   esi,[screen_ptr]
170
 mov   edi,[Zbuffer_ptr]
8047 leency 171
 cmp   [dr_flag],12
172
 je    @f
6619 leency 173
 lea   ebx,[ebx*3]
8047 leency 174
 jmp   .f
175
@@:
176
 shl   ebx,2
177
.f:
6619 leency 178
 mov   edx,esi
179
 add   esi,ebx
180
 lea   ebx,[ebx+esi]
181
 pxor  xmm0,xmm0
182
 push  eax
8047 leency 183
.emb:
184
 cmp   [dr_flag],12
185
 je    @f
6619 leency 186
 movlps     xmm1,[esi+3]
187
 movhps     xmm1,[esi+6]
188
 movlps     xmm2,[esi-3]
189
 movhps     xmm2,[esi]
190
 movlps     xmm3,[ebx]
191
 movhps     xmm3,[ebx+3]
192
 movlps     xmm4,[edx]
193
 movhps     xmm4,[edx+3]
8047 leency 194
 jmp        .ff
195
@@:
196
 movlps     xmm1,[esi+4]
197
 movhps     xmm1,[esi+8]
198
 movlps     xmm2,[esi-4]
199
 movhps     xmm2,[esi]
200
 movlps     xmm3,[ebx]
201
 movhps     xmm3,[ebx+4]
202
 movlps     xmm4,[edx]
203
 movhps     xmm4,[edx+4]
204
.ff:
205
 punpcklbw  xmm1,xmm0
206
 punpcklbw  xmm2,xmm0
6619 leency 207
 punpcklbw  xmm3,xmm0
208
 punpcklbw  xmm4,xmm0
209
 psubsw     xmm1,xmm2
8014 leency 210
 paddw      xmm1,[emboss_bias]
6619 leency 211
 psubsw     xmm3,xmm4
8014 leency 212
 paddw      xmm3,[emboss_bias]
6619 leency 213
 pmulhw     xmm1,xmm3
214
 movaps      xmm7,xmm1
215
 movaps      xmm6,xmm1
8014 leency 216
 psrlq       xmm7,2*8
217
 psrlq       xmm6,4*8
6619 leency 218
 pmaxsw      xmm1,xmm7
219
 pmaxsw      xmm1,xmm6
220
 
221
if 0
222
 movaps      xmm7,xmm3
223
 movaps      xmm6,xmm3
8014 leency 224
 psrlq       xmm7,2*8
225
 psrlq       xmm6,4*8
6619 leency 226
 pmaxsw      xmm3,xmm7
227
 pmaxsw      xmm3,xmm6
228
end if
229
 pmaxsw      xmm1,xmm3
230
 
8014 leency 231
 movd        eax,xmm1
232
 movzx       eax,al
8047 leency 233
; cmp         [dr_flag],12
234
; je          @f
8014 leency 235
 lea         eax,[eax*3+envmap_cub]
8047 leency 236
; jmp         .fff
237
;@@:
238
 
8014 leency 239
 mov         eax,[eax]
240
 mov        [edi],eax  ;xmm1
6619 leency 241
 psrldq     xmm1,8
8014 leency 242
 movd       eax,xmm1
243
 movzx      eax,al
244
 lea        eax,[eax*3+envmap_cub]
245
 mov        eax,[eax]
246
 mov        [edi+4],eax
6619 leency 247
 
8047 leency 248
 cmp    [dr_flag],12
249
 jne    @f
250
 add    esi,2
251
 add    ebx,2
252
 add    edx,2
253
@@:
6619 leency 254
 
8014 leency 255
 add    edi,8
256
 add    esi,6
257
 add    ebx,6
258
 add    edx,6
259
 sub    ecx,2
8047 leency 260
 jnc    .emb
6619 leency 261
 
262
 
8014 leency 263
 pop    ecx  ;,eax
264
 mov    edi,[screen_ptr]
265
 mov    esi,[Zbuffer_ptr]
8047 leency 266
 cmp    [dr_flag],12
267
 je     .e
6619 leency 268
@@:
269
 movsd
8014 leency 270
 dec    edi
271
 loop   @b
8047 leency 272
.e:
273
 rep    movsd
274
 
6619 leency 275
end if
8047 leency 276
 
6619 leency 277
ret
278
 
6769 IgorA 279
;align 16
280
; emboss_bias:
281
;    dw 128, 128, 128, 128, 128, 128, 128, 128
6619 leency 282
 
283
if 0  ; old emb proc
284
 
1245 hidnplayr 285
 ;  emboss -  after drawing all,
286
 ;  transfer screen buffer into bump map
287
 ;  and draw two bump triangles
288
 ; *************************************
8014 leency 289
        mov     esi,screen
290
        mov     edi,bumpmap2
291
        mov     ecx,TEXTURE_SIZE/3
292
        cld
1245 hidnplayr 293
if  Ext=NON
8014 leency 294
        xor     eax,eax
295
        xor     bh,bh
296
        xor     dh,dh
1245 hidnplayr 297
      @@:
8014 leency 298
        lodsb
299
        movzx   bx,al
300
        lodsb
301
        movzx   dx,al
302
        lodsb
303
        add     ax,bx
304
        add     ax,dx
1245 hidnplayr 305
      ;  cwd
306
      ;  div     [i3]
307
 ;;       push    ax
308
 ;;       pop     bx
309
 ;;       shr     bx,3
310
 ;;       shr     ax,2
311
 ;;       add     ax,bx
312
 
8014 leency 313
        lea      eax,[eax*5]
314
        shr      ax,4
1245 hidnplayr 315
 
8014 leency 316
        stosb
317
        loop    @b
1245 hidnplayr 318
else
8014 leency 319
        emms
320
        pxor          mm1,mm1
321
        mov           ebx,0x0000ffff
1245 hidnplayr 322
      @@:
8014 leency 323
        movd          mm0,[esi]
324
        punpcklbw     mm0,mm1
325
        movq          mm2,mm0
326
        psrlq         mm2,16
327
        movq          mm3,mm0
328
        psrlq         mm3,32
329
        paddw         mm0,mm2
330
        paddw         mm0,mm3
1245 hidnplayr 331
 
332
 
8014 leency 333
        movd          eax,mm0
334
        and           eax,ebx
335
        lea           eax,[eax*5]
336
        shr           ax,4
337
        stosb
338
        add           esi,3
339
        loop          @b
1245 hidnplayr 340
 
341
end if
8014 leency 342
        push    ebp
1245 hidnplayr 343
 
8014 leency 344
        push    dword 0          ; env coords
345
        push    word 0
346
        push    word SIZE_X
347
        push    word SIZE_Y
348
        push    dword 0
349
        push    dword 0          ; bump coords
350
        push    word SIZE_X
351
        push    word SIZE_Y
352
        push    word 0
353
        mov     eax,SIZE_Y
354
        mov     ebx,SIZE_X*65536+0
355
        xor     ecx,ecx
356
        mov     edx,bumpmap2
357
        mov     esi,envmap
358
        mov     edi,screen
359
        call    bump_triangle
1245 hidnplayr 360
 
8014 leency 361
        push    dword SIZE_X shl 16 + SIZE_Y       ; env coords
362
        push    word 0
363
        push    word SIZE_X
364
        push    word SIZE_Y
365
        push    word 0
366
        push    dword SIZE_X shl 16 + SIZE_Y        ; bump coords
367
        push    word 0
368
        push    word SIZE_X
369
        push    word SIZE_Y
370
        push    word 0
371
        mov     eax,SIZE_Y
372
        mov     ebx,SIZE_X * 65536+0
373
        mov     ecx,SIZE_X shl 16 + SIZE_Y
374
        mov     edx,bumpmap2
375
        mov     esi,envmap
376
        mov     edi,screen
377
        call    bump_triangle
1245 hidnplayr 378
 
8014 leency 379
        pop     ebp
1245 hidnplayr 380
ret
6619 leency 381
end if
1245 hidnplayr 382
;********************************EMBOSS DONE*******************************
383
 
384
 
385
generate_object2:  ; torus
386
;in  ax - figure number       2=torus, 3=loop, 4=loop
387
;locals
388
;   counter dw ?
389
;   sin     dd ?
390
;   cos     dd ?
391
;endl
392
.counter equ  word[ebp-2]
8014 leency 393
.sin     equ  dword[ebp-6]
394
.cos     equ  dword[ebp-10]
395
.sin2    equ  dword[ebp-14]
396
.cos2    equ  dword[ebp-18]
1245 hidnplayr 397
.piD180m3 equ dword[ebp-22]
8014 leency 398
.cD2      equ word[ebp-24]
399
        push  ebp
400
        mov   ebp,esp
401
        sub   esp,24
1245 hidnplayr 402
 
8014 leency 403
        push  ax
1245 hidnplayr 404
 
8014 leency 405
        fninit
406
        mov     edi,[points_ptr]
407
        xor     eax,eax
408
                                    ; init seed -> 4   3d points
409
        mov     dword[edi],-1.0     ; x
410
        add     edi,4
411
        stosd                       ; y
412
        stosd                       ; z
413
        mov     dword[edi],-0.9     ; x1
414
        mov     dword[edi+4],0.1    ; y1
415
        add     edi,8
416
        stosd                       ; z1
417
        mov     dword[edi],-0.8
418
        add     edi,4
419
        stosd
420
        stosd
421
        mov     dword[edi],-0.9     ; x3
422
        mov     dword[edi+4],-0.1   ; y3
423
        add     edi,8
424
        stosd                       ; z3
425
        mov     [points_count_var],4
1245 hidnplayr 426
 
8014 leency 427
        fld     [piD180]
428
        fidiv   [i3]
429
        fstp    .piD180m3
430
        mov     .cD2,5
1245 hidnplayr 431
 
8014 leency 432
        pop     ax
433
        mov     ecx,1
434
        mov     edx,9
435
      .next:                      ; calc angle and rotate seed 4 points
436
        mov     .counter,cx
437
        mov     ebx,[points_ptr]
438
        fld     .piD180m3
439
        fimul   .counter
440
        fld     st
441
        fsincos
442
        fstp    .sin
443
        fstp    .cos
444
        fadd    st,st0
445
        fsincos
446
        fstp    .sin2
447
        fstp    .cos2
1245 hidnplayr 448
 
8014 leency 449
      .rotor:                          ; next 4
450
        ; rotary y
451
        fld     dword[ebx]         ; x
452
        fld     .sin
453
        fmul    dword[ebx+8]       ; z * sinbeta
454
        fchs
455
        fld     .cos
456
        fmul    dword[ebx]         ; x * cosbeta
457
        faddp
458
        fstp    dword[edi]         ; new x
459
        fmul    .sin             ; old x * sinbeta
460
        fld     .cos
461
        fmul    dword[ebx+8]       ; z * cosbeta
462
        faddp
463
        dec     dx
464
        or      dx,dx
465
        jnz     @f
1245 hidnplayr 466
;        mov     .counter,dx
8014 leency 467
        fld     st
468
        fidiv   [i3]
469
        faddp
1245 hidnplayr 470
    @@:
8014 leency 471
        fstp    dword[edi+8]       ; new z
472
        fld     dword[ebx+4]
473
        or      dx,dx
474
        jnz     @f
1245 hidnplayr 475
  ;      fld1
476
  ;      faddp
477
;        fld     st
8014 leency 478
        fadd    st,st0
479
        fadd    st,st0
1245 hidnplayr 480
;        fxch
481
;        fimul   [i3]
482
;        fsin
483
;        faddp
8014 leency 484
        mov     dx,9
1245 hidnplayr 485
    @@:
8014 leency 486
        fstp    dword[edi+4]
487
        ; rotary x
488
        cmp     al,3
489
        jl      .end_rot
490
        fld     dword[edi+4]    ;y
491
        fld     .sin2
492
        fmul    dword[edi+8]    ;z
493
        fld     .cos2
494
        fmul    dword[edi+4]    ;y
495
        faddp
496
        fstp    dword[edi+4]    ; new y
497
        fmul    .sin2       ; sinbeta * old y
498
        fchs
499
        fld     .cos2
500
        fmul    dword[edi+8]
501
        faddp
502
        fstp    dword[edi+8]
503
        ; rotary z
504
        cmp     al,4
505
        jl      .end_rot
506
        fld     dword[edi]      ;x
507
        fld     .sin
508
        fmul    dword[edi+4]    ;y
509
        fld     .cos
510
        fmul    dword[edi]      ;x
511
        faddp
512
        fstp    dword[edi]      ;new x
513
        fmul    .sin       ; sinbeta * old x
514
        fchs
515
        fld     .cos
516
        fmul    dword[edi+4]         ; cosbeta * y
517
        faddp
518
        fstp    dword[edi+4]    ; new y
1245 hidnplayr 519
 
520
 
521
 
522
      .end_rot:
523
 
8014 leency 524
        add     edi,12
525
        add     ebx,12
526
        mov     esi,[points_ptr]
527
        add     esi,12*4
528
        cmp     ebx,esi
529
        jl      .rotor
1245 hidnplayr 530
 
8014 leency 531
        add     [points_count_var],4
532
        add     cx,18
533
        cmp     cx,(18*21*3)+1
534
        jle     .next
1245 hidnplayr 535
 
8014 leency 536
        mov     edi,[triangles_ptr]
537
        mov     eax,4
538
        mov     ebx,4+4
539
        mov     [triangles_count_var],160*3    ;164*3   ;140
1245 hidnplayr 540
 
8014 leency 541
        mov     ecx,80*3  ;68
1245 hidnplayr 542
      @@:
8014 leency 543
        stosd                 ;----
544
        mov     [edi],ebx      ;    |
545
        add     edi,4         ;    |
546
        inc     eax            ;    |
547
        stosd                 ;    |repeat 4 times
1245 hidnplayr 548
 
8014 leency 549
        mov     [edi],ebx      ;    |
550
        inc     ebx
551
        add     edi,4
552
        stosd                 ;    |
553
        mov     [edi],ebx      ;    |
554
        add     edi,4         ;----
555
        loop     @b
1245 hidnplayr 556
 
557
 
8014 leency 558
        mov     dword[edi],-1  ; < - end mark
559
        mov       [culling_flag],0
1245 hidnplayr 560
 
8014 leency 561
        mov     esp,ebp
562
        pop     ebp
1245 hidnplayr 563
 
564
ret
565
 
566
 
567
generate_object3:  ; heart
568
;locals
569
;   counter dw ?
570
;   sin     dd ?
571
;   cos     dd ?
572
;endl
573
.counter equ  word[ebp-2]
8014 leency 574
.sin     equ  dword[ebp-6]
575
.cos     equ  dword[ebp-10]
576
.sin2    equ  dword[ebp-14]
577
.cos2    equ  dword[ebp-18]
1245 hidnplayr 578
.piD180m3 equ dword[ebp-22]
8014 leency 579
.cD2      equ word[ebp-24]
580
        push  ebp
581
        mov   ebp,esp
582
        sub   esp,24
1245 hidnplayr 583
 
8014 leency 584
        fninit
585
        mov     edi,[points_ptr]
586
        xor     eax,eax
587
                               ; init seed -> eight   3d points
588
        mov     dword[edi],2.0
589
        add     edi,4
590
        stosd
591
        stosd
1245 hidnplayr 592
 
8014 leency 593
        mov     dword[edi],2.0
594
        mov     dword[edi+4],-0.5
595
        add     edi,8
596
        stosd
1245 hidnplayr 597
 
8014 leency 598
        mov     dword[edi],1.5
599
        mov     dword[edi+4],-1.5
600
        add     edi,8
601
        stosd
602
        mov     dword[edi],1.0
603
        mov     dword[edi+4],-2.0
604
        add     edi,8
605
        stosd
1245 hidnplayr 606
 
8014 leency 607
        stosd
608
        mov     dword[edi],-2.5
609
        add     edi,4
610
        stosd
1245 hidnplayr 611
 
8014 leency 612
        mov     [points_count_var],5
1245 hidnplayr 613
 
8014 leency 614
        mov     ecx,1
615
      .next:                      ; calc angle and rotate seed 4 points
616
        mov     .counter,cx
617
        mov     ebx,[points_ptr]
618
        fld     [piD180]
619
        fimul   .counter
620
        fsincos
621
        fstp    .sin
622
        fstp    .cos
1245 hidnplayr 623
 
8014 leency 624
      .rotor:                          ; next 4
625
        ; rotary y
626
        fld     dword[ebx]         ; x
627
        fld     .sin
628
        fmul    dword[ebx+8]       ; z * sinbeta
629
        fchs
630
        fld     .cos
631
        fmul    dword[ebx]         ; x * cosbeta
632
        faddp
633
        fidiv   [i3]
634
        fstp    dword[edi]         ; new x
635
        fmul    .sin               ; old x * sinbeta
636
        fld     .cos
637
        fmul    dword[ebx+8]       ; z * cosbeta
638
        faddp
639
        fstp    dword[edi+8]       ; new z
1245 hidnplayr 640
 
8014 leency 641
        fld     dword[ebx+4]   ;y
642
        fstp    dword[edi+4]
1245 hidnplayr 643
 
644
 
645
      .end_rot:
646
 
8014 leency 647
        add     edi,12
648
        add     ebx,12
649
        mov     esi,[points_ptr]
650
        add     esi,12*5
651
        cmp     ebx,esi  ;real_points + (12*5)
652
        jl      .rotor
1245 hidnplayr 653
 
8014 leency 654
        add     [points_count_var],5
655
        add     cx,18
656
        cmp     cx,(18*21)+1
657
        jle     .next
1245 hidnplayr 658
;last points
659
 
8014 leency 660
        xor     eax,eax
1245 hidnplayr 661
 
8014 leency 662
        mov     dword[edi],0.22
663
        mov     dword[edi+4],0.77
664
        mov     dword[edi+8],1.25
665
        add     edi,12
1245 hidnplayr 666
 
8014 leency 667
        mov     dword[edi],0.22
668
        mov     dword[edi+4],0.77
669
        mov     dword[edi+8],-1.25
670
        add     edi,12
671
        stosd
1245 hidnplayr 672
 
8014 leency 673
        add     [points_count_var],2
1245 hidnplayr 674
 
675
; init triangles list
676
 
8014 leency 677
        mov     edi,[triangles_ptr]
678
        mov     eax,5
679
        mov     ebx,5+5
680
        mov     [triangles_count_var],200  ;204
1245 hidnplayr 681
 
8014 leency 682
        mov     ecx,100
1245 hidnplayr 683
      @@:
8014 leency 684
        stosd                 ;----
685
        mov     [edi],ebx      ;    |
686
        add     edi,4         ;    |
687
        inc     eax            ;    |
688
        stosd                 ;    |repeat
1245 hidnplayr 689
 
8014 leency 690
        mov     [edi],ebx      ;    |
691
        inc     ebx
692
        add     edi,4
693
        stosd                 ;    |
694
        mov     [edi],ebx      ;    |
695
        add     edi,4         ;----
696
        loop     @b
1245 hidnplayr 697
 
8014 leency 698
        mov     eax,5
699
        mov     ebx,[points_count_var]
700
        sub     ebx,2
701
        mov     dl,2
1245 hidnplayr 702
    .nx:
8014 leency 703
        mov     ecx,5
704
        add     [triangles_count_var],ecx
1245 hidnplayr 705
    @@:
8014 leency 706
        stosd
707
        add     eax,5
708
        stosd
709
        mov     dword[edi],ebx
710
        add     edi,4
711
        loop    @b
1245 hidnplayr 712
 
8014 leency 713
        cmp     dl,1
714
        je      @f
1245 hidnplayr 715
 
8014 leency 716
        inc     ebx
717
        jmp     .lab
1245 hidnplayr 718
     @@:
8014 leency 719
        dec     ebx
1245 hidnplayr 720
     .lab:
8014 leency 721
        mov     ecx,5
722
        add     [triangles_count_var],ecx
1245 hidnplayr 723
     @@:
8014 leency 724
        stosd
725
        add     eax,5
726
        stosd
727
        mov     dword[edi],ebx
728
        add     edi,4
729
        loop    @b
1245 hidnplayr 730
 
8014 leency 731
        dec     dl
732
        or      dl,dl
733
        jnz     .nx
1245 hidnplayr 734
 
8014 leency 735
        sub     eax,25
736
        stosd
737
        sub     eax,50
738
        stosd
739
        mov     dword[edi],ebx
740
        add     edi,4
1245 hidnplayr 741
 
8014 leency 742
        stosd
743
        add     eax,50
744
        stosd
745
        inc     ebx
746
        mov     dword[edi],ebx
747
        add     edi,4
748
        add     [triangles_count_var],2
1245 hidnplayr 749
 
8014 leency 750
        mov     dword[edi],-1  ; < - end mark
751
        mov     [culling_flag],0
1245 hidnplayr 752
 
8014 leency 753
        mov     esp,ebp
754
        pop     ebp
1245 hidnplayr 755
 
756
ret
8014 leency 757