2,7 → 2,7 |
f_vt db ' gl_vertex_transform',0 |
end if |
|
align 16 |
align 4 |
proc glopNormal uses ecx esi edi, context:dword, p:dword |
mov esi,[p] |
add esi,4 |
14,7 → 14,7 |
ret |
endp |
|
align 16 |
align 4 |
proc glopTexCoord uses ecx esi edi, context:dword, p:dword |
mov esi,[p] |
add esi,4 |
25,7 → 25,7 |
ret |
endp |
|
align 16 |
align 4 |
proc glopEdgeFlag uses eax ebx, context:dword, p:dword |
mov eax,[context] |
mov ebx,[p] |
34,7 → 34,7 |
ret |
endp |
|
align 16 |
align 4 |
proc glopColor uses eax ecx esi edi, context:dword, p:dword |
locals |
q rd 7 |
69,7 → 69,7 |
ret |
endp |
|
align 16 |
align 4 |
proc gl_eval_viewport uses eax, context:dword |
locals |
zsize dd ? ;float |
115,7 → 115,7 |
endp |
|
|
align 16 |
align 4 |
proc glopBegin uses eax ebx ecx edx, context:dword, p:dword |
locals |
tmp M4 |
134,12 → 134,7 |
jnc .end_mmpu |
|
cmp dword[edx+offs_cont_lighting_enabled],0 ;if(context.lighting_enabled) |
jne .if_0 |
cmp dword[eax+offs_cont_texture_2d_enabled],0 |
jne .if_0 |
jmp @f |
align 4 |
.if_0: |
je @f |
if DEBUG ;context.matrix_stack_ptr[0] |
stdcall gl_print_matrix,dword[edx+offs_cont_matrix_stack_ptr],4 |
end if |
160,7 → 155,6 |
stdcall gl_print_matrix,ebx,4 |
end if |
jmp .end_if_0 |
align 4 |
@@: |
mov ecx,edx |
add ecx,offs_cont_matrix_model_projection |
213,7 → 207,6 |
mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_select |
mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_select |
jmp .end_if_2 |
align 4 |
@@: |
|
cmp dword[edx+offs_cont_polygon_mode_front],GL_POINT |
220,13 → 213,11 |
jne @f |
mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_point |
jmp .end_if_1 |
align 4 |
@@: |
cmp dword[edx+offs_cont_polygon_mode_front],GL_LINE |
jne @f |
mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_line |
jmp .end_if_1 |
align 4 |
@@: ;default: |
mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_fill |
.end_if_1: |
235,13 → 226,11 |
jne @f |
mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_point |
jmp .end_if_2 |
align 4 |
@@: |
cmp dword[edx+offs_cont_polygon_mode_back],GL_LINE |
jne @f |
mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_line |
jmp .end_if_2 |
align 4 |
@@: ;default: |
mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_fill |
.end_if_2: |
250,18 → 239,13 |
|
; coords, tranformation , clip code and projection |
; TODO : handle all cases |
align 16 |
align 4 |
proc gl_vertex_transform, context:dword, v:dword |
pushad |
mov eax,[context] |
mov edx,[v] |
cmp dword[eax+offs_cont_lighting_enabled],0 ;if (context.lighting_enabled) |
jne @f |
cmp dword[eax+offs_cont_texture_2d_enabled],0 |
jne @f |
jmp .els_0 |
align 4 |
@@: |
je .els_0 |
; eye coordinates needed for lighting |
mov ebx,dword[eax+offs_cont_matrix_stack_ptr] |
finit |
372,7 → 356,6 |
je .end_els |
stdcall gl_V3_Norm,edx |
jmp .end_els |
align 4 |
.els_0: |
; no eye coordinates needed, no normal |
; NOTE: W = 1 is assumed |
426,7 → 409,6 |
mov ebx,dword[ebx+60] ;ebx = m[15] |
mov dword[esi+12],ebx ;v.pc.W = m[15] |
jmp .end_els |
align 4 |
.els_1: |
fld dword[ebx+48] ;st0 = m[12] |
fmul st0,st3 ;st0 *= v.coord.X |
460,7 → 442,7 |
ret |
endp |
|
align 16 |
align 4 |
proc glopVertex, context:dword, p:dword |
locals |
;ebx = GLVertex * v |
515,7 → 497,6 |
je .els_0 |
stdcall gl_shade_vertex, edx,ebx |
jmp @f |
align 4 |
.els_0: |
mov esi,edx |
add esi,offs_cont_current_color |
537,7 → 518,6 |
add eax,offs_vert_tex_coord |
stdcall gl_M4_MulV4, eax, dword[edx+offs_cont_matrix_stack_ptr+8] |
jmp @f |
align 4 |
.els_1: |
mov esi,edx |
add esi,offs_cont_current_tex_coord |
562,7 → 542,6 |
stdcall gl_draw_point, edx, dword[edx+offs_cont_vertex] ;dword[edx+...] = &context.vertex[0] |
mov dword[n],0 |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_LINES |
jne @f |
575,7 → 554,6 |
xor eax,eax |
mov dword[n],eax |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_LINE_STRIP |
je .li_loop |
590,7 → 568,6 |
mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
rep movsd ;context.vertex[2] = context.vertex[0] |
jmp .end_f |
align 4 |
.els_2: |
cmp dword[n],2 |
jne .end_f ;else if (n == 2) |
604,7 → 581,6 |
rep movsd ;context.vertex[0] = context.vertex[1] |
mov dword[n],1 |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLES |
jne @f |
621,7 → 597,6 |
xor eax,eax |
mov dword[n],eax |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP |
jne @f |
644,7 → 619,6 |
sub esp,12 |
stdcall gl_draw_triangle, edx ;v2,v1,v0 |
jmp .end_f |
align 4 |
.case_1: |
mov [esp-12],eax |
add eax,sizeof.GLVertex |
654,7 → 628,6 |
sub esp,12 |
stdcall gl_draw_triangle, edx ;v0,v1,v2 |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN |
jne @f |
674,7 → 647,6 |
rep movsd ;context.vertex[1] = context.vertex[2] |
mov dword[n],2 |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_QUADS |
jne @f |
700,7 → 672,6 |
xor eax,eax |
mov dword[n],eax |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_QUAD_STRIP |
jne @f |
727,7 → 698,6 |
rep movsd ;context.vertex[0] = context.vertex[2], context.vertex[1] = context.vertex[3] |
mov dword[n],2 |
jmp .end_f |
align 4 |
@@: |
cmp dword[edx+offs_cont_begin_type],GL_POLYGON |
je .end_f |
742,7 → 712,7 |
ret |
endp |
|
align 16 |
align 4 |
proc glopEnd uses eax ebx ecx, context:dword, p:dword |
mov eax,[context] |
; assert(c->in_begin == 1); |
757,7 → 727,6 |
push ebx |
stdcall gl_draw_line, eax |
jmp .end_i |
align 4 |
.else_i: |
cmp dword[eax+offs_cont_begin_type],GL_POLYGON |
jne .end_i |
774,7 → 743,6 |
push ecx ;ecx = &context.vertex[i-1] |
stdcall gl_draw_triangle, eax,[eax+offs_cont_vertex] |
jmp @b |
align 4 |
.end_i: |
mov dword[eax+offs_cont_in_begin],0 |
ret |