Subversion Repositories Kolibri OS

Rev

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

Rev 6523 Rev 8063
Line 13... Line 13...
13
	mov eax,[context]
13
	mov eax,[context]
14
	mov ebx,[v]
14
	mov ebx,[v]
Line 15... Line 15...
15
 
15
 
16
	; coordinates
16
	; coordinates
17
	fld1
17
	fld1
Line 18... Line 18...
18
	fdiv dword[ebx+offs_vert_pc+offs_W] ;st0 = 1/v.pc.W
18
	fdiv dword[ebx+GLVertex.pc+offs_W] ;st0 = 1/v.pc.W
19
 
19
 
20
	fld dword[ebx+offs_vert_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+offs_vpor_scale+offs_X]
Line 23... Line 23...
23
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_X]
23
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_X]
24
	fistp dword[ebx+offs_vert_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+offs_vert_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
Line 28... Line 28...
28
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Y]
28
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Y]
29
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Y]
29
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Y]
30
	fistp dword[ebx+offs_vert_zp+offs_zbup_y] ;v.zp.y = st0, st0 = st1
30
	fistp dword[ebx+GLVertex.zp+offs_zbup_y] ;v.zp.y = st0, st0 = st1
31
 
31
 
32
	fld dword[ebx+offs_vert_pc+offs_Z] ;st0 = v.pc.Z
32
	fld dword[ebx+GLVertex.pc+offs_Z] ;st0 = v.pc.Z
Line 33... Line 33...
33
	fmulp
33
	fmulp
34
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Z]
34
	fmul dword[eax+GLContext.viewport+offs_vpor_scale+offs_Z]
35
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Z]
35
	fadd dword[eax+GLContext.viewport+offs_vpor_trans+offs_Z]
36
	fistp dword[ebx+offs_vert_zp+offs_zbup_z] ;v.zp.z = st0, st0 = st1
-
 
37
 
36
	fistp dword[ebx+GLVertex.zp+offs_zbup_z] ;v.zp.z = st0, st0 = st1
38
	; color
37
 
39
	cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled)
38
	; color
40
	je @f
39
	cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled)
41
		mov ecx,ebx
40
	je @f
42
		add ecx,offs_vert_zp+offs_zbup_b
41
		lea ecx,[ebx+GLVertex.zp+offs_zbup_b]
43
		push ecx
42
		push ecx
44
		add ecx,offs_zbup_g-offs_zbup_b
43
		add ecx,offs_zbup_g-offs_zbup_b
45
		push ecx
44
		push ecx
46
		add ecx,offs_zbup_r-offs_zbup_g
45
		add ecx,offs_zbup_r-offs_zbup_g
47
		push ecx
46
		push ecx
48
		stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8]
47
		stdcall RGBFtoRGBI, dword[ebx+GLVertex.color],dword[ebx+GLVertex.color+4],dword[ebx+GLVertex.color+8]
49
		jmp .end_if
48
		jmp .end_if
50
align 4
49
align 4
51
	@@:
50
	@@:
52
		; 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
53
		mov ecx,[eax+GLContext.longcurrent_color]
52
		mov ecx,[eax+GLContext.longcurrent_color]
54
		mov dword[ebx+offs_vert_zp+offs_zbup_r],ecx
53
		mov dword[ebx+GLVertex.zp+offs_zbup_r],ecx
Line 55... Line 54...
55
		mov ecx,[eax+GLContext.longcurrent_color+4]
54
		mov ecx,[eax+GLContext.longcurrent_color+4]
56
		mov dword[ebx+offs_vert_zp+offs_zbup_g],ecx
55
		mov dword[ebx+GLVertex.zp+offs_zbup_g],ecx
57
		mov ecx,[eax+GLContext.longcurrent_color+8]
56
		mov ecx,[eax+GLContext.longcurrent_color+8]
58
		mov dword[ebx+offs_vert_zp+offs_zbup_b],ecx
57
		mov dword[ebx+GLVertex.zp+offs_zbup_b],ecx
59
	.end_if:
58
	.end_if:
60
  
59
  
Line 61... Line 60...
61
	; texture
60
	; texture
62
	cmp dword[eax+GLContext.texture_2d_enabled],0
61
	cmp dword[eax+GLContext.texture_2d_enabled],0
63
	je @f
62
	je @f
64
		mov eax,[eax+GLContext.current_texture] ;eax = &context.current_texture
63
		mov eax,[eax+GLContext.current_texture] ;eax = &context.current_texture
Line 65... Line 64...
65
		mov eax,[eax] ;eax = context.current_texture
64
		mov eax,[eax] ;eax = context.current_texture
66
		;[eax+offs_text_images] = im = &context.current_texture.images[0]
65
		;[eax+offs_text_images] = im = &context.current_texture.images[0]
67
 
66
 
68
		fild dword[eax+offs_text_images+offs_imag_s_bound]
67
		fild dword[eax+offs_text_images+offs_imag_s_bound]
69
		fmul dword[ebx+offs_vert_tex_coord+offs_X]
68
		fmul dword[ebx+GLVertex.tex_coord+offs_X]
70
		fistp dword[ebx+offs_vert_zp+offs_zbup_s]
69
		fistp dword[ebx+GLVertex.zp+offs_zbup_s]
71
		;v.zp.s=(int)(v.tex_coord.X * im.s_bound)
70
		;v.zp.s=(int)(v.tex_coord.X * im.s_bound)
Line 111... Line 110...
111
; point
110
; point
Line 112... Line 111...
112
 
111
 
113
align 16
112
align 16
114
proc gl_draw_point uses eax ebx, context:dword, p0:dword
113
proc gl_draw_point uses eax ebx, context:dword, p0:dword
115
	mov ebx,[p0]
114
	mov ebx,[p0]
116
	cmp dword[ebx+offs_vert_clip_code],0 ;if (p0.clip_code == 0)
115
	cmp dword[ebx+GLVertex.clip_code],0 ;if (p0.clip_code == 0)
117
	jne @f
116
	jne @f
118
	mov eax,[context]
117
	mov eax,[context]
119
	cmp dword[eax+GLContext.render_mode],GL_SELECT
118
	cmp dword[eax+GLContext.render_mode],GL_SELECT
120
	jne .els
119
	jne .els
121
		stdcall gl_add_select, eax,dword[ebx+offs_vert_zp+offs_zbup_z],dword[ebx+offs_vert_zp+offs_zbup_z] ;p0.zp.z,p0.zp.z
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
122
		jmp @f
