Subversion Repositories Kolibri OS

Rev

Rev 6523 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6523 Rev 8062
Line 94... Line 94...
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+GLContext.matrix_mode]
97
	mov edi,[eax+GLContext.matrix_mode]
98
	shl edi,2
-
 
99
	add edi,eax
98
	lea edi,[eax+4*edi]
100
	mov edi,dword[edi+GLContext.matrix_stack_ptr]
99
	mov edi,dword[edi+GLContext.matrix_stack_ptr]
Line 101... Line 100...
101
 
100
 
102
	mov esi,[p]
101
	mov esi,[p]
103
	add esi,4
102
	add esi,4
Line 110... Line 109...
110
align 4
109
align 4
111
proc glopLoadIdentity uses eax ebx, context:dword, p:dword
110
proc glopLoadIdentity uses eax ebx, context:dword, p:dword
112
	mov eax,[context]
111
	mov eax,[context]
113
	mov ebx,[eax+GLContext.matrix_mode]
112
	mov ebx,[eax+GLContext.matrix_mode]
114
	shl ebx,2
-
 
115
	add ebx,eax
113
	lea ebx,[eax+4*ebx]
Line 116... Line 114...
116
 
114
 
117
	stdcall gl_M4_Id,[ebx+GLContext.matrix_stack_ptr]
115
	stdcall gl_M4_Id,[ebx+GLContext.matrix_stack_ptr]
118
	gl_matrix_update eax,ebx
116
	gl_matrix_update eax,ebx
119
	ret
117
	ret
Line 125... Line 123...
125
	m M4
123
	m M4
126
endl
124
endl
127
	mov esi,[p]
125
	mov esi,[p]
128
	add esi,4
126
	add esi,4
129
	mov edi,ebp
127
	lea edi,[ebp-sizeof.M4]
130
	sub edi,sizeof.M4
-
 
131
	stdcall gl_M4_Transpose,edi,esi ;транспонируем входную матрицу в локальную матрицу m
128
	stdcall gl_M4_Transpose,edi,esi ;транспонируем входную матрицу в локальную матрицу m
132
 
129
 
Line 133... Line 130...
133
	mov eax,[context]
130
	mov eax,[context]
134
	mov esi,[eax+GLContext.matrix_mode]
131
	mov esi,[eax+GLContext.matrix_mode]
135
	shl esi,2
-
 
136
	add esi,eax
132
	lea esi,[eax+4*esi]
137
	stdcall gl_M4_MulLeft,dword[esi+GLContext.matrix_stack_ptr],edi
133
	stdcall gl_M4_MulLeft,dword[esi+GLContext.matrix_stack_ptr],edi
Line 138... Line 134...
138
 
134
 
139
	gl_matrix_update eax,edi
135
	gl_matrix_update eax,edi
140
	ret
136
	ret
Line 147... Line 143...
147
 
143
 
Line 148... Line 144...
148
;  assert( (c->matrix_stack_ptr[ebx] - c->matrix_stack[ebx] + 1 )
144
;  assert( (c->matrix_stack_ptr[ebx] - c->matrix_stack[ebx] + 1 )
149
;	   < c->matrix_stack_depth_max[ebx] );
145
;	   < c->matrix_stack_depth_max[ebx] );
Line 150... Line -...
150
 
-
 
151
	shl ebx,2
-
 
152
	add ebx,eax
146
 
153
	add ebx,GLContext.matrix_stack_ptr
147
	lea ebx,[eax+4*ebx+GLContext.matrix_stack_ptr]
154
	add dword[ebx],sizeof.M4
148
	add dword[ebx],sizeof.M4
Line 155... Line 149...
155
	mov ebx,[ebx] ;ebx = ++context.matrix_stack_ptr[context.matrix_mode]
149
	mov ebx,[ebx] ;ebx = ++context.matrix_stack_ptr[context.matrix_mode]
156
 
150
 
Line 169... Line 163...
169
	mov ebx,[eax+GLContext.matrix_mode]
163
	mov ebx,[eax+GLContext.matrix_mode]
170
 
164
 
Line 171... Line 165...
171
;  assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] );
165
;  assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] );
Line 172... Line -...
172
 
