Patch #7916: New Empty Types - Sphere and Cone

Submitted by: David Bryant (digikiller)

This patch adds two new drawtypes for empties in Blender:
* Sphere
* Cone

These draw with wireframes which are slightly more complicated than for other empties. However, this shouldn't really be an issue.
This commit is contained in:
2007-12-15 07:48:30 +00:00
parent faf638238d
commit 3301d046b6
3 changed files with 53 additions and 2 deletions

View File

@@ -143,6 +143,8 @@ static void draw_bounding_volume(Object *ob);
static void drawcube_size(float size);
static void drawcircle_size(float size);
static void draw_empty_sphere(float size);
static void draw_empty_cone(float size);
/* ************* Setting OpenGL Material ************ */
@@ -412,6 +414,14 @@ void drawaxes(float size, int flag, char drawtype)
drawcircle_size(size);
break;
case OB_EMPTY_SPHERE:
draw_empty_sphere(size);
break;
case OB_EMPTY_CONE:
draw_empty_cone(size);
break;
case OB_ARROWS:
default:
for (axis=0; axis<3; axis++) {
@@ -3984,6 +3994,45 @@ static void drawnurb(Base *base, Nurb *nurb, int dt)
if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
}
/* 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);
glPushMatrix();
glTranslatef(cent, cent, cent);
glScalef(size, size, size);
gluSphere(qobj, 1.0, 8, 5);
glPopMatrix();
gluDeleteQuadric(qobj);
}
/* draw a cone for use as an empty drawtype */
static void draw_empty_cone (float size)
{
float cent=0;
float radius;
GLUquadricObj *qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
glPushMatrix();
radius = size;
glTranslatef(cent,cent, cent);
glScalef(radius, 2.0*size, radius);
glRotatef(-90., 1.0, 0.0, 0.0);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
glPopMatrix();
gluDeleteQuadric(qobj);
}
/* draw points on curve speed handles */
static void curve_draw_speed(Object *ob)
{
@@ -5504,4 +5553,3 @@ void draw_object_instance(Object *ob, int dt, int outline)
break;
}
}