Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-12-15 10:48:30 +0300
committerJoshua Leung <aligorith@gmail.com>2007-12-15 10:48:30 +0300
commit3301d046b67098b72eed93f6384ea2a9477d77e4 (patch)
tree4f35471ddba75b1d6239ca46ca2dd4b34d134dcb /source/blender/src/drawobject.c
parentfaf638238dc5147fa3b9c5cc4999bda907acd6f7 (diff)
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.
Diffstat (limited to 'source/blender/src/drawobject.c')
-rw-r--r--source/blender/src/drawobject.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 26858f657a6..397d411e4b0 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -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;
}
}
-