-
 
173
	shl ebx,2
166
 
174
	add ebx,eax
167
	lea ebx,[eax+4*ebx]
Line 175... Line 168...
175
	sub dword[ebx+GLContext.matrix_stack_ptr],sizeof.M4
168
	sub dword[ebx+GLContext.matrix_stack_ptr],sizeof.M4
176
 
169
 
177
	gl_matrix_update eax,ebx
170
	gl_matrix_update eax,ebx
Line 191... Line 184...
191
endl
184
endl
192
 
185
 
Line 193... Line 186...
193
	mov eax,[context]
186
	mov eax,[context]
194
	mov ebx,[p]
187
	mov ebx,[p]
195
	mov ecx,ebp
-
 
196
	sub ecx,sizeof.M4 ;ecx=&m
188
	lea ecx,[ebp-sizeof.M4] ;ecx=&m
197
	finit
189
	finit
198
	fldpi
190
	fldpi
199
	fmul dword[ebx+4]
191
	fmul dword[ebx+4]
200
	fdiv dword[an180f]
192
	fdiv dword[an180f]
201
	fst dword[angle] ;angle = p[1].f * M_PI / 180.0
193
	fst dword[angle] ;angle = p[1].f * M_PI / 180.0
Line 423... Line 415...
423
	.end_sw:
415
	.end_sw:
424
 
416
 
Line 425... Line 417...
425
	mov eax,[context]
417
	mov eax,[context]
426
	mov ebx,[eax+GLContext.matrix_mode]
418
	mov ebx,[eax+GLContext.matrix_mode]
427
	shl ebx,2
-
 
428
	add ebx,eax
419
	lea ebx,[eax+4*ebx]
429
	stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx
420
	stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx
430
	gl_matrix_update eax,ebx
421
	gl_matrix_update eax,ebx
431
	jmp .end_f
422
	jmp .end_f
432
	.f2:
423
	.f2:
433
		ffree st0 ;len
424
		ffree st0 ;len
Line 443... Line 434...
443
	mov ecx,[p]
434
	mov ecx,[p]
444
 
435
 
Line 445... Line 436...
445
	mov eax,[context]
436
	mov eax,[context]
446
	mov ebx,[eax+GLContext.matrix_mode]
437
	mov ebx,[eax+GLContext.matrix_mode]
447
	shl ebx,2
-
 
448
	add ebx,eax
438
	lea ebx,[eax+4*ebx]
449
	mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0]
439
	mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0]
Line 450... Line 440...
450
 
440
 
451
	fld dword[ecx+ 4] ;x
441
	fld dword[ecx+ 4] ;x
452
	fld dword[ecx+ 8] ;y
442
	fld dword[ecx+ 8] ;y
Line 480... Line 470...
480
	mov ecx,[p]
470
	mov ecx,[p]
481
 
471
 
Line 482... Line 472...
482
	mov eax,[context]
472
	mov eax,[context]
483
	mov ebx,[eax+GLContext.matrix_mode]
473
	mov ebx,[eax+GLContext.matrix_mode]
484
	shl ebx,2
-
 
485
	add ebx,eax
474
	lea ebx,[eax+4*ebx]
486
	mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0]
475
	mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0]
Line 487... Line 476...
487
 
476
 
488
	fld dword[ecx+ 4] ;x
477
	fld dword[ecx+ 4] ;x
489
	fld dword[ecx+ 8] ;y
478
	fld dword[ecx+ 8] ;y
Line 605... Line 594...
605
	gl_matrix_update eax,ebx
594
	gl_matrix_update eax,ebx
606
	ret
595
	ret
607
endp
596
endp
608
597
 
Line -... Line 598...
-
 
598
align 4
-
 
599
proc glopOrtho uses eax ebx ecx, context:dword, p:dword
-
 
600
locals
-
 
601
	x dd ?
-
 
602
	y dd ?
-
 
603
	A dd ?
-
 
604
	B dd ?
-
 
605
	C dd ?
-
 
606
	D dd ?
-
 
607
	m M4
-
 
608
endl
-
 
