+ polys += wire(ci, 3);
+ return polys;
+}
+
+static int DrawRCA(Circuit *ci, RCA *rca)
+{
+ int polys = 0;
+ GLfloat col[] = {0.6, 0.6, 0.6, 1.0}; /* metal */
+ GLfloat red[] = {1.0, 0.0, 0.0, 1.0}; /* red */
+ GLfloat white[] = {1.0, 1.0, 1.0, 1.0}; /* white */
+ GLfloat spec[] = {1, 1, 1, 1}; /* glass */
+
+ glPushMatrix();
+ glTranslatef(0.3, 0, 0);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, col);
+ glMateriali(GL_FRONT, GL_SHININESS, 40);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, spec);
+ polys += createCylinder(ci, 0.7, 0.45, 0, 0);
+ glTranslatef(0.4, 0, 0);
+ polys += createCylinder(ci, 0.9, 0.15, 1, 0);
+ glTranslatef(-1.9, 0, 0);
+ glMateriali(GL_FRONT, GL_SHININESS, 20);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, rca->col ? white : red);
+ polys += createCylinder(ci, 1.5, 0.6, 1, 0);
+ glTranslatef(-0.9, 0, 0);
+ polys += createCylinder(ci, 0.9, 0.25, 0, 0);
+ glTranslatef(0.1, 0, 0);
+ polys += createCylinder(ci, 0.2, 0.3, 0, 0);
+ glTranslatef(0.3, 0, 0);
+ polys += createCylinder(ci, 0.2, 0.3, 1, 0);
+ glTranslatef(0.3, 0, 0);
+ polys += createCylinder(ci, 0.2, 0.3, 1, 0);
+ glPopMatrix();
+ return polys;
+}
+
+static int DrawSwitch(Circuit *ci, Switch *f)
+{
+ int polys = 0;
+ GLfloat col[] = {0.6, 0.6, 0.6, 0}; /* metal */
+ GLfloat dark[] = {0.1, 0.1, 0.1, 1.0}; /* dark */
+ GLfloat brown[] = {0.69, 0.32, 0, 1.0}; /* brown */
+ GLfloat spec[] = {0.9, 0.9, 0.9, 1}; /* shiny */
+
+ glPushMatrix();
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, col);
+ glMaterialfv(GL_FRONT, GL_AMBIENT, dark);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, spec);
+ glMateriali(GL_FRONT, GL_SHININESS, 90);
+ polys += Rect(-0.25, 0, 0, 1.5, 0.5, 0.75);
+/* polys += Rect(-0.5, 0.5, 0, 2, 0.1, 0.75); */
+ glPushMatrix();
+ glRotatef(90, 1, 0, 0);
+ glTranslatef(-0.5, -0.4, -0.4);
+ polys += HoledRectangle(ci, 0.5, 0.75, 0.1, 0.15, 8);
+ glTranslatef(2, 0, 0);
+ polys += HoledRectangle(ci, 0.5, 0.75, 0.1, 0.15, 8);
+ glPopMatrix();
+ polys += Rect(0.1, -0.4, -0.25, 0.1, 0.4, 0.05);
+ polys += Rect(0.5, -0.4, -0.25, 0.1, 0.4, 0.05);
+ polys += Rect(0.9, -0.4, -0.25, 0.1, 0.4, 0.05);
+ polys += Rect(0.1, -0.4, -0.5, 0.1, 0.4, 0.05);
+ polys += Rect(0.5, -0.4, -0.5, 0.1, 0.4, 0.05);
+ polys += Rect(0.9, -0.4, -0.5, 0.1, 0.4, 0.05);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, dark);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, spec);
+ polys += Rect(0, 0.5, -0.1, 1, 0.05, 0.5);
+ polys += Rect(0, 0.6, -0.1, 0.5, 0.6, 0.5);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, brown);
+ polys += Rect(-0.2, -0.01, -0.1, 1.4, 0.1, 0.55);
+ glPopMatrix();
+ return polys;