Subversion Repositories Kolibri OS

Rev

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

Rev 8063 Rev 8069
Line 17... Line 17...
17
	fld1
17
	fld1
18
	fdiv dword[ebx+GLVertex.pc+offs_W] ;st0 = 1/v.pc.W
18
	fdiv dword[ebx+GLVertex.pc+offs_W] ;st0 = 1/v.pc.W
Line 19... Line 19...
19
 
19
 
20
	fld dword[ebx+GLVertex.pc+offs_X] ;st0 = v.pc.X
20
	fld dword[ebx+GLVertex.pc+offs_X] ;st0 = v.pc.X
21
	fmul st0,st1
21
	fmul st0,st1
22
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_X]
22
	fmul dword[eax+GLContext.viewport+GLViewport.scale+offs_X]
23
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_X]
23
	fadd dword[eax+GLContext.viewport+GLViewport.trans+offs_X]
Line 24... Line 24...
24
	fistp dword[ebx+GLVertex.zp] ;v.zp.x = st0, st0 = st1
24
	fistp dword[ebx+GLVertex.zp] ;v.zp.x = st0, st0 = st1
25
 
25
 
26
	fld dword[ebx+GLVertex.pc+offs_Y] ;st0 = v.pc.Y
26
	fld dword[ebx+GLVertex.pc+offs_Y] ;st0 = v.pc.Y
27
	fmul st0,st1
27
	fmul st0,st1
28
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Y]
28
	fmul dword[eax+GLContext.viewport+GLViewport.scale+offs_Y]
Line 29... Line 29...
29
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Y]
29
	fadd dword[eax+GLContext.viewport+GLViewport.trans+offs_Y]
30
	fistp dword[ebx+GLVertex.zp+offs_zbup_y] ;v.zp.y = st0, st0 = st1
30
	fistp dword[ebx+GLVertex.zp+ZBufferPoint.y] ;v.zp.y = st0, st0 = st1
31
 
31
 
32
	fld dword[ebx+GLVertex.pc+offs_Z] ;st0 = v.pc.Z
32
	fld dword[ebx+GLVertex.pc+offs_Z] ;st0 = v.pc.Z
33
	fmulp
33
	fmulp
Line 34... Line 34...
34
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Z]
34
	fmul dword[eax+GLContext.viewport+GLViewport.scale+offs_Z]
35
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Z]
35
	fadd dword[eax+GLContext.viewport+GLViewport.trans+offs_Z]
36
	fistp dword[ebx+GLVertex.zp+offs_zbup_z] ;v.zp.z = st0, st0 = st1
36
	fistp dword[ebx+GLVertex.zp+ZBufferPoint.z] ;v.zp.z = st0, st0 = st1
37
 
37
 
38
	; color
38
	; color
39
	cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled)
39
	cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled)
40
	je @f
40
	je @f
41
		lea ecx,[ebx+GLVertex.zp+offs_zbup_b]
41
		lea ecx,[ebx+GLVertex.zp+ZBufferPoint.b]
42
		push ecx
42
		push ecx
43
		add ecx,offs_zbup_g-offs_zbup_b
43
		add ecx,ZBufferPoint.g-ZBufferPoint.b
44
		push ecx
44
		push ecx
45
		add ecx,offs_zbup_r-offs_zbup_g
45
		add ecx,ZBufferPoint.r-ZBufferPoint.g
46
		push ecx
46
		push ecx
47
		stdcall RGBFtoRGBI, dword[ebx+GLVertex.color],dword[ebx+GLVertex.color+4],dword[ebx+GLVertex.color+8]
47
		stdcall RGBFtoRGBI, dword[ebx+GLVertex.color],dword[ebx+GLVertex.color+4],dword[ebx+GLVertex.color+8]
48
		jmp .end_if
48
		jmp .end_if
49
align 4
49
align 4
50
	@@:
50
	@@:
51
		; no need to convert to integer if no lighting : take current color
51
		; no need to convert to integer if no lighting : take current color
