void drawHitherControl (void) { float xx,b,slope; int hitherTop, hitherBot; float b0x,b1x; /* draw box indicating minimum and maximum distance of projection */ GSetForeground(trashGC,(float)hitherBoxColor,Xoption); b0x = (pzMin - clipPlaneMin)/(clipPlaneMax-clipPlaneMin); b0x = hitherMaxX - b0x*(hitherMaxX - hitherMinX); /* screen x */ b1x = (pzMax - clipPlaneMin)/(clipPlaneMax-clipPlaneMin); b1x = hitherMaxX - b1x*(hitherMaxX - hitherMinX); /* screen x */ GDraw3DButtonOut(trashGC,volumeWindow, (int)(b0x),frusY(hitherBoxTop), (int)fabs(b1x-b0x),hitherBoxHeight,Xoption); /* draw the hither plane */ GSetForeground(trashGC,(float)hitherColor,Xoption); /* percentage x */ xx = ((viewData.clipPlane-clipPlaneMin)/(clipPlaneMax-clipPlaneMin)); xx = hitherMaxX - xx*(hitherMaxX - hitherMinX); /* screen x */ slope = ((float)frustrumY - frustrumMidY)/(frustrumX - frustrumVertex); b = ((float)frustrumX*frustrumMidY - frustrumVertex*frustrumY) / (frustrumX - frustrumVertex); hitherTop = slope * xx + b + 0.5; slope = (float)(frustrumBotY - frustrumMidY)/(frustrumX - frustrumVertex); b = ((float)frustrumX*frustrumMidY - frustrumVertex*frustrumBotY) / (frustrumX - frustrumVertex); hitherBot = slope * xx + b + 0.5; GDrawLine(trashGC,volumeWindow, frusX((int)xx),frusY(hitherTop), frusX((int)xx),frusY(hitherBot),Xoption); /* draw hither control box and bar */ GDraw3DButtonOut(trashGC,volumeWindow, frusX(hitherWinX),frusY(hitherWinY+5), hitherWidth,hitherHeight,Xoption); GDrawLine(trashGC,volumeWindow, frusX(hitherMinX),frusY(hitherBarY+5), frusX(hitherMaxX),frusY(hitherBarY+5),Xoption); /* draw hither plane I/O pointer arrow */ GDrawLine(trashGC,volumeWindow, frusX((int)xx),frusY(hitherBarY+2), frusX((int)xx),frusY(hitherBarY+8),Xoption); /* print string label */ GSetForeground(volumeGC,(float)hitherColor,Xoption); GDrawString(volumeGC,volumeWindow,hitherMessX,hitherMessY,"Hither",6,Xoption); }
void drawSavePanel(void) { const char* s; int i,strlength; GSetForeground(saveGC,(float)saveButtonColor,Xoption); for (i=saveButtonsStart; i<(saveButtonsEnd); i++) { GDraw3DButtonOut(saveGC,saveWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); s = (control->buttonQueue[i]).text; strlength = strlen(s); GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(trashGC,saveWindow, (control->buttonQueue[i]).buttonX + centerX(processGC,s,strlength, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(processGC,(control->buttonQueue[i]).buttonHeight), s,strlen(s),Xoption); } /* for i in control->buttonQueue */ } /* drawSavePanel */
void drawEyeControl (void) { float here; int there; GSetForeground(trashGC,(float)eyeColor,Xoption); /* draw the eyeDistance box & slide bar */ GDraw3DButtonOut(trashGC,volumeWindow, frusX(eyeWinX),frusY(eyeWinY+5),eyeWidth,eyeHeight,Xoption); GDrawLine(trashGC,volumeWindow, frusX(eyeMinX),frusY(eyeBarY+5),frusX(eyeMaxX),frusY(eyeBarY+5),Xoption); here = (viewData.eyeDistance - minEyeDistance) / (maxEyeDistance - minEyeDistance); here = pow((double)here,0.333333); there = here * (eyeMaxX - eyeMinX) + eyeMinX; /* screen x */ GDrawLine(trashGC,volumeWindow, frusX(there),frusY(eyeBarY+2),frusX(there),frusY(eyeBarY+8),Xoption); /* draw the eye */ GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GSetForeground(trashGC,(float)monoColor(52),Xoption); GDrawLine(trashGC,volumeWindow, frusX(there),frusY(frustrumMidY-5), frusX(there+8),frusY(frustrumMidY),Xoption); GDrawLine(trashGC,volumeWindow, frusX(there+2),frusY(frustrumMidY+4), frusX(there+8),frusY(frustrumMidY-1),Xoption); GSetForeground(trashGC,(float)frustrumColor,Xoption); GDrawLine(trashGC,volumeWindow, frusX(there+4),frusY(frustrumMidY-3), frusX(there+2),frusY(frustrumMidY),Xoption); GDrawLine(trashGC,volumeWindow, frusX(there+4),frusY(frustrumMidY+2), frusX(there+3),frusY(frustrumMidY),Xoption); GSetLineAttributes(trashGC,0,LineSolid,CapButt,JoinMiter,Xoption); /* draw string label */ GSetForeground(volumeGC,(float)eyeColor,Xoption); GDrawString(volumeGC,volumeWindow,eyeDistMessX,eyeDistMessY, "Eye Distance",strlen("eye distance"),Xoption); }
void drawLightingPanel(void) { char *s; int i,strlength; /* Draw border lines to separate the lighting window, potentiometers, and button regions of the lightng subpanel. */ GSetForeground(trashGC,(float)foregroundColor,Xoption); GSetLineAttributes(trashGC,3,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, lightingWindow, 0, potA, controlWidth, potA, Xoption); GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, lightingWindow, 0, lightB, controlWidth, lightB, Xoption); GDrawLine(trashGC, lightingWindow, 0, lightPotA, controlWidth, lightPotA, Xoption); GDrawLine(trashGC, lightingWindow, 0, lightPotB, controlWidth, lightPotB, Xoption); GDrawLine(trashGC, lightingWindow, lightTransL, lightPotA, lightTransL, lightPotB, Xoption); writeControlTitle(lightingWindow); s = "Lighting Control Panel"; strlength = strlen(s); GSetForeground(anotherGC,(float)lightingTitleColor,Xoption); GDrawString(anotherGC, lightingWindow, centerX(anotherGC, s, strlength, controlWidth), lightB+18, s, strlength, Xoption); for (i=lightingButtonsStart; i<(lightingButtonsEnd); i++) { switch (i) { case lightMove: GSetForeground(lightingGC,(float)lightingButtonColor,Xoption); GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + 2*(control->buttonQueue[i]).yHalf,Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf, (control->buttonQueue[i]).buttonX + 2*(control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf,Xoption); break; case lightMoveXY: GSetForeground(lightingGC,(float)lightingButtonColor,Xoption); GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + 2*(control->buttonQueue[i]).yHalf,Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf, (control->buttonQueue[i]).buttonX + 2*(control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf,Xoption); break; case lightMoveZ: GSetForeground(lightingGC,(float)lightingButtonColor,Xoption); GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + 2*(control->buttonQueue[i]).yHalf,Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf - (control->buttonQueue[i]).xHalf/2, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf + (control->buttonQueue[i]).xHalf/2, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf,Xoption); break; case lightTranslucent: drawLightTransArrow(); break; default: GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); s = (control->buttonQueue[i]).text; strlength = strlen(s); GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(trashGC, lightingWindow, (control->buttonQueue[i]).buttonX + centerX(processGC,s,strlength, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(processGC,(control->buttonQueue[i]).buttonHeight), s,strlen(s),Xoption); } /* switch */ } /* for i in control->buttonQueue */ GSetForeground(lightingGC,(float)monoColor(labelColor),Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightMoveXY].buttonX + control->buttonQueue[lightMoveXY].buttonWidth + 3, control->buttonQueue[lightMoveXY].buttonY + control->buttonQueue[lightMoveXY].yHalf, "x",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightMoveXY].buttonX + control->buttonQueue[lightMoveXY].xHalf - 2, control->buttonQueue[lightMoveXY].buttonY - 4, "y",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightMoveZ].buttonX + control->buttonQueue[lightMoveZ].xHalf - 2, control->buttonQueue[lightMoveZ].buttonY - 4, "z",1,Xoption); /** Draw the title for the intensity potentiometer. */ GSetForeground(lightingGC,(float)lightingTransColor,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY, "I",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight, "n",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*2, "t",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*3, "e",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*4, "n",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*5, "s",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*6, "i",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*7, "t",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*8, "y",1,Xoption); drawLightingAxes(); drawLightTransArrow(); } /* drawLightingPanel */
void drawVolumePanel (void) { int i,strlength; /* Draw some lines for volume panel. */ GSetForeground(trashGC,(float)foregroundColor,Xoption); GSetLineAttributes(trashGC,3,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, volumeWindow, 0, potA, controlWidth, potA, Xoption); GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, volumeWindow, 0, volumeTitleA, controlWidth, volumeTitleA, Xoption); GDrawLine(trashGC, volumeWindow, 0, volumeTitleB, controlWidth, volumeTitleB, Xoption); writeControlTitle(volumeWindow); s = "Viewing Volume Panel"; strlength = strlen(s); GSetForeground(anotherGC,(float)volumeTitleColor,Xoption); GDrawString(anotherGC,volumeWindow, centerX(anotherGC,s,strlength,controlWidth), volumeTitleA+18,s,strlength,Xoption); GSetForeground(anotherGC,(float)monoColor(toggleColor),Xoption); GDrawString(anotherGC,volumeWindow, control->buttonQueue[perspectiveBut].buttonX + 4, control->buttonQueue[perspectiveBut].buttonY - 17, "Settings", 8, Xoption); GSetForeground(trashGC,(float)monoColor(toggleColor),Xoption); GDraw3DButtonOut(trashGC,volumeWindow, control->buttonQueue[perspectiveBut].buttonX - 7, control->buttonQueue[perspectiveBut].buttonY - 36, 100,100,Xoption); for (i=0; i<strlen(clipMess); i++) GDrawString(trashGC,volumeWindow,clipMessX,clipMessY + i*clipMessDy, &(clipMess[i]),1,Xoption); for (i=0; i<strlen(eyeMess1); i++) GDrawString(trashGC,volumeWindow,eyeMess1X,eyeMess1Y + i*eyeMess1Dy, &(eyeMess1[i]),1,Xoption); for (i=0; i<strlen(eyeMess2); i++) GDrawString(trashGC,volumeWindow,eyeMess2X,eyeMess2Y + i*eyeMess2Dy, &(eyeMess2[i]),1,Xoption); GSetLineAttributes(trashGC,0,LineSolid,CapButt,JoinMiter,Xoption); GSetForeground(trashGC,(float)volumeButtonColor,Xoption); for (i=volumeButtonsStart; i<(volumeButtonsEnd); i++) { GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); switch (i) { case perspectiveBut: case clipRegionBut: case clipSurfaceBut: GSetForeground(volumeGC,(float)monoColor(toggleColor),Xoption); GDraw3DButtonOut(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(volumeGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).buttonWidth + 4, (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), (control->buttonQueue[i]).text, strlen(control->buttonQueue[i].text),Xoption); if (i==perspectiveBut && viewData.perspective) GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(volumeGC,"x",1, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), "x",1,Xoption); else if (i==clipRegionBut && viewData.clipbox) GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(volumeGC,"x",1, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), "x",1,Xoption); else if (i==clipSurfaceBut && viewData.clipStuff) GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(volumeGC,"x",1, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), "x",1,Xoption); break; case clipXBut: drawClipXBut(); break; case clipYBut: drawClipYBut(); break; case clipZBut: drawClipZBut(); break; case frustrumBut: break; default: GDraw3DButtonOut(trashGC,volumeWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); s = (control->buttonQueue[i]).text; strlength = strlen(s); GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(trashGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(processGC,s,strlength, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(processGC,(control->buttonQueue[i]).buttonHeight), s,strlen(s),Xoption); } /* switch */ } /* for i in volumeButtons */ drawFrustrum(); drawClipVolume(); /*** put in header ***/ drawClipXBut(); drawClipYBut(); drawClipZBut(); } /* drawVolumePanel() */