-+-+-+-+-+-+-+-+ START OF PART 282 -+-+-+-+-+-+-+-+ X** The camera must be switched OFF for these values to be set. X** The error code is a standard PHIGS error code.`7D X*/ X`7B X Pmatrix3 orimat; X X setwindow(windid); X if (windptr != NULL) X `7B X ptk_pevalvieworientationmatrix3(vrp, vpn, vup, error, orimat); X if (*error == 0) X `7B X windptr->vrp = *vrp; X windptr->vpn = *vpn; X windptr->vup = *vup; X updateview(); X `7D X `7D X`7D /* ptk_setvieworientation3 */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setviewmapping3(C(Pint) windid, C(Plimit *) window, X C(Plimit3 *) viewport, C(Pprojtype) proj, C(Ppoint3 *) prp,`20 X C(Pfloat) viewplane, C(Pfloat) backplane, C(Pfloat) frontplane,` V20 X C(Pint *) error) XPreANSI(Pint windid) XPreANSI(Plimit *window) XPreANSI(Plimit3 *viewport) XPreANSI(Pprojtype proj) XPreANSI(Ppoint3 *prp) XPreANSI(Pfloat viewplane) XPreANSI(Pfloat backplane) XPreANSI(Pfloat frontplane) XPreANSI(Pint *error) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPlimit *`7D`7Bwindow`7D`7Bview window`7D`7BIN`7D X** \param`7BPlimit3 *`7D`7Bviewport`7D`7Bprojection viewport`7D`7BIN`7D X** \param`7BPprojtype`7D`7Bproj`7D`7Bprojection type`7D`7BIN`7D X** \param`7BPpoint3 *`7D`7Bprp`7D`7Bprojection reference point`7D`7BIN`7D X** \param`7BPfloat`7D`7Bviewplane`7D`7Bview plane distance`7D`7BIN`7D X** \param`7BPfloat`7D`7Bbackplane`7D`7Bback plane distance`7D`7BIN`7D X** \param`7BPfloat`7D`7Bfrontplane`7D`7Bfront plane distance`7D`7BIN`7D X** \param`7BPint *`7D`7Berror`7D`7Berror indicator`7D`7BOUT`7D X** \paramend`20 X** \blurb`7BThis function sets the window view mapping values. X** The camera must be switched OFF for these values to be set. X** The largest square within the window is defined to be the X** device coordinates area which the view maps onto. X** The error code is a standard PHIGS error code.`7D X*/ X`7B X Pmatrix3 mapmat; X Pviewmapping3 mapping; X X setwindow(windid); X if (windptr != NULL) X `7B X mapping.window = *window; X mapping.proj = proj; X mapping.prp = *prp; X mapping.view_plane = viewplane; X mapping.back_plane = backplane; X mapping.front_plane = frontplane; X mapping.viewport = *viewport; X evalviewport(&mapping.viewport); X pevalviewmappingmatrix3(&mapping, error, mapmat); X if (*error == 0) X `7B X windptr->window = *window; X windptr->viewport = *viewport; X windptr->proj = proj; X windptr->prp = *prp; X windptr->viewplane = viewplane; X windptr->backplane = backplane; X windptr->frontplane = frontplane; X updateview(); X `7D X `7D X`7D /* ptk_setviewmapping3 */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setviewclipping3(C(Pint) windid, C(Plimit3 *) cliplims, X C(Pclip) clipxy, C(Pclip) clipback, C(Pclip) clipfront) XPreANSI(Pint windid) XPreANSI(Plimit3 *cliplims) XPreANSI(Pclip clipxy) XPreANSI(Pclip clipfront) XPreANSI(Pclip clipback) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPlimit3 *`7D`7Bcliplims`7D`7Bview clipping limits`7D`7BIN`7D X** \param`7BPclip`7D`7Bclipxy`7D`7Bx-y clipping indicator`7D`7BIN`7D X** \param`7BPclip`7D`7Bclipback`7D`7Bback plane clipping indicator`7D`7BIN`7 VD X** \param`7BPclip`7D`7Bclipfront`7D`7Bfront plane clipping indicator`7D`7BIN V`7D X** \paramend`20 X** \blurb`7BThis function sets the window view clipping values.`20 X** The camera must be switched OFF for these values to be set.`7D X*/ X`7B X setwindow(windid); X if (windptr != NULL) X `7B X windptr->cliplimit = *cliplims; X windptr->clipxy = clipxy; X windptr->clipback = clipback; X windptr->clipfront = clipfront; X updateview(); X `7D X`7D /* ptk_setviewclipping3 */ X X/*-------------------------------------------------------------------------- V*/ X/*------------------- Window system functions ------------------------------ V*/ X/*-------------------------------------------------------------------------- V*/ X Xstatic void createwindow(C(Pint) wsid, C(Pint) windid, C(Ppoint *) size, X C(Ppoint *) position, C(Pint) backgdcolour, X C(Pint) edgecolour, C(Pint) frametlcolour, C(Pint) framebrcolour, X C(Pint) titlecolour, C(Pchar *) titlestring) XPreANSI(Pint wsid) XPreANSI(Pint windid) XPreANSI(Ppoint *size) XPreANSI(Ppoint *position) XPreANSI(Pint backgdcolour) XPreANSI(Pint edgecolour) XPreANSI(Pint frametlcolour) XPreANSI(Pint framebrcolour) XPreANSI(Pint titlecolour) XPreANSI(Pchar *titlestring) X/*`20 X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bsize`7D`7Bwindow size`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bposition`7D`7Bwindow position`7D`7BIN`7D X** \param`7BPint`7D`7Bbackgdcolour`7D`7Bbackground colour index of window`7D V`7BIN`7D X** \param`7BPint`7D`7Bedgecolour`7D`7Bedge colour index of window`7D`7BIN`7D X** \param`7BPint`7D`7Bframetlcolour`7D`7Btop-left frame colour index`7D`7BIN V`7D X** \param`7BPint`7D`7Bframebrcolour`7D`7Bbottom-right frame colour index`7D` V7BIN`7D X** \param`7BPint`7D`7Btitlecolour`7D`7Btitle string colour index`7D`7BIN`7D X** \param`7BPchar *`7D`7Btitlestring`7D`7Btitle string`7D`7BIN`7D X** \paramend X** \blurb`7BThis function creates a window structure which may be used X** for viewing PHIGS structures, PHIGS Toolkit topology diagrams and X** PHIGS Toolkit structure content diagrams. A terminal window X** type which contains only text. The window size and position are X** given in the range `5B0, 1`5D. Each window has a virtual camera X** which is useful for moving around a scene.`7D X*/ X`7B X Pint err, inclname; X Pviewrep3 vrep; X Pchar stname`5B30`5D, str`5B10`5D; X Ppoint pts`5B4`5D, textpos, iconbox; X Pmatrix3 unitmat, mat; X Ppoint3 wscale, shift; X Pfloat charht; X Ptxalign align; X Ppointlst sets; X Pintlst incl; X `20 X setwindow(windid); X if (windptr == NULL) X `7B X if (lastwind == NULL) X `7B X firstwind = lastwind = windptr = X (ptkswindow *)malloc(sizeof(ptkswindow)); X windptr->next = NULL; X `7D X else X `7B X lastwind->next = windptr = (ptkswindow *)malloc(sizeof(ptkswindow)); X windptr->next = NULL; X lastwind = lastwind->next; X `7D X X windowcount++; `20 X windptr->wsid = wsid; X checkws(wsid); X windptr->windowid = windid; X sprintf(stname, "struct$window%d", windid); X windptr->windowstid = windptr->currentstid =`20 X ptk_stringtoint("structureid", stname); X sprintf(stname, "struct$icon%d", windid); X windptr->iconstid = ptk_stringtoint("structureid", stname); X sprintf(stname, "view$window%d", windid); X windptr->windowviewind = ptk_stringtoint("viewindex", stname); X sprintf(stname, "name$window%d", windid); X windptr->windowname = ptk_stringtoint("name", stname); X windptr->windowsize = *size; X windptr->windowposition = *position; X `20 X /* default camera variables */ X windptr->position = ptk_point3(0.5, 0.5, 2.0); X windptr->ptinterest = ptk_point3(0.5, 0.5, 0.5); X windptr->positionaxis = ptk_point3(0.0, 1.0, 0.0); X windptr->ptinterestaxis = ptk_point3(0.0, 1.0, 0.0); X windptr->lastvpn = ptk_point3(0.0, 0.0, 1.0); X windptr->lastvup = ptk_point3(0.0, 1.0, 0.0); X windptr->swivelangle = windptr->spinangle =`20 X windptr->twistangle = 0.0; X windptr->cameraproj = PPARALLEL; X windptr->xaxis = ptk_point3(1.0, 0.0, 0.0); X windptr->yaxis = ptk_point3(0.0, 1.0, 0.0); X `20 X /* default viewing variables */ X windptr->proj = PPARALLEL; X windptr->vrp = ptk_point3(0.5, 0.5, 0.5); X windptr->prp = ptk_point3(0.0, 0.0, 2.0); X windptr->vpn = ptk_point3(0.0, 0.0, 1.0); X windptr->vup = ptk_point3(0.0, 1.0, 0.0); X windptr->window = ptk_limit(-0.5, 0.5, -0.5, 0.5); X windptr->viewport = ptk_limit3(0.0, 1.0, 0.0, 1.0, 0.0, 1.0); X windptr->frontplane = 0.5; X windptr->viewplane = 0.0; X windptr->backplane = -0.5; X windptr->clipxy = windptr->clipfront = windptr->clipback = PNOCLIP; X `20 X /* other window defaults */ X windptr->windowtype = PTKESTRUCTWINDOW; X windptr->cameraswitch = PTKECAMERAON; X windptr->framesize = ptk_point(0.01, 0.01); X windptr->iconsize = ptk_point(0.1, 0.1); X windptr->iconposition = windptr->windowposition; X windptr->defaulticon = TRUE; X windptr->titlefont = 1; X windptr->bannerheight = 0.02; X windptr->bannercolour = backgdcolour; X `20 X windptr->backgdcolour = backgdcolour; X windptr->edgecolour = edgecolour; X windptr->frametlcolour = frametlcolour; X windptr->framebrcolour = framebrcolour; X windptr->titlecolour = titlecolour; X strncpy(windptr->titlestring, titlestring, strlen(titlestring) + 1); X windptr->posted = FALSE; X windptr->windowstate = PTKEWINDOWOPEN; X X windptr->viewbox = windptr->viewlims = windptr->cliplimit = X ptk_limit3(position->x - (size->x / 2.0), X position->x + (size->x / 2.0), X position->y - (size->y / 2.0), X position->y + (size->y / 2.0), X 0.0, 1.0); X windptr->viewvolume = ptk_point3(1.0, 1.0, 1.0); X `20 X /* make window structure */ X ptk_seteditmode(PEDIT_INSERT); X ptk_openstruct(windptr->windowstid); X X incl.number = 1; X incl.integers = &inclname; X incl.integers`5B0`5D = windptr->windowname; X paddnameset(&incl); X X plabel(ptk_stringtoint("label", "globaltran")); X /* window frame transformation */ X shift = ptk_point3(windptr->windowposition.x, windptr->windowposition.y, V`20 X 0.0);`20 X ptk_shift3(&shift, PREPLACE, mat); X psetlocaltran3(mat, PREPLACE); X `20 X plabel(ptk_stringtoint("label", "begin-frame")); X buildframe(); X plabel(ptk_stringtoint("label", "end-frame")); X X psetintstyle(PHOLLOW); X psetedgeflag(PEDGE_OFF); X psetedgecolourind(1); X psetintcolourind(1); X psettextcolourind(1); X psetcharheight(0.01); X psettextfont(1); X X ptk_unitmatrix3(mat); X psetlocaltran3(mat, PREPLACE); X psetviewind(windptr->windowviewind); X `20 X plabel(ptk_stringtoint("label", "begin-window")); X `20 X plabel(ptk_stringtoint("label", "end-window")); X premovenameset(&incl); X ptk_closestruct(); X `20 X updatecamera(); X `20 X /* make default window icon structure */ X ptk_openstruct(windptr->iconstid); X paddnameset(&incl); X psetpickid(PTKEWINDOWICON); X shift = ptk_point3(-0.5, -0.5, 0.0); X ptk_shift3(&shift, PREPLACE, mat); X wscale.x = windptr->iconsize.x; X wscale.y = windptr->iconsize.y; X wscale.z = 1.0; X ptk_scale3(&wscale, PPOSTCONCATENATE, mat); X shift = ptk_point3(windptr->iconposition.x, windptr->iconposition.y, X 0.0); X ptk_shift3(&shift, PPOSTCONCATENATE, mat); X psetlocaltran3(mat, PREPLACE); X plabel(ptk_stringtoint("label", "begin-icon")); X pts`5B0`5D = ptk_point(0.0, 0.0); X pts`5B1`5D = ptk_point(1.0, 0.0); X pts`5B2`5D = ptk_point(1.0, 1.0); X pts`5B3`5D = ptk_point(0.0, 1.0); X psetintstyle(PSOLID); X psetintcolourind(backgdcolour); X psetedgeflag(PEDGE_ON); X psetedgecolourind(titlecolour); X sets.number = 4; X sets.points = pts; X ptk_fillareaset(1, &sets); X `20 X sprintf(str, "%d", windptr->windowid); X textpos = ptk_point(0.5, 0.5); X align.hor = PAH_CENTRE; X align.ver = PAV_HALF; X psettextalign(&align); X iconbox = ptk_point(1.0, 1.0); X ptk_computecharheight(windptr->wsid, str, &iconbox, 1, &charht); X psetcharheight(charht); X psettextcolourind(titlecolour); X ptext(&textpos, str);`20 X plabel(ptk_stringtoint("label", "end-icon")); X premovenameset(&incl);`20 X ptk_closestruct();`20 X ptk_unseteditmode(); X `7D X`7D /* createwindow */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_createwindow(C(Pint) wsid, C(Pint) windid, C(Ppoint *) size, X C(Ppoint *) position, C(Pchar *) titlestring) XPreANSI(Pint wsid) XPreANSI(Pint windid) XPreANSI(Ppoint *size) XPreANSI(Ppoint *position) XPreANSI(Pchar *titlestring) X/*`20 X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bsize`7D`7Bwindow size`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bposition`7D`7Bwindow position`7D`7BIN`7D X** \param`7BPchar *`7D`7Btitlestring`7D`7Btitle string`7D`7BIN`7D X** \paramend X** \blurb`7BThis function creates a window structure which may be used X** for viewing PHIGS structures, PHIGS Toolkit topology diagrams and X** PHIGS Toolkit structure content diagrams. A terminal window X** type which contains only text. The window size and position are X** given in the range `5B0, 1`5D. Each window has a virtual camera X** which is useful for moving around a scene. X** This function requires hashtables "structureid", "label", "name", X** "viewindex".`7D`20 X*/ X`7B X createwindow(wsid, windid, size, position, 0, 1, 1, 1, 1, titlestring); X`7D /* ptk_createwindow */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setwindowattrs(C(Pint) windid, X C(Pint) titlefont, C(Pint) titlecolour, C(Pint) bannercolour, X C(Pint) backgdcolour, C(Pint) edgecolour,`20 X C(Pint) frametlcolour, C(Pint) framebrcolour) XPreANSI(Pint windid) XPreANSI(Pint titlefont) XPreANSI(Pint titlecolour) XPreANSI(Pint bannercolour) XPreANSI(Pint backgdcolour) XPreANSI(Pint edgecolour) XPreANSI(Pint frametlcolour) XPreANSI(Pint framebrcolour) X/*`20 X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPint`7D`7Btitlefont`7D`7Btitle string font`7D`7BIN`7D +-+-+-+-+-+-+-+- END OF PART 282 +-+-+-+-+-+-+-+-