Subversion Repositories Kolibri OS

Rev

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

Rev 6108 Rev 6143
Line 28... Line 28...
28
;	  GLdouble centerx, GLdouble centery, GLdouble centerz,
28
;	  GLdouble centerx, GLdouble centery, GLdouble centerz,
29
;	  GLdouble upx, GLdouble upy, GLdouble upz)
29
;	  GLdouble upx, GLdouble upy, GLdouble upz)
30
;{
30
;{
31
;}
31
;}
Line 32... Line 32...
32
 
32
 
33
align 4
33
align 16
34
gluNewQuadric:
34
gluNewQuadric:
35
	stdcall gl_malloc, sizeof.GLUquadricObj
35
	stdcall gl_malloc, sizeof.GLUquadricObj
36
	or eax,eax
36
	or eax,eax
37
	jz @f
37
	jz @f
Line 41... Line 41...
41
		mov dword[eax+offs_qobj_Normals],GLU_SMOOTH
41
		mov dword[eax+offs_qobj_Normals],GLU_SMOOTH
42
		mov dword[eax+offs_qobj_ErrorFunc],0 ;NULL
42
		mov dword[eax+offs_qobj_ErrorFunc],0 ;NULL
43
	@@:
43
	@@:
44
	ret
44
	ret
Line 45... Line 45...
45
 
45
 
46
align 4
46
align 16
47
proc gluDeleteQuadric, state:dword
47
proc gluDeleteQuadric, state:dword
48
	cmp dword[state],0
48
	cmp dword[state],0
49
	je @f
49
	je @f
50
		stdcall gl_free,[state]
50
		stdcall gl_free,[state]
Line 54... Line 54...
54
 
54
 
55
;
55
;
56
; Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE,
56
; Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE,
57
; or GLU_POINT.
57
; or GLU_POINT.
58
;
58
;
59
align 4
59
align 16
60
proc gluQuadricDrawStyle uses eax ebx, qobj:dword, drawStyle:dword
60
proc gluQuadricDrawStyle uses eax ebx, qobj:dword, drawStyle:dword
61
	mov eax,[qobj]
61
	mov eax,[qobj]
62
	or eax,eax
62
	or eax,eax
63
	jz .err_q
63
	jz .err_q
Line 69... Line 69...
69
	cmp ebx,GLU_SILHOUETTE
69
	cmp ebx,GLU_SILHOUETTE
70
	je @f
70
	je @f
71
	cmp ebx,GLU_POINT
71
	cmp ebx,GLU_POINT
72
	je @f
72
	je @f
73
	jmp .err_q
73
	jmp .err_q
-
 
74
align 4
74
	@@:
75
	@@:
75
		mov dword[eax+offs_qobj_DrawStyle],ebx
76
		mov dword[eax+offs_qobj_DrawStyle],ebx
76
		jmp @f
77
		jmp @f
-
 
78
align 4
77
	.err_q:
79
	.err_q:
78
		stdcall dbg_print,sz_gluQuadricDrawStyle,err_9
80
		stdcall dbg_print,sz_gluQuadricDrawStyle,err_9
79
	@@:
81
	@@:
80
	ret
82
	ret
81
endp
83
endp
Line 82... Line 84...
82
 
84
 
83
;
85
;
84
; Set the orientation to GLU_INSIDE or GLU_OUTSIDE.
86
; Set the orientation to GLU_INSIDE or GLU_OUTSIDE.
85
;
87
;
86
align 4
88
align 16
87
proc gluQuadricOrientation uses eax ebx, qobj:dword, orientation:dword
89
proc gluQuadricOrientation uses eax ebx, qobj:dword, orientation:dword
88
	mov eax,[qobj]
90
	mov eax,[qobj]
89
	or eax,eax
91
	or eax,eax
90
	jz .err_q
92
	jz .err_q
91
	mov ebx,[orientation]
93
	mov ebx,[orientation]
92
	cmp ebx,GLU_INSIDE
94
	cmp ebx,GLU_INSIDE
93
	je @f
95
	je @f
94
	cmp ebx,GLU_OUTSIDE
96
	cmp ebx,GLU_OUTSIDE
95
	je @f
97
	je @f
-
 
