forked from KolibriOS/kolibrios
some fixes & optimizations
git-svn-id: svn://kolibrios.org@5353 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
89cf5a21d6
commit
334d99f484
@ -27,6 +27,13 @@ proc glVertex2f, x:dword, y:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc glVertex2fv uses eax, v:dword
|
||||||
|
mov eax,[v]
|
||||||
|
stdcall glVertex4f,[eax],[eax+4],0.0,1.0
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glVertex3f, x:dword, y:dword, z:dword
|
proc glVertex3f, x:dword, y:dword, z:dword
|
||||||
stdcall glVertex4f,[x],[y],[z],1.0
|
stdcall glVertex4f,[x],[y],[z],1.0
|
||||||
@ -40,6 +47,13 @@ proc glVertex3fv uses eax, v:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc glVertex4fv uses eax, v:dword
|
||||||
|
mov eax,[v]
|
||||||
|
stdcall glVertex4f,[eax],[eax+4],[eax+8],[eax+12]
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
; glNormal
|
; glNormal
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -548,7 +562,7 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;/* lightening */
|
; lightening
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glMaterialfv uses eax ecx, mode:dword, type:dword, v:dword
|
proc glMaterialfv uses eax ecx, mode:dword, type:dword, v:dword
|
||||||
@ -721,7 +735,7 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;/* clear */
|
; clear
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glClear uses eax, mask:dword
|
proc glClear uses eax, mask:dword
|
||||||
@ -775,7 +789,7 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;/* textures */
|
; textures
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glTexImage2D uses ecx edi esi,\
|
proc glTexImage2D uses ecx edi esi,\
|
||||||
@ -879,7 +893,7 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;/* selection */
|
; selection
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glInitNames uses eax
|
proc glInitNames uses eax
|
||||||
@ -954,7 +968,7 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;/* Special Functions */
|
; Special Functions
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glCallList uses eax, list:dword
|
proc glCallList uses eax, list:dword
|
||||||
|
@ -174,18 +174,23 @@ align 4
|
|||||||
add esi,[edx+offs_cont_color_array] ;esi = &context.color_array[i]
|
add esi,[edx+offs_cont_color_array] ;esi = &context.color_array[i]
|
||||||
mov edi,ebp
|
mov edi,ebp
|
||||||
sub edi,28 ;edi = &p[1]
|
sub edi,28 ;edi = &p[1]
|
||||||
movsd ;p[1].f = context.color_array[i]
|
mov ebx,[esi+8]
|
||||||
movsd
|
mov [edi],ebx ;p[1].f = context.color_array[i+2]
|
||||||
movsd
|
mov ebx,[esi+4]
|
||||||
|
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
|
||||||
|
mov ebx,[esi]
|
||||||
|
mov [edi+8],ebx ;p[3].f = context.color_array[i]
|
||||||
|
add edi,12
|
||||||
cmp dword[size],3
|
cmp dword[size],3
|
||||||
jle .e1
|
jle .e1
|
||||||
|
add esi,12
|
||||||
movsd
|
movsd
|
||||||
sub edi,20 ;&p[0]
|
|
||||||
jmp .e2
|
jmp .e2
|
||||||
.e1:
|
.e1:
|
||||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||||
sub edi,16 ;&p[0]
|
|
||||||
.e2:
|
.e2:
|
||||||
|
mov edi,ebp
|
||||||
|
sub edi,32 ;edi = &p[0]
|
||||||
mov ebx,ebp
|
mov ebx,ebp
|
||||||
sub ebx,12 ;ebp-12 = &p[5]
|
sub ebx,12 ;ebp-12 = &p[5]
|
||||||
push ebx
|
push ebx
|
||||||
@ -256,6 +261,7 @@ align 4
|
|||||||
.e6:
|
.e6:
|
||||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||||
add edi,4
|
add edi,4
|
||||||
|
jmp .e8 ;и 4-й тоже ставим по умолчанию
|
||||||
.e7:
|
.e7:
|
||||||
cmp dword[size],3
|
cmp dword[size],3
|
||||||
jle .e8
|
jle .e8
|
||||||
@ -302,7 +308,7 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc glopDrawElements uses eax ebx edx, context:dword, param:dword
|
proc glopDrawElements uses eax ebx edx, context:dword, param:dword
|
||||||
locals
|
locals
|
||||||
p rd 5
|
p rd 8
|
||||||
endl
|
endl
|
||||||
|
|
||||||
mov edx,[context]
|
mov edx,[context]
|
||||||
@ -318,7 +324,7 @@ endl
|
|||||||
mov eax,[ebx+4]
|
mov eax,[ebx+4]
|
||||||
mov [p+4],eax ;p[1].i = param[1].i
|
mov [p+4],eax ;p[1].i = param[1].i
|
||||||
mov eax,ebp
|
mov eax,ebp
|
||||||
sub eax,20 ;=sizeof(dd)*5
|
sub eax,32 ;=sizeof(dd)*8
|
||||||
stdcall glopBegin, edx,eax
|
stdcall glopBegin, edx,eax
|
||||||
|
|
||||||
; for (int ii=0; ii<count; ii++) {
|
; for (int ii=0; ii<count; ii++) {
|
||||||
@ -360,7 +366,7 @@ endl
|
|||||||
; }
|
; }
|
||||||
; }
|
; }
|
||||||
mov eax,ebp
|
mov eax,ebp
|
||||||
sub eax,20 ;=sizeof(dd)*5
|
sub eax,32 ;=sizeof(dd)*8
|
||||||
stdcall glopEnd, edx,eax
|
stdcall glopEnd, edx,eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
@ -13,6 +13,10 @@ offs_Y equ 4
|
|||||||
offs_Z equ 8
|
offs_Z equ 8
|
||||||
offs_W equ 12
|
offs_W equ 12
|
||||||
|
|
||||||
|
if DEBUG
|
||||||
|
f_ttv db ' gl_transform_to_viewport',0
|
||||||
|
end if
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
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
|
||||||
@ -69,8 +73,8 @@ endl
|
|||||||
.end_if:
|
.end_if:
|
||||||
|
|
||||||
; texture
|
; texture
|
||||||
bt dword[eax+offs_cont_texture_2d_enabled],0
|
cmp dword[eax+offs_cont_texture_2d_enabled],0
|
||||||
jnc @f
|
je @f
|
||||||
mov dword[point],dword(ZB_POINT_S_MAX - ZB_POINT_S_MIN)
|
mov dword[point],dword(ZB_POINT_S_MAX - ZB_POINT_S_MIN)
|
||||||
fild dword[point]
|
fild dword[point]
|
||||||
fmul dword[ebx+offs_vert_tex_coord] ;st0 *= v.tex_coord.X
|
fmul dword[ebx+offs_vert_tex_coord] ;st0 *= v.tex_coord.X
|
||||||
@ -84,7 +88,7 @@ endl
|
|||||||
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
|
||||||
@@:
|
@@:
|
||||||
if DEBUG ;gl_transform_to_viewport
|
if DEBUG ;gl_transform_to_viewport
|
||||||
push edi
|
pushad
|
||||||
mov ecx,80
|
mov ecx,80
|
||||||
mov eax,[ebx+offs_vert_zp]
|
mov eax,[ebx+offs_vert_zp]
|
||||||
lea edi,[buf_param]
|
lea edi,[buf_param]
|
||||||
@ -106,7 +110,7 @@ push edi
|
|||||||
|
|
||||||
stdcall str_n_cat,edi,txt_nl,2
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
stdcall dbg_print,f_ttv,buf_param
|
stdcall dbg_print,f_ttv,buf_param
|
||||||
pop edi
|
popad
|
||||||
end if
|
end if
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -170,11 +174,11 @@ proc interpolate uses eax ebx ecx, q:dword,p0:dword,p1:dword,t:dword
|
|||||||
fld dword[t]
|
fld dword[t]
|
||||||
|
|
||||||
; интерполяция по координатам
|
; интерполяция по координатам
|
||||||
fld dword[ecx+offs_vert_pc+offs_X]
|
fld dword[ecx+offs_vert_pc]
|
||||||
fsub dword[ebx+offs_vert_pc+offs_X]
|
fsub dword[ebx+offs_vert_pc]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fadd dword[ebx+offs_vert_pc+offs_X]
|
fadd dword[ebx+offs_vert_pc]
|
||||||
fstp dword[eax+offs_vert_pc+offs_X]
|
fstp dword[eax+offs_vert_pc] ;q.pc.X = p0.pc.X + (p1.pc.X - p0.pc.X) * t
|
||||||
|
|
||||||
fld dword[ecx+offs_vert_pc+offs_Y]
|
fld dword[ecx+offs_vert_pc+offs_Y]
|
||||||
fsub dword[ebx+offs_vert_pc+offs_Y]
|
fsub dword[ebx+offs_vert_pc+offs_Y]
|
||||||
@ -663,8 +667,8 @@ proc updateTmp uses eax ebx ecx edx, context:dword, q:dword, p0:dword, p1:dword,
|
|||||||
stdcall gl_clipcode, [ebx+offs_vert_pc+offs_X],[ebx+offs_vert_pc+offs_Y],\
|
stdcall gl_clipcode, [ebx+offs_vert_pc+offs_X],[ebx+offs_vert_pc+offs_Y],\
|
||||||
[ebx+offs_vert_pc+offs_Z],[ebx+offs_vert_pc+offs_W]
|
[ebx+offs_vert_pc+offs_Z],[ebx+offs_vert_pc+offs_W]
|
||||||
mov dword[ebx+offs_vert_clip_code],eax
|
mov dword[ebx+offs_vert_clip_code],eax
|
||||||
cmp eax,0 ;if (q.clip_code==0)
|
or eax,eax ;if (q.clip_code==0)
|
||||||
jne @f
|
jnz @f
|
||||||
stdcall gl_transform_to_viewport,[context],ebx
|
stdcall gl_transform_to_viewport,[context],ebx
|
||||||
mov eax,ebx
|
mov eax,ebx
|
||||||
add eax,offs_vert_zp+offs_zbup_b
|
add eax,offs_vert_zp+offs_zbup_b
|
||||||
@ -689,7 +693,6 @@ pushad
|
|||||||
mov ebx,[p0]
|
mov ebx,[p0]
|
||||||
mov ecx,[p1]
|
mov ecx,[p1]
|
||||||
mov edx,[p2]
|
mov edx,[p2]
|
||||||
|
|
||||||
mov edi,[ebx+offs_vert_clip_code]
|
mov edi,[ebx+offs_vert_clip_code]
|
||||||
mov dword[cc],edi
|
mov dword[cc],edi
|
||||||
mov eax,[ecx+offs_vert_clip_code]
|
mov eax,[ecx+offs_vert_clip_code]
|
||||||
@ -700,8 +703,9 @@ pushad
|
|||||||
or edi,eax ;co = cc[0] | cc[1] | cc[2]
|
or edi,eax ;co = cc[0] | cc[1] | cc[2]
|
||||||
|
|
||||||
; we handle the non clipped case here to go faster
|
; we handle the non clipped case here to go faster
|
||||||
cmp edi,0 ;if (co==0)
|
;or edi,___ - было выше
|
||||||
jne .els_0
|
jnz .els_0
|
||||||
|
;if (co==0)
|
||||||
mov edi,dword[edx+offs_vert_zp+offs_zbup_x]
|
mov edi,dword[edx+offs_vert_zp+offs_zbup_x]
|
||||||
sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
|
sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
|
||||||
mov dword[norm],edi
|
mov dword[norm],edi
|
||||||
@ -728,13 +732,12 @@ pushad
|
|||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
je .end_f
|
je .end_f
|
||||||
jb @f
|
jbe @f ;jb @f ???
|
||||||
inc dword[front] ;front = 0.0 > norm
|
inc dword[front] ;front = 0.0 > norm
|
||||||
@@:
|
@@:
|
||||||
mov edi,[context]
|
mov edi,[context]
|
||||||
mov eax,dword[edi+offs_cont_current_front_face]
|
mov eax,dword[edi+offs_cont_current_front_face]
|
||||||
xor dword[front],eax ;front ^= context.current_front_face
|
xor dword[front],eax ;front ^= context.current_front_face
|
||||||
|
|
||||||
; back face culling
|
; back face culling
|
||||||
cmp dword[edi+offs_cont_cull_face_enabled],0
|
cmp dword[edi+offs_cont_cull_face_enabled],0
|
||||||
je .els_1
|
je .els_1
|
||||||
@ -765,8 +768,8 @@ pushad
|
|||||||
;eax = cc[2]
|
;eax = cc[2]
|
||||||
and eax,[cc]
|
and eax,[cc]
|
||||||
and eax,[cc+4] ;eax = c_and = cc[0] & cc[1] & cc[2]
|
and eax,[cc+4] ;eax = c_and = cc[0] & cc[1] & cc[2]
|
||||||
cmp eax,0 ;if (c_and==0)
|
or eax,eax ;if (c_and==0)
|
||||||
jne .end_f
|
jnz .end_f
|
||||||
stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
|
stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
|
||||||
.end_f:
|
.end_f:
|
||||||
popad
|
popad
|
||||||
@ -799,8 +802,8 @@ pushad
|
|||||||
or edi,eax
|
or edi,eax
|
||||||
mov [co],edi ;co = cc[0] | cc[1] | cc[2]
|
mov [co],edi ;co = cc[0] | cc[1] | cc[2]
|
||||||
|
|
||||||
cmp edi,0 ;if (co == 0)
|
or edi,edi ;if (co == 0)
|
||||||
jne .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
|
||||||
.els_0:
|
.els_0:
|
||||||
@ -809,8 +812,8 @@ pushad
|
|||||||
and eax,[cc+4] ;c_and = cc[0] & cc[1] & cc[2]
|
and eax,[cc+4] ;c_and = cc[0] & cc[1] & cc[2]
|
||||||
|
|
||||||
; the triangle is completely outside
|
; the triangle is completely outside
|
||||||
cmp eax,0 ;if (c_and!=0) return
|
or eax,eax ;if (c_and!=0) return
|
||||||
jne .end_f
|
jnz .end_f
|
||||||
|
|
||||||
; find the next direction to clip
|
; find the next direction to clip
|
||||||
.cycle_0: ;while (clip_bit < 6 && (co & (1 << clip_bit)) == 0)
|
.cycle_0: ;while (clip_bit < 6 && (co & (1 << clip_bit)) == 0)
|
||||||
@ -821,8 +824,8 @@ pushad
|
|||||||
mov ecx,[clip_bit]
|
mov ecx,[clip_bit]
|
||||||
shl eax,cl
|
shl eax,cl
|
||||||
and eax,[co]
|
and eax,[co]
|
||||||
cmp eax,0
|
or eax,eax
|
||||||
jne .cycle_0_end
|
jnz .cycle_0_end
|
||||||
inc dword[clip_bit]
|
inc dword[clip_bit]
|
||||||
jmp .cycle_0
|
jmp .cycle_0
|
||||||
.cycle_0_end:
|
.cycle_0_end:
|
||||||
@ -854,13 +857,13 @@ end if
|
|||||||
|
|
||||||
mov ecx,[p1] ;востанавливаем после shl ___,cl
|
mov ecx,[p1] ;востанавливаем после shl ___,cl
|
||||||
|
|
||||||
cmp eax,0 ;if (co1)
|
or eax,eax ;if (co1)
|
||||||
je .els_1
|
jz .els_1
|
||||||
; one point outside
|
; one point outside
|
||||||
mov eax,[cc]
|
mov eax,[cc]
|
||||||
and eax,[clip_mask]
|
and eax,[clip_mask]
|
||||||
cmp eax,0 ;if (cc[0] & clip_mask)
|
or eax,eax ;if (cc[0] & clip_mask)
|
||||||
je .els_2
|
jz .els_2
|
||||||
;q[0]=p0 q[1]=p1 q[2]=p2
|
;q[0]=p0 q[1]=p1 q[2]=p2
|
||||||
mov [q],ebx
|
mov [q],ebx
|
||||||
mov [q+4],ecx
|
mov [q+4],ecx
|
||||||
@ -869,8 +872,8 @@ end if
|
|||||||
.els_2:
|
.els_2:
|
||||||
mov eax,[cc+4]
|
mov eax,[cc+4]
|
||||||
and eax,[clip_mask]
|
and eax,[clip_mask]
|
||||||
cmp eax,0 ;else if (cc[1] & clip_mask)
|
or eax,eax ;else if (cc[1] & clip_mask)
|
||||||
je .els_3
|
jz .els_3
|
||||||
;q[0]=p1 q[1]=p2 q[2]=p0
|
;q[0]=p1 q[1]=p2 q[2]=p0
|
||||||
mov [q],ecx
|
mov [q],ecx
|
||||||
mov [q+4],edx
|
mov [q+4],edx
|
||||||
@ -917,7 +920,7 @@ end if
|
|||||||
stdcall updateTmp,[context],edi,ebx,edx,eax ;updateTmp(c,&tmp2,q[0],q[2],tt)
|
stdcall updateTmp,[context],edi,ebx,edx,eax ;updateTmp(c,&tmp2,q[0],q[2],tt)
|
||||||
|
|
||||||
mov eax,[ebx+offs_vert_edge_flag]
|
mov eax,[ebx+offs_vert_edge_flag]
|
||||||
mov [tmp1+offs_vert_edge_flag],eax ;q[0].edge_flag
|
mov [tmp1.edge_flag],eax ;q[0].edge_flag
|
||||||
mov eax,[edx+offs_vert_edge_flag]
|
mov eax,[edx+offs_vert_edge_flag]
|
||||||
mov [edge_flag_tmp],eax ;q[2].edge_flag
|
mov [edge_flag_tmp],eax ;q[2].edge_flag
|
||||||
mov dword[edx+offs_vert_edge_flag],0 ;q[2].edge_flag=0
|
mov dword[edx+offs_vert_edge_flag],0 ;q[2].edge_flag=0
|
||||||
@ -992,11 +995,9 @@ end if
|
|||||||
sub edi,offs_vert_pc
|
sub edi,offs_vert_pc
|
||||||
stdcall updateTmp,[context],edi,[q],[q+8],eax
|
stdcall updateTmp,[context],edi,[q],[q+8],eax
|
||||||
|
|
||||||
mov edx,[q+8]
|
mov dword[tmp1.edge_flag],1
|
||||||
|
mov eax,[edx+offs_vert_edge_flag-offs_vert_pc]
|
||||||
mov dword[tmp1+offs_vert_edge_flag],1
|
mov dword[tmp2.edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
|
||||||
mov eax,[edx+offs_vert_edge_flag]
|
|
||||||
mov dword[tmp1+offs_vert_edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
|
|
||||||
mov eax,[clip_bit]
|
mov eax,[clip_bit]
|
||||||
inc eax
|
inc eax
|
||||||
push eax
|
push eax
|
||||||
|
@ -192,7 +192,7 @@ err_message_import db 'Error on load import library tinygl.obj',0
|
|||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
|
|
||||||
i_end:
|
i_end:
|
||||||
rb 1024
|
rb 4096
|
||||||
stacktop:
|
stacktop:
|
||||||
cur_dir_path:
|
cur_dir_path:
|
||||||
rb 4096
|
rb 4096
|
||||||
|
@ -384,11 +384,13 @@ proc glopScale uses eax ebx ecx, context:dword, p:dword
|
|||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
if DEBUG ;glopScale
|
if DEBUG ;glopScale
|
||||||
|
pushad
|
||||||
stdcall dbg_print,txt_gl_scal,txt_nl
|
stdcall dbg_print,txt_gl_scal,txt_nl
|
||||||
mov ebx,[eax+offs_cont_matrix_mode]
|
mov ebx,[eax+offs_cont_matrix_mode]
|
||||||
shl ebx,2
|
shl ebx,2
|
||||||
add ebx,eax
|
add ebx,eax
|
||||||
stdcall gl_print_matrix,[ebx+offs_cont_matrix_stack_ptr],4
|
stdcall gl_print_matrix,[ebx+offs_cont_matrix_stack_ptr],4
|
||||||
|
popad
|
||||||
end if
|
end if
|
||||||
gl_matrix_update eax,ebx
|
gl_matrix_update eax,ebx
|
||||||
ret
|
ret
|
||||||
@ -429,11 +431,13 @@ proc glopTranslate uses eax ebx ecx, context:dword, p:dword
|
|||||||
fincstp
|
fincstp
|
||||||
|
|
||||||
if DEBUG ;glopTranslate
|
if DEBUG ;glopTranslate
|
||||||
|
pushad
|
||||||
stdcall dbg_print,txt_gl_tran,txt_nl
|
stdcall dbg_print,txt_gl_tran,txt_nl
|
||||||
mov ebx,[eax+offs_cont_matrix_mode]
|
mov ebx,[eax+offs_cont_matrix_mode]
|
||||||
shl ebx,2
|
shl ebx,2
|
||||||
add ebx,eax
|
add ebx,eax
|
||||||
stdcall gl_print_matrix,[ebx+offs_cont_matrix_stack_ptr],4
|
stdcall gl_print_matrix,[ebx+offs_cont_matrix_stack_ptr],4
|
||||||
|
popad
|
||||||
end if
|
end if
|
||||||
gl_matrix_update eax,ebx
|
gl_matrix_update eax,ebx
|
||||||
ret
|
ret
|
||||||
|
@ -12,9 +12,9 @@ include 'zmath.asm'
|
|||||||
include 'clip.asm'
|
include 'clip.asm'
|
||||||
include 'vertex.asm'
|
include 'vertex.asm'
|
||||||
include 'api.asm'
|
include 'api.asm'
|
||||||
include 'list.asm'
|
include 'list.asm' ;gl_add_op
|
||||||
include 'init.asm'
|
include 'init.asm'
|
||||||
include 'matrix.asm'
|
include 'matrix.asm' ;gl_print_matrix
|
||||||
include 'texture.asm'
|
include 'texture.asm'
|
||||||
include 'misc.asm'
|
include 'misc.asm'
|
||||||
include 'clear.asm'
|
include 'clear.asm'
|
||||||
@ -36,42 +36,7 @@ include 'glu.asm'
|
|||||||
|
|
||||||
if DEBUG
|
if DEBUG
|
||||||
include 'info_fun_float.inc'
|
include 'info_fun_float.inc'
|
||||||
end if
|
|
||||||
|
|
||||||
; ***
|
|
||||||
glVertex2d: ;(double ,double)
|
|
||||||
glVertex2fv: ;(float *)
|
|
||||||
glVertex2dv: ;(double *)
|
|
||||||
glVertex3d: ;(double ,double ,double)
|
|
||||||
glVertex3dv: ;(double *)
|
|
||||||
glVertex4d: ;(double ,double ,double, double )
|
|
||||||
glVertex4fv: ;(float *)
|
|
||||||
glVertex4dv: ;(double *)
|
|
||||||
glColor3d: ;(double ,double ,double)
|
|
||||||
glColor3dv: ;(double *)
|
|
||||||
glColor4d: ;(double ,double ,double, double )
|
|
||||||
glColor4dv: ;(double *)
|
|
||||||
glNormal3d: ;(double ,double ,double)
|
|
||||||
glNormal3dv: ;(double *)
|
|
||||||
glTexCoord1f: ;(float)
|
|
||||||
glTexCoord1d: ;(double)
|
|
||||||
glTexCoord1fv: ;(float *)
|
|
||||||
glTexCoord1dv: ;(double *)
|
|
||||||
glTexCoord2d: ;(double ,double)
|
|
||||||
glTexCoord2dv: ;(double *)
|
|
||||||
glTexCoord3f: ;(float ,float ,float)
|
|
||||||
glTexCoord3d: ;(double ,double ,double)
|
|
||||||
glTexCoord3fv: ;(float *)
|
|
||||||
glTexCoord3dv: ;(double *)
|
|
||||||
glTexCoord4d: ;(double ,double ,double, double )
|
|
||||||
glTexCoord4fv: ;(float *)
|
|
||||||
glTexCoord4dv: ;(double *)
|
|
||||||
glGenTextures: ;(int n, unsigned int *textures)
|
|
||||||
glDeleteTextures: ;(int n, const unsigned int *textures)
|
|
||||||
glGetIntegerv: ;(int pname,int *params)
|
|
||||||
glGetFloatv: ;(int pname, float *v)
|
|
||||||
|
|
||||||
if DEBUG
|
|
||||||
align 4
|
align 4
|
||||||
txt_nl db 13,10,0
|
txt_nl db 13,10,0
|
||||||
txt_sp db ' ',0
|
txt_sp db ' ',0
|
||||||
@ -140,6 +105,37 @@ align 4
|
|||||||
ret ;пока в стеке храниться кол-во вызовов то столько раз мы и будем вызываться
|
ret ;пока в стеке храниться кол-во вызовов то столько раз мы и будем вызываться
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
; ***
|
||||||
|
glVertex2d: ;(double ,double)
|
||||||
|
glVertex2dv: ;(double *)
|
||||||
|
glVertex3d: ;(double ,double ,double)
|
||||||
|
glVertex3dv: ;(double *)
|
||||||
|
glVertex4d: ;(double ,double ,double, double )
|
||||||
|
glVertex4dv: ;(double *)
|
||||||
|
glColor3d: ;(double ,double ,double)
|
||||||
|
glColor3dv: ;(double *)
|
||||||
|
glColor4d: ;(double ,double ,double, double )
|
||||||
|
glColor4dv: ;(double *)
|
||||||
|
glNormal3d: ;(double ,double ,double)
|
||||||
|
glNormal3dv: ;(double *)
|
||||||
|
glTexCoord1f: ;(float)
|
||||||
|
glTexCoord1d: ;(double)
|
||||||
|
glTexCoord1fv: ;(float *)
|
||||||
|
glTexCoord1dv: ;(double *)
|
||||||
|
glTexCoord2d: ;(double ,double)
|
||||||
|
glTexCoord2dv: ;(double *)
|
||||||
|
glTexCoord3f: ;(float ,float ,float)
|
||||||
|
glTexCoord3d: ;(double ,double ,double)
|
||||||
|
glTexCoord3fv: ;(float *)
|
||||||
|
glTexCoord3dv: ;(double *)
|
||||||
|
glTexCoord4d: ;(double ,double ,double, double )
|
||||||
|
glTexCoord4fv: ;(float *)
|
||||||
|
glTexCoord4dv: ;(double *)
|
||||||
|
glGenTextures: ;(int n, unsigned int *textures)
|
||||||
|
glDeleteTextures: ;(int n, const unsigned int *textures)
|
||||||
|
glGetIntegerv: ;(int pname,int *params)
|
||||||
|
glGetFloatv: ;(int pname, float *v)
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
f_kosgl_1 db 'kosglMakeCurrent',0
|
f_kosgl_1 db 'kosglMakeCurrent',0
|
||||||
err_0 db 'Error while initializing Z buffer',13,10,0
|
err_0 db 'Error while initializing Z buffer',13,10,0
|
||||||
@ -151,20 +147,13 @@ f_vp db ' glViewport',0
|
|||||||
err_4 db 'error while resizing display',13,10,0
|
err_4 db 'error while resizing display',13,10,0
|
||||||
err_5 db 'size too small',13,10,0
|
err_5 db 'size too small',13,10,0
|
||||||
f_clipcode db ' gl_clipcode',0
|
f_clipcode db ' gl_clipcode',0
|
||||||
f_ttv db ' gl_transform_to_viewport',0
|
|
||||||
f_vt db ' gl_vertex_transform',0
|
|
||||||
f_ev db ' gl_eval_viewport',0
|
|
||||||
f_zbz db ' ZB_line_z',0
|
f_zbz db ' ZB_line_z',0
|
||||||
f_zb db ' ZB_line',0
|
f_zb db ' ZB_line',0
|
||||||
f_m4m db 'gl_M4_Mul',0
|
|
||||||
f_m4ml db 'gl_M4_MulLeft',0
|
|
||||||
f_find_l db 'find_list',0
|
f_find_l db 'find_list',0
|
||||||
f_alloc_l db 'alloc_list',0
|
f_alloc_l db 'alloc_list',0
|
||||||
f_is_l db 'glIsList',0
|
f_is_l db 'glIsList',0
|
||||||
f_gen_l db 'glGenLists',0
|
f_gen_l db 'glGenLists',0
|
||||||
f_end_l db 'glEndList',0
|
f_end_l db 'glEndList',0
|
||||||
;f_fill_trf db 'ZB_fillTriangleFlat',0
|
|
||||||
;f_fill_trrgb db 'ZB_fillTriangleSmooth',0
|
|
||||||
f_fill_tr db 'ZB_fillTriangle...',0
|
f_fill_tr db 'ZB_fillTriangle...',0
|
||||||
f_fill_tr_nl db ' lines',0
|
f_fill_tr_nl db ' lines',0
|
||||||
f_fill_tr_nll db ' len',0
|
f_fill_tr_nll db ' len',0
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
if DEBUG
|
||||||
|
f_vt db ' gl_vertex_transform',0
|
||||||
|
end if
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glopNormal uses ecx esi edi, context:dword, p:dword
|
proc glopNormal uses ecx esi edi, context:dword, p:dword
|
||||||
@ -117,7 +120,7 @@ proc glopBegin uses eax ebx ecx edx, context:dword, p:dword
|
|||||||
locals
|
locals
|
||||||
tmp M4
|
tmp M4
|
||||||
endl
|
endl
|
||||||
; assert(c->in_begin == 0);
|
;assert(context.in_begin == 0)
|
||||||
|
|
||||||
mov edx,[context]
|
mov edx,[context]
|
||||||
mov ebx,[p]
|
mov ebx,[p]
|
||||||
@ -137,7 +140,7 @@ if DEBUG ;context.matrix_stack_ptr[0]
|
|||||||
end if
|
end if
|
||||||
; precompute inverse modelview
|
; precompute inverse modelview
|
||||||
mov ebx,ebp
|
mov ebx,ebp
|
||||||
sub ebx,64
|
sub ebx,sizeof.M4
|
||||||
stdcall gl_M4_Inv, ebx,dword[edx+offs_cont_matrix_stack_ptr]
|
stdcall gl_M4_Inv, ebx,dword[edx+offs_cont_matrix_stack_ptr]
|
||||||
if DEBUG ;tmp
|
if DEBUG ;tmp
|
||||||
stdcall dbg_print,txt_sp,txt_nl
|
stdcall dbg_print,txt_sp,txt_nl
|
||||||
@ -165,18 +168,21 @@ end if
|
|||||||
fcomp st1
|
fcomp st1
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
jne .end_if_0
|
jne @f
|
||||||
fld dword[ecx+13*4]
|
fld dword[ecx+13*4]
|
||||||
fcomp st1
|
fcomp st1
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
jne .end_if_0
|
jne @f
|
||||||
fld dword[ecx+14*4]
|
fld dword[ecx+14*4]
|
||||||
fcomp st1
|
fcomp st1
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
jne .end_if_0
|
jne @f
|
||||||
mov dword[edx+offs_cont_matrix_model_projection_no_w_transform],1
|
mov dword[edx+offs_cont_matrix_model_projection_no_w_transform],1
|
||||||
|
@@:
|
||||||
|
ffree st0 ;0.0
|
||||||
|
fincstp
|
||||||
.end_if_0:
|
.end_if_0:
|
||||||
|
|
||||||
; test if the texture matrix is not Identity
|
; test if the texture matrix is not Identity
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
; ******* Gestion des matrices 4x4 ******
|
; ******* Gestion des matrices 4x4 ******
|
||||||
|
|
||||||
|
if DEBUG
|
||||||
|
f_m4m db 'gl_M4_Mul',0
|
||||||
|
f_m4ml db 'gl_M4_MulLeft',0
|
||||||
|
end if
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc gl_M4_Id uses eax ecx edi, a:dword
|
proc gl_M4_Id uses eax ecx edi, a:dword
|
||||||
mov edi,[a]
|
mov edi,[a]
|
||||||
@ -115,23 +120,21 @@ pushad
|
|||||||
|
|
||||||
mov edx,[c]
|
mov edx,[c]
|
||||||
mov dword[i],0
|
mov dword[i],0
|
||||||
|
mov eax,ebp
|
||||||
|
sub eax,sizeof.M4
|
||||||
.cycle_0: ;i
|
.cycle_0: ;i
|
||||||
xor ebx,ebx
|
xor ebx,ebx ;j=0
|
||||||
.cycle_1: ;j
|
.cycle_1: ;j
|
||||||
finit
|
|
||||||
fldz ;sum=0
|
fldz ;sum=0
|
||||||
xor ecx,ecx
|
xor ecx,ecx ;k=0
|
||||||
mov eax,ebp
|
|
||||||
sub eax,sizeof.M4
|
|
||||||
M4_reg edi,eax,dword[i],0
|
M4_reg edi,eax,dword[i],0
|
||||||
.cycle_2: ;k
|
.cycle_2: ;k
|
||||||
fld dword[edi]
|
fld dword[edi]
|
||||||
add edi,4
|
add edi,4
|
||||||
M4_reg esi,[b],ecx,ebx
|
M4_reg esi,[b],ecx,ebx
|
||||||
fmul dword[esi]
|
fmul dword[esi]
|
||||||
fadd st0,st1 ;sum += a[i][k] * b[k][j]
|
faddp ;sum += a[i][k] * b[k][j]
|
||||||
inc ecx
|
inc ecx
|
||||||
add eax,4
|
|
||||||
cmp ecx,4
|
cmp ecx,4
|
||||||
jl .cycle_2
|
jl .cycle_2
|
||||||
fstp dword[edx] ;c[i][j] = sum
|
fstp dword[edx] ;c[i][j] = sum
|
||||||
@ -142,7 +145,6 @@ pushad
|
|||||||
inc dword[i]
|
inc dword[i]
|
||||||
cmp dword[i],4
|
cmp dword[i],4
|
||||||
jl .cycle_0
|
jl .cycle_0
|
||||||
finit
|
|
||||||
if DEBUG ;gl_M4_MulLeft
|
if DEBUG ;gl_M4_MulLeft
|
||||||
stdcall dbg_print,f_m4ml,txt_nl
|
stdcall dbg_print,f_m4ml,txt_nl
|
||||||
stdcall gl_print_matrix,[c],4
|
stdcall gl_print_matrix,[c],4
|
||||||
|
Loading…
Reference in New Issue
Block a user