forked from KolibriOS/kolibrios
fix in textures
git-svn-id: svn://kolibrios.org@6134 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fc65c2518c
commit
5398730057
@ -8,7 +8,7 @@ CLIP_YMAX equ (1<<3)
|
|||||||
CLIP_ZMIN equ (1<<4)
|
CLIP_ZMIN equ (1<<4)
|
||||||
CLIP_ZMAX equ (1<<5)
|
CLIP_ZMAX equ (1<<5)
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword
|
proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword
|
||||||
locals
|
locals
|
||||||
point dd ?
|
point dd ?
|
||||||
@ -53,6 +53,7 @@ endl
|
|||||||
push ecx
|
push ecx
|
||||||
stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8]
|
stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8]
|
||||||
jmp .end_if
|
jmp .end_if
|
||||||
|
align 4
|
||||||
@@:
|
@@:
|
||||||
; no need to convert to integer if no lighting : take current color
|
; no need to convert to integer if no lighting : take current color
|
||||||
mov ecx,[eax+offs_cont_longcurrent_color]
|
mov ecx,[eax+offs_cont_longcurrent_color]
|
||||||
@ -74,14 +75,14 @@ endl
|
|||||||
|
|
||||||
mov dword[point],dword(ZB_POINT_T_MAX - ZB_POINT_T_MIN)
|
mov dword[point],dword(ZB_POINT_T_MAX - ZB_POINT_T_MIN)
|
||||||
fild dword[point]
|
fild dword[point]
|
||||||
fmul dword[ebx+offs_vert_tex_coord+4] ;st0 *= v.tex_coord.Y
|
fmul dword[ebx+offs_vert_tex_coord+offs_Y] ;st0 *= v.tex_coord.Y
|
||||||
fistp dword[ebx+offs_vert_zp+offs_zbup_t]
|
fistp dword[ebx+offs_vert_zp+offs_zbup_t]
|
||||||
add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_T_MIN
|
add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_T_MIN
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_add_select1 uses eax ebx ecx, context:dword, z1:dword,z2:dword,z3:dword
|
proc gl_add_select1 uses eax ebx ecx, context:dword, z1:dword,z2:dword,z3:dword
|
||||||
mov eax,[z1]
|
mov eax,[z1]
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
@ -113,7 +114,7 @@ endp
|
|||||||
|
|
||||||
; point
|
; point
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_point uses eax ebx, context:dword, p0:dword
|
proc gl_draw_point uses eax ebx, context:dword, p0:dword
|
||||||
mov ebx,[p0]
|
mov ebx,[p0]
|
||||||
cmp dword[ebx+offs_vert_clip_code],0 ;if (p0.clip_code == 0)
|
cmp dword[ebx+offs_vert_clip_code],0 ;if (p0.clip_code == 0)
|
||||||
@ -123,6 +124,7 @@ proc gl_draw_point uses eax ebx, context:dword, p0:dword
|
|||||||
jne .els
|
jne .els
|
||||||
stdcall gl_add_select, eax,dword[ebx+offs_vert_zp+offs_zbup_z],dword[ebx+offs_vert_zp+offs_zbup_z] ;p0.zp.z,p0.zp.z
|
stdcall gl_add_select, eax,dword[ebx+offs_vert_zp+offs_zbup_z],dword[ebx+offs_vert_zp+offs_zbup_z] ;p0.zp.z,p0.zp.z
|
||||||
jmp @f
|
jmp @f
|
||||||
|
align 4
|
||||||
.els:
|
.els:
|
||||||
add ebx,offs_vert_zp
|
add ebx,offs_vert_zp
|
||||||
stdcall ZB_plot, dword[eax+offs_cont_zb],ebx
|
stdcall ZB_plot, dword[eax+offs_cont_zb],ebx
|
||||||
@ -132,7 +134,7 @@ endp
|
|||||||
|
|
||||||
; line
|
; line
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc interpolate uses eax ebx ecx, q:dword,p0:dword,p1:dword,t:dword
|
proc interpolate uses eax ebx ecx, q:dword,p0:dword,p1:dword,t:dword
|
||||||
mov eax,[q]
|
mov eax,[q]
|
||||||
mov ebx,[p0]
|
mov ebx,[p0]
|
||||||
@ -195,7 +197,7 @@ endp
|
|||||||
; Line Clipping algorithm from 'Computer Graphics', Principles and
|
; Line Clipping algorithm from 'Computer Graphics', Principles and
|
||||||
; Practice
|
; Practice
|
||||||
; tmin,tmax -> &float
|
; tmin,tmax -> &float
|
||||||
align 4
|
align 16
|
||||||
proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword
|
proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword
|
||||||
fld dword[denom]
|
fld dword[denom]
|
||||||
ftst
|
ftst
|
||||||
@ -217,6 +219,7 @@ proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword
|
|||||||
jbe .r1_f1 ;if (t>*tmin) *tmin=t
|
jbe .r1_f1 ;if (t>*tmin) *tmin=t
|
||||||
fstp dword[ebx]
|
fstp dword[ebx]
|
||||||
jmp .r1
|
jmp .r1
|
||||||
|
align 4
|
||||||
.els_0: ;else if (denom<0)
|
.els_0: ;else if (denom<0)
|
||||||
jae .els_1
|
jae .els_1
|
||||||
fld dword[num]
|
fld dword[num]
|
||||||
@ -234,6 +237,7 @@ proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword
|
|||||||
jae .r1_f1
|
jae .r1_f1
|
||||||
fstp dword[ebx] ;if (t<*tmin) *tmax=t
|
fstp dword[ebx] ;if (t<*tmin) *tmax=t
|
||||||
jmp .r1
|
jmp .r1
|
||||||
|
align 4
|
||||||
.els_1: ;else if (num>0)
|
.els_1: ;else if (num>0)
|
||||||
ffree st0 ;denom
|
ffree st0 ;denom
|
||||||
fincstp
|
fincstp
|
||||||
@ -243,13 +247,14 @@ proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword
|
|||||||
sahf
|
sahf
|
||||||
ja .r0_f1 ;if (num>0) return 0
|
ja .r0_f1 ;if (num>0) return 0
|
||||||
jmp .r1_f1
|
jmp .r1_f1
|
||||||
|
align 4
|
||||||
.r0_f1: ;return 0 & free st0
|
.r0_f1: ;return 0 & free st0
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
.r0: ;return 0
|
.r0: ;return 0
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.r1_f1: ;return 1 & free st0
|
.r1_f1: ;return 1 & free st0
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
@ -260,7 +265,7 @@ proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_line, context:dword, p1:dword, p2:dword
|
proc gl_draw_line, context:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
d_x dd ?
|
d_x dd ?
|
||||||
@ -291,6 +296,7 @@ pushad
|
|||||||
stdcall gl_add_select1, edx,dword[edi+offs_vert_zp+offs_zbup_z],\
|
stdcall gl_add_select1, edx,dword[edi+offs_vert_zp+offs_zbup_z],\
|
||||||
dword[esi+offs_vert_zp+offs_zbup_z],dword[esi+offs_vert_zp+offs_zbup_z]
|
dword[esi+offs_vert_zp+offs_zbup_z],dword[esi+offs_vert_zp+offs_zbup_z]
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_1:
|
.els_1:
|
||||||
add edi,offs_vert_zp
|
add edi,offs_vert_zp
|
||||||
add esi,offs_vert_zp
|
add esi,offs_vert_zp
|
||||||
@ -302,15 +308,17 @@ pushad
|
|||||||
;if (context.depth_test)
|
;if (context.depth_test)
|
||||||
call ZB_line_z ;, dword[edx+offs_cont_zb],edi,esi
|
call ZB_line_z ;, dword[edx+offs_cont_zb],edi,esi
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_2:
|
.els_2:
|
||||||
call ZB_line ;, dword[edx+offs_cont_zb],edi,esi
|
call ZB_line ;, dword[edx+offs_cont_zb],edi,esi
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_i:
|
.els_i:
|
||||||
;else if ( (p1.clip_code & p2.clip_code) != 0 )
|
;else if ( (p1.clip_code & p2.clip_code) != 0 )
|
||||||
mov eax,[edi+offs_vert_clip_code]
|
mov eax,[edi+offs_vert_clip_code]
|
||||||
and eax,[esi+offs_vert_clip_code]
|
and eax,[esi+offs_vert_clip_code]
|
||||||
cmp eax,0
|
or eax,eax
|
||||||
jne .end_f
|
jnz .end_f
|
||||||
.els_0:
|
.els_0:
|
||||||
|
|
||||||
fld dword[esi+offs_vert_pc+offs_X]
|
fld dword[esi+offs_vert_pc+offs_X]
|
||||||
@ -454,6 +462,7 @@ pushad
|
|||||||
je .els_3
|
je .els_3
|
||||||
call ZB_line_z ;(context.zb,&q1.zp,&q2.zp)
|
call ZB_line_z ;(context.zb,&q1.zp,&q2.zp)
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_3:
|
.els_3:
|
||||||
call ZB_line ;(context.zb,&q1.zp,&q2.zp)
|
call ZB_line ;(context.zb,&q1.zp,&q2.zp)
|
||||||
.end_f:
|
.end_f:
|
||||||
@ -509,6 +518,7 @@ end if
|
|||||||
fldz
|
fldz
|
||||||
fst dword[t] ;t=0
|
fst dword[t] ;t=0
|
||||||
jmp .e_zero
|
jmp .e_zero
|
||||||
|
align 4
|
||||||
@@: ;else
|
@@: ;else
|
||||||
fld dword[edx+offs#dir]
|
fld dword[edx+offs#dir]
|
||||||
if sign eq 0
|
if sign eq 0
|
||||||
@ -543,37 +553,37 @@ end if
|
|||||||
mov eax,[t]
|
mov eax,[t]
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc clip_xmin uses ebx ecx edx, c:dword, a:dword, b:dword
|
proc clip_xmin uses ebx ecx edx, c:dword, a:dword, b:dword
|
||||||
clip_func 0,_X,_Y,_Z
|
clip_func 0,_X,_Y,_Z
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc clip_xmax uses ebx ecx edx, c:dword, a:dword, b:dword
|
proc clip_xmax uses ebx ecx edx, c:dword, a:dword, b:dword
|
||||||
clip_func 1,_X,_Y,_Z
|
clip_func 1,_X,_Y,_Z
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc clip_ymin uses ebx ecx edx, c:dword, a:dword, b:dword
|
proc clip_ymin uses ebx ecx edx, c:dword, a:dword, b:dword
|
||||||
clip_func 0,_Y,_X,_Z
|
clip_func 0,_Y,_X,_Z
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc clip_ymax uses ebx ecx edx, c:dword, a:dword, b:dword
|
proc clip_ymax uses ebx ecx edx, c:dword, a:dword, b:dword
|
||||||
clip_func 1,_Y,_X,_Z
|
clip_func 1,_Y,_X,_Z
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc clip_zmin uses ebx ecx edx, c:dword, a:dword, b:dword
|
proc clip_zmin uses ebx ecx edx, c:dword, a:dword, b:dword
|
||||||
clip_func 0,_Z,_X,_Y
|
clip_func 0,_Z,_X,_Y
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc clip_zmax uses ebx ecx edx, c:dword, a:dword, b:dword
|
proc clip_zmax uses ebx ecx edx, c:dword, a:dword, b:dword
|
||||||
clip_func 1,_Z,_X,_Y
|
clip_func 1,_Z,_X,_Y
|
||||||
ret
|
ret
|
||||||
@ -582,7 +592,7 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
clip_proc dd clip_xmin,clip_xmax, clip_ymin,clip_ymax, clip_zmin,clip_zmax
|
clip_proc dd clip_xmin,clip_xmax, clip_ymin,clip_ymax, clip_zmin,clip_zmax
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc updateTmp uses eax ebx ecx edx, context:dword, q:dword, p0:dword, p1:dword, t:dword
|
proc updateTmp uses eax ebx ecx edx, context:dword, q:dword, p0:dword, p1:dword, t:dword
|
||||||
mov ebx,[q]
|
mov ebx,[q]
|
||||||
mov edx,[context]
|
mov edx,[context]
|
||||||
@ -606,6 +616,7 @@ proc updateTmp uses eax ebx ecx edx, context:dword, q:dword, p0:dword, p1:dword,
|
|||||||
fadd dword[eax+offs_vert_color+8]
|
fadd dword[eax+offs_vert_color+8]
|
||||||
fstp dword[ebx+offs_vert_color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t
|
fstp dword[ebx+offs_vert_color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t
|
||||||
jmp @f
|
jmp @f
|
||||||
|
align 4
|
||||||
.els_0:
|
.els_0:
|
||||||
mov ecx,[eax+offs_vert_color]
|
mov ecx,[eax+offs_vert_color]
|
||||||
mov [ebx+offs_vert_color],ecx ;q.color.v[0]=p0.color.v[0]
|
mov [ebx+offs_vert_color],ecx ;q.color.v[0]=p0.color.v[0]
|
||||||
@ -648,7 +659,7 @@ proc updateTmp uses eax ebx ecx edx, context:dword, q:dword, p0:dword, p1:dword,
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_triangle, context:dword, p0:dword, p1:dword, p2:dword
|
proc gl_draw_triangle, context:dword, p0:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
cc rd 3
|
cc rd 3
|
||||||
@ -716,6 +727,7 @@ pushad
|
|||||||
je .end_f
|
je .end_f
|
||||||
stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx
|
stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
@@:
|
@@:
|
||||||
cmp dword[edi+offs_cont_current_cull_face],GL_FRONT
|
cmp dword[edi+offs_cont_current_cull_face],GL_FRONT
|
||||||
jne .end_f
|
jne .end_f
|
||||||
@ -723,15 +735,18 @@ pushad
|
|||||||
jne .end_f
|
jne .end_f
|
||||||
stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx
|
stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_1:
|
.els_1:
|
||||||
; no culling
|
; no culling
|
||||||
cmp dword[front],0
|
cmp dword[front],0
|
||||||
je @f
|
je @f
|
||||||
stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx
|
stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
@@:
|
@@:
|
||||||
stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx
|
stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_0:
|
.els_0:
|
||||||
;eax = cc[2]
|
;eax = cc[2]
|
||||||
and eax,[cc]
|
and eax,[cc]
|
||||||
@ -744,7 +759,7 @@ popad
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword
|
proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword
|
||||||
locals
|
locals
|
||||||
co dd ?
|
co dd ?
|
||||||
@ -774,6 +789,7 @@ pushad
|
|||||||
jnz .els_0
|
jnz .els_0
|
||||||
stdcall gl_draw_triangle, [context],ebx,ecx,edx
|
stdcall gl_draw_triangle, [context],ebx,ecx,edx
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_0:
|
.els_0:
|
||||||
;eax = cc[2]
|
;eax = cc[2]
|
||||||
and eax,[cc]
|
and eax,[cc]
|
||||||
@ -796,6 +812,7 @@ pushad
|
|||||||
jnz .cycle_0_end
|
jnz .cycle_0_end
|
||||||
inc dword[clip_bit]
|
inc dword[clip_bit]
|
||||||
jmp .cycle_0
|
jmp .cycle_0
|
||||||
|
align 4
|
||||||
.cycle_0_end:
|
.cycle_0_end:
|
||||||
|
|
||||||
; this test can be true only in case of rounding errors
|
; this test can be true only in case of rounding errors
|
||||||
@ -837,6 +854,7 @@ end if
|
|||||||
mov [q+4],ecx
|
mov [q+4],ecx
|
||||||
mov [q+8],edx
|
mov [q+8],edx
|
||||||
jmp .els_2_end
|
jmp .els_2_end
|
||||||
|
align 4
|
||||||
.els_2:
|
.els_2:
|
||||||
mov eax,[cc+4]
|
mov eax,[cc+4]
|
||||||
and eax,[clip_mask]
|
and eax,[clip_mask]
|
||||||
@ -847,6 +865,7 @@ end if
|
|||||||
mov [q+4],edx
|
mov [q+4],edx
|
||||||
mov [q+8],ebx
|
mov [q+8],ebx
|
||||||
jmp .els_2_end
|
jmp .els_2_end
|
||||||
|
align 4
|
||||||
.els_3:
|
.els_3:
|
||||||
;q[0]=p2 q[1]=p0 q[2]=p1
|
;q[0]=p2 q[1]=p0 q[2]=p1
|
||||||
mov [q],edx
|
mov [q],edx
|
||||||
@ -908,6 +927,7 @@ end if
|
|||||||
add edi,sizeof.GLVertex ;edi = &tmp2
|
add edi,sizeof.GLVertex ;edi = &tmp2
|
||||||
stdcall gl_draw_triangle_clip,[context],edi ;gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1)
|
stdcall gl_draw_triangle_clip,[context],edi ;gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1)
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_1:
|
.els_1:
|
||||||
; two points outside
|
; two points outside
|
||||||
mov eax,[cc]
|
mov eax,[cc]
|
||||||
@ -919,6 +939,7 @@ end if
|
|||||||
mov [q+4],ecx
|
mov [q+4],ecx
|
||||||
mov [q+8],edx
|
mov [q+8],edx
|
||||||
jmp .els_4_end
|
jmp .els_4_end
|
||||||
|
align 4
|
||||||
.els_4:
|
.els_4:
|
||||||
mov eax,[cc+4]
|
mov eax,[cc+4]
|
||||||
and eax,[clip_mask]
|
and eax,[clip_mask]
|
||||||
@ -929,6 +950,7 @@ end if
|
|||||||
mov [q+4],edx
|
mov [q+4],edx
|
||||||
mov [q+8],ebx
|
mov [q+8],ebx
|
||||||
jmp .els_4_end
|
jmp .els_4_end
|
||||||
|
align 4
|
||||||
.els_5:
|
.els_5:
|
||||||
;q[0]=p2 q[1]=p0 q[2]=p1
|
;q[0]=p2 q[1]=p0 q[2]=p1
|
||||||
mov [q],edx
|
mov [q],edx
|
||||||
@ -977,7 +999,7 @@ popad
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword
|
proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword
|
||||||
mov eax,[p2]
|
mov eax,[p2]
|
||||||
push dword[eax+offs_vert_zp+offs_Z]
|
push dword[eax+offs_vert_zp+offs_Z]
|
||||||
@ -995,7 +1017,7 @@ if PROFILE eq 1
|
|||||||
count_pixels dd ?
|
count_pixels dd ?
|
||||||
end if
|
end if
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_triangle_fill, context:dword, p0:dword,p1:dword,p2:dword
|
proc gl_draw_triangle_fill, context:dword, p0:dword,p1:dword,p2:dword
|
||||||
pushad
|
pushad
|
||||||
if PROFILE eq 1
|
if PROFILE eq 1
|
||||||
@ -1030,8 +1052,19 @@ end if
|
|||||||
stdcall ZB_setTexture, dword[edx+offs_cont_zb],dword[eax]
|
stdcall ZB_setTexture, dword[edx+offs_cont_zb],dword[eax]
|
||||||
mov eax,[p0]
|
mov eax,[p0]
|
||||||
add eax,offs_vert_zp
|
add eax,offs_vert_zp
|
||||||
stdcall ZB_fillTriangleMappingPerspective, dword[edx+offs_cont_zb],eax,ebx,ecx
|
push ecx
|
||||||
|
push ebx
|
||||||
|
push eax
|
||||||
|
push dword[edx+offs_cont_zb]
|
||||||
|
cmp dword[edx+offs_cont_matrix_model_projection_no_w_transform],0
|
||||||
|
je @f
|
||||||
|
call ZB_fillTriangleMappingPerspective
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
|
@@:
|
||||||
|
call ZB_fillTriangleMapping
|
||||||
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els_i:
|
.els_i:
|
||||||
mov eax,[p0]
|
mov eax,[p0]
|
||||||
add eax,offs_vert_zp
|
add eax,offs_vert_zp
|
||||||
@ -1040,6 +1073,7 @@ end if
|
|||||||
;else if (context.current_shade_model == GL_SMOOTH)
|
;else if (context.current_shade_model == GL_SMOOTH)
|
||||||
stdcall ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],eax,ebx,ecx
|
stdcall ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],eax,ebx,ecx
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
|
align 4
|
||||||
.els:
|
.els:
|
||||||
stdcall ZB_fillTriangleFlat, dword[edx+offs_cont_zb],eax,ebx,ecx
|
stdcall ZB_fillTriangleFlat, dword[edx+offs_cont_zb],eax,ebx,ecx
|
||||||
.end_f:
|
.end_f:
|
||||||
@ -1049,13 +1083,14 @@ endp
|
|||||||
|
|
||||||
; Render a clipped triangle in line mode
|
; Render a clipped triangle in line mode
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_triangle_line uses eax ebx ecx edx, context:dword, p0:dword,p1:dword,p2:dword
|
proc gl_draw_triangle_line uses eax ebx ecx edx, context:dword, p0:dword,p1:dword,p2:dword
|
||||||
mov edx,[context]
|
mov edx,[context]
|
||||||
cmp dword[edx+offs_cont_depth_test],0
|
cmp dword[edx+offs_cont_depth_test],0
|
||||||
je .els
|
je .els
|
||||||
lea ecx,[ZB_line_z]
|
lea ecx,[ZB_line_z]
|
||||||
jmp @f
|
jmp @f
|
||||||
|
align 4
|
||||||
.els:
|
.els:
|
||||||
lea ecx,[ZB_line]
|
lea ecx,[ZB_line]
|
||||||
@@:
|
@@:
|
||||||
@ -1095,7 +1130,7 @@ proc gl_draw_triangle_line uses eax ebx ecx edx, context:dword, p0:dword,p1:dwor
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
; Render a clipped triangle in point mode
|
; Render a clipped triangle in point mode
|
||||||
align 4
|
align 16
|
||||||
proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p2:dword
|
proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p2:dword
|
||||||
mov edx,[context]
|
mov edx,[context]
|
||||||
mov eax,[p0]
|
mov eax,[p0]
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
if not exist bin mkdir bin
|
||||||
|
if not exist bin\text_1.png @copy text_1.png bin\text_1.png
|
||||||
|
if not exist bin\toolb_1.png @copy toolb_1.png bin\toolb_1.png
|
||||||
|
if not exist bin\font8x9.bmp @copy ..\..\..\..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
|
||||||
|
if not exist bin\tinygl.obj @fasm.exe -m 16384 ..\tinygl.asm bin\tinygl.obj
|
||||||
|
|
||||||
|
@fasm.exe -m 16384 test0.asm bin\test0.kex
|
||||||
|
@fasm.exe -m 16384 test1.asm bin\test1.kex
|
||||||
|
@fasm.exe -m 16384 test2.asm bin\test2.kex
|
||||||
|
@fasm.exe -m 16384 test3.asm bin\test3.kex
|
||||||
|
|
||||||
|
@fasm.exe -m 16384 test_array0.asm bin\test_array0.kex
|
||||||
|
@fasm.exe -m 16384 test_array1.asm bin\test_array1.kex
|
||||||
|
|
||||||
|
@fasm.exe -m 16384 test_glu0.asm bin\test_glu0.kex
|
||||||
|
@fasm.exe -m 16384 test_glu1.asm bin\test_glu1.kex
|
||||||
|
@fasm.exe -m 16384 test_glu2.asm bin\test_glu2.kex
|
||||||
|
|
||||||
|
@fasm.exe -m 16384 gears.asm bin\gears.kex
|
||||||
|
@fasm.exe -m 16384 textures0.asm bin\textures0.kex
|
||||||
|
|
||||||
|
|
||||||
|
@kpack bin\test0.kex
|
||||||
|
@kpack bin\test1.kex
|
||||||
|
@kpack bin\test2.kex
|
||||||
|
@kpack bin\test3.kex
|
||||||
|
|
||||||
|
@kpack bin\test_array0.kex
|
||||||
|
@kpack bin\test_array1.kex
|
||||||
|
|
||||||
|
@kpack bin\test_glu0.kex
|
||||||
|
@kpack bin\test_glu1.kex
|
||||||
|
@kpack bin\test_glu2.kex
|
||||||
|
|
||||||
|
@kpack bin\gears.kex
|
||||||
|
@kpack bin\textures0.kex
|
||||||
|
|
||||||
|
pause
|
@ -39,7 +39,7 @@ end if
|
|||||||
add [z],eax
|
add [z],eax
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc ZB_fillTriangleFlat, zb:dword, p0:dword, p1:dword, p2:dword
|
proc ZB_fillTriangleFlat, zb:dword, p0:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
if TGL_FEATURE_RENDER_BITS eq 24
|
if TGL_FEATURE_RENDER_BITS eq 24
|
||||||
@ -94,12 +94,12 @@ end if
|
|||||||
add [ob1],eax
|
add [ob1],eax
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc ZB_fillTriangleSmooth, zb:dword, p0:dword, p1:dword, p2:dword
|
proc ZB_fillTriangleSmooth, zb:dword, p0:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
include 'ztriangle.inc'
|
include 'ztriangle.inc'
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc ZB_setTexture uses eax ebx, zb:dword, texture:dword
|
proc ZB_setTexture uses eax ebx, zb:dword, texture:dword
|
||||||
mov eax,[zb]
|
mov eax,[zb]
|
||||||
mov ebx,[texture]
|
mov ebx,[texture]
|
||||||
@ -120,6 +120,7 @@ macro DRAW_INIT
|
|||||||
macro PUT_PIXEL _a
|
macro PUT_PIXEL _a
|
||||||
{
|
{
|
||||||
local .end_0
|
local .end_0
|
||||||
|
local .in_mem
|
||||||
mov eax,[z]
|
mov eax,[z]
|
||||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||||
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
||||||
@ -131,6 +132,10 @@ if TGL_FEATURE_RENDER_BITS eq 24
|
|||||||
and ebx,0x3fc00000
|
and ebx,0x3fc00000
|
||||||
or ebx,[s]
|
or ebx,[s]
|
||||||
shr ebx,14
|
shr ebx,14
|
||||||
|
cmp ebx,256*256-1 ;проверка на выход за пределы текстуры
|
||||||
|
jl .in_mem ;координата 1.0,1.0 может выползать
|
||||||
|
mov ebx,256*256-1 ;переход на последний пиксель текстуры
|
||||||
|
.in_mem:
|
||||||
imul ebx,3
|
imul ebx,3
|
||||||
add ebx,[texture] ;ptr = texture + (((t & 0x3fc00000) | s) >> 14) * 3
|
add ebx,[texture] ;ptr = texture + (((t & 0x3fc00000) | s) >> 14) * 3
|
||||||
mov ax,word[ebx]
|
mov ax,word[ebx]
|
||||||
@ -149,7 +154,7 @@ end if
|
|||||||
add [t],eax
|
add [t],eax
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc ZB_fillTriangleMapping, zb:dword, p0:dword, p1:dword, p2:dword
|
proc ZB_fillTriangleMapping, zb:dword, p0:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
texture dd ? ;PIXEL*
|
texture dd ? ;PIXEL*
|
||||||
@ -188,6 +193,7 @@ macro DRAW_INIT
|
|||||||
macro PUT_PIXEL _a
|
macro PUT_PIXEL _a
|
||||||
{
|
{
|
||||||
local .end_0
|
local .end_0
|
||||||
|
local .in_mem
|
||||||
mov eax,[z]
|
mov eax,[z]
|
||||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||||
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
||||||
@ -201,6 +207,15 @@ if TGL_FEATURE_RENDER_BITS eq 24
|
|||||||
and eax,0x003fc000
|
and eax,0x003fc000
|
||||||
or ebx,eax
|
or ebx,eax
|
||||||
shr ebx,14
|
shr ebx,14
|
||||||
|
if 1
|
||||||
|
; не знаю нужна ли сдесь эта проверка
|
||||||
|
; функция ZB_fillTriangleMapping без нее не работает
|
||||||
|
; на всякий случай делаю и тут такое же
|
||||||
|
cmp ebx,256*256-1 ;проверка на выход за пределы текстуры
|
||||||
|
jl .in_mem ;координата 1.0,1.0 может выползать
|
||||||
|
mov ebx,256*256-1 ;переход на последний пиксель текстуры
|
||||||
|
.in_mem:
|
||||||
|
end if
|
||||||
imul ebx,3
|
imul ebx,3
|
||||||
add ebx,[texture] ;ptr = texture + (((t & 0x3fc00000) | (s & 0x003FC000)) >> 14) * 3
|
add ebx,[texture] ;ptr = texture + (((t & 0x3fc00000) | (s & 0x003FC000)) >> 14) * 3
|
||||||
mov ax,word[ebx]
|
mov ax,word[ebx]
|
||||||
@ -233,7 +248,6 @@ if TGL_FEATURE_RENDER_BITS eq 24
|
|||||||
fld1
|
fld1
|
||||||
fild dword[z1]
|
fild dword[z1]
|
||||||
fst dword[f_z] ;fz = (float)z1
|
fst dword[f_z] ;fz = (float)z1
|
||||||
;fld1
|
|
||||||
fdivp
|
fdivp
|
||||||
fstp dword[zinv] ;zinv = 1.0 / fz
|
fstp dword[zinv] ;zinv = 1.0 / fz
|
||||||
imul edi,PSZB
|
imul edi,PSZB
|
||||||
@ -271,7 +285,6 @@ fld1
|
|||||||
fld dword[f_z]
|
fld dword[f_z]
|
||||||
fadd dword[fndzdx]
|
fadd dword[fndzdx]
|
||||||
fst dword[f_z] ;fz += fndzdx
|
fst dword[f_z] ;fz += fndzdx
|
||||||
;fld1
|
|
||||||
fdivp
|
fdivp
|
||||||
fstp dword[zinv] ;zinv = 1.0 / fz
|
fstp dword[zinv] ;zinv = 1.0 / fz
|
||||||
PUT_PIXEL 0
|
PUT_PIXEL 0
|
||||||
@ -292,6 +305,7 @@ fld1
|
|||||||
fadd dword[t_z]
|
fadd dword[t_z]
|
||||||
fstp dword[t_z] ;tz += ndtzdx
|
fstp dword[t_z] ;tz += ndtzdx
|
||||||
jmp .cycle_2
|
jmp .cycle_2
|
||||||
|
align 4
|
||||||
.cycle_2_end:
|
.cycle_2_end:
|
||||||
fld dword[zinv]
|
fld dword[zinv]
|
||||||
fld st0
|
fld st0
|
||||||
@ -318,11 +332,12 @@ align 4
|
|||||||
add edi,PSZB ;pp += PSZB
|
add edi,PSZB ;pp += PSZB
|
||||||
dec dword[n]
|
dec dword[n]
|
||||||
jmp .cycle_3
|
jmp .cycle_3
|
||||||
|
align 4
|
||||||
.cycle_3_end:
|
.cycle_3_end:
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc ZB_fillTriangleMappingPerspective, zb:dword, p0:dword, p1:dword, p2:dword
|
proc ZB_fillTriangleMappingPerspective, zb:dword, p0:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
texture dd ? ;PIXEL *
|
texture dd ? ;PIXEL *
|
||||||
@ -386,7 +401,7 @@ local .end_0
|
|||||||
fstp dword[t_z]
|
fstp dword[t_z]
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 16
|
||||||
proc ZB_fillTriangleMappingPerspective, zb:dword, p0:dword, p1:dword, p2:dword
|
proc ZB_fillTriangleMappingPerspective, zb:dword, p0:dword, p1:dword, p2:dword
|
||||||
locals
|
locals
|
||||||
texture dd ? ;PIXEL*
|
texture dd ? ;PIXEL*
|
||||||
|
Loading…
Reference in New Issue
Block a user