Subversion Repositories Kolibri OS

Rev

Rev 5418 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5418 Rev 6523
Line 58... Line 58...
58
macro gl_matrix_update context, reg
58
macro gl_matrix_update context, reg
59
{
59
{
60
	local .end_0
60
	local .end_0
61
	xor reg,reg
61
	xor reg,reg
62
	cmp dword[context+offs_cont_matrix_mode],1
62
	cmp dword[context+GLContext.matrix_mode],1
63
	jg .end_0
63
	jg .end_0
64
		inc reg
64
		inc reg
65
	.end_0:
65
	.end_0:
66
	mov dword[context+offs_cont_matrix_model_projection_updated],reg
66
	mov dword[context+GLContext.matrix_model_projection_updated],reg
67
}
67
}
Line 68... Line 68...
68
 
68
 
69
align 4
69
align 4
70
proc glopMatrixMode uses eax ebx, context:dword, p:dword
70
proc glopMatrixMode uses eax ebx, context:dword, p:dword
71
	mov eax,[context]
71
	mov eax,[context]
Line 72... Line 72...
72
	mov ebx,[p]
72
	mov ebx,[p]
73
 
73
 
74
	cmp dword[ebx+4],GL_MODELVIEW ;cmp p[1],...
74
	cmp dword[ebx+4],GL_MODELVIEW ;cmp p[1],...
75
	jne @f
75
	jne @f
76
		mov dword[eax+offs_cont_matrix_mode],0
76
		mov dword[eax+GLContext.matrix_mode],0
77
		jmp .end_f
77
		jmp .end_f
78
	@@:
78
	@@:
79
	cmp dword[ebx+4],GL_PROJECTION
79
	cmp dword[ebx+4],GL_PROJECTION
80
	jne @f
80
	jne @f
81
		mov dword[eax+offs_cont_matrix_mode],1
81
		mov dword[eax+GLContext.matrix_mode],1
82
		jmp .end_f
82
		jmp .end_f
83
	@@:
83
	@@:
84
	cmp dword[ebx+4],GL_TEXTURE
84
	cmp dword[ebx+4],GL_TEXTURE
85
	jne .def
85
	jne .def
86
		mov dword[eax+offs_cont_matrix_mode],2
86
		mov dword[eax+GLContext.matrix_mode],2
87
		jmp .end_f
87
		jmp .end_f
88
	.def:
88
	.def:
89
;assert(0);
89
;assert(0);
90
	.end_f:
90
	.end_f:
Line 91... Line 91...
91
	ret
91
	ret
92
endp
92
endp
93
 
93
 
94
align 4
94
align 4
95
proc glopLoadMatrix uses eax edi esi, context:dword, p:dword
95
proc glopLoadMatrix uses eax edi esi, context:dword, p:dword
96
	mov eax,[context]
96
	mov eax,[context]
97
	mov edi,[eax+offs_cont_matrix_mode]
97
	mov edi,[eax+GLContext.matrix_mode]
Line 98... Line 98...
98
	shl edi,2
98
	shl edi,2
99
	add edi,eax
99
	add edi,eax
100
	mov edi,dword[edi+offs_cont_matrix_stack_ptr]
100
	mov edi,dword[edi+GLContext.matrix_stack_ptr]
Line 109... Line 109...
109
 
109
 
Line 110... Line 110...
110
align 4
110
align 4
111
proc glopLoadIdentity uses eax ebx, context:dword, p:dword
111
proc glopLoadIdentity uses eax ebx, context:dword, p:dword
112
	mov eax,[context]
112
	mov eax,[context]
113
	mov ebx,[eax+offs_cont_matrix_mode]
113
	mov ebx,[eax+GLContext.matrix_mode]
114
	shl ebx,2
114
	shl ebx,2
115
	add ebx,eax
115
	add ebx,eax
Line 116... Line 116...
116
 
116
 
117
	stdcall gl_M4_Id,[ebx+offs_cont_matrix_stack_ptr]