121
		jmp @f
123
align 4
122
align 4
124
	.els:
123
	.els:
125
		add ebx,offs_vert_zp
124
		add ebx,GLVertex.zp
126
		stdcall ZB_plot, dword[eax+GLContext.zb],ebx
125
		stdcall ZB_plot, dword[eax+GLContext.zb],ebx
127
	@@:
126
	@@:
128
	ret
127
	ret
Line 138... Line 137...
138
macro interpolate q, p0, p1, t
137
macro interpolate q, p0, p1, t
139
{
138
{
140
	fld dword[t]
139
	fld dword[t]
Line 141... Line 140...
141
 
140
 
142
	; интерполяция по координатам
141
	; интерполяция по координатам
143
	fld dword[p1+offs_vert_pc]
142
	fld dword[p1+GLVertex.pc]
144
	fsub dword[p0+offs_vert_pc]
143
	fsub dword[p0+GLVertex.pc]
145
	fmul st0,st1
144
	fmul st0,st1
146
	fadd dword[p0+offs_vert_pc]
145
	fadd dword[p0+GLVertex.pc]
Line 147... Line 146...
147
	fstp dword[q+offs_vert_pc] ;q.pc.X = p0.pc.X + (p1.pc.X - p0.pc.X) * t
146
	fstp dword[q+GLVertex.pc] ;q.pc.X = p0.pc.X + (p1.pc.X - p0.pc.X) * t
148
 
147
 
149
	fld dword[p1+offs_vert_pc+offs_Y]
148
	fld dword[p1+GLVertex.pc+offs_Y]
150
	fsub dword[p0+offs_vert_pc+offs_Y]
149
	fsub dword[p0+GLVertex.pc+offs_Y]
151
	fmul st0,st1
150
	fmul st0,st1
Line 152... Line 151...
152
	fadd dword[p0+offs_vert_pc+offs_Y]
151
	fadd dword[p0+GLVertex.pc+offs_Y]
153
	fstp dword[q+offs_vert_pc+offs_Y]
152
	fstp dword[q+GLVertex.pc+offs_Y]
154
 
153
 
155
	fld dword[p1+offs_vert_pc+offs_Z]
154
	fld dword[p1+GLVertex.pc+offs_Z]
156
	fsub dword[p0+offs_vert_pc+offs_Z]
155
	fsub dword[p0+GLVertex.pc+offs_Z]
Line 157... Line 156...
157
	fmul st0,st1
156
	fmul st0,st1
158
	fadd dword[p0+offs_vert_pc+offs_Z]
157
	fadd dword[p0+GLVertex.pc+offs_Z]
159
	fstp dword[q+offs_vert_pc+offs_Z]
158
	fstp dword[q+GLVertex.pc+offs_Z]
160
 
159
 
161
	fld dword[p1+offs_vert_pc+offs_W]
160
	fld dword[p1+GLVertex.pc+offs_W]
Line 162... Line 161...
162
	fsub dword[p0+offs_vert_pc+offs_W]
161
	fsub dword[p0+GLVertex.pc+offs_W]
163
	fmul st0,st1
162
	fmul st0,st1
164
	fadd dword[p0+offs_vert_pc+offs_W]
163
	fadd dword[p0+GLVertex.pc+offs_W]
165
	fstp dword[q+offs_vert_pc+offs_W]
164
	fstp dword[q+GLVertex.pc+offs_W]
166
 
165
 
167
	; интерполяция по цвету
166
	; интерполяция по цвету
Line 168... Line 167...
168
	fld dword[p1+offs_vert_color]
167
	fld dword[p1+GLVertex.color]
169
	fsub dword[p0+offs_vert_color]
168
	fsub dword[p0+GLVertex.color]
170
	fmul st0,st1
169
	fmul st0,st1
171
	fadd dword[p0+offs_vert_color]
170
	fadd dword[p0+GLVertex.color]
172
	fstp dword[q+offs_vert_color]
171
	fstp dword[q+GLVertex.color]
Line 173... Line 172...
173
 
172
 
174
	fld dword[p1+offs_vert_color+4]
173
	fld dword[p1+GLVertex.color+4]
175
	fsub dword[p0+offs_vert_color+4]
174
	fsub dword[p0+GLVertex.color+4]
176
	fmul st0,st1
175
	fmul st0,st1
177
	fadd dword[p0+offs_vert_color+4]
176
	fadd dword[p0+GLVertex.color+4]
178
	fstp dword[q+offs_vert_color+4]
177
	fstp dword[q+GLVertex.color+4]
Line 179... Line 178...
179
 
178
 
180
	fld dword[p1+offs_vert_color+8]
179
	fld dword[p1+GLVertex.color+8]
181
	fsub dword[p0+offs_vert_color+8]
180
	fsub dword[p0+GLVertex.color+8]
Line 278... Line 277...
278
pushad
277
pushad
279
	mov edx,[context]
278
	mov edx,[context]
280
	mov edi,[p1]
279
	mov edi,[p1]
281
	mov esi,[p2]
280
	mov esi,[p2]
Line 282... Line 281...
282
 
281
 
283
	cmp dword[edi+offs_vert_clip_code],0
282
	cmp dword[edi+GLVertex.clip_code],0
284
	jne .els_i
283
	jne .els_i
285
	cmp dword[esi+offs_vert_clip_code],0
284
	cmp dword[esi+GLVertex.clip_code],0
286
	jne .els_i
285
	jne .els_i
287
		;if ( (p1.clip_code | p2.clip_code) == 0)
286
		;if ( (p1.clip_code | p2.clip_code) == 0)
288
		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)
289
		jne .els_1
288
		jne .els_1
290
			stdcall gl_add_select1, edx,dword[edi+offs_vert_zp+offs_zbup_z],\
289
			stdcall gl_add_select1, edx,dword[edi+GLVertex.zp+offs_zbup_z],\
291
				dword[esi+offs_vert_zp+offs_zbup_z],dword[esi+offs_vert_zp+offs_zbup_z]
290
				dword[esi+GLVertex.zp+offs_zbup_z],dword[esi+GLVertex.zp+offs_zbup_z]
292
			jmp .end_f
291
			jmp .end_f
293
align 4
292
align 4
294
		.els_1:
293
		.els_1:
295
			add edi,offs_vert_zp
294
			add edi,GLVertex.zp
296
			add esi,offs_vert_zp
295
			add esi,GLVertex.zp
297
			push esi
296
			push esi
298
			push edi
297
			push edi
299
			push dword[edx+GLContext.zb]
298
			push dword[edx+GLContext.zb]
300
			cmp dword[edx+GLContext.depth_test],0
299
			cmp dword[edx+GLContext.depth_test],0
Line 307... Line 306...
307
				call ZB_line ;, dword[edx+GLContext.zb],edi,esi
306
				call ZB_line ;, dword[edx+GLContext.zb],edi,esi
308
				jmp .end_f
307
				jmp .end_f
309
align 4
308
align 4
310
	.els_i:
309
	.els_i:
311
		;else if ( (p1.clip_code & p2.clip_code) != 0 )
310
		;else if ( (p1.clip_code & p2.clip_code) != 0 )
312
		mov eax,[edi+offs_vert_clip_code]
311
		mov eax,[edi+GLVertex.clip_code]
313
		and eax,[esi+offs_vert_clip_code]
312
		and eax,[esi+GLVertex.clip_code]
314
		or eax,eax
313
		or eax,eax
315
		jnz .end_f
314
		jnz .end_f
316
	.els_0:
315
	.els_0:
Line 317... Line 316...
317
 
316
 
318
	fld dword[esi+offs_vert_pc+offs_X]
317
	fld dword[esi+GLVertex.pc+offs_X]
319
	fsub dword[edi+offs_vert_pc+offs_X]
318
	fsub dword[edi+GLVertex.pc+offs_X]
320
	fstp dword[d_x] ;d_x = p2.pc.X - p1.pc.X
319
	fstp dword[d_x] ;d_x = p2.pc.X - p1.pc.X
321
	fld dword[esi+offs_vert_pc+offs_Y]
320
	fld dword[esi+GLVertex.pc+offs_Y]
322
	fsub dword[edi+offs_vert_pc+offs_Y]
321
	fsub dword[edi+GLVertex.pc+offs_Y]
323
	fstp dword[d_y] ;d_y = p2.pc.Y - p1.pc.Y
322
	fstp dword[d_y] ;d_y = p2.pc.Y - p1.pc.Y
324
	fld dword[esi+offs_vert_pc+offs_Z]
323
	fld dword[esi+GLVertex.pc+offs_Z]
325
	fsub dword[edi+offs_vert_pc+offs_Z]
324
	fsub dword[edi+GLVertex.pc+offs_Z]
326
	fstp dword[d_z] ;d_z = p2.pc.Z - p1.pc.Z
325
	fstp dword[d_z] ;d_z = p2.pc.Z - p1.pc.Z
327
	fld dword[esi+offs_vert_pc+offs_W]
326
	fld dword[esi+GLVertex.pc+offs_W]
328
	fsub dword[edi+offs_vert_pc+offs_W]
327
	fsub dword[edi+GLVertex.pc+offs_W]
Line 329... Line 328...
329
	fstp dword[d_w] ;d_w = p2.pc.W - p1.pc.W
328
	fstp dword[d_w] ;d_w = p2.pc.W - p1.pc.W
330
 
329
 
331
	mov eax,[edi+offs_vert_pc+offs_X]
330
	mov eax,[edi+GLVertex.pc+offs_X]
332
	mov [x1],eax ;x1 = p1.pc.X
331
	mov [x1],eax ;x1 = p1.pc.X
333
	mov eax,[edi+offs_vert_pc+offs_Y]
332
	mov eax,[edi+GLVertex.pc+offs_Y]
334
	mov [y1],eax ;y1 = p1.pc.Y
333
	mov [y1],eax ;y1 = p1.pc.Y
335
	mov eax,[edi+offs_vert_pc+offs_Z]
334
	mov eax,[edi+GLVertex.pc+offs_Z]
336
	mov [z1],eax ;z1 = p1.pc.Z
335
	mov [z1],eax ;z1 = p1.pc.Z
Line 337... Line 336...
337
	mov eax,[edi+offs_vert_pc+offs_W]
336
	mov eax,[edi+GLVertex.pc+offs_W]
338
	mov [w1],eax ;w1 = p1.pc.W
337
	mov [w1],eax ;w1 = p1.pc.W
Line 339... Line 338...
339
 
338
 
340
	mov dword[tmin],0.0
-
 
341
	mov dword[tmax],1.0
339
	mov dword[tmin],0.0
342
 
340
	mov dword[tmax],1.0
343
	mov eax,ebp
341
 
344
	sub eax,4
342
	lea eax,[ebp-4]
345
	push eax ;толкаем в стек адрес &tmax
343
	push eax ;толкаем в стек адрес &tmax
Line 417... Line 415...
417
	sub esp,8
415
	sub esp,8
418
	call ClipLine1 ;-d_z+d_w,z1-w1,&tmin,&tmax
416
	call ClipLine1 ;-d_z+d_w,z1-w1,&tmin,&tmax
419
	bt eax,0
417
	bt eax,0
420
	jnc .end_f
418
	jnc .end_f
Line 421... Line -...
421
 
-
 
422
	mov eax,ebp
419
 
423
	sub eax,8+2*sizeof.GLVertex ;eax = &q1
420
	lea eax,[ebp-8-2*sizeof.GLVertex] ;eax = &q1
424
	interpolate eax,edi,esi,tmin
421
	interpolate eax,edi,esi,tmin
425
	stdcall gl_transform_to_viewport, edx,eax
422
	stdcall gl_transform_to_viewport, edx,eax
426
	add eax,sizeof.GLVertex ;eax = &q2
423
	add eax,sizeof.GLVertex ;eax = &q2
427
	interpolate eax,edi,esi,tmax
424
	interpolate eax,edi,esi,tmax
Line 428... Line 425...
428
	stdcall gl_transform_to_viewport, edx,eax
425
	stdcall gl_transform_to_viewport, edx,eax
429
 
-
 
430
	sub eax,sizeof.GLVertex ;eax = &q1
426
 
431
	mov ebx,eax
427
	sub eax,sizeof.GLVertex ;eax = &q1
432
	add ebx,offs_vert_zp+offs_zbup_b
428
	lea ebx,[eax+GLVertex.zp+offs_zbup_b]
433
	push ebx
429
	push ebx
434
	add ebx,offs_zbup_g-offs_zbup_b
430
	add ebx,offs_zbup_g-offs_zbup_b
435
	push ebx
431
	push ebx
436
	add ebx,offs_zbup_r-offs_zbup_g
432
	add ebx,offs_zbup_r-offs_zbup_g
Line 437... Line 433...
437
	push ebx
433
	push ebx
438
	stdcall RGBFtoRGBI, dword[eax+offs_vert_color],dword[eax+offs_vert_color+4],dword[eax+offs_vert_color+8]
-
 
439
 
434
	stdcall RGBFtoRGBI, dword[eax+GLVertex.color],dword[eax+GLVertex.color+4],dword[eax+GLVertex.color+8]
440
	add eax,sizeof.GLVertex ;eax = &q2
435
 
441
	mov ebx,eax
436
	add eax,sizeof.GLVertex ;eax = &q2
442
	add ebx,offs_vert_zp+offs_zbup_b
437
	lea ebx,[eax+GLVertex.zp+offs_zbup_b]
443
	push ebx
438
	push ebx
444
	add ebx,offs_zbup_g-offs_zbup_b
439
	add ebx,offs_zbup_g-offs_zbup_b
445
	push ebx
440
	push ebx
Line 446... Line 441...
446
	add ebx,offs_zbup_r-offs_zbup_g
441
	add ebx,offs_zbup_r-offs_zbup_g
447
	push ebx
442
	push ebx
448
	stdcall RGBFtoRGBI, dword[eax+offs_vert_color],dword[eax+offs_vert_color+4],dword[eax+offs_vert_color+8]
443
	stdcall RGBFtoRGBI, dword[eax+GLVertex.color],dword[eax+GLVertex.color+4],dword[eax+GLVertex.color+8]
449
 
444
 
450
	add eax,offs_vert_zp ;eax = &q2.zp
445
	add eax,GLVertex.zp ;eax = &q2.zp
451
	push eax
446
	push eax
Line 593... Line 588...
593
	mov edx,[context]
588
	mov edx,[context]
594
	mov eax,[p0]
589
	mov eax,[p0]
595
	cmp dword[edx+GLContext.current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH)
590
	cmp dword[edx+GLContext.current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH)
596
	jne .els_0
591
	jne .els_0
597
		mov ecx,[p1]
592
		mov ecx,[p1]
598
		fld dword[ecx+offs_vert_color]
593
		fld dword[ecx+GLVertex.color]
599
		fsub dword[eax+offs_vert_color]
594
		fsub dword[eax+GLVertex.color]
600
		fmul dword[t]
595
		fmul dword[t]
601
		fadd dword[eax+offs_vert_color]
596
		fadd dword[eax+GLVertex.color]
602
		fstp dword[edi+offs_vert_color] ;q.color.v[0]=p0.color.v[0] + (p1.color.v[0]-p0.color.v[0])*t
597
		fstp dword[edi+GLVertex.color] ;q.color.v[0]=p0.color.v[0] + (p1.color.v[0]-p0.color.v[0])*t
603
		fld dword[ecx+offs_vert_color+4]
598
		fld dword[ecx+GLVertex.color+4]
604
		fsub dword[eax+offs_vert_color+4]
599
		fsub dword[eax+GLVertex.color+4]
605
		fmul dword[t]
600
		fmul dword[t]
606
		fadd dword[eax+offs_vert_color+4]
601
		fadd dword[eax+GLVertex.color+4]
607
		fstp dword[edi+offs_vert_color+4] ;q.color.v[1]=p0.color.v[1] + (p1.color.v[1]-p0.color.v[1])*t
602
		fstp dword[edi+GLVertex.color+4] ;q.color.v[1]=p0.color.v[1] + (p1.color.v[1]-p0.color.v[1])*t
608
		fld dword[ecx+offs_vert_color+8]
603
		fld dword[ecx+GLVertex.color+8]
609
		fsub dword[eax+offs_vert_color+8]
604
		fsub dword[eax+GLVertex.color+8]
610
		fmul dword[t]
605
		fmul dword[t]
611
		fadd dword[eax+offs_vert_color+8]
606
		fadd dword[eax+GLVertex.color+8]
612
		fstp dword[edi+offs_vert_color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t
607
		fstp dword[edi+GLVertex.color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t
613
		jmp @f
608
		jmp @f
614
align 4
609
align 4
615
	.els_0:
610
	.els_0:
616
		mov ecx,[eax+offs_vert_color]
611
		mov ecx,[eax+GLVertex.color]
617
		mov [edi+offs_vert_color],ecx ;q.color.v[0]=p0.color.v[0]
612
		mov [edi+GLVertex.color],ecx ;q.color.v[0]=p0.color.v[0]
618
		mov ecx,[eax+offs_vert_color+4]
613
		mov ecx,[eax+GLVertex.color+4]
619
		mov [edi+offs_vert_color+4],ecx ;q.color.v[1]=p0.color.v[1]
614
		mov [edi+GLVertex.color+4],ecx ;q.color.v[1]=p0.color.v[1]
620
		mov ecx,[eax+offs_vert_color+8]
615
		mov ecx,[eax+GLVertex.color+8]
621
		mov [edi+offs_vert_color+8],ecx ;q.color.v[2]=p0.color.v[2]
616
		mov [edi+GLVertex.color+8],ecx ;q.color.v[2]=p0.color.v[2]
622
	@@:
617
	@@:
Line 623... Line 618...
623
 
618
 
624
	cmp dword[edx+GLContext.texture_2d_enabled],0 ;if (context.texture_2d_enabled)
619
	cmp dword[edx+GLContext.texture_2d_enabled],0 ;if (context.texture_2d_enabled)
625
	je @f
620
	je @f
626
		mov ecx,[p1]
621
		mov ecx,[p1]
627
		fld dword[ecx+offs_vert_tex_coord+offs_X]
622
		fld dword[ecx+GLVertex.tex_coord+offs_X]
628
		fsub dword[eax+offs_vert_tex_coord+offs_X]
623
		fsub dword[eax+GLVertex.tex_coord+offs_X]
629
		fmul dword[t]
624
		fmul dword[t]
630
		fadd dword[eax+offs_vert_tex_coord+offs_X]
625
		fadd dword[eax+GLVertex.tex_coord+offs_X]
631
		fstp dword[edi+offs_vert_tex_coord+offs_X] ;q.tex_coord.X=p0.tex_coord.X + (p1.tex_coord.X-p0.tex_coord.X)*t
626
		fstp dword[edi+GLVertex.tex_coord+offs_X] ;q.tex_coord.X=p0.tex_coord.X + (p1.tex_coord.X-p0.tex_coord.X)*t
632
		fld dword[ecx+offs_vert_tex_coord+offs_Y]
627
		fld dword[ecx+GLVertex.tex_coord+offs_Y]
633
		fsub dword[eax+offs_vert_tex_coord+offs_Y]
628
		fsub dword[eax+GLVertex.tex_coord+offs_Y]
634
		fmul dword[t]
629
		fmul dword[t]
635
		fadd dword[eax+offs_vert_tex_coord+offs_Y]
630
		fadd dword[eax+GLVertex.tex_coord+offs_Y]
636
		fstp dword[edi+offs_vert_tex_coord+offs_Y] ;q.tex_coord.Y=p0.tex_coord.Y + (p1.tex_coord.Y-p0.tex_coord.Y)*t
631
		fstp dword[edi+GLVertex.tex_coord+offs_Y] ;q.tex_coord.Y=p0.tex_coord.Y + (p1.tex_coord.Y-p0.tex_coord.Y)*t
Line 637... Line 632...
637
	@@:
632
	@@:
638
 
633
 
639
	stdcall gl_clipcode, [edi+offs_vert_pc+offs_X],[edi+offs_vert_pc+offs_Y],\
634
	stdcall gl_clipcode, [edi+GLVertex.pc+offs_X],[edi+GLVertex.pc+offs_Y],\
640
		[edi+offs_vert_pc+offs_Z],[edi+offs_vert_pc+offs_W]
635
		[edi+GLVertex.pc+offs_Z],[edi+GLVertex.pc+offs_W]
641
	mov dword[edi+offs_vert_clip_code],eax
636
	mov dword[edi+GLVertex.clip_code],eax
642
	or eax,eax ;if (q.clip_code==0)
637
	or eax,eax ;if (q.clip_code==0)
643
	jnz @f
-
 
644
		stdcall gl_transform_to_viewport,[context],edi
638
	jnz @f
645
		mov eax,edi
639
		stdcall gl_transform_to_viewport,[context],edi
646
		add eax,offs_vert_zp+offs_zbup_b
640
		lea eax,[edi+GLVertex.zp+offs_zbup_b]
647
		push eax
641
		push eax
648
		add eax,offs_zbup_g-offs_zbup_b
642
		add eax,offs_zbup_g-offs_zbup_b
649
		push eax
643
		push eax
650
		add eax,offs_zbup_r-offs_zbup_g
644
		add eax,offs_zbup_r-offs_zbup_g
651
		push eax
645
		push eax
652
		stdcall RGBFtoRGBI, dword[edi+offs_vert_color],dword[edi+offs_vert_color+4],dword[edi+offs_vert_color+8]
646
		stdcall RGBFtoRGBI, dword[edi+GLVertex.color],dword[edi+GLVertex.color+4],dword[edi+GLVertex.color+8]
653
	@@:
647
	@@:
Line 654... Line 648...
654
	ret
648
	ret
Line 663... Line 657...
663
endl
657
endl
664
pushad
658
pushad
665
	mov ebx,[p0]
659
	mov ebx,[p0]
666
	mov ecx,[p1]
660
	mov ecx,[p1]
667
	mov edx,[p2]
661
	mov edx,[p2]
668
	mov edi,[ebx+offs_vert_clip_code]
662
	mov edi,[ebx+GLVertex.clip_code]
669
	mov dword[cc],edi
663
	mov dword[cc],edi
670
	mov eax,[ecx+offs_vert_clip_code]
664
	mov eax,[ecx+GLVertex.clip_code]
671
	mov dword[cc+4],eax
665
	mov dword[cc+4],eax
672
	or edi,eax
666
	or edi,eax
673
	mov eax,[edx+offs_vert_clip_code]
667
	mov eax,[edx+GLVertex.clip_code]
674
	mov dword[cc+8],eax
668
	mov dword[cc+8],eax
675
	or edi,eax ;co = cc[0] | cc[1] | cc[2]
669
	or edi,eax ;co = cc[0] | cc[1] | cc[2]
Line 676... Line 670...
676
 
670
 
677
	; we handle the non clipped case here to go faster
671
	; we handle the non clipped case here to go faster
678
	;or edi,___ - было выше
672
	;or edi,___ - было выше
679
	jnz .els_0
673
	jnz .els_0
680
		;if (co==0)
674
		;if (co==0)
681
		mov edi,dword[edx+offs_vert_zp+offs_zbup_x]
675
		mov edi,dword[edx+GLVertex.zp+offs_zbup_x]
682
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
676
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_x]
683
		mov dword[norm],edi ;p2.x-p0.x
677
		mov dword[norm],edi ;p2.x-p0.x
684
		fild dword[norm]
678
		fild dword[norm]
685
		mov edi,dword[ecx+offs_vert_zp+offs_zbup_y]
679
		mov edi,dword[ecx+GLVertex.zp+offs_zbup_y]
686
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_y]
680
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_y]
687
		mov dword[norm],edi ;p1.y-p0.y
