Subversion Repositories Kolibri OS

Rev

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

Rev 5218 Rev 5290
Line 50... Line 50...
50
		stdcall gl_free,[state]
50
		stdcall gl_free,[state]
51
	@@:
51
	@@:
52
	ret
52
	ret
53
endp
53
endp
Line -... Line 54...
-
 
54
 
-
 
55
;
-
 
56
; Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE,
-
 
57
; or GLU_POINT.
-
 
58
;
54
 
59
align 4
-
 
60
proc gluQuadricDrawStyle uses eax ebx, qobj:dword, drawStyle:dword
-
 
61
	mov eax,[qobj]
-
 
62
	or eax,eax
-
 
63
	jz .err_q
-
 
64
	mov ebx,[drawStyle]
-
 
65
	cmp ebx,GLU_FILL
-
 
66
	je @f
-
 
67
	cmp ebx,GLU_LINE
-
 
68
	je @f
-
 
69
	cmp ebx,GLU_SILHOUETTE
-
 
70
	je @f
-
 
71
	cmp ebx,GLU_POINT
-
 
72
	je @f
-
 
73
	jmp .err_q
-
 
74
	@@:
-
 
75
		mov dword[eax+offs_qobj_DrawStyle],ebx
-
 
76
		jmp @f
-
 
77
	.err_q:
-
 
78
		;quadric_error(qobj, GLU_INVALID_ENUM, "qluQuadricDrawStyle")
-
 
79
	@@:
-
 
80
	ret
-
 
81
endp
55
;void gluQuadricDrawStyle(GLUquadricObj *obj, int style)
82
 
-
 
83
;
56
;{
84
; Set the orientation to GLU_INSIDE or GLU_OUTSIDE.
-
 
85
;
-
 
86
align 4
-
 
87
proc gluQuadricOrientation uses eax ebx, qobj:dword, orientation:dword
-
 
88
	mov eax,[qobj]
-
 
89
	or eax,eax
-
 
90
	jz .err_q
-
 
91
	mov ebx,[orientation]
-
 
92
	cmp ebx,GLU_INSIDE
-
 
93
	je @f
-
 
94
	cmp ebx,GLU_OUTSIDE
-
 
95
	je @f
-
 
96
	jmp .err_q
-
 
97
	@@:
-
 
98
		mov dword[eax+offs_qobj_Orientation],ebx
-
 
99
		jmp @f
-
 
100
	.err_q:
-
 
101
		;quadric_error(qobj, GLU_INVALID_ENUM, "qluQuadricOrientation")
-
 
102
	@@:
-
 
103
	ret
Line 57... Line 104...
57
;}
104
endp
58
 
105
 
59
;void gluCylinder(GLUquadricObj *qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks )
106
;void gluCylinder(GLUquadricObj *qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks )
Line 119... Line 166...
119
	fidiv dword[slices]
166
	fidiv dword[slices]
120
	fstp dword[dtheta]
167
	fstp dword[dtheta]
121
	ffree st0
168
	ffree st0
122
	fincstp
169
	fincstp
Line -... Line 170...
-
 
170
 
-
 
171
	cmp dword[eax+offs_qobj_DrawStyle],GLU_FILL ;if (qobj.DrawStyle==GLU_FILL)
-
 
172
	jne .if_glu_line
123
 
173
 
124
	; draw +Z end as a triangle fan
174
	; draw +Z end as a triangle fan
125
	stdcall glBegin,GL_TRIANGLE_FAN
175
	stdcall glBegin,GL_TRIANGLE_FAN
126
	cmp dword[normals],GL_TRUE
176
	cmp dword[normals],GL_TRUE
127
	jne @f
177
	jne @f
Line 172... Line 222...
172
			fstp dword[esp-4]
222
			fstp dword[esp-4]
173
			fld dword[y]
223
			fld dword[y]
174
			fmul st0,st1
224
			fmul st0,st1
175
			fstp dword[esp-8]
225
			fstp dword[esp-8]
176
			fld dword[x]
226
			fld dword[x]
177
			fmul st0,st1
227
			fmulp
178
			fstp dword[esp-12]
228
			fstp dword[esp-12]
179
			sub esp,12
229
			sub esp,12
180
			ffree st0
-
 
181
			fincstp
-
 
182
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
230
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
183
		@@:
231
		@@:
184
		fld dword[radius]
232
		fld dword[radius]
185
		fld dword[z]
233
		fld dword[z]