609
	mov eax,[context]
-
 
610
	mov ebx,[p]
Line -... Line 611...
-
 
611
 
-
 
612
	fld dword[ebx+8]
-
 
613
	fsub dword[ebx+4]  ;st0 = (right-left)
-
 
614
	fld1
-
 
615
	fadd st0,st0       ;st0 = 2.0
-
 
616
	fdiv st0,st1
-
 
617
	fstp dword[x]      ;x = 2.0 / (right-left)
-
 
618
	fld dword[ebx+16]
-
 
619
	fsub dword[ebx+12] ;st0 = (top-bottom)
-
 
620
	fld1
-
 
621
	fadd st0,st0       ;st0 = 2.0
-
 
622
	fdiv st0,st1
-
 
623
	fstp dword[y]      ;y = 2.0 / (top-bottom)
-
 
624
	fld dword[ebx+8]
-
 
625
	fadd dword[ebx+4]
-
 
626
	fchs               ;st0 = -(right+left)
-
 
627
	fdiv st0,st2       ;st2 = (right-left)
-
 
628
	fstp dword[A]      ;A = -(right+left) / (right-left)
-
 
629
	fld dword[ebx+16]
-
 
630
	fadd dword[ebx+12]
-
 
631
	fchs               ;st0 = -(top+bottom)
-
 
632
	fdiv st0,st1       ;st1 = (top-bottom)
-
 
633
	fstp dword[B]      ;B = -(top+bottom) / (top-bottom)
-
 
634
	fld dword[ebx+24]
-
 
635
	fsub dword[ebx+20] ;st0 = (farp-near)
-
 
636
	fld1
-
 
637
	fadd st0,st0
-
 
638
	fchs ;st0 = -2.0
-
 
639
	fdiv st0,st1
-
 
640
	fstp dword[C]      ;C = -2.0 / (farp-near)
-
 
641
	fld dword[ebx+24]
-
 
642
	fadd dword[ebx+20] ;st0 = farp+near
-
 
643
	fchs               ;st0 = -(farp+near)
-
 
644
	fdiv st0,st1
-
 
645
	fstp dword[D]      ;D = -(farp*near) / (farp-near)
-
 
646
	ffree st0
-
 
647
	fincstp
-
 
648
	ffree st0
-
 
649
	fincstp
-
 
650
	ffree st0
-
 
651
	fincstp
-
 
652
 
-
 
653
	lea ecx,[ebp-sizeof.M4]
-
 
654
 
-
 
655
	mov ebx,[x]
-
 
656
	mov dword[ecx],ebx
-
 
657
	mov dword[ecx+4],0.0
-
 
658
	mov dword[ecx+8],0.0
-
 
659
	mov ebx,[A]
-
 
660
	mov dword[ecx+12],ebx
-
 
661
	mov dword[ecx+16],0.0
-
 
662
	mov ebx,[y]
-
 
663
	mov dword[ecx+20],ebx
-
 
664
	mov dword[ecx+24],0.0
-
 
665
	mov ebx,[B]
-
 
666
	mov dword[ecx+28],ebx
-
 
667
	mov dword[ecx+32],0.0
-
 
668
	mov dword[ecx+36],0.0
-
 
669
	mov ebx,[C]
-
 
670
	mov dword[ecx+40],ebx
-
 
671
	mov ebx,[D]
-
 
672
	mov dword[ecx+44],ebx
-
 
673
	mov dword[ecx+48],0.0
-
 
674
	mov dword[ecx+52],0.0
-
 
675
	mov dword[ecx+56],0.0
-
 
676
	mov dword[ecx+60],1.0
-
 
677
 
-
 
678
	mov ebx,[eax+GLContext.matrix_mode]
-
 
679
	lea ebx,[eax+4*ebx]
-
 
680
	stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx
-
 
681
 
-
 
682
if DEBUG ;glopOrtho
-
 
683
	stdcall gl_print_matrix,ecx,4
-
 
684
	stdcall gl_print_matrix,dword[ebx+GLContext.matrix_stack_ptr],4
-
 
685
end if
-
 
686
	gl_matrix_update eax,ebx
-
 
687
	ret