Subversion Repositories Kolibri OS

Rev

Rev 8047 | 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
8232 leency 82
   jl      @f
8047 leency 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
8232 leency 90
   jl      @f
8047 leency 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
8232 leency 109
   cmp     [dr_flag],12
110
   jge     @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
8232 leency 172
 jge   @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
8232 leency 185
 jge   @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
8232 leency 249
 jl     @f
8047 leency 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
8232 leency 267
 jge    .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
generate_object3:  ; heart
566
;locals
567
;   counter dw ?
568
;   sin     dd ?
569
;   cos     dd ?
570
;endl
571
.counter equ  word[ebp-2]
8014 leency 572
.sin     equ  dword[ebp-6]
573
.cos     equ  dword[ebp-10]
574
.sin2    equ  dword[ebp-14]
575
.cos2    equ  dword[ebp-18]
1245 hidnplayr 576
.piD180m3 equ dword[ebp-22]
8014 leency 577
.cD2      equ word[ebp-24]
578
        push  ebp
579
        mov   ebp,esp
580
        sub   esp,24
1245 hidnplayr 581
 
8014 leency 582
        fninit
583
        mov     edi,[points_ptr]
584
        xor     eax,eax
585
                               ; init seed -> eight   3d points
586
        mov     dword[edi],2.0
587
        add     edi,4
588
        stosd
589
        stosd
1245 hidnplayr 590
 
8014 leency 591
        mov     dword[edi],2.0
592
        mov     dword[edi+4],-0.5
593
        add     edi,8
594
        stosd
1245 hidnplayr 595
 
8014 leency 596
        mov     dword[edi],1.5
597
        mov     dword[edi+4],-1.5
598
        add     edi,8
599
        stosd
600
        mov     dword[edi],1.0
601
        mov     dword[edi+4],-2.0
602
        add     edi,8
603
        stosd
1245 hidnplayr 604
 
8014 leency 605
        stosd
606
        mov     dword[edi],-2.5
607
        add     edi,4
608
        stosd
1245 hidnplayr 609
 
8014 leency 610
        mov     [points_count_var],5
1245 hidnplayr 611
 
8014 leency 612
        mov     ecx,1
613
      .next:                      ; calc angle and rotate seed 4 points
614
        mov     .counter,cx
615
        mov     ebx,[points_ptr]
616
        fld     [piD180]
617
        fimul   .counter
618
        fsincos
619
        fstp    .sin
620
        fstp    .cos
1245 hidnplayr 621
 
8014 leency 622
      .rotor:                          ; next 4
623
        ; rotary y
624
        fld     dword[ebx]         ; x
625
        fld     .sin
626
        fmul    dword[ebx+8]       ; z * sinbeta
627
        fchs
628
        fld     .cos
629
        fmul    dword[ebx]         ; x * cosbeta
630
        faddp
631
        fidiv   [i3]
632
        fstp    dword[edi]         ; new x
633
        fmul    .sin               ; old x * sinbeta
634
        fld     .cos
635
        fmul    dword[ebx+8]       ; z * cosbeta
636
        faddp
637
        fstp    dword[edi+8]       ; new z
1245 hidnplayr 638
 
8014 leency 639
        fld     dword[ebx+4]   ;y
640
        fstp    dword[edi+4]
1245 hidnplayr 641
 
642
 
643
      .end_rot:
644
 
8014 leency 645
        add     edi,12
646
        add     ebx,12
647
        mov     esi,[points_ptr]
648
        add     esi,12*5
649
        cmp     ebx,esi  ;real_points + (12*5)
650
        jl      .rotor
1245 hidnplayr 651
 
8014 leency 652
        add     [points_count_var],5
653
        add     cx,18
654
        cmp     cx,(18*21)+1
655
        jle     .next
1245 hidnplayr 656
;last points
657
 
8014 leency 658
        xor     eax,eax
1245 hidnplayr 659
 
8014 leency 660
        mov     dword[edi],0.22
661
        mov     dword[edi+4],0.77
662
        mov     dword[edi+8],1.25
663
        add     edi,12
1245 hidnplayr 664
 
8014 leency 665
        mov     dword[edi],0.22
666
        mov     dword[edi+4],0.77
667
        mov     dword[edi+8],-1.25
668
        add     edi,12
669
        stosd
1245 hidnplayr 670
 
8014 leency 671
        add     [points_count_var],2
1245 hidnplayr 672
 
673
; init triangles list
674
 
8014 leency 675
        mov     edi,[triangles_ptr]
676
        mov     eax,5
677
        mov     ebx,5+5
678
        mov     [triangles_count_var],200  ;204
1245 hidnplayr 679
 
8014 leency 680
        mov     ecx,100
1245 hidnplayr 681
      @@:
8014 leency 682
        stosd                 ;----
683
        mov     [edi],ebx      ;    |
684
        add     edi,4         ;    |
685
        inc     eax            ;    |
686
        stosd                 ;    |repeat
1245 hidnplayr 687
 
8014 leency 688
        mov     [edi],ebx      ;    |
689
        inc     ebx
690
        add     edi,4
691
        stosd                 ;    |
692
        mov     [edi],ebx      ;    |
693
        add     edi,4         ;----
694
        loop     @b
1245 hidnplayr 695
 
8014 leency 696
        mov     eax,5
697
        mov     ebx,[points_count_var]
698
        sub     ebx,2
699
        mov     dl,2
1245 hidnplayr 700
    .nx:
8014 leency 701
        mov     ecx,5
702
        add     [triangles_count_var],ecx
1245 hidnplayr 703
    @@:
8014 leency 704
        stosd
705
        add     eax,5
706
        stosd
707
        mov     dword[edi],ebx
708
        add     edi,4
709
        loop    @b
1245 hidnplayr 710
 
8014 leency 711
        cmp     dl,1
712
        je      @f
1245 hidnplayr 713
 
8014 leency 714
        inc     ebx
715
        jmp     .lab
1245 hidnplayr 716
     @@:
8014 leency 717
        dec     ebx
1245 hidnplayr 718
     .lab:
8014 leency 719
        mov     ecx,5
720
        add     [triangles_count_var],ecx
1245 hidnplayr 721
     @@:
8014 leency 722
        stosd
723
        add     eax,5
724
        stosd
725
        mov     dword[edi],ebx
726
        add     edi,4
727
        loop    @b
1245 hidnplayr 728
 
8014 leency 729
        dec     dl
730
        or      dl,dl
731
        jnz     .nx
1245 hidnplayr 732
 
8014 leency 733
        sub     eax,25
734
        stosd
735
        sub     eax,50
736
        stosd
737
        mov     dword[edi],ebx
738
        add     edi,4
1245 hidnplayr 739
 
8014 leency 740
        stosd
741
        add     eax,50
742
        stosd
743
        inc     ebx
744
        mov     dword[edi],ebx
745
        add     edi,4
746
        add     [triangles_count_var],2
1245 hidnplayr 747
 
8014 leency 748
        mov     dword[edi],-1  ; < - end mark
749
        mov     [culling_flag],0
1245 hidnplayr 750
 
8014 leency 751
        mov     esp,ebp
752
        pop     ebp
1245 hidnplayr 753
 
754
ret
8014 leency 755