186
		fmul st0,st1
234
		fmul st0,st1
187
		fstp dword[esp-4]
235
		fstp dword[esp-4]
188
		fld dword[y]
236
		fld dword[y]
189
		fmul st0,st1
237
		fmul st0,st1
190
		fstp dword[esp-8]
238
		fstp dword[esp-8]
191
		fld dword[x]
239
		fld dword[x]
192
		fmul st0,st1
240
		fmulp
193
		fstp dword[esp-12]
241
		fstp dword[esp-12]
194
		sub esp,12
242
		sub esp,12
195
		ffree st0
-
 
196
		fincstp
-
 
197
		call glVertex3f ;x*radius, y*radius, z*radius
243
		call glVertex3f ;x*radius, y*radius, z*radius
198
		inc dword[j]
244
		inc dword[j]
199
		jmp .cycle_0
245
		jmp .cycle_0
200
	.cycle_0_end:
246
	.cycle_0_end:
201
	stdcall glEnd
247
	call glEnd
Line 202... Line 248...
202
 
248
 
203
	fld1
249
	fld1
204
	fidiv dword[slices]
250
	fidiv dword[slices]
205
	fstp dword[d_s] ;1.0 / slices
251
	fstp dword[d_s] ;1.0 / slices
Line 265... Line 311...
265
			fstp dword[esp-4]
311
			fstp dword[esp-4]
266
			fld dword[y]
312
			fld dword[y]
267
			fmul st0,st1
313
			fmul st0,st1
268
			fstp dword[esp-8]
314
			fstp dword[esp-8]
269
			fld dword[x]
315
			fld dword[x]
270
			fmul st0,st1
316
			fmulp
271
			fstp dword[esp-12]
317
			fstp dword[esp-12]
272
			sub esp,12
318
			sub esp,12
273
			ffree st0
-
 
274
			fincstp
-
 
275
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
319
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
276
		@@:
320
		@@:
277
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
321
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
278
		je @f
322
		je @f
279
;glTexCoord2f(s,1-t)
323
;glTexCoord2f(s,1-t)
Line 284... Line 328...
284
		fstp dword[esp-4]
328
		fstp dword[esp-4]
285
		fld dword[y]
329
		fld dword[y]
286
		fmul st0,st1
330
		fmul st0,st1
287
		fstp dword[esp-8]
331
		fstp dword[esp-8]
288
		fld dword[x]
332
		fld dword[x]
289
		fmul st0,st1
333
		fmulp
290
		fstp dword[esp-12]
334
		fstp dword[esp-12]
291
		sub esp,12
335
		sub esp,12
292
		ffree st0
-
 
293
		fincstp
-
 
294
		call glVertex3f ;x*radius, y*radius, z*radius
336
		call glVertex3f ;x*radius, y*radius, z*radius
295
		fld dword[rho]
337
		fld dword[rho]
296
		fadd dword[drho]
338
		fadd dword[drho]
297
		fsin ;st0 = sin(rho+drho)
339
		fsin ;st0 = sin(rho+drho)
298
		fld dword[theta]
340
		fld dword[theta]
Line 317... Line 359...
317
			fstp dword[esp-4]
359
			fstp dword[esp-4]
318
			fld dword[y]
360
			fld dword[y]
319
			fmul st0,st1
361
			fmul st0,st1
320
			fstp dword[esp-8]
362
			fstp dword[esp-8]
321
			fld dword[x]
363
			fld dword[x]
322
			fmul st0,st1
364
			fmulp
323
			fstp dword[esp-12]
365
			fstp dword[esp-12]
324
			sub esp,12
366
			sub esp,12
325
			ffree st0
-
 
326
			fincstp
-
 
327
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
367
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
328
		@@:
368
		@@:
329
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
369
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
330
		je @f
370
		je @f
331
;glTexCoord2f(s,1-(t-dt))
371
;glTexCoord2f(s,1-(t-dt))
Line 339... Line 379...
339
		fstp dword[esp-4]
379
		fstp dword[esp-4]
340
		fld dword[y]
380
		fld dword[y]
341
		fmul st0,st1
381
		fmul st0,st1
342
		fstp dword[esp-8]
382
		fstp dword[esp-8]
343
		fld dword[x]
383
		fld dword[x]
344
		fmul st0,st1
384
		fmulp
345
		fstp dword[esp-12]
385
		fstp dword[esp-12]
346
		sub esp,12
386
		sub esp,12
347
		ffree st0
