
/* $XConsortium: dcue2.pi,v 5.2 91/07/24 18:51:21 hersh Exp $ */

## dcue2.pi -
## Test depth cuing with different primitives

source macro.pi

tbegintest("dcue2","Test depth cuing with different primitives");

# initialize: depth cue representations
yellow = I_Pgcolr(PMODEL_RGB,1.0,1.0,0.0)
red = I_Pgcolr(PMODEL_RGB,1.0,0.0,0.0)
dcue = I_Pdcue_bundle(PALLOWED,0.0,1.0,0.0,1.0,red)


# setup: open phigs, open workstation, open structure
#	set depth cue representations, interior style and colour

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_dcue_rep(1,1,&dcue)

pset_int_style(PSTYLE_SOLID)
pset_int_colr(&yellow)
pset_anno_char_ht(0.03);
pset_char_ht(0.03);
pset_text_colr(&yellow);
pset_line_colr(&yellow);
pset_marker_colr(&yellow);
pset_dcue_ind(1)

# draw different primitives with depth cuing 

# 1. annotation text
atxpos1 = I_Ppoint3(0.1,0.1,0.0);
atxoffset1 = I_Ppoint3( 0.0,0.0,0.0);
panno_text_rel3(&atxpos1,&atxoffset1,"PEX-SI");

# 3. fill area
fapts3 = IA_Ppoint3(4, 0.5,0.1,0.0, 0.5,0.2,1.0, 0.6,0.2,1.0, 0.6,0.1,0.0)
fa3 = I_Ppoint_list3(4,fapts3);
pfill_area3(&fa3);

# 4. fill area set
pts4 = IA_Ppoint3(4, 0.7,0.1,0.0, 0.7,0.2,1.0, 0.8,0.2,1.0, 0.8,0.1,0.0)
fas4 = I_Ppoint_list3(4,pts4);
fas4_l = I_Ppoint_list_list3(1,&fas4);
pfill_area_set3(&fas4_l);

# 5. fill area set with data
ptarr5 = IA_Ppoint3(4, 0.1,0.3,0.0, 0.1,0.4,1.0, 0.2,0.4,1.0, 0.2,0.3,0.0)
varr5 = I_Pfacet_vdata_arr3(PVERT_COORD,ptarr5);
vlst5 = I_Pfacet_vdata_list3(4,varr5);
vdata5 = IA_Pfacet_vdata_list3(1,vlst5);
pfill_area_set3_data(PFACET_NONE,PEDGE_NONE,PVERT_COORD,PMODEL_RGB,NULL,1,NULL,vdata5);

# 6. nurb curve
floatarr6 = IA_Pfloat(7, 0.0,0.0,0.0,0.1,0.2,0.2,0.2);
knots6 = I_Pfloat_list(7, floatarr6);
cpts6 = IA_Ppoint3(4, 0.3,0.3,0.0, 0.4,0.4,1.0, 0.5,0.4,1.0, 0.6,0.3,0.0);
ctlpts6 = I_Ppoint_list34(4,"3D",cpts6);
pnuni_bsp_curv(3,&knots6,PNON_RATIONAL,&ctlpts6,0.0,0.2);

# 7. nurb surface
floatarr7 = IA_Pfloat(6, 0.0,0.0,0.0,0.1,0.1,0.1);
knots7 = I_Pfloat_list(6, floatarr7);
cpts7 = IA_Ppoint3(9, 0.7,0.3,0.0, 0.8,0.35,0.0, 0.9,0.3,0.0,
                     0.7,0.4,0.5, 0.8,0.45,0.5, 0.9,0.4,0.5,
                     0.7,0.5,1.0, 0.8,0.55,1.0, 0.9,0.5,1.0);
grid7 = I_Ppoint_grid34(3,3,"3D",cpts7);
pnuni_bsp_surf(3,3,&knots7,&knots7,PNON_RATIONAL,&grid7,0,NULL)

# 8. polyline
plpts8 = IA_Ppoint3(2, 0.1,0.5,1.0, 0.1,0.6,0.0);
pl8 = I_Ppoint_list3(2,plpts8);
ppolyline3(&pl8);

# 9. polymarker
pmpts9 = IA_Ppoint3(2, 0.2,0.5,1.0, 0.2,0.6,0.0);
pm9 = I_Ppoint_list3(2,pmpts9);
ppolymarker3(&pm9);

# 10. polyline set with data
ptarr10 = IA_Ppoint3(2,0.3,0.5,1.0, 0.3,0.6,0.0);
lva10 = I_Pline_vdata_arr3(PVERT_COORD,ptarr10);
lv10 = I_Pline_vdata_list3(2,lva10);
vdata10 = IA_Pline_vdata_list3(1,lv10);
ppolyline_set3_data(PVERT_COORD,PMODEL_RGB,1,vdata10);

# 11. quad mesh with data
dim11 = I_Pint_size(2,2);
ptarr11 = IA_Ppoint3(4,0.4,0.5,0.0, 0.5,0.5,0.0, 0.4,0.6,1.0, 0.5,0.6,1.0);
vdata11 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr11);
pquad_mesh3_data(PFACET_NONE,PVERT_COORD,PMODEL_RGB,&dim11,NULL,&vdata11);

# 12. triangle strip with data
ptarr12 = IA_Ppoint3(3,0.2,0.7,0.0, 0.3,0.8,1.0, 0.1,0.8,1.0);
vdata12 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr12);
ptri_strip3_data(PFACET_NONE,PVERT_COORD,PMODEL_RGB,3,NULL,&vdata12); 
 
# 13. set of fill area set with data
ia13 = IA_Pint(3,0,1,2);
il13 = I_Pint_list(3,ia13);

ill13 = I_Pint_list_list(1,&il13);
vlist13 = IA_Pint_list_list(1,ill13);
 
ptarr13 = IA_Ppoint3(3, 0.5,0.7,0.0, 0.6,0.8,1.0, 0.4,0.8,1.0);
varr13 = I_Pfacet_vdata_arr3(PVERT_COORD, ptarr13);
vdata13 = I_Pfacet_vdata_list3(3,varr13);
pset_of_fill_area_set3_data(PFACET_NONE,PEDGE_NONE,PVERT_COORD,PMODEL_RGB,1,NULL,NULL,vlist13,&vdata13);

# 14. text

txpos14 = I_Ppoint3( 0.7,0.7,0.0);
dir14 = IA_Pvec3(2, 1.0,0.0,0.0, 0.0,1.0,0.0);
ptext3(&txpos14,dir14,"PEX-SI");


# verify image
i_check_image("dcue2",xdisplay,xwindow,0,0,199,199,
        "depth cuing with different primitives");

im_def_grid();
i_pause();

tendtest();
