Subversion Repositories Kolibri OS

Rev

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

Rev 5262 Rev 5269
Line 106... Line 106...
106
	fchs
106
	fchs
107
	mov dword[zsize],(1 shl ZB_POINT_Z_FRAC_BITS) / 2
107
	mov dword[zsize],(1 shl ZB_POINT_Z_FRAC_BITS) / 2
108
	fiadd dword[zsize]
108
	fiadd dword[zsize]
109
	fstp dword[eax+offs_vpor_trans+offs_Z]
109
	fstp dword[eax+offs_vpor_trans+offs_Z]
110
if DEBUG ;gl_eval_viewport
110
	ret
111
	stdcall dbg_print,f_ev,txt_nl
-
 
112
	add eax,offs_vpor_scale
-
 
113
	stdcall gl_print_matrix,eax,1
-
 
114
	add eax,8
-
 
115
	stdcall gl_print_matrix,eax,1
-
 
116
end if
-
 
117
	ret
-
 
118
endp
111
endp
119
 
112
 
Line 120... Line 113...
120
 
113
 
Line 258... Line 251...
258
			fld dword[ebx]     ;st0 = m[0]
251
			fld dword[ebx]     ;st0 = m[0]
259
			fmul st0,st3       ;st0 *= v.coord.X
252
			fmul st0,st3       ;st0 *= v.coord.X
260
			fld dword[ebx+4]   ;st0 = m[1]
253
			fld dword[ebx+4]   ;st0 = m[1]
261
			fmul st0,st3       ;st0 *= v.coord.Y
254
			fmul st0,st3       ;st0 *= v.coord.Y
262
			fld dword[ebx+8]   ;st0 = m[2]
255
			faddp              ;st0 = v.coord.X * m[0] + v.coord.Y * m[1]
-
 
256
			fld dword[ebx+8]   ;st0 = m[2]
263
			fmul st0,st3       ;st0 *= v.coord.Z
257
			fmul st0,st2       ;st0 *= v.coord.Z
264
			fadd dword[ebx+12] ;st0 += m[3]
258
			fadd dword[ebx+12] ;st0 += m[3]
265
			faddp              ;st0 += v.coord.Z * m[2] 
259
			faddp              ;st0 += v.ec.X
266
			faddp              ;st0 += v.coord.Y * m[1] 
-
 
267
			fstp dword[edx+offs_vert_ec] ;v.ec.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
260
			fstp dword[edx+offs_vert_ec] ;v.ec.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
268
			add ebx,16 ;следущая строка матрицы
261
			add ebx,16 ;следущая строка матрицы
269
			add edx,4  ;следущая координата вектора
262
			add edx,4  ;следущая координата вектора
270
		loop .cycle_0
263
		loop .cycle_0
271
		ffree st0
264
		ffree st0
272
		fincstp
265
		fincstp
Line 288... Line 281...
288
			fld dword[ebx]     ;st0 = m[0]
281
			fld dword[ebx]     ;st0 = m[0]
289
			fmul st0,st3       ;st0 *= v.ec.X
282
			fmul st0,st3       ;st0 *= v.ec.X
290
			fld dword[ebx+4]   ;st0 = m[1]
283
			fld dword[ebx+4]   ;st0 = m[1]
291
			fmul st0,st3       ;st0 *= v.ec.Y
284
			fmul st0,st3       ;st0 *= v.ec.Y
292
			fld dword[ebx+8]   ;st0 = m[2]
285
			faddp              ;st0 = v.ec.X * m[0] + v.ec.Y * m[1]
-
 
286
			fld dword[ebx+8]   ;st0 = m[2]
293
			fmul st0,st3       ;st0 *= v.ec.Z
287
			fmul st0,st2       ;st0 *= v.ec.Z
294
			fadd dword[ebx+12] ;st0 += m[3]
288
			fadd dword[ebx+12] ;st0 += m[3]
295
			faddp              ;st0 += v.ec.Z * m[2]
289
			faddp              ;st0 = v.pc.X
296
			faddp              ;st0 += v.ec.Y * m[1]
-
 
297
			fstp dword[edx+offs_vert_pc] ;v.pc.X = v.ec.X * m[0] + v.ec.Y * m[1] + v.ec.Z * m[2] + m[3]
290
			fstp dword[edx+offs_vert_pc] ;v.pc.X = v.ec.X * m[0] + v.ec.Y * m[1] + v.ec.Z * m[2] + m[3]
298
			add ebx,16 ;следущая строка матрицы