-
 
348
		fincstp
-
 
349
		call glVertex3f ;x*radius, y*radius, z*radius
387
		call glVertex3f ;x*radius, y*radius, z*radius
350
		inc dword[j]
388
		inc dword[j]
351
		jmp .cycle_2
389
		jmp .cycle_2
352
		.cycle_2_end:
390
		.cycle_2_end:
353
	stdcall glEnd
391
	call glEnd
354
	fld dword[t]
392
	fld dword[t]
355
	fsub dword[d_t]
393
	fsub dword[d_t]
356
	fstp dword[t]
394
	fstp dword[t]
357
	inc dword[i]
395
	inc dword[i]
358
	jmp .cycle_1
396
	jmp .cycle_1
Line 382... Line 420...
382
	fst dword[rho]
420
	fst dword[rho]
383
	fcos
421
	fcos
384
	fmul dword[nsign]
422
	fmul dword[nsign]
385
	fstp dword[z] ;z = nsign * cos(rho)
423
	fstp dword[z] ;z = nsign * cos(rho)
386
	mov [j],ecx
424
	mov [j],ecx
-
 
425
align 4
387
	.cycle_3: ;for (j=slices;j>=0;j--)
426
	.cycle_3: ;for (j=slices;j>=0;j--)
388
		cmp dword[j],0
427
		cmp dword[j],0
389
		jl .cycle_3_end
428
		jl .cycle_3_end
390
		fld dword[rho]
429
		fld dword[rho]
391
		fsin
430
		fsin
Line 435... Line 474...
435
		fstp dword[esp-4]
474
		fstp dword[esp-4]
436
		fld dword[y]
475
		fld dword[y]
437
		fmul st0,st1
476
		fmul st0,st1
438
		fstp dword[esp-8]
477
		fstp dword[esp-8]
439
		fld dword[x]
478
		fld dword[x]
440
		fmul st0,st1
479
		fmulp
441
		fstp dword[esp-12]
480
		fstp dword[esp-12]
442
		sub esp,12
481
		sub esp,12
443
		ffree st0
-
 
444
		fincstp
-
 
445
		call glVertex3f ;x*radius, y*radius, z*radius
482
		call glVertex3f ;x*radius, y*radius, z*radius
446
		dec dword[j]
483
		dec dword[j]
447
		jmp .cycle_3
484
		jmp .cycle_3
448
	.cycle_3_end:
485
	.cycle_3_end:
-
 
486
	call glEnd
-
 
487
	jmp .end_f
-
 
488
 
-
 
489
	.if_glu_line:
-
 
490
	cmp dword[eax+offs_qobj_DrawStyle],GLU_LINE ;if (qobj.DrawStyle==GLU_LINE)
-
 
491
	je @f
-
 
492
	cmp dword[eax+offs_qobj_DrawStyle],GLU_SILHOUETTE ;if (qobj.DrawStyle==GLU_SILHOUETTE)
-
 
493
	je @f
-
 
494
	jmp .if_glu_point
-
 
495
	@@:
-
 
496
 
-
 
497
	; draw stack lines
-
 
498
	mov dword[i],1
-
 
499
	mov ebx,[stacks]
-
 
500
	mov ecx,[slices]
-
 
501
align 4
-
 