98
	jmp .err_q
96
	jmp .err_q
99
align 4
97
	@@:
100
	@@:
98
		mov dword[eax+offs_qobj_Orientation],ebx
101
		mov dword[eax+offs_qobj_Orientation],ebx
-
 
102
		jmp @f
99
		jmp @f
103
align 4
100
	.err_q:
104
	.err_q:
101
		stdcall dbg_print,sz_gluQuadricOrientation,err_9
105
		stdcall dbg_print,sz_gluQuadricOrientation,err_9
102
	@@:
106
	@@:
103
	ret
107
	ret
Line 104... Line 108...
104
endp
108
endp
105
 
109
 
106
align 4
110
align 16
107
proc gluQuadricTexture uses eax ebx, qobj:dword, texture:dword
111
proc gluQuadricTexture uses eax ebx, qobj:dword, texture:dword
108
	mov eax,[qobj]
112
	mov eax,[qobj]
109
	or eax,eax
113
	or eax,eax
Line 114... Line 118...
114
	cmp ebx,GL_FALSE
118
	cmp ebx,GL_FALSE
115
	je @f
119
	je @f
116
	@@:
120
	@@:
117
		mov dword[eax+offs_qobj_TextureFlag],ebx
121
		mov dword[eax+offs_qobj_TextureFlag],ebx
118
		jmp @f
122
		jmp @f
-
 
123
align 4
119
	.err_q:
124
	.err_q:
120
		stdcall dbg_print,sz_gluQuadricTexture,err_9
125
		stdcall dbg_print,sz_gluQuadricTexture,err_9
121
	@@:
126
	@@:
122
	ret
127
	ret
123
endp
128
endp
Line 136... Line 141...
136
; Sphere (adapted from Mesa)
141
; Sphere (adapted from Mesa)
137
;
142
;
Line 138... Line 143...
138
 
143
 
139
;input:
144
;input:
140
; float radius, int slices, int stacks
145
; float radius, int slices, int stacks
141
align 4
146
align 16
142
proc gluSphere qobj:dword, radius:dword, slices:dword, stacks:dword
147
proc gluSphere qobj:dword, radius:dword, slices:dword, stacks:dword
143
locals
148
locals
144
	rho dd ? ;float
149
	rho dd ? ;float
145
	drho dd ? 
150
	drho dd ? 
Line 163... Line 168...
163
	mov eax,[qobj]
168
	mov eax,[qobj]
164
	cmp dword[eax+offs_qobj_Normals],GLU_NONE ;if (qobj.Normals==GLU_NONE)
169
	cmp dword[eax+offs_qobj_Normals],GLU_NONE ;if (qobj.Normals==GLU_NONE)
165
	jne .els_0
170
	jne .els_0
166
		mov dword[normals],GL_FALSE
171
		mov dword[normals],GL_FALSE
167
		jmp @f
172
		jmp @f
-
 
173
align 4
168
	.els_0:
174
	.els_0:
169
		mov dword[normals],GL_TRUE
175
		mov dword[normals],GL_TRUE
170
	@@:
176
	@@:
171
	cmp dword[eax+offs_qobj_Orientation],GLU_INSIDE ;if (qobj.Orientation==GLU_INSIDE)
177
	cmp dword[eax+offs_qobj_Orientation],GLU_INSIDE ;if (qobj.Orientation==GLU_INSIDE)
172
	jne .els_1
178
	jne .els_1
173
		mov dword[nsign],-1.0
179
		mov dword[nsign],-1.0
174
		jmp @f
180
		jmp @f
-
 
181
align 4
175
	.els_1:
182
	.els_1:
176
		mov dword[nsign],1.0
183
		mov dword[nsign],1.0
177
	@@:
184
	@@:
Line 178... Line 185...
178
 
185
 
Line 196... Line 203...
196
	jne @f
203
	jne @f
197
		stdcall glNormal3f, 0.0, 0.0, 1.0
204
		stdcall glNormal3f, 0.0, 0.0, 1.0
198
	@@:
205
	@@:
199
	cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
206
	cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
200
	je @f
207
	je @f
201
		stdcall glTexCoord2f, 0.5,0.0
208
		stdcall glTexCoord2f, 0.5,1.0
