[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17468] branches/animsys2/source/blender/ src/drawobject.c: AnimSys2: Improved drawing of 'sphere' empty drawtype
Joshua Leung
aligorith at gmail.com
Sat Nov 15 12:26:22 CET 2008
Revision: 17468
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17468
Author: aligorith
Date: 2008-11-15 12:26:21 +0100 (Sat, 15 Nov 2008)
Log Message:
-----------
AnimSys2: Improved drawing of 'sphere' empty drawtype
This now uses the same method used for armature bones points, with only a few core lines being drawn (one per axis).
Modified Paths:
--------------
branches/animsys2/source/blender/src/drawobject.c
Modified: branches/animsys2/source/blender/src/drawobject.c
===================================================================
--- branches/animsys2/source/blender/src/drawobject.c 2008-11-15 04:31:12 UTC (rev 17467)
+++ branches/animsys2/source/blender/src/drawobject.c 2008-11-15 11:26:21 UTC (rev 17468)
@@ -4037,18 +4037,35 @@
/* draw a sphere for use as an empty drawtype */
static void draw_empty_sphere (float size)
{
- float cent=0;
- GLUquadricObj *qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ static GLuint displist=0;
+
+ if (displist == 0) {
+ GLUquadricObj *qobj;
- glPushMatrix();
- glTranslatef(cent, cent, cent);
- glScalef(size, size, size);
- gluSphere(qobj, 1.0, 8, 5);
+ displist= glGenLists(1);
+ glNewList(displist, GL_COMPILE_AND_EXECUTE);
- glPopMatrix();
+ glPushMatrix();
+
+ qobj = gluNewQuadric();
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ gluDisk(qobj, 0.0, 1, 16, 1);
+
+ glRotatef(90, 0, 1, 0);
+ gluDisk(qobj, 0.0, 1, 16, 1);
+
+ glRotatef(90, 1, 0, 0);
+ gluDisk(qobj, 0.0, 1, 16, 1);
+
+ gluDeleteQuadric(qobj);
+
+ glPopMatrix();
+ glEndList();
+ }
- gluDeleteQuadric(qobj);
+ glScalef(size, size, size);
+ glCallList(displist);
+ glScalef(1/size, 1/size, 1/size);
}
/* draw a cone for use as an empty drawtype */
More information about the Bf-blender-cvs
mailing list