291
			add ebx,16 ;следущая строка матрицы
299
			add edx,4  ;следущая координата вектора
292
			add edx,4  ;следущая координата вектора
300
		loop .cycle_1
293
		loop .cycle_1
301
		ffree st0
294
		ffree st0
302
		fincstp
295
		fincstp
Line 315... Line 308...
315
		fld dword[edi+offs_Y]
308
		fld dword[edi+offs_Y]
316
		fld dword[edi+offs_Z]
309
		fld dword[edi+offs_Z]
317
 
310
 
Line 318... Line 311...
318
		mov ecx,3
311
		mov ecx,3
-
 
312
		add edx,offs_vert_normal
319
		.cycle_2:
313
		.cycle_2:
320
			fld dword[ebx]   ;st0 = m[0]
314
			fld dword[ebx]   ;st0 = m[0]
321
			fmul st0,st3     ;st0 *= n.X
315
			fmul st0,st3     ;st0 *= n.X
322
			fld dword[ebx+4] ;st0 = m[1]
316
			fld dword[ebx+4] ;st0 = m[1]
323
			fmul st0,st3     ;st0 *= n.Y
317
			fmul st0,st3     ;st0 *= n.Y
-
 
318
			faddp            ;st0 = n.X * m[0] + n.Y * m[1]
324
			fld dword[ebx+8] ;st0 = m[2]
319
			fld dword[ebx+8] ;st0 = m[2]
325
			fmul st0,st3     ;st0 *= n.Z
320
			fmul st0,st2     ;st0 *= n.Z
326
			faddp            ;st0 += n.Z * m[2]
-
 
327
			faddp            ;st0 += n.Y * m[1]
321
			faddp            ;st0 = v.normal.X
328
			fstp dword[edx+offs_vert_normal] ;v.normal.X = n.X * m[0] + n.Y * m[1] + n.Z * m[2]
322
			fstp dword[edx]  ;v.normal.X = n.X * m[0] + n.Y * m[1] + n.Z * m[2]
329
			add ebx,16 ;следущая строка матрицы
323
			add ebx,16 ;следущая строка матрицы
330
			add edx,4  ;следущая координата вектора
324
			add edx,4  ;следущая координата вектора
331
		loop .cycle_2
325
		loop .cycle_2
Line 332... Line 326...
332
 
326
 
333
		cmp dword[eax+offs_cont_normalize_enabled],0
327
		cmp dword[eax+offs_cont_normalize_enabled],0
334
		je .end_els
328
		je .end_els
335
			mov edx,[v]
-
 
336
			add edx,offs_vert_normal
329
			sub edx,12
337
			stdcall gl_V3_Norm,edx
330
			stdcall gl_V3_Norm,edx
338
		jmp .end_els
331
		jmp .end_els
339
	.els_0:
332
	.els_0:
340
		; no eye coordinates needed, no normal
333
		; no eye coordinates needed, no normal
Line 353... Line 346...
353
		fld dword[ebx]     ;st0 = m[0]
346
		fld dword[ebx]     ;st0 = m[0]
354
		fmul st0,st3       ;st0 *= v.coord.X
347
		fmul st0,st3       ;st0 *= v.coord.X
355
		fld dword[ebx+4]   ;st0 = m[1]
348
		fld dword[ebx+4]   ;st0 = m[1]
356
		fmul st0,st3       ;st0 *= v.coord.Y
349
		fmul st0,st3       ;st0 *= v.coord.Y
-
 
350
		faddp              ;st0 = v.coord.X * m[0] + v.coord.Y * m[1]
357
		fld dword[ebx+8]   ;st0 = m[2]
351
		fld dword[ebx+8]   ;st0 = m[2]
358
		fmul st0,st3       ;st0 *= v.coord.Z
352
		fmul st0,st2       ;st0 *= v.coord.Z
359
		fadd dword[ebx+12] ;st0 += m[3]
353
		fadd dword[ebx+12] ;st0 += m[3]
360
		faddp              ;st0 += v.coord.Z * m[2]
-
 
361
		faddp              ;st0 += v.coord.Y * m[1]
354
		faddp              ;st0 = v.pc.X
362
		fstp dword[esi]    ;v.pc.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
355
		fstp dword[esi]    ;v.pc.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
Line 363... Line 356...
363
 
356
 
364
		fld dword[ebx+16]  ;st0 = m[4]
357
		fld dword[ebx+16]  ;st0 = m[4]
365
		fmul st0,st3       ;st0 *= v.coord.X
358
		fmul st0,st3       ;st0 *= v.coord.X