52
		mov ecx,[eax+GLContext.longcurrent_color]
52
		mov ecx,[eax+GLContext.longcurrent_color]
53
		mov dword[ebx+GLVertex.zp+offs_zbup_r],ecx
53
		mov dword[ebx+GLVertex.zp+ZBufferPoint.r],ecx
54
		mov ecx,[eax+GLContext.longcurrent_color+4]
54
		mov ecx,[eax+GLContext.longcurrent_color+4]
Line 55... Line 55...
55
		mov dword[ebx+GLVertex.zp+offs_zbup_g],ecx
55
		mov dword[ebx+GLVertex.zp+ZBufferPoint.g],ecx
56
		mov ecx,[eax+GLContext.longcurrent_color+8]
56
		mov ecx,[eax+GLContext.longcurrent_color+8]
57
		mov dword[ebx+GLVertex.zp+offs_zbup_b],ecx
57
		mov dword[ebx+GLVertex.zp+ZBufferPoint.b],ecx
Line 64... Line 64...
64
		mov eax,[eax] ;eax = context.current_texture
64
		mov eax,[eax] ;eax = context.current_texture
65
		;[eax+offs_text_images] = im = &context.current_texture.images[0]
65
		;[eax+offs_text_images] = im = &context.current_texture.images[0]
Line 66... Line 66...
66
 
66
 
67
		fild dword[eax+offs_text_images+offs_imag_s_bound]
67
		fild dword[eax+offs_text_images+offs_imag_s_bound]
68
		fmul dword[ebx+GLVertex.tex_coord+offs_X]
68
		fmul dword[ebx+GLVertex.tex_coord+offs_X]
69
		fistp dword[ebx+GLVertex.zp+offs_zbup_s]
69
		fistp dword[ebx+GLVertex.zp+ZBufferPoint.s]
Line 70... Line 70...
70
		;v.zp.s=(int)(v.tex_coord.X * im.s_bound)
70
		;v.zp.s=(int)(v.tex_coord.X * im.s_bound)
71
 
71
 
72
		fild dword[eax+offs_text_images+offs_imag_t_bound]
72
		fild dword[eax+offs_text_images+offs_imag_t_bound]
73
		fmul dword[ebx+GLVertex.tex_coord+offs_Y]
73
		fmul dword[ebx+GLVertex.tex_coord+offs_Y]
74
		fistp dword[ebx+GLVertex.zp+offs_zbup_t]
74
		fistp dword[ebx+GLVertex.zp+ZBufferPoint.t]
75
		;v.zp.t=(int)(v.tex_coord.Y * im.t_bound)
75
		;v.zp.t=(int)(v.tex_coord.Y * im.t_bound)
76
	@@:
76
	@@:
Line 115... Line 115...
115
	cmp dword[ebx+GLVertex.clip_code],0 ;if (p0.clip_code == 0)
115
	cmp dword[ebx+GLVertex.clip_code],0 ;if (p0.clip_code == 0)
116
	jne @f
116
	jne @f
117
	mov eax,[context]
117
	mov eax,[context]
118
	cmp dword[eax+GLContext.render_mode],GL_SELECT
118
	cmp dword[eax+GLContext.render_mode],GL_SELECT
119
	jne .els
119
	jne .els
120
		stdcall gl_add_select, eax,dword[ebx+GLVertex.zp+offs_zbup_z],dword[ebx+GLVertex.zp+offs_zbup_z] ;p0.zp.z,p0.zp.z
120
		stdcall gl_add_select, eax,dword[ebx+GLVertex.zp+ZBufferPoint.z],dword[ebx+GLVertex.zp+ZBufferPoint.z] ;p0.zp.z,p0.zp.z
121
		jmp @f
121
		jmp @f
122
align 4
122
align 4
123
	.els:
123
	.els:
124
		add ebx,GLVertex.zp
124
		add ebx,GLVertex.zp
125
		stdcall ZB_plot, dword[eax+GLContext.zb],ebx