681
		mov dword[norm],edi ;p1.y-p0.y
688
		fimul dword[norm]
682
		fimul dword[norm]
689
		fchs
683
		fchs
690
		mov edi,dword[ecx+offs_vert_zp+offs_zbup_x]
684
		mov edi,dword[ecx+GLVertex.zp+offs_zbup_x]
691
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
685
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_x]
692
		mov dword[norm],edi ;p1.x-p0.x
686
		mov dword[norm],edi ;p1.x-p0.x
693
		fild dword[norm]
687
		fild dword[norm]
694
		mov edi,dword[edx+offs_vert_zp+offs_zbup_y]
688
		mov edi,dword[edx+GLVertex.zp+offs_zbup_y]
695
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_y]
689
		sub edi,dword[ebx+GLVertex.zp+offs_zbup_y]
696
		mov dword[norm],edi ;p2.y-p0.y
690
		mov dword[norm],edi ;p2.y-p0.y
697
		fimul dword[norm]
691
		fimul dword[norm]
698
		faddp
692
		faddp
Line 768... Line 762...
768
pushad
762
pushad
769
	mov ebx,[p0]
763
	mov ebx,[p0]
770
	mov ecx,[p1]
764
	mov ecx,[p1]
771
	mov edx,[p2]
765
	mov edx,[p2]
