From 09b127b67d6819d936da3572028a0f78189f3139 Mon Sep 17 00:00:00 2001 From: IgorA Date: Mon, 29 Dec 2014 22:06:55 +0000 Subject: [PATCH] add wired & points sphere; add 2 functions in quadric object git-svn-id: svn://kolibrios.org@5290 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/TinyGL/asm_fork/export.inc | 2 + .../develop/libraries/TinyGL/asm_fork/glu.asm | 331 ++++++++++++++++-- 2 files changed, 306 insertions(+), 27 deletions(-) diff --git a/programs/develop/libraries/TinyGL/asm_fork/export.inc b/programs/develop/libraries/TinyGL/asm_fork/export.inc index 5da2d1b90e..3fd00dc875 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/export.inc +++ b/programs/develop/libraries/TinyGL/asm_fork/export.inc @@ -160,6 +160,8 @@ E_LIB glClose ;(void) E_LIB gluNewQuadric E_LIB gluDeleteQuadric +E_LIB gluQuadricDrawStyle +E_LIB gluQuadricOrientation E_LIB gluSphere ; diff --git a/programs/develop/libraries/TinyGL/asm_fork/glu.asm b/programs/develop/libraries/TinyGL/asm_fork/glu.asm index 406345e849..782d99297d 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/glu.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/glu.asm @@ -52,9 +52,56 @@ proc gluDeleteQuadric, state:dword ret endp -;void gluQuadricDrawStyle(GLUquadricObj *obj, int style) -;{ -;} +; +; Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE, +; or GLU_POINT. +; +align 4 +proc gluQuadricDrawStyle uses eax ebx, qobj:dword, drawStyle:dword + mov eax,[qobj] + or eax,eax + jz .err_q + mov ebx,[drawStyle] + cmp ebx,GLU_FILL + je @f + cmp ebx,GLU_LINE + je @f + cmp ebx,GLU_SILHOUETTE + je @f + cmp ebx,GLU_POINT + je @f + jmp .err_q + @@: + mov dword[eax+offs_qobj_DrawStyle],ebx + jmp @f + .err_q: + ;quadric_error(qobj, GLU_INVALID_ENUM, "qluQuadricDrawStyle") + @@: + ret +endp + +; +; Set the orientation to GLU_INSIDE or GLU_OUTSIDE. +; +align 4 +proc gluQuadricOrientation uses eax ebx, qobj:dword, orientation:dword + mov eax,[qobj] + or eax,eax + jz .err_q + mov ebx,[orientation] + cmp ebx,GLU_INSIDE + je @f + cmp ebx,GLU_OUTSIDE + je @f + jmp .err_q + @@: + mov dword[eax+offs_qobj_Orientation],ebx + jmp @f + .err_q: + ;quadric_error(qobj, GLU_INVALID_ENUM, "qluQuadricOrientation") + @@: + ret +endp ;void gluCylinder(GLUquadricObj *qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks ) ;{ @@ -121,6 +168,9 @@ pushad ffree st0 fincstp + cmp dword[eax+offs_qobj_DrawStyle],GLU_FILL ;if (qobj.DrawStyle==GLU_FILL) + jne .if_glu_line + ; draw +Z end as a triangle fan stdcall glBegin,GL_TRIANGLE_FAN cmp dword[normals],GL_TRUE @@ -174,11 +224,9 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp stdcall glNormal3f ;x*nsign, y*nsign, z*nsign @@: fld dword[radius] @@ -189,16 +237,14 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp call glVertex3f ;x*radius, y*radius, z*radius inc dword[j] jmp .cycle_0 .cycle_0_end: - stdcall glEnd + call glEnd fld1 fidiv dword[slices] @@ -267,11 +313,9 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp stdcall glNormal3f ;x*nsign, y*nsign, z*nsign @@: cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag) @@ -286,11 +330,9 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp call glVertex3f ;x*radius, y*radius, z*radius fld dword[rho] fadd dword[drho] @@ -319,11 +361,9 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp stdcall glNormal3f ;x*nsign, y*nsign, z*nsign @@: cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag) @@ -341,16 +381,14 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp call glVertex3f ;x*radius, y*radius, z*radius inc dword[j] jmp .cycle_2 .cycle_2_end: - stdcall glEnd + call glEnd fld dword[t] fsub dword[d_t] fstp dword[t] @@ -384,6 +422,7 @@ align 4 fmul dword[nsign] fstp dword[z] ;z = nsign * cos(rho) mov [j],ecx +align 4 .cycle_3: ;for (j=slices;j>=0;j--) cmp dword[j],0 jl .cycle_3_end @@ -437,16 +476,254 @@ align 4 fmul st0,st1 fstp dword[esp-8] fld dword[x] - fmul st0,st1 + fmulp fstp dword[esp-12] sub esp,12 - ffree st0 - fincstp call glVertex3f ;x*radius, y*radius, z*radius dec dword[j] jmp .cycle_3 .cycle_3_end: - stdcall glEnd + call glEnd + jmp .end_f + + .if_glu_line: + cmp dword[eax+offs_qobj_DrawStyle],GLU_LINE ;if (qobj.DrawStyle==GLU_LINE) + je @f + cmp dword[eax+offs_qobj_DrawStyle],GLU_SILHOUETTE ;if (qobj.DrawStyle==GLU_SILHOUETTE) + je @f + jmp .if_glu_point + @@: + + ; draw stack lines + mov dword[i],1 + mov ebx,[stacks] + mov ecx,[slices] +align 4 + .cycle_4: ;for (i=1;i