/* $XConsortium: faswd1.pi,v 5.2 94/04/17 20:49:00 rws Exp $ */ /***************************************************************** Copyright (c) 1989, 1990, 1991,1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989, 1990, 1991,1990 by Sun Microsystems, Inc. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Sun Microsystems, and the X Consortium, not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ ## faswd1.pi ## Test fill area set geometry and facet/vertex colour ## . 1-set vertices FACET_COLOUR (indirect) VERT_COORD ## . 2-set vertices FACET_NONE,VERT_COORD_COLOUR (RGB) ## . 2-set vertices FACET_COLOUR (RGB) VERT_COORD ## . 2-set vertices with edges data FACET_NONE,VERT_COORD ## . 2-set vertices with edges data FACET_NONE,VERT_COORD ## . 1-set vertices FACET_COLOUR (RGB) VERT_COORD_COLOUR (RGB) source macro.pi # data structures initialization section tbegintest("faswd1","fill area set with data - geometry and facet/vertex colour"); # initialize geometry for fill area set # 1-set - facet indirect colour, vertex coordinate col2 = I_Pcoval(PINDIRECT, 4); fdata2 = I_Pfacet_data3(PFACET_COLOUR, col2); ptarr2 = IA_Ppoint3(3, 0.4,0.1,0.0, 0.5,0.2,0.0, 0.6,0.1,0.0); varr2 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr2); vlst2 = I_Pfacet_vdata_list3(3, varr2); vdata2 = IA_Pfacet_vdata_list3(1, vlst2); # 2-set - facet none, vertex coordinate and RGB colour p31 = I_Ppoint3(0.1,0.7,0.0); p32 = I_Ppoint3(0.1,0.5,0.0); p33 = I_Ppoint3(0.3,0.7,0.0); p34 = I_Ppoint3(0.3,0.5,0.0); c31 = I_Pcoval(PMODEL_RGB,0.0,0.0,1.0); c32 = I_Pcoval(PMODEL_RGB,1.0,1.0,0.0); c33 = I_Pcoval(PMODEL_RGB,0.0,1.0,0.0); c34 = I_Pcoval(PMODEL_RGB,0.0,0.0,1.0); ptcolarr31 = IA_Pptco3(3,p31,c31,p32,c32,p33,c33); ptcolarr32 = IA_Pptco3(3,p32,c32,p33,c33,p34,c34); varr31 = I_Pfacet_vdata_arr3(PVERT_COORD_COLOUR, ptcolarr31); varr32 = I_Pfacet_vdata_arr3(PVERT_COORD_COLOUR, ptcolarr32); vlst31 = I_Pfacet_vdata_list3(3, varr31); vlst32 = I_Pfacet_vdata_list3(3, varr32); vdata3 = IA_Pfacet_vdata_list3(2, vlst31,vlst32); # 2-set - facet RGB colour, vertex coordinate col4 = I_Pcoval(PMODEL_RGB, 1.0,0.0,0.0); ptarr41 = IA_Ppoint3(3, 0.4,0.7,0.0, 0.4,0.5,0.0, 0.6,0.7,0.0); ptarr42 = IA_Ppoint3(3, 0.4,0.5,0.0, 0.6,0.7,0.0, 0.6,0.5,0.0); varr41 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr41); varr42 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr42); vlst41 = I_Pfacet_vdata_list3(3, varr41); vlst42 = I_Pfacet_vdata_list3(3, varr42); vdata4 = IA_Pfacet_vdata_list3(2, vlst41,vlst42); fdata4 = I_Pfacet_data3(PFACET_COLOUR, col4); # 2-set - facet none, vertex coordinate, edge data ptarr51 = IA_Ppoint3(3, 0.1,0.8,0.0, 0.1,0.9,0.0, 0.3,0.8,0.0); ptarr52 = IA_Ppoint3(3, 0.2,0.9,0.0, 0.4,0.8,0.0, 0.4,0.9,0.0); varr51 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr51); varr52 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr52); vlst51 = I_Pfacet_vdata_list3(3, varr51); vlst52 = I_Pfacet_vdata_list3(3, varr52); vdata5 = IA_Pfacet_vdata_list3(2, vlst51,vlst52); edataarr51 = I_Pedge_data_arr(3,PEDGE_ON,PEDGE_OFF,PEDGE_ON) edataarr52 = I_Pedge_data_arr(3,PEDGE_OFF,PEDGE_ON,PEDGE_OFF) elst51 = I_Pedge_data_list(3,edataarr51) elst52 = I_Pedge_data_list(3,edataarr52) edata5 = IA_Pedge_data_list(2,elst51,elst52) # 2-set - facet none, vertex coordinate, edge data ptarr61 = IA_Ppoint3(3, 0.1,0.1,0.0, 0.1,0.2,0.0, 0.3,0.1,0.0); ptarr62 = IA_Ppoint3(3, 0.2,0.2,0.0, 0.4,0.1,0.0, 0.4,0.2,0.0); varr61 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr61); varr62 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr62); vlst61 = I_Pfacet_vdata_list3(3, varr61); vlst62 = I_Pfacet_vdata_list3(3, varr62); vdata6 = IA_Pfacet_vdata_list3(2, vlst61,vlst62); edataarr61 = I_Pedge_data_arr(3,PEDGE_ON,PEDGE_OFF,PEDGE_ON) edataarr62 = I_Pedge_data_arr(3,PEDGE_OFF,PEDGE_ON,PEDGE_OFF) elst61 = I_Pedge_data_list(3,edataarr61) elst62 = I_Pedge_data_list(3,edataarr62) edata6 = IA_Pedge_data_list(2,elst61,elst62) # 3 vertex - facet RGB colour, vertex coordinate and RGB colour col7 = I_Pcoval(PMODEL_RGB, 1.0,0.0,0.0); fdata7 = I_Pfacet_data3(PFACET_COLOUR, col7); p71 = I_Ppoint3(0.6,0.8,0.0); p72 = I_Ppoint3(0.7,0.9,0.0); p73 = I_Ppoint3(0.8,0.8,0.0); c71 = I_Pcoval(PMODEL_RGB,1.0,1.0,1.0); c72 = I_Pcoval(PMODEL_RGB,1.0,0.0,1.0); c73 = I_Pcoval(PMODEL_RGB,0.0,1.0,1.0); ptcolarr7 = IA_Pptco3(3,p71,c71,p72,c72,p73,c73); varr7 = I_Pfacet_vdata_arr3(PVERT_COORD_COLOUR, ptcolarr7); vlst7 = I_Pfacet_vdata_list3(3, varr7); vdata7 = IA_Pfacet_vdata_list3(1, vlst7); # state initialization i_open_phigs(NULL,0); i_open_x_ws(1,&xdisplay,&xwindow,0,0,200,200); popen_struct(1); ppost_struct(1,1,1.0) pset_int_shad_meth(PSD_NONE); pset_int_style(PSTYLE_SOLID); pset_int_colr_ind(1); # triangle strip with data # 1-set - facet indirect colour, vertex coordinate pfill_area_set3_data(PFACET_COLOUR,PEDGE_NONE,PVERT_COORD,PINDIRECT, &fdata2,1,NULL,vdata2); # 2-set - facet none, vertex coordinate and RGB colour pfill_area_set3_data(PFACET_NONE,PEDGE_NONE,PVERT_COORD_COLOUR,PMODEL_RGB, NULL,2,NULL,vdata3) # 2-set - facet RGB colour, vertex coordinate pfill_area_set3_data(PFACET_COLOUR,PEDGE_NONE,PVERT_COORD,PMODEL_RGB, &fdata4,2,NULL,vdata4) # 2-set - facet none, vertex coordinate, edge data, edge flag OFF pfill_area_set3_data(PFACET_NONE,PEDGE_VISIBILITY,PVERT_COORD,PMODEL_RGB, NULL,2,edata5,vdata5) # 2-set - facet none, vertex coordinate, edge data, edge flag ON pset_edge_flag(PEDGE_ON); pset_edge_colr_ind(4); pset_edgewidth(3.0); pfill_area_set3_data(PFACET_NONE,PEDGE_VISIBILITY,PVERT_COORD,PMODEL_RGB, NULL,2,edata6,vdata6) # 1-set - facet RGB colour, vertex coordinate and RGB colour pfill_area_set3_data(PFACET_COLOUR,PEDGE_NONE,PVERT_COORD_COLOUR,PMODEL_RGB, &fdata7,1,NULL,vdata7) # verify image i_check_image("faswd1",xdisplay,xwindow,0,0,199,199, "fill area set with data - geometry and colour"); im_def_grid(); i_pause(); tendtest();