Line 772... Line 766...
772
 
766
 
773
	mov edi,[ebx+offs_vert_clip_code]
767
	mov edi,[ebx+GLVertex.clip_code]
774
	mov [cc],edi
768
	mov [cc],edi
775
	mov eax,[ecx+offs_vert_clip_code]
769
	mov eax,[ecx+GLVertex.clip_code]
776
	mov [cc+4],eax
770
	mov [cc+4],eax
777
	or edi,eax
771
	or edi,eax
778
	mov eax,[edx+offs_vert_clip_code]
772
	mov eax,[edx+GLVertex.clip_code]
779
	mov [cc+8],eax
773
	mov [cc+8],eax
780
	or edi,eax
774
	or edi,eax
Line 781... Line 775...
781
	mov [co],edi ;co = cc[0] | cc[1] | cc[2]
775
	mov [co],edi ;co = cc[0] | cc[1] | cc[2]
Line 867... Line 861...
867
			mov [q+4],ebx
861
			mov [q+4],ebx
868
			mov [q+8],ecx
862
			mov [q+8],ecx
869
		.els_2_end:
863
		.els_2_end:
Line 870... Line 864...
870
 
864
 
871
		mov ebx,[q]
865
		mov ebx,[q]
872
		add ebx,offs_vert_pc