502
	.cycle_4: ;for (i=1;i
-
 
503
		cmp dword[i],ebx
-
 
504
		jge .cycle_4_end
-
 
505
		; stack line at i==stacks-1 was missing here
-
 
506
 
-
 
507
		fild dword[i]
-
 
508
		fmul dword[drho]
-
 
509
		fstp dword[rho] ;rho = i * drho
-
 
510
		stdcall glBegin,GL_LINE_LOOP
-
 
511
		mov dword[j],0
-
 
512
align 4
-
 
513
		.cycle_5: ;for (j=0;j
-
 
514
			cmp dword[j],ecx
-
 
515
			jge .cycle_5_end
-
 
516
			fild dword[j]
-
 
517
			fmul dword[dtheta]
-
 
518
			fst dword[theta] ;theta = j * dtheta;
-
 
519
			fcos
-
 
520
			fld dword[rho]
-
 
521
			fsin
-
 
522
			fxch ;толкаем sin(rho) в st1
-
 
523
			fmul st0,st1
-
 
524
			fstp dword[x] ;x = cos(theta) * sin(rho)
-
 
525
			fld dword[theta]
-
 
526
			fsin
-
 
527
			fmulp ;множим на sin(rho) ранее записанный в st1
-
 
528
			fstp dword[y] ;y = sin(theta) * sin(rho)
-
 
529
			fld dword[rho]
-
 
530
			fcos
-
 
531
			fstp dword[z] ;z = cos(rho)
-
 
532
			cmp dword[normals],GL_TRUE
-
 
533
			jne @f
-
 
534
				fld dword[nsign]
-
 
535
				fld dword[z]
-
 
536
				fmul st0,st1
-
 
537
				fstp dword[esp-4]
-
 
538
				fld dword[y]
-
 
539
				fmul st0,st1
-
 
540
				fstp dword[esp-8]
-
 
541
				fld dword[x]
-
 
542
				fmulp
-
 
543
				fstp dword[esp-12]
-
 
544
				sub esp,12
-
 
545
				stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
-
 
546
			@@:
-
 
547
			fld dword[radius]
-
 
548
			fld dword[z]
-
 
549
			fmul st0,st1
-
 
550
			fstp dword[esp-4]
-
 
551
			fld dword[y]
-
 
552
			fmul st0,st1
-
 
553
			fstp dword[esp-8]
-
 
554
			fld dword[x]
-
 
555
			fmulp
-
 
556
			fstp dword[esp-12]
-
 
557
			sub esp,12
-
 
558
			call glVertex3f ;x*radius, y*radius, z*radius
-
 
559
			inc dword[j]
-
 
560
			jmp .cycle_5
-
 
561
		.cycle_5_end:
-
 
562
		call glEnd
-
 
563
		inc dword[i]
-
 
564
		jmp .cycle_4
-
 
565
	.cycle_4_end:
-
 
566
 
-
 
567
	; draw slice lines
-
 
568
	mov dword[j],0
-
 
569
align 4
-
 
570
	.cycle_6: ;for (j=0;j
-
 
571
		cmp dword[j],ecx
-
 
572
		jge .cycle_6_end
-
 
573
		fild dword[j]
-
 
574
		fmul dword[dtheta]
-
 
575
		fstp dword[theta] ;theta = j * dtheta;
-
 
576
		stdcall glBegin,GL_LINE_STRIP
-
 
577
		mov dword[i],0
-
 
578
align 4
-
 
579
		.cycle_7: ;for (i=0;i<=stacks;i++)
-
 
580
			cmp dword[i],ebx
-
 
581
			jg .cycle_7_end
-
 
582
			fild dword[i]
-
 
583
			fmul dword[drho]
-
 
584
			fst dword[rho] ;rho = i * drho
-
 
585
			fsin
-
 
586
			fld dword[theta]
-
 
587
			fcos
-
 
588
			fmul st0,st1
-
 
589
			fstp dword[x] ;x = cos(theta) * sin(rho)
-
 
590
			fld dword[theta]
-
 
591
			fsin
-
 
592
			fmulp
-
 
593
			fstp dword[y] ;y = sin(theta) * sin(rho)
-
 
594
			fld dword[rho]
-
 
595
			fcos
-
 
596
			fstp dword[z] ;z = cos(rho)
-
 
597
			cmp dword[normals],GL_TRUE
-
 
598
			jne @f
-
 
599
				fld dword[nsign]
-
 
600
				fld dword[z]
-
 
601
				fmul st0,st1
-
 
602
				fstp dword[esp-4]
-
 
603
				fld dword[y]
-
 
604
				fmul st0,st1
-
 
605
				fstp dword[esp-8]
-
 
606
				fld dword[x]
-
 
607
				fmulp
-
 
608
				fstp dword[esp-12]
-
 
609
				sub esp,12
-
 
610
				stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
-
 
611
			@@:
-
 
612
			fld dword[radius]
-
 
613
			fld dword[z]
-
 
614
			fmul st0,st1
-
 
615
			fstp dword[esp-4]
-
 
616
			fld dword[y]
-
 
617
			fmul st0,st1
-
 
618
			fstp dword[esp-8]
-
 
619
			fld dword[x]
-
 
620
			fmulp
-
 
621
			fstp dword[esp-12]
-
 
622
			sub esp,12
-
 
623
			call glVertex3f ;x*radius, y*radius, z*radius
-
 
624
			inc dword[i]
-
 
625
			jmp .cycle_7
-
 
626
		.cycle_7_end:
449
	stdcall glEnd
627
		call glEnd
-
 
628
		inc dword[j]
-
 
629
		jmp .cycle_6
-
 
630
	.cycle_6_end:
-
 
631
	jmp .end_f
-
 
632
 
-
 
633
	.if_glu_point:
-
 
634
	cmp dword[eax+offs_qobj_DrawStyle],GLU_POINT ;if (qobj.DrawStyle==GLU_POINT)
-
 
635
	jne .end_f
-
 
636
 
-
 
637
	; top and bottom-most points
-
 
638
	stdcall glBegin,GL_POINTS
-
 
639
	cmp dword[normals],GL_TRUE
-
 
640
	jne @f
-
 
641
		stdcall glNormal3f, 0.0,0.0,dword[nsign]
-
 
642
	@@:
-
 
643
	stdcall glVertex3f, 0.0,0.0,dword[radius]
-
 
644
	cmp dword[normals],GL_TRUE
-
 
645
	jne @f
-
 
646
		sub esp,4
-
 
647
		fld dword[nsign]
-
 
648
		fchs
-
 
649
		fstp dword[esp]
-
 
650
		stdcall glNormal3f, 0.0,0.0 ;,-nsign
-
 
651
	@@:
-
 
652
	sub esp,4
-
 
653
	fld dword[radius]
-
 
654
	fchs
-
 
655
	fstp dword[esp]
-
 
656
	stdcall glVertex3f, 0.0,0.0 ;,-radius
-
 
657
 
-
 
658
	; loop over stacks
-
 
659
	mov dword[i],1
-
 
660
	mov ebx,[stacks]
-
 
661
	mov ecx,[slices]
-
 
662
align 4
-
 
663
	.cycle_8: ;for (i=1;i
-
 
664
		cmp dword[i],ebx
-
 
665
		jge .cycle_8_end
-
 
666
		fild dword[i]
-
 
667
		fmul dword[drho]
-
 
668
		fstp dword[rho] ;rho = i * drho
-
 
669
 
-
 
670
		mov dword[j],0
-
 
671
align 4
-
 
672
		.cycle_9: ;for (j=0;j
-
 
673
			cmp dword[j],ecx
-
 
674
			jge .cycle_9_end
-
 
675
			fild dword[j]
-
 
676
			fmul dword[dtheta]
-
 
677
			fst dword[theta] ;theta = j * dtheta;
-
 
678
			fcos
-
 
679
			fld dword[rho]
-
 
680
			fsin
-
 
681
			fxch ;толкаем sin(rho) в st1
-
 
682
			fmul st0,st1
-
 
683
			fstp dword[x] ;x = cos(theta) * sin(rho)
-
 
684
			fld dword[theta]
-
 
685
			fsin
-
 
686
			fmulp ;множим на sin(rho) ранее записанный в st1
-
 
687
			fstp dword[y] ;y = sin(theta) * sin(rho)
-
 
688
			fld dword[rho]
-
 
689
			fcos
-
 
690
			fstp dword[z] ;z = cos(rho)
-
 
691
			cmp dword[normals],GL_TRUE
-
 
692
			jne @f
-
 
693
				fld dword[nsign]
-
 
694
				fld dword[z]
-
 
695
				fmul st0,st1
-
 
696
				fstp dword[esp-4]
-
 
697
				fld dword[y]
-
 
698
				fmul st0,st1
-
 
699
				fstp dword[esp-8]
-
 
700
				fld dword[x]
-
 
701
				fmulp
-
 
702
				fstp dword[esp-12]
-
 
703
				sub esp,12
-
 
704
				stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
-
 
705
			@@:
-
 
706
			fld dword[radius]
-
 
707
			fld dword[z]
-
 
708
			fmul st0,st1
-
 
709
			fstp dword[esp-4]
-
 
710
			fld dword[y]
-
 
711
			fmul st0,st1
-
 
712
			fstp dword[esp-8]
-
 
713
			fld dword[x]
-
 
714
			fmulp
-
 
715
			fstp dword[esp-12]
-
 
716
			sub esp,12
-
 
717
			call glVertex3f ;x*radius, y*radius, z*radius
-
 
718
			inc dword[j]
-
 
719
			jmp .cycle_9
-
 
720
		.cycle_9_end:
-
 
721
		inc dword[i]
-
 
722
		jmp .cycle_8
-
 
723
	.cycle_8_end:
-
 
724
	call glEnd
-
 
725
 
-
 
726
	.end_f:
450
popad
727
popad
451
	ret
728
	ret
452
endp
729
endp