366
		fld dword[ebx+20]  ;st0 = m[5]
359
		fld dword[ebx+20]  ;st0 = m[5]
-
 
360
		fmul st0,st3       ;st0 *= v.coord.Y
367
		fmul st0,st3       ;st0 *= v.coord.Y
361
		faddp              ;st0 = v.coord.X * m[4] + v.coord.Y * m[5]
368
		fld dword[ebx+24]  ;st0 = m[6]
362
		fld dword[ebx+24]  ;st0 = m[6]
369
		fmul st0,st3       ;st0 *= v.coord.Z
363
		fmul st0,st2       ;st0 *= v.coord.Z
370
		fadd dword[ebx+28] ;st0 += m[7]
-
 
371
		faddp              ;st0 += v.coord.Z * m[6]
364
		fadd dword[ebx+28] ;st0 += m[7]
372
		faddp              ;st0 += v.coord.Y * m[5]
365
		faddp              ;st0 = v.pc.Y
Line 373... Line 366...
373
		fstp dword[esi+4]  ;v.pc.X = v.coord.X * m[4] + v.coord.Y * m[5] + v.coord.Z * m[6] + m[7]
366
		fstp dword[esi+4]  ;v.pc.Y = v.coord.X * m[4] + v.coord.Y * m[5] + v.coord.Z * m[6] + m[7]
374
 
367
 
375
		fld dword[ebx+32]  ;st0 = m[8]
368
		fld dword[ebx+32]  ;st0 = m[8]
376
		fmul st0,st3       ;st0 *= v.coord.X
369
		fmul st0,st3       ;st0 *= v.coord.X
-
 
370
		fld dword[ebx+36]  ;st0 = m[9]
377
		fld dword[ebx+36]  ;st0 = m[9]
371
		fmul st0,st3       ;st0 *= v.coord.Y
378
		fmul st0,st3       ;st0 *= v.coord.Y
372
		faddp              ;st0 = v.coord.X * m[8] + v.coord.Y * m[9]
379
		fld dword[ebx+40]  ;st0 = m[10]
373
		fld dword[ebx+40]  ;st0 = m[10]
380
		fmul st0,st3       ;st0 *= v.coord.Z
374
		fmul st0,st2       ;st0 *= v.coord.Z
381
		fadd dword[ebx+44] ;st0 += m[11]
-
 
382
		faddp              ;st0 += v.coord.Z * m[10]
375
		fadd dword[ebx+44] ;st0 += m[11]
Line 383... Line 376...
383
		faddp              ;st0 += v.coord.Y * m[9]
376
		faddp              ;st0 = v.pc.Z
384
		fstp dword[esi+8]  ;v.pc.X = v.coord.X * m[8] + v.coord.Y * m[9] + v.coord.Z * m[10] + m[11]
377
		fstp dword[esi+8]  ;v.pc.Z = v.coord.X * m[8] + v.coord.Y * m[9] + v.coord.Z * m[10] + m[11]
385
 
378
 
386
		cmp dword[eax+offs_cont_matrix_model_projection_no_w_transform],0
379
		cmp dword[eax+offs_cont_matrix_model_projection_no_w_transform],0
Line 393... Line 386...
393
			fld dword[ebx+48]  ;st0 = m[12]
386
			fld dword[ebx+48]  ;st0 = m[12]
394
			fmul st0,st3       ;st0 *= v.coord.X
387
			fmul st0,st3       ;st0 *= v.coord.X
395
			fld dword[ebx+52]  ;st0 = m[13]
388
			fld dword[ebx+52]  ;st0 = m[13]
396
			fmul st0,st3       ;st0 *= v.coord.Y
389
			fmul st0,st3       ;st0 *= v.coord.Y
397
			fld dword[ebx+56]  ;st0 = m[14]
390
			faddp              ;st0 = v.coord.X * m[12] + v.coord.Y * m[13]
-
 
391
			fld dword[ebx+56]  ;st0 = m[14]
398
			fmul st0,st3       ;st0 *= v.coord.Z
392
			fmul st0,st2       ;st0 *= v.coord.Z
399
			fadd dword[ebx+60] ;st0 += m[15]
393
			fadd dword[ebx+60] ;st0 += m[15]
400
			faddp              ;st0 += v.coord.Z * m[14] 
394
			faddp              ;st0 = v.pc.W
401
			faddp              ;st0 += v.coord.Y * m[13] 
-
 
402
			fstp dword[esi+12] ;v.pc.W = v.coord.X * m[12] + v.coord.Y * m[13] + v.coord.Z * m[14] + m[15]
395
			fstp dword[esi+12] ;v.pc.W = v.coord.X * m[12] + v.coord.Y * m[13] + v.coord.Z * m[14] + m[15]
403
	.end_els:
396
	.end_els:
404
	ffree st0
397
	ffree st0
405
	fincstp
398
	fincstp
406
	ffree st0
399
	ffree st0
407
	fincstp
400
	fincstp
Line 490... Line 483...
490
	cmp dword[edx+offs_cont_texture_2d_enabled],0
483
	cmp dword[edx+offs_cont_texture_2d_enabled],0
491
	je @f
484
	je @f
492
		cmp dword[edx+offs_cont_apply_texture_matrix],0
485
		cmp dword[edx+offs_cont_apply_texture_matrix],0
493
		je .els_1
486
		je .els_1
494
;           gl_M4_MulV4(&v->tex_coord, c->matrix_stack_ptr[2], &c->current_tex_coord);
487
			mov eax,edx
-
 
488
			add eax,offs_cont_current_tex_coord
-
 
489
			push eax ;&context.current_tex_coord
-
 
490
			mov eax,ebx
-
 
491
			add eax,offs_vert_tex_coord
-
 
492
			stdcall gl_M4_MulV4, eax, dword[edx+offs_cont_matrix_stack_ptr+8]
495
			jmp @f
493
			jmp @f
496
		.els_1:
494
		.els_1:
497
			mov eax,[edx+offs_cont_current_tex_coord]
495
			mov esi,edx
-
 
496
			add esi,offs_cont_current_tex_coord
498
			mov [ebx+offs_vert_tex_coord],eax
497
			mov edi,ebx
-
 
498
			add edi,offs_vert_tex_coord
499
	@@:
499
			mov ecx,4
-
 
500
			rep movsd
-
 
501
	@@:
500
 
502
 
Line 501... Line 503...
501
	; precompute the mapping to the viewport
503
	; precompute the mapping to the viewport
502
	cmp dword[ebx+offs_vert_clip_code],0
504
	cmp dword[ebx+offs_vert_clip_code],0
503
	jne @f
505
	jne @f
Line 570... Line 572...
570
		jmp .end_f
572
		jmp .end_f
571
	@@:
573
	@@:
572
	cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP
574
	cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP
573
	jne @f
575
	jne @f
574
;       if (c->vertex_cnt >= 3) {
576
		cmp dword[edx+offs_cont_vertex_cnt],3 ;if (context.vertex_cnt >= 3)
575
;           if (n == 3)
577
		jl .end_f
-
 
578
			cmp dword[n],3
576
;               n = 0;
579
			jne .ts3
-
 
580
				xor eax,eax
-
 
581
				mov dword[n],eax
577
;            /* needed to respect triangle orientation */
582
			.ts3:
-
 
583
			; needed to respect triangle orientation
578
;            switch(c->vertex_cnt & 1) {
584
			mov eax,[edx+offs_cont_vertex]
-
 
585
			bt dword[edx+offs_cont_vertex_cnt],0
579
;            case 0:
586
			jc .case_1
580
;               gl_draw_triangle(c,&c->vertex[2],&c->vertex[1],&c->vertex[0]);
587
				mov [esp-12],eax
-
 
588
				add eax,sizeof.GLVertex
581
;               break;
589
				mov [esp-8],eax
582
;            default:
590
				add eax,sizeof.GLVertex
583
;            case 1:
591
				mov [esp-4],eax
584
;               gl_draw_triangle(c,&c->vertex[0],&c->vertex[1],&c->vertex[2]);
592
				sub esp,12
-
 
593
				stdcall gl_draw_triangle, edx ;&v[2],&v[1],&v[0]
585
;               break;
594
				jmp .end_f
-
 
595
			.case_1:
-
 
596
				mov [esp-4],eax
586
;            }
597
				add eax,sizeof.GLVertex
-
 
598
				mov [esp-8],eax
587
;       }
599
				add eax,sizeof.GLVertex
-
 
600
				mov [esp-12],eax
-
 
601
				sub esp,12
588
		jmp .end_f
602
				stdcall gl_draw_triangle, edx ;&v[0],&v[1],&v[2]
-
 
603
		jmp .end_f
589
	@@:
604
	@@:
590
	cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN
605
	cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN
591
	jne @f
606
	jne @f
592
		cmp dword[n],3
607
		cmp dword[n],3
593
		jne .end_f
608
		jne .end_f