125
		stdcall ZB_plot, dword[eax+GLContext.zb],ebx
Line 284... Line 284...
284
	cmp dword[esi+GLVertex.clip_code],0
284
	cmp dword[esi+GLVertex.clip_code],0
285
	jne .els_i
285
	jne .els_i
286
		;if ( (p1.clip_code | p2.clip_code) == 0)
286
		;if ( (p1.clip_code | p2.clip_code) == 0)
287
		cmp dword[edx+GLContext.render_mode],GL_SELECT ;if (context.render_mode == GL_SELECT)
287
		cmp dword[edx+GLContext.render_mode],GL_SELECT ;if (context.render_mode == GL_SELECT)
288
		jne .els_1
288
		jne .els_1
289
			stdcall gl_add_select1, edx,dword[edi+GLVertex.zp+offs_zbup_z],\
289
			stdcall gl_add_select1, edx,dword[edi+GLVertex.zp+ZBufferPoint.z],\
290
				dword[esi+GLVertex.zp+offs_zbup_z],dword[esi+GLVertex.zp+offs_zbup_z]
290
				dword[esi+GLVertex.zp+ZBufferPoint.z],dword[esi+GLVertex.zp+ZBufferPoint.z]
291
			jmp .end_f
291
			jmp .end_f
292
align 4
292
align 4
293
		.els_1:
293
		.els_1:
294
			add edi,GLVertex.zp
294
			add edi,GLVertex.zp
295
			add esi,GLVertex.zp
295
			add esi,GLVertex.zp
Line 423... Line 423...
423
	add eax,sizeof.GLVertex ;eax = &q2
423
	add eax,sizeof.GLVertex ;eax = &q2
424
	interpolate eax,edi,esi,tmax
424
	interpolate eax,edi,esi,tmax
425
	stdcall gl_transform_to_viewport, edx,eax
425
	stdcall gl_transform_to_viewport, edx,eax
Line 426... Line 426...
426
 
426
 
427
	sub eax,sizeof.GLVertex ;eax = &q1
427
	sub eax,sizeof.GLVertex ;eax = &q1
428
	lea ebx,[eax+GLVertex.zp+offs_zbup_b]
428
	lea ebx,[eax+GLVertex.zp+ZBufferPoint.b]
429
	push ebx
429
	push ebx
430
	add ebx,offs_zbup_g-offs_zbup_b
430
	add ebx,ZBufferPoint.g-ZBufferPoint.b
431
	push ebx
431
	push ebx
432
	add ebx,offs_zbup_r-offs_zbup_g
432
	add ebx,ZBufferPoint.r-ZBufferPoint.g
433
	push ebx
433
	push ebx
Line 434... Line 434...
434
	stdcall RGBFtoRGBI, dword[eax+GLVertex.color],dword[eax+GLVertex.color+4],dword[eax+GLVertex.color+8]
434
	stdcall RGBFtoRGBI, dword[eax+GLVertex.color],dword[eax+GLVertex.color+4],dword[eax+GLVertex.color+8]
435
 
435
 
436
	add eax,sizeof.GLVertex ;eax = &q2
436
	add eax,sizeof.GLVertex ;eax = &q2
437
	lea ebx,[eax+GLVertex.zp+offs_zbup_b]
437
	lea ebx,[eax+GLVertex.zp+ZBufferPoint.b]
438
	push ebx
438
	push ebx
439
	add ebx,offs_zbup_g-offs_zbup_b
439
	add ebx,ZBufferPoint.g-ZBufferPoint.b
440
	push ebx
440
	push ebx
441
	add ebx,offs_zbup_r-offs_zbup_g
441
	add ebx,ZBufferPoint.r-ZBufferPoint.g
Line 442... Line 442...
442
	push ebx
442
	push ebx
443
	stdcall RGBFtoRGBI, dword[eax+GLVertex.color],dword[eax+GLVertex.color+4],dword[eax+GLVertex.color+8]
443
	stdcall RGBFtoRGBI, dword[eax+GLVertex.color],dword[eax+GLVertex.color+4],dword[eax+GLVertex.color+8]
Line 635... Line 635...
635
		[edi+GLVertex.pc+offs_Z],[edi+GLVertex.pc+offs_W]
635
		[edi+GLVertex.pc+offs_Z],[edi+GLVertex.pc+offs_W]
636
	mov dword[edi+GLVertex.clip_code],eax
636
	mov dword[edi+GLVertex.clip_code],eax
637
	or eax,eax ;if (q.clip_code==0)
637
	or eax,eax ;if (q.clip_code==0)
638
	jnz @f
638
	jnz @f
639
		stdcall gl_transform_to_viewport,[context],edi
639
		stdcall gl_transform_to_viewport,[context],edi
640
		lea eax,[edi+GLVertex.zp+offs_zbup_b]
640
		lea eax,[edi+GLVertex.zp+ZBufferPoint.b]
641
		push eax
641
		push eax
642
		add eax,offs_zbup_g-offs_zbup_b
642
		add eax,ZBufferPoint.g-ZBufferPoint.b
643
		push eax
643
		push eax
644
		add eax,offs_zbup_r-offs_zbup_g
644
		add eax,ZBufferPoint.r-ZBufferPoint.g
645
		push eax
645
		push eax
646
		stdcall RGBFtoRGBI, dword[edi+GLVertex.color],dword[edi+GLVertex.color+4],dword[edi+GLVertex.color+8]
646
		stdcall RGBFtoRGBI, dword[edi+GLVertex.color],dword[edi+GLVertex.color+4],dword[edi+GLVertex.color+8]
647
	@@:
647
	@@:
648
	ret
648
	ret
649
endp
649
endp
Line 670... Line 670...
670
 
670
 
671
	; we handle the non clipped case here to go faster
671
	; we handle the non clipped case here to go faster
672
	;or edi,___ - было выше
672
	;or edi,___ - было выше
673
	jnz .els_0
673
	jnz .els_0
674
		;if (co==0)
674
		;if (co==0)
675
		mov edi,dword[edx+GLVertex.zp+offs_zbup_x]
675
		mov edi,dword[edx+GLVertex.zp+ZBufferPoint.x]
676
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_x]
676
		sub edi,dword[ebx+GLVertex.zp+ZBufferPoint.x]
677
		mov dword[norm],edi ;p2.x-p0.x
677
		mov dword[norm],edi ;p2.x-p0.x
678
		fild dword[norm]
678
		fild dword[norm]
679
		mov edi,dword[ecx+GLVertex.zp+offs_zbup_y]
679
		mov edi,dword[ecx+GLVertex.zp+ZBufferPoint.y]
680
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_y]
680
		sub edi,dword[ebx+GLVertex.zp+ZBufferPoint.y]
681
		mov dword[norm],edi ;p1.y-p0.y
681
		mov dword[norm],edi ;p1.y-p0.y
682
		fimul dword[norm]
682
		fimul dword[norm]
683
		fchs
683
		fchs
684
		mov edi,dword[ecx+GLVertex.zp+offs_zbup_x]
684
		mov edi,dword[ecx+GLVertex.zp+ZBufferPoint.x]
685
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_x]
685
		sub edi,dword[ebx+GLVertex.zp+ZBufferPoint.x]
686
		mov dword[norm],edi ;p1.x-p0.x
686
		mov dword[norm],edi ;p1.x-p0.x
687
		fild dword[norm]
687
		fild dword[norm]
688
		mov edi,dword[edx+GLVertex.zp+offs_zbup_y]
688
		mov edi,dword[edx+GLVertex.zp+ZBufferPoint.y]
689
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_y]
689
		sub edi,dword[ebx+GLVertex.zp+ZBufferPoint.y]
690
		mov dword[norm],edi ;p2.y-p0.y
690
		mov dword[norm],edi ;p2.y-p0.y
691
		fimul dword[norm]
691
		fimul dword[norm]
692
		faddp
692
		faddp