117
	stdcall gl_M4_Id,[ebx+GLContext.matrix_stack_ptr]
118
	gl_matrix_update eax,ebx
118
	gl_matrix_update eax,ebx
119
	ret
119
	ret
Line 120... Line 120...
120
endp
120
endp
Line 130... Line 130...
130
	sub edi,sizeof.M4
130
	sub edi,sizeof.M4
131
	stdcall gl_M4_Transpose,edi,esi ;транспонируем входную матрицу в локальную матрицу m
131
	stdcall gl_M4_Transpose,edi,esi ;транспонируем входную матрицу в локальную матрицу m
132
 
132
 
Line 133... Line 133...
133
	mov eax,[context]
133
	mov eax,[context]
134
	mov esi,[eax+offs_cont_matrix_mode]
134
	mov esi,[eax+GLContext.matrix_mode]
135
	shl esi,2
135
	shl esi,2
136
	add esi,eax
136
	add esi,eax
137
	stdcall gl_M4_MulLeft,dword[esi+offs_cont_matrix_stack_ptr],edi
137
	stdcall gl_M4_MulLeft,dword[esi+GLContext.matrix_stack_ptr],edi
Line 138... Line 138...
138
 
138
 
139
	gl_matrix_update eax,edi
139
	gl_matrix_update eax,edi
140
	ret
140
	ret
Line 141... Line 141...
141
endp
141
endp
142
 
142
 
143
align 4
143
align 4
144
proc glopPushMatrix uses eax ebx, context:dword, p:dword
144
proc glopPushMatrix uses eax ebx, context:dword, p:dword
Line 145... Line 145...
145
	mov eax,[context]
145
	mov eax,[context]
146
	mov ebx,[eax+offs_cont_matrix_mode]
146
	mov ebx,[eax+GLContext.matrix_mode]
Line 147... Line 147...
147
 
147
 
148
;  assert( (c->matrix_stack_ptr[ebx] - c->matrix_stack[ebx] + 1 )
148
;  assert( (c->matrix_stack_ptr[ebx] - c->matrix_stack[ebx] + 1 )
149
;	   < c->matrix_stack_depth_max[ebx] );
149
;	   < c->matrix_stack_depth_max[ebx] );
150
 
150
 
151
	shl ebx,2
151
	shl ebx,2
Line 152... Line 152...
152
	add ebx,eax
152
	add ebx,eax
153
	add ebx,offs_cont_matrix_stack_ptr
153
	add ebx,GLContext.matrix_stack_ptr
Line 165... Line 165...
165
 
165
 
Line 166... Line 166...
166
align 4
166
align 4
167
proc glopPopMatrix uses eax ebx, context:dword, p:dword
167
proc glopPopMatrix uses eax ebx, context:dword, p:dword
168
	mov eax,[context]
168
	mov eax,[context]
169
	mov ebx,[eax+offs_cont_matrix_mode]
169
	mov ebx,[eax+GLContext.matrix_mode]
Line 170... Line 170...
170
 
170
 
Line 171... Line 171...
171
;  assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] );
171
;  assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] );
172
 
172
 
173
	shl ebx,2
173
	shl ebx,2
Line 174... Line 174...
174
	add ebx,eax
174
	add ebx,eax
175
	sub dword[ebx+offs_cont_matrix_stack_ptr],sizeof.M4
175
	sub dword[ebx+GLContext.matrix_stack_ptr],sizeof.M4
176
 
176
 
Line 422... Line 422...
422
  fincstp
422
  fincstp
423
	.end_sw:
423
	.end_sw:
424
 
424
 
Line 425... Line 425...
425
	mov eax,[context]
425
	mov eax,[context]
426
	mov ebx,[eax+offs_cont_matrix_mode]
426
	mov ebx,[eax+GLContext.matrix_mode]
427
	shl ebx,2
427
	shl ebx,2
428
	add ebx,eax
428
	add ebx,eax
429
	stdcall gl_M4_MulLeft,dword[ebx+offs_cont_matrix_stack_ptr],ecx
429
	stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx
430
	gl_matrix_update eax,ebx
430
	gl_matrix_update eax,ebx
431
	jmp .end_f
431
	jmp .end_f
432
	.f2:
432
	.f2:
433
		ffree st0 ;len
433
		ffree st0 ;len
434
		fincstp
434
		fincstp
Line 442... Line 442...
442
proc glopScale uses eax ebx ecx, context:dword, p:dword
442
proc glopScale uses eax ebx ecx, context:dword, p:dword
443
	mov ecx,[p]
443
	mov ecx,[p]
444
 
444
 
Line 445... Line 445...
445
	mov eax,[context]
445
	mov eax,[context]
446
	mov ebx,[eax+offs_cont_matrix_mode]
446
	mov ebx,[eax+GLContext.matrix_mode]
447
	shl ebx,2
447
	shl ebx,2
448
	add ebx,eax
448
	add ebx,eax
449
	mov ebx,[ebx+offs_cont_matrix_stack_ptr] ;ebx = &m[0]
449
	mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0]
Line 450... Line 450...
450
 
450
 
451
	fld dword[ecx+ 4] ;x
451
	fld dword[ecx+ 4] ;x
452
	fld dword[ecx+ 8] ;y
452
	fld dword[ecx+ 8] ;y
453
	fld dword[ecx+12] ;z
453
	fld dword[ecx+12] ;z
Line 479... Line 479...
479
proc glopTranslate uses eax ebx ecx, context:dword, p:dword
479
proc glopTranslate uses eax ebx ecx, context:dword, p:dword
480
	mov ecx,[p]
480
	mov ecx,[p]
481
 
481
 
Line 482... Line 482...
482
	mov eax,[context]
482
	mov eax,[context]
483
	mov ebx,[eax+offs_cont_matrix_mode]
483
	mov ebx,[eax+GLContext.matrix_mode]
484
	shl ebx,2
484
	shl ebx,2
485
	add ebx,eax
485
	add ebx,eax
486
	mov ebx,[ebx+offs_cont_matrix_stack_ptr] ;ebx = &m[0]
486
	mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0]
Line 487... Line 487...
487
 
487
 
488
	fld dword[ecx+ 4] ;x
488
	fld dword[ecx+ 4] ;x
489
	fld dword[ecx+ 8] ;y
489
	fld dword[ecx+ 8] ;y
490
	fld dword[ecx+12] ;z
490
	fld dword[ecx+12] ;z
Line 592... Line 592...
592
	mov dword[ecx+52],0.0
592
	mov dword[ecx+52],0.0
593
	mov dword[ecx+56],-1.0
593
	mov dword[ecx+56],-1.0
594
	mov dword[ecx+60],0.0
594
	mov dword[ecx+60],0.0
595
 
595
 
Line 596... Line 596...
596
	mov ebx,[eax+offs_cont_matrix_mode]
596
	mov ebx,[eax+GLContext.matrix_mode]
597
	shl ebx,2
597
	shl ebx,2
598
	add ebx,eax
598
	add ebx,eax
599
	stdcall gl_M4_MulLeft,dword[ebx+offs_cont_matrix_stack_ptr],ecx
599
	stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx
Line 600... Line 600...
600
 
600
 
601
if DEBUG ;glopFrustum
601
if DEBUG ;glopFrustum
602
	stdcall gl_print_matrix,ecx,4
602
	stdcall gl_print_matrix,ecx,4
603
	stdcall gl_print_matrix,dword[ebx+offs_cont_matrix_stack_ptr],4
603
	stdcall gl_print_matrix,dword[ebx+GLContext.matrix_stack_ptr],4
604
end if
604
end if
605
	gl_matrix_update eax,ebx
605
	gl_matrix_update eax,ebx
606
	ret
606
	ret