Subversion Repositories Kolibri OS

Rev

Rev 5153 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. align 4
  3. proc ZB_plot uses eax ebx ecx edx edi, zb:dword, p:dword
  4.         mov eax,[zb]
  5.         mov ebx,[p]
  6.         mov ecx,[ebx+offs_zbup_y]
  7.         imul ecx,[eax+offs_zbuf_xsize]
  8.         add ecx,[ebx+offs_zbup_x]
  9.         shl ecx,1
  10.         add ecx,[eax+offs_zbuf_zbuf]
  11.         mov edx,[eax+offs_zbuf_linesize]
  12.         imul edx,[ebx+offs_zbup_y]
  13.         mov edi,[ebx+offs_zbup_x]
  14.         imul edi,PSZB
  15.         add edx,edi
  16.         add edx,[eax+offs_zbuf_pbuf]
  17.         mov edi,[ebx+offs_zbup_z]
  18.         shr edi,ZB_POINT_Z_FRAC_BITS
  19.         cmp di,word[ecx]
  20.         jl .end_f
  21. if TGL_FEATURE_RENDER_BITS eq 24
  22.         mov eax,[ebx+offs_zbup_r]
  23.         mov byte[edx],ah
  24.         mov eax,[ebx+offs_zbup_g]
  25.         mov byte[edx+1],ah
  26.         mov eax,[ebx+offs_zbup_b]
  27.         mov byte[edx+2],ah
  28. else
  29. ;       *pp = RGB_TO_PIXEL(p->r, p->g, p->b);
  30. end if
  31.         mov word[ecx],di
  32.         .end_f:
  33.         ret
  34. endp
  35.  
  36. INTERP_Z equ 1
  37. align 4
  38. proc ZB_line_flat_z, zb:dword, p1:dword, p2:dword, color:dword
  39. include 'zline.inc'
  40.  
  41. ; line with color interpolation
  42. INTERP_Z equ 1
  43. align 4
  44. proc ZB_line_interp_z, zb:dword, p1:dword, p2:dword
  45. include 'zline_r.inc'
  46.  
  47. ; no Z interpolation
  48.  
  49. align 4
  50. proc ZB_line_flat, zb:dword, p1:dword, p2:dword, color:dword
  51. include 'zline.inc'
  52.  
  53. align 4
  54. proc ZB_line_interp, zb:dword, p1:dword, p2:dword
  55. include 'zline_r.inc'
  56.  
  57. align 4
  58. proc ZB_line_z uses eax ebx ecx, zb:dword, p1:dword, p2:dword
  59. if DEBUG ;ZB_line_z
  60. push edi
  61.         mov ecx,80
  62.         mov eax,[p1]
  63.         mov eax,[eax+offs_zbup_x]
  64.         lea edi,[buf_param]
  65.         stdcall convert_int_to_str,ecx
  66.         stdcall str_n_cat,edi,txt_zp_sp,2
  67.         stdcall str_len,edi
  68.         add edi,eax
  69.         sub ecx,eax
  70.  
  71.         mov eax,[p1]
  72.         mov eax,[eax+offs_zbup_y]
  73.         stdcall convert_int_to_str,ecx
  74.         stdcall str_n_cat,edi,txt_zp_sp,2
  75.         stdcall str_len,edi
  76.         add edi,eax
  77.         sub ecx,eax
  78.  
  79.         mov eax,[p2]
  80.         mov eax,[eax+offs_zbup_x]
  81.         stdcall convert_int_to_str,ecx
  82.         stdcall str_n_cat,edi,txt_zp_sp,2
  83.         stdcall str_len,edi
  84.         add edi,eax
  85.         sub ecx,eax
  86.  
  87.         mov eax,[p2]
  88.         mov eax,[eax+offs_zbup_y]
  89.         stdcall convert_int_to_str,ecx
  90.  
  91.         stdcall str_n_cat,edi,txt_nl,2
  92.         stdcall dbg_print,f_zbz,buf_param
  93. pop edi
  94. end if
  95.         mov ebx,[p1]
  96.         RGB_TO_PIXEL dword[ebx+offs_zbup_r],dword[ebx+offs_zbup_g],dword[ebx+offs_zbup_b]
  97.         mov ecx,eax
  98.         mov ebx,[p2]
  99.         RGB_TO_PIXEL dword[ebx+offs_zbup_r],dword[ebx+offs_zbup_g],dword[ebx+offs_zbup_b]
  100.  
  101.         ; choose if the line should have its color interpolated or not
  102.         cmp ecx,eax
  103.         jne .els
  104.                 stdcall ZB_line_flat_z, dword[zb], dword[p1], ebx, ecx
  105.                 jmp @f
  106.         .els:
  107.                 stdcall ZB_line_interp_z, dword[zb], dword[p1], ebx
  108.         @@:
  109.         ret
  110. endp
  111.  
  112. align 4
  113. proc ZB_line uses eax ebx ecx, zb:dword, p1:dword, p2:dword
  114. if DEBUG ;ZB_line
  115. push edi
  116.         mov ecx,80
  117.         mov eax,[p1]
  118.         mov eax,[eax+offs_zbup_x]
  119.         lea edi,[buf_param]
  120.         stdcall convert_int_to_str,ecx
  121.         stdcall str_n_cat,edi,txt_zp_sp,2
  122.         stdcall str_len,edi
  123.         add edi,eax
  124.         sub ecx,eax
  125.  
  126.         mov eax,[p1]
  127.         mov eax,[eax+offs_zbup_y]
  128.         stdcall convert_int_to_str,ecx
  129.         stdcall str_n_cat,edi,txt_zp_sp,2
  130.         stdcall str_len,edi
  131.         add edi,eax
  132.         sub ecx,eax
  133.  
  134.         mov eax,[p2]
  135.         mov eax,[eax+offs_zbup_x]
  136.         stdcall convert_int_to_str,ecx
  137.         stdcall str_n_cat,edi,txt_zp_sp,2
  138.         stdcall str_len,edi
  139.         add edi,eax
  140.         sub ecx,eax
  141.  
  142.         mov eax,[p2]
  143.         mov eax,[eax+offs_zbup_y]
  144.         stdcall convert_int_to_str,ecx
  145.  
  146.         stdcall str_n_cat,edi,txt_nl,2
  147.         stdcall dbg_print,f_zb,buf_param
  148. pop edi
  149. end if
  150.         mov ebx,[p1]
  151.         RGB_TO_PIXEL dword[ebx+offs_zbup_r],dword[ebx+offs_zbup_g],dword[ebx+offs_zbup_b]
  152.         mov ecx,eax
  153.         mov ebx,[p2]
  154.         RGB_TO_PIXEL dword[ebx+offs_zbup_r],dword[ebx+offs_zbup_g],dword[ebx+offs_zbup_b]
  155.  
  156.         ; choose if the line should have its color interpolated or not
  157.         cmp ecx,eax
  158.         jne .els
  159.                 stdcall ZB_line_flat, dword[zb], dword[p1], ebx, ecx
  160.                 jmp @f
  161.         .els:
  162.                 stdcall ZB_line_interp, dword[zb], dword[p1], ebx
  163.         @@:
  164.         ret
  165. endp
  166.