VERTEX_ARRAY equ 0x0001 COLOR_ARRAY equ 0x0002 NORMAL_ARRAY equ 0x0004 TEXCOORD_ARRAY equ 0x0008 ;glArrayElement - использование (рисование) одного элемента из массива ;glDrawArrays - рисование всех элементов в массиве ;glDrawElements - рисование тех элементов в массиве, которые заданны в массиве индексов align 4 proc glopArrayElement uses eax ebx ecx edx, context:dword, param:dword locals p rd 5 endl mov eax,[context] mov ebx,[param] mov ebx,[ebx+4] ;ebx = p[1] bt dword[eax+GLContext.client_states],1 ;2^1=COLOR_ARRAY jnc @f mov ecx,[eax+GLContext.color_array_size] add ecx,[eax+GLContext.color_array_stride] imul ecx,ebx shl ecx,2 add ecx,[eax+GLContext.color_array] ;ecx = &context.color_array[i] mov ebx,ebp sub ebx,20 ;=sizeof(dd)*5 mov edx,[ecx] mov [ebx+4],edx mov edx,[ecx+4] mov [ebx+8],edx mov edx,[ecx+8] mov [ebx+12],edx cmp dword[eax+GLContext.color_array_size],3 jg .l0 mov edx,1.0 jmp .l1 .l0: mov edx,[ecx+12] .l1: mov [ebx+16],edx stdcall glopColor, eax,ebx @@: bt dword[eax+GLContext.client_states],2 ;2^2=NORMAL_ARRAY jnc @f mov esi,dword[eax+GLContext.normal_array_stride] add esi,3 imul esi,ebx shl esi,2 add esi,[eax+GLContext.normal_array] ;esi = &normal_array[ebx * (3 + c->normal_array_stride)] mov edi,eax add edi,GLContext.current_normal mov ecx,3 rep movsd mov dword[edi],0.0 @@: bt dword[eax+GLContext.client_states],3 ;2^3=TEXCOORD_ARRAY jnc @f mov ecx,[eax+GLContext.texcoord_array_size] add ecx,[eax+GLContext.texcoord_array_stride] imul ecx,ebx shl ecx,2 add ecx,[eax+GLContext.texcoord_array] ;ecx = &context.texcoord_array[i] mov edx,[ecx] mov [eax+GLContext.current_tex_coord],edx mov edx,[ecx+4] mov [eax+GLContext.current_tex_coord+4],edx cmp dword[eax+GLContext.texcoord_array_size],2 jg .l2 mov edx,0.0 jmp .l3 .l2: mov edx,[ecx+8] .l3: mov [eax+GLContext.current_tex_coord+8],edx cmp dword[eax+GLContext.texcoord_array_size],3 jg .l4 mov edx,1.0 jmp .l5 .l4: mov edx,[ecx+12] .l5: mov [eax+GLContext.current_tex_coord+12],edx @@: bt dword[eax+GLContext.client_states],0 ;2^0=VERTEX_ARRAY jnc @f mov ecx,[eax+GLContext.vertex_array_size] add ecx,[eax+GLContext.vertex_array_stride] imul ecx,ebx shl ecx,2 add ecx,[eax+GLContext.vertex_array] ;ecx = &context.vertex_array[i] mov ebx,ebp sub ebx,20 ;=sizeof(dd)*5 mov edx,[ecx] mov [ebx+4],edx mov edx,[ecx+4] mov [ebx+8],edx cmp dword[eax+GLContext.vertex_array_size],2 jg .l6 mov edx,0.0 jmp .l7 .l6: mov edx,[ecx+8] .l7: mov [ebx+12],edx cmp dword[eax+GLContext.vertex_array_size],3 jg .l8 mov edx,1.0 jmp .l9 .l8: mov edx,[ecx+12] .l9: mov [ebx+16],edx stdcall glopVertex, eax,ebx @@: ret endp align 4 proc glArrayElement uses eax, i:dword locals p rd 2 endl mov dword[p],OP_ArrayElement mov eax,[i] mov dword[p+4],eax mov eax,ebp sub eax,8 ;=sizeof(dd)*2 stdcall gl_add_op,eax ret endp align 4 proc glopDrawArrays, context:dword, param:dword locals vi dd ? idx dd ? states dd ? size dd ? p rd 8 ;функция glopColor требует 8 параметров, другие функции требуют меньше, берем по максимуму что-бы не портить стек endl pushad mov edx,[context] mov ebx,[param] mov ecx,[ebx+12] ;count = param[3].i mov eax,[edx+GLContext.client_states] mov [states],eax mov eax,[ebx+8] mov [idx],eax ;param[2].i mov eax,[ebx+4] mov [p+4],eax ;p[1].i = param[1].i mov eax,ebp sub eax,32 ;=sizeof(dd)*8 stdcall glopBegin, edx,eax mov dword[vi],0 align 4 .cycle_0: ;for (int vi=0; vi