202
	@@:
209
	@@:
203
	sub esp,4
210
	sub esp,4
204
	fld dword[nsign]
211
	fld dword[nsign]
205
	fmul dword[radius]
212
	fmul dword[radius]
206
	fstp dword[esp]
213
	fstp dword[esp]
Line 219... Line 226...
219
		fsin
226
		fsin
220
		je @f
227
		je @f
221
			fild dword[j]
228
			fild dword[j]
222
			fmul dword[dtheta]
229
			fmul dword[dtheta]
223
			jmp .t0_end
230
			jmp .t0_end
-
 
231
align 4
224
		@@:
232
		@@:
225
			fldz
233
			fldz
226
		.t0_end:
234
		.t0_end:
227
		fst dword[theta] ;theta = (j==slices) ? 0.0 : j * dtheta
235
		fst dword[theta] ;theta = (j==slices) ? 0.0 : j * dtheta
228
		fsin
236
		fsin
Line 260... Line 268...
260
		fstp dword[esp-12]
268
		fstp dword[esp-12]
261
		sub esp,12
269
		sub esp,12
262
		call glVertex3f ;x*radius, y*radius, z*radius
270
		call glVertex3f ;x*radius, y*radius, z*radius
263
		inc dword[j]
271
		inc dword[j]
264
		jmp .cycle_0
272
		jmp .cycle_0
-
 
273
align 4
265
	.cycle_0_end:
274
	.cycle_0_end:
266
	call glEnd
275
	call glEnd
Line 267... Line 276...
267
 
276
 
268
	fld1
277
	fld1
Line 276... Line 285...
276
	cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
285
	cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
277
	je .els_2
286
	je .els_2
278
		mov dword[i],0
287
		mov dword[i],0
279
		mov [imax],ebx
288
		mov [imax],ebx
280
		jmp @f
289
		jmp @f
-
 
290
align 4
281
	.els_2:
291
	.els_2:
282
		mov dword[i],1
292
		mov dword[i],1
283
		dec ebx
293
		dec ebx
284
		mov [imax],ebx
294
		mov [imax],ebx
285
	@@:
295
	@@:
Line 304... Line 314...
304
		fsin
314
		fsin
305
		je @f
315
		je @f
306
			fild dword[j]
316
			fild dword[j]
307
			fmul dword[dtheta]
317
			fmul dword[dtheta]
308
			jmp .t1_end
318
			jmp .t1_end
-
 
319
align 4
309
		@@:
320
		@@:
310
			fldz
321
			fldz
311
		.t1_end:
322
		.t1_end:
312
		fst dword[theta] ;theta = (j==slices) ? 0.0 : j * dtheta
323
		fst dword[theta] ;theta = (j==slices) ? 0.0 : j * dtheta
313
		fsin
324
		fsin
Line 337... Line 348...
337
			sub esp,12
348
			sub esp,12
338
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
349
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
339
		@@:
350
		@@:
340
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
351
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
341
		je @f
352
		je @f
342
			fld1
-
 
343
			fsub dword[t]
-
 
344
			fstp dword[esp-4]
-
 
345
			sub esp,4
-
 
346
			stdcall glTexCoord2f, [s] ;,1-t
353
			stdcall glTexCoord2f, [s],[t]
347
		@@:
354
		@@:
348
		fld dword[radius]
355
		fld dword[radius]
349
		fld dword[z]
356
		fld dword[z]
350
		fmul st0,st1
357
		fmul st0,st1
351
		fstp dword[esp-4]
358
		fstp dword[esp-4]
Line 389... Line 396...
389
			sub esp,12
396
			sub esp,12
390
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
397
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
391
		@@:
398
		@@:
392
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
399
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
393
		je @f
400
		je @f
394
			fld1
-
 
395
			fsub dword[t]
401
			fld dword[t]
396
			fadd dword[d_t]
402
			fsub dword[d_t]
397
			fstp dword[esp-4]
403
			fstp dword[esp-4]
398
			sub esp,4
404
			sub esp,4
399
			stdcall glTexCoord2f, [s] ;,1-(t-dt)
405
			stdcall glTexCoord2f, [s] ;,t-dt
400
			fld dword[s]