866
		add ebx,GLVertex.pc
873
		mov ecx,[q+4]
867
		mov ecx,[q+4]
874
		add ecx,offs_vert_pc
868
		add ecx,GLVertex.pc
875
		mov edx,[q+8]
869
		mov edx,[q+8]
Line 876... Line 870...
876
		add edx,offs_vert_pc
870
		add edx,GLVertex.pc
877
 
871
 
878
		lea eax,[clip_proc]
-
 
879
		mov edi,[clip_bit]
872
		lea eax,[clip_proc]
880
		shl edi,2
-
 
881
		add eax,edi
873
		mov edi,[clip_bit]
882
		mov edi,ebp
874
		lea eax,[eax+4*edi]
883
		sub edi,(2*sizeof.GLVertex)-offs_vert_pc
875
		lea edi,[ebp-(2*sizeof.GLVertex)+GLVertex.pc]
Line 884... Line 876...
884
		stdcall dword[eax],edi,ebx,ecx ;clip_proc[clip_bit](&tmp1.pc,&q[0].pc,&q[1].pc)
876
		stdcall dword[eax],edi,ebx,ecx ;clip_proc[clip_bit](&tmp1.pc,&q[0].pc,&q[1].pc)
885
		sub edi,offs_vert_pc
877
		sub edi,GLVertex.pc
886
 
878
 
887
		sub ebx,offs_vert_pc
879
		sub ebx,GLVertex.pc
Line 888... Line 880...
888
		sub ecx,offs_vert_pc
880
		sub ecx,GLVertex.pc
889
		stdcall updateTmp,[context],ebx,ecx,eax ;(c,&tmp1,q[0],q[1],tt)
881
		stdcall updateTmp,[context],ebx,ecx,eax ;(c,&tmp1,q[0],q[1],tt)
890
		add ebx,offs_vert_pc
-
 
891
 
882
		add ebx,GLVertex.pc
892
		lea eax,[clip_proc]
-
 
893
		mov edi,[clip_bit]
883
 
894
		shl edi,2
884
		lea eax,[clip_proc]
895
		add eax,edi
885
		mov edi,[clip_bit]
896
		mov edi,ebp
886
		lea eax,[eax+4*edi]
897
		sub edi,sizeof.GLVertex-offs_vert_pc
887
		lea edi,[ebp-sizeof.GLVertex+GLVertex.pc]
898
		stdcall dword[eax],edi,ebx,edx ;clip_proc[clip_bit](&tmp2.pc,&q[0].pc,&q[2].pc)
888
		stdcall dword[eax],edi,ebx,edx ;clip_proc[clip_bit](&tmp2.pc,&q[0].pc,&q[2].pc)
Line 899... Line 889...
899
		sub edi,offs_vert_pc
889
		sub edi,GLVertex.pc
900
		sub ebx,offs_vert_pc
890
		sub ebx,GLVertex.pc
901
		sub edx,offs_vert_pc
891
		sub edx,GLVertex.pc
902
		stdcall updateTmp,[context],ebx,edx,eax ;(c,&tmp2,q[0],q[2],tt)
892
		stdcall updateTmp,[context],ebx,edx,eax ;(c,&tmp2,q[0],q[2],tt)
903
 
893
 
904
		mov eax,[ebx+offs_vert_edge_flag]
894
		mov eax,[ebx+GLVertex.edge_flag]
905
		mov [tmp1.edge_flag],eax ;q[0].edge_flag
895
		mov [tmp1.edge_flag],eax ;q[0].edge_flag
906
		mov eax,[edx+offs_vert_edge_flag]
896
		mov eax,[edx+GLVertex.edge_flag]
907
		mov [edge_flag_tmp],eax	;q[2].edge_flag
-
 
908
		mov dword[edx+offs_vert_edge_flag],0 ;q[2].edge_flag=0
897
		mov [edge_flag_tmp],eax	;q[2].edge_flag
909
		mov eax,[clip_bit]
898
		mov dword[edx+GLVertex.edge_flag],0 ;q[2].edge_flag=0
Line 910... Line 899...
910
		inc eax
899
		mov eax,[clip_bit]
911
		push eax ;для вызова нижней функции
900
		inc eax
912
		mov edi,ebp
901
		push eax ;для вызова нижней функции
913
		sub edi,2*sizeof.GLVertex
902
		lea edi,[ebp-2*sizeof.GLVertex]
914
		stdcall gl_draw_triangle_clip,[context],edi,ecx,edx,eax ;gl_draw_triangle_clip(c,&tmp1,q[1],q[2],clip_bit+1)
903
		stdcall gl_draw_triangle_clip,[context],edi,ecx,edx,eax ;gl_draw_triangle_clip(c,&tmp1,q[1],q[2],clip_bit+1)
915
 
904
 
916
		mov dword[tmp2.edge_flag],0
905
		mov dword[tmp2.edge_flag],0
917
		mov dword[tmp1.edge_flag],0
906
		mov dword[tmp1.edge_flag],0
918
		mov eax,[edge_flag_tmp]
907
		mov eax,[edge_flag_tmp]
Line 952... Line 941...
952
			mov [q+4],ebx
941
			mov [q+4],ebx
953
			mov [q+8],ecx
942
			mov [q+8],ecx
954
		.els_4_end:
943
		.els_4_end:
Line 955... Line 944...
955
 
944
 
956
		mov ebx,[q]
945
		mov ebx,[q]
957
		add ebx,offs_vert_pc
946
		add ebx,GLVertex.pc
958
		mov ecx,[q+4]
947
		mov ecx,[q+4]
959
		add ecx,offs_vert_pc
948
		add ecx,GLVertex.pc
960
		mov edx,[q+8]
949
		mov edx,[q+8]
Line 961... Line 950...
961
		add edx,offs_vert_pc
950
		add edx,GLVertex.pc
962
 
951
 
963
		lea eax,[clip_proc]
-
 
964
		mov edi,[clip_bit]
952
		lea eax,[clip_proc]
965
		shl edi,2
-
 
966
		add eax,edi
953
		mov edi,[clip_bit]
967
		mov edi,ebp
954
		lea eax,[eax+4*edi]
968
		sub edi,(2*sizeof.GLVertex)-offs_vert_pc
955
		lea edi,[ebp-(2*sizeof.GLVertex)+GLVertex.pc]
969
		stdcall dword[eax],edi,ebx,ecx ;clip_proc[clip_bit](&tmp1.pc,&q[0].pc,&q[1].pc)
956
		stdcall dword[eax],edi,ebx,ecx ;clip_proc[clip_bit](&tmp1.pc,&q[0].pc,&q[1].pc)
Line 970... Line 957...
970
		sub edi,offs_vert_pc
957
		sub edi,GLVertex.pc
971
		stdcall updateTmp,[context],[q],[q+4],eax
958
		stdcall updateTmp,[context],[q],[q+4],eax
972
 
-
 
973
		lea eax,[clip_proc]
959
 
974
		mov edi,[clip_bit]
-
 
975
		shl edi,2
960
		lea eax,[clip_proc]
976
		add eax,edi
961
		mov edi,[clip_bit]
977
		mov edi,ebp
962
		lea eax,[eax+4*edi]
978
		sub edi,sizeof.GLVertex-offs_vert_pc
963
		lea edi,[ebp-sizeof.GLVertex+GLVertex.pc]
Line 979... Line 964...
979
		stdcall dword[eax],edi,ebx,edx ;clip_proc[clip_bit](&tmp2.pc,&q[0].pc,&q[2].pc)
964
		stdcall dword[eax],edi,ebx,edx ;clip_proc[clip_bit](&tmp2.pc,&q[0].pc,&q[2].pc)
980
		sub edi,offs_vert_pc
965
		sub edi,GLVertex.pc
981
		stdcall updateTmp,[context],[q],[q+8],eax
966
		stdcall updateTmp,[context],[q],[q+8],eax
982
 
967
 
983
		mov dword[tmp1.edge_flag],1
968
		mov dword[tmp1.edge_flag],1
984
		mov eax,[edx+offs_vert_edge_flag-offs_vert_pc]
969
		mov eax,[edx+GLVertex.edge_flag-GLVertex.pc]
985
		mov dword[tmp2.edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
970
		mov dword[tmp2.edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
Line 995... Line 980...
995
endp
980
endp
Line 996... Line 981...
996
 
981
 
997
align 16
982
align 16
998
proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword
983
proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword
999
	mov eax,[p2]
984
	mov eax,[p2]
1000
	push dword[eax+offs_vert_zp+offs_Z]
985
	push dword[eax+GLVertex.zp+offs_Z]
1001
	mov eax,[p1]
986
	mov eax,[p1]
1002
	push dword[eax+offs_vert_zp+offs_Z]
987
	push dword[eax+GLVertex.zp+offs_Z]
1003
	mov eax,[p0]
988
	mov eax,[p0]
1004
	push dword[eax+offs_vert_zp+offs_Z]
989
	push dword[eax+GLVertex.zp+offs_Z]
1005
	stdcall gl_add_select1, [context] ;,p0.zp.z, p1.zp.z, p2.zp.z
990
	stdcall gl_add_select1, [context] ;,p0.zp.z, p1.zp.z, p2.zp.z
1006
	ret
991
	ret
Line 1007... Line 992...
1007
endp
992
endp
Line 1029... Line 1014...
1029
;    count_pixels+=abs(norm)/2;
1014
;    count_pixels+=abs(norm)/2;
1030
	inc dword[count_triangles]
1015
	inc dword[count_triangles]
1031
end if
1016
end if
Line 1032... Line 1017...
1032
 
1017
 
1033
	mov ebx,[p1]
1018
	mov ebx,[p1]
1034
	add ebx,offs_vert_zp
1019
	add ebx,GLVertex.zp
1035
	mov ecx,[p2]
1020
	mov ecx,[p2]
1036
	add ecx,offs_vert_zp
1021
	add ecx,GLVertex.zp
1037
	mov edx,[context]
1022
	mov edx,[context]
1038
	cmp dword[edx+GLContext.texture_2d_enabled],0
1023
	cmp dword[edx+GLContext.texture_2d_enabled],0
1039
	je .els_i
1024
	je .els_i
1040
		;if (context.texture_2d_enabled)
1025
		;if (context.texture_2d_enabled)
Line 1045... Line 1030...
1045
		mov eax,[eax] ;переход по указателю
1030
		mov eax,[eax] ;переход по указателю
1046
		;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax]
1031
		;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax]
1047
		stdcall ZB_setTexture, [edx+GLContext.zb], [eax],\
1032
		stdcall ZB_setTexture, [edx+GLContext.zb], [eax],\
1048
			[eax+offs_imag_s_bound],[eax+offs_imag_t_bound],[eax+offs_imag_xsize_log2]
1033
			[eax+offs_imag_s_bound],[eax+offs_imag_t_bound],[eax+offs_imag_xsize_log2]
1049
		mov eax,[p0]
1034
		mov eax,[p0]
1050
		add eax,offs_vert_zp
1035
		add eax,GLVertex.zp
1051
		push ecx
1036
		push ecx
1052
		push ebx
1037
		push ebx
1053
		push eax
1038
		push eax
1054
		push dword[edx+GLContext.zb]
1039
		push dword[edx+GLContext.zb]
1055
		cmp dword[edx+GLContext.matrix_model_projection_no_w_transform],0
1040
		cmp dword[edx+GLContext.matrix_model_projection_no_w_transform],0
Line 1061... Line 1046...
1061
			call ZB_fillTriangleMapping
1046
			call ZB_fillTriangleMapping
1062
		jmp .end_f
1047
		jmp .end_f
1063
align 4
1048
align 4
1064
	.els_i:
1049
	.els_i:
1065
		mov eax,[p0]
1050
		mov eax,[p0]
1066
		add eax,offs_vert_zp
1051
		add eax,GLVertex.zp
1067
		cmp dword[edx+GLContext.current_shade_model],GL_SMOOTH
1052
		cmp dword[edx+GLContext.current_shade_model],GL_SMOOTH
1068
		jne .els
1053
		jne .els
1069
			;else if (context.current_shade_model == GL_SMOOTH)
1054
			;else if (context.current_shade_model == GL_SMOOTH)
1070
			stdcall ZB_fillTriangleSmooth, dword[edx+GLContext.zb],eax,ebx,ecx
1055
			stdcall ZB_fillTriangleSmooth, dword[edx+GLContext.zb],eax,ebx,ecx
1071
			jmp .end_f
1056
			jmp .end_f
Line 1091... Line 1076...
1091
		lea ecx,[ZB_line]
1076
		lea ecx,[ZB_line]
1092
	@@:
1077
	@@:
Line 1093... Line 1078...
1093
 
1078
 
1094
	;if (p0.edge_flag) ZB_line_z(context.zb,&p0.zp,&p1.zp)
1079
	;if (p0.edge_flag) ZB_line_z(context.zb,&p0.zp,&p1.zp)
1095
	mov eax,[p0]
1080
	mov eax,[p0]
1096
	cmp dword[eax+offs_vert_edge_flag],0
1081
	cmp dword[eax+GLVertex.edge_flag],0
1097
	je @f
-
 
1098
		mov ebx,eax
1082
	je @f
1099
		add ebx,offs_vert_zp
1083
		lea ebx,[eax+GLVertex.zp]
1100
		mov eax,[p1]
1084
		mov eax,[p1]
1101
		add eax,offs_vert_zp
1085
		add eax,GLVertex.zp
1102
		stdcall ecx,dword[edx+GLContext.zb],ebx,eax
1086
		stdcall ecx,dword[edx+GLContext.zb],ebx,eax
1103
	@@:
1087
	@@:
1104
	;if (p1.edge_flag) ZB_line_z(context.zb,&p1.zp,&p2.zp)
1088
	;if (p1.edge_flag) ZB_line_z(context.zb,&p1.zp,&p2.zp)
1105
	mov eax,[p1]
1089
	mov eax,[p1]
1106
	cmp dword[eax+offs_vert_edge_flag],0
1090
	cmp dword[eax+GLVertex.edge_flag],0
1107
	je @f
-
 
1108
		mov ebx,eax
1091
	je @f
1109
		add ebx,offs_vert_zp
1092
		lea ebx,[eax+GLVertex.zp]
1110
		mov eax,[p2]
1093
		mov eax,[p2]
1111
		add eax,offs_vert_zp
1094
		add eax,GLVertex.zp
1112
		stdcall ecx,dword[edx+GLContext.zb],ebx,eax
1095
		stdcall ecx,dword[edx+GLContext.zb],ebx,eax
1113
	@@:
1096
	@@:
1114
	;if (p2.edge_flag) ZB_line_z(context.zb,&p2.zp,&p0.zp);
1097
	;if (p2.edge_flag) ZB_line_z(context.zb,&p2.zp,&p0.zp);
1115
	mov eax,[p2]
1098
	mov eax,[p2]
1116
	cmp dword[eax+offs_vert_edge_flag],0
1099
	cmp dword[eax+GLVertex.edge_flag],0
1117
	je @f
-
 
1118
		mov ebx,eax
1100
	je @f
1119
		add ebx,offs_vert_zp
1101
		lea ebx,[eax+GLVertex.zp]
1120
		mov eax,[p0]
1102
		mov eax,[p0]
1121
		add eax,offs_vert_zp
1103
		add eax,GLVertex.zp
1122
		stdcall ecx,dword[edx+GLContext.zb],ebx,eax
1104
		stdcall ecx,dword[edx+GLContext.zb],ebx,eax
Line 1123... Line 1105...
1123
	@@:
1105
	@@:
1124
 
1106
 
Line 1125... Line 1107...
1125
	ret
1107
	ret
1126
endp
1108
endp
1127
 
1109
 
1128
; Render a clipped triangle in point mode
1110
; Render a clipped triangle in point mode
1129
align 16
1111
align 16
1130
proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p2:dword
1112
proc gl_draw_triangle_point uses eax edx, context:dword, p0:dword,p1:dword,p2:dword
1131
	mov edx,[context]
1113
	mov edx,[context]
1132
	mov eax,[p0]
-
 
1133
	cmp dword[eax+offs_vert_edge_flag],0
1114
	mov eax,[p0]
1134
	je @f
1115
	cmp dword[eax+GLVertex.edge_flag],0
1135
		mov ebx,eax
1116
	je @f
1136
		add ebx,offs_vert_zp
1117
		lea eax,[eax+GLVertex.zp]
1137
		stdcall ZB_plot,dword[edx+GLContext.zb],ebx
1118
		stdcall ZB_plot,dword[edx+GLContext.zb],eax
1138
	@@:
1119
	@@:
1139
	mov eax,[p1]
-
 
1140
	cmp dword[eax+offs_vert_edge_flag],0
1120
	mov eax,[p1]
1141
	je @f
1121
	cmp dword[eax+GLVertex.edge_flag],0
1142
		mov ebx,eax
1122
	je @f
1143
		add ebx,offs_vert_zp
1123
		lea eax,[eax+GLVertex.zp]
1144
		stdcall ZB_plot,dword[edx+GLContext.zb],ebx
1124
		stdcall ZB_plot,dword[edx+GLContext.zb],eax
1145
	@@:
1125
	@@:
1146
	mov eax,[p2]
-
 
1147
	cmp dword[eax+offs_vert_edge_flag],0
1126
	mov eax,[p2]
1148
	je @f
1127
	cmp dword[eax+GLVertex.edge_flag],0
1149
		mov ebx,eax
1128
	je @f
1150
		add ebx,offs_vert_zp
1129
		lea eax,[eax+GLVertex.zp]
1151
		stdcall ZB_plot,dword[edx+GLContext.zb],ebx
1130
		stdcall ZB_plot,dword[edx+GLContext.zb],eax