406
			fld dword[s]
401
			fadd dword[d_s]
407
			fadd dword[d_s]
402
			fstp dword[s]
408
			fstp dword[s]
403
		@@:
409
		@@:
404
		fld dword[radius]
410
		fld dword[radius]
Line 413... Line 419...
413
		fstp dword[esp-12]
419
		fstp dword[esp-12]
414
		sub esp,12
420
		sub esp,12
415
		call glVertex3f ;x*radius, y*radius, z*radius
421
		call glVertex3f ;x*radius, y*radius, z*radius
416
		inc dword[j]
422
		inc dword[j]
417
		jmp .cycle_2
423
		jmp .cycle_2
-
 
424
align 4
418
		.cycle_2_end:
425
		.cycle_2_end:
419
	call glEnd
426
	call glEnd
420
	fld dword[t]
427
	fld dword[t]
421
	fsub dword[d_t]
428
	fsub dword[d_t]
422
	fstp dword[t]
429
	fstp dword[t]
423
	inc dword[i]
430
	inc dword[i]
424
	jmp .cycle_1
431
	jmp .cycle_1
-
 
432
align 4
425
	.cycle_1_end:
433
	.cycle_1_end:
Line 426... Line 434...
426
 
434
 
427
	; draw -Z end as a triangle fan
435
	; draw -Z end as a triangle fan
428
	stdcall glBegin,GL_TRIANGLE_FAN
436
	stdcall glBegin,GL_TRIANGLE_FAN
429
	cmp dword[normals],GL_TRUE
437
	cmp dword[normals],GL_TRUE
430
	jne @f
438
	jne @f
431
		stdcall glNormal3f, 0.0, 0.0, -1.0
439
		stdcall glNormal3f, 0.0, 0.0, -1.0
432
	@@:
440
	@@:
433
	cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
441
	cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
434
	je @f
442
	je @f
435
		stdcall glTexCoord2f, 0.5,1.0
443
		stdcall glTexCoord2f, 0.5,0.0
436
		mov dword[s],1.0
444
		mov dword[s],1.0
437
		mov ebx,[d_t]
445
		mov ebx,[d_t]
438
		mov [t],ebx
446
		mov [t],ebx
439
	@@:
447
	@@:
Line 458... Line 466...
458
		fsin
466
		fsin
459
		je @f
467
		je @f
460
			fild dword[j]
468
			fild dword[j]
461
			fmul dword[dtheta]
469
			fmul dword[dtheta]
462
			jmp .t2_end
470
			jmp .t2_end
-
 
471
align 4
463
		@@:
472
		@@:
464
			fldz
473
			fldz
465
		.t2_end:
474
		.t2_end:
466
		fst dword[theta] ;theta = (j==slices) ? 0.0 : j * dtheta
475
		fst dword[theta] ;theta = (j==slices) ? 0.0 : j * dtheta
467
		fsin
476
		fsin
Line 489... Line 498...
489
			fincstp
498
			fincstp
490
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
499
			stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
491
		@@:
500
		@@:
492
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
501
		cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
493
		je @f
502
		je @f
494
			fld1
-
 
495
			fsub dword[t]
-
 
496
			fstp dword[esp-4]
-
 
497
			sub esp,4
-
 
498
			stdcall glTexCoord2f, [s] ;,1-t
503
			stdcall glTexCoord2f, [s],[t]
499
			fld dword[s]
504
			fld dword[s]
500
			fsub dword[d_s]
505
			fsub dword[d_s]
501
			fstp dword[s]
506
			fstp dword[s]
502
		@@:
507
		@@:
503
		fld dword[radius]
508
		fld dword[radius]
Line 512... Line 517...
512
		fstp dword[esp-12]
517
		fstp dword[esp-12]
513
		sub esp,12
518
		sub esp,12
514
		call glVertex3f ;x*radius, y*radius, z*radius
519
		call glVertex3f ;x*radius, y*radius, z*radius
515
		dec dword[j]
520
		dec dword[j]
516
		jmp .cycle_3
521
		jmp .cycle_3
-
 
522
align 4
517
	.cycle_3_end:
523
	.cycle_3_end:
518
	call glEnd
524
	call glEnd
519
	jmp .end_f
525
	jmp .end_f
Line -... Line 526...
-
 
526
 
520
 
527
align 4
521
	.if_glu_line:
528
	.if_glu_line:
522
	cmp dword[eax+offs_qobj_DrawStyle],GLU_LINE ;if (qobj.DrawStyle==GLU_LINE)
529
	cmp dword[eax+offs_qobj_DrawStyle],GLU_LINE ;if (qobj.DrawStyle==GLU_LINE)
523
	je @f
530
	je @f
524
	cmp dword[eax+offs_qobj_DrawStyle],GLU_SILHOUETTE ;if (qobj.DrawStyle==GLU_SILHOUETTE)
531
	cmp dword[eax+offs_qobj_DrawStyle],GLU_SILHOUETTE ;if (qobj.DrawStyle==GLU_SILHOUETTE)
525
	je @f
532
	je @f
-
 
533
	jmp .if_glu_point
526
	jmp .if_glu_point
534
align 4
Line 527... Line 535...
527
	@@:
535
	@@:
528
 
536
 
529
	; draw stack lines
537
	; draw stack lines
Line 588... Line 596...
588
			fstp dword[esp-12]
596
			fstp dword[esp-12]
589
			sub esp,12
597
			sub esp,12
590
			call glVertex3f ;x*radius, y*radius, z*radius
598
			call glVertex3f ;x*radius, y*radius, z*radius
591
			inc dword[j]
599
			inc dword[j]
592
			jmp .cycle_5
600
			jmp .cycle_5
-
 
601
align 4
593
		.cycle_5_end:
602
		.cycle_5_end:
594
		call glEnd
603
		call glEnd
595
		inc dword[i]
604
		inc dword[i]
596
		jmp .cycle_4
605
		jmp .cycle_4
-
 
606
align 4
597
	.cycle_4_end:
607
	.cycle_4_end:
Line 598... Line 608...
598
 
608
 
599
	; draw slice lines
609
	; draw slice lines
600
	mov dword[j],0
610
	mov dword[j],0
Line 653... Line 663...
653
			fstp dword[esp-12]
663
			fstp dword[esp-12]
654
			sub esp,12
664
			sub esp,12
655
			call glVertex3f ;x*radius, y*radius, z*radius
665
			call glVertex3f ;x*radius, y*radius, z*radius
656
			inc dword[i]
666
			inc dword[i]
657
			jmp .cycle_7
667
			jmp .cycle_7
-
 
668
align 4
658
		.cycle_7_end:
669
		.cycle_7_end:
659
		call glEnd
670
		call glEnd
660
		inc dword[j]
671
		inc dword[j]
661
		jmp .cycle_6
672
		jmp .cycle_6
-
 
673
align 4
662
	.cycle_6_end:
674
	.cycle_6_end:
663
	jmp .end_f
675
	jmp .end_f
Line -... Line 676...
-
 
676
 
664
 
677
align 4
665
	.if_glu_point:
678
	.if_glu_point:
666
	cmp dword[eax+offs_qobj_DrawStyle],GLU_POINT ;if (qobj.DrawStyle==GLU_POINT)
679
	cmp dword[eax+offs_qobj_DrawStyle],GLU_POINT ;if (qobj.DrawStyle==GLU_POINT)
Line 667... Line 680...
667
	jne .end_f
680
	jne .end_f
Line 747... Line 760...
747
			fstp dword[esp-12]
760
			fstp dword[esp-12]
748
			sub esp,12
761
			sub esp,12
749
			call glVertex3f ;x*radius, y*radius, z*radius
762
			call glVertex3f ;x*radius, y*radius, z*radius
750
			inc dword[j]
763
			inc dword[j]
751
			jmp .cycle_9
764
			jmp .cycle_9
-
 
765
align 4
752
		.cycle_9_end:
766
		.cycle_9_end:
753
		inc dword[i]
767
		inc dword[i]
754
		jmp .cycle_8
768
		jmp .cycle_8
-
 
769
align 4
755
	.cycle_8_end:
770
	.cycle_8_end:
756
	call glEnd
771
	call glEnd
Line 757... Line 772...
757
 
772
 
758
	.end_f:
773
	.end_f: