0022819: Redesign of OpenGl driver
[occt.git] / src / OpenGl / OpenGl_togl_view.cxx
1 /***********************************************************************
2
3 FONCTION :
4 ----------
5 File OpenGl_togl_view :
6
7
8 REMARQUES:
9 ----------       
10
11 HISTORIQUE DES MODIFICATIONS   :
12 --------------------------------
13 xx-xx-xx : xxx ; Creation.
14 08-07-96 : FMN ; Suppression appel call_togl_ car deja fait dans
15 call_togl_cliplimit.
16 17-07-96 : FMN ; Suppression appel call_subr_hlhsr
17 30-01-97 : FMN ; Suppression call_util_init_indexes()
18 30-06-97 : FMN ; Suppression code inutile
19 08-09-97 : CAL ; subr_open_ws retourne 0 si pb.
20 24-12-97 : FMN ; Suppression de call_func_set_back_int_shad_meth()
21
22 ************************************************************************/
23
24 /*----------------------------------------------------------------------*/
25 /*
26 * Includes
27 */ 
28
29 #include <OpenGl_tgl_all.hxx>
30
31 #include <InterfaceGraphic_Labels.hxx>
32 #include <InterfaceGraphic_Graphic3d.hxx>
33 #include <InterfaceGraphic_Visual3d.hxx>
34
35 #include <OpenGl_tgl_vis.hxx>
36 #include <OpenGl_tgl_util.hxx>
37 #include <OpenGl_tgl_funcs.hxx>
38 #include <OpenGl_tgl_subrvis.hxx>
39 #include <OpenGl_tgl_utilgr.hxx>
40
41 /*----------------------------------------------------------------------*/
42
43 int EXPORT
44 call_togl_view
45 (
46  CALL_DEF_VIEW * aview
47  )
48 {
49
50   if (! call_subr_open_ws(aview))
51     return 0;
52
53   call_util_init_filters(aview->WsId);
54
55   if( call_util_test_structure(aview->ViewId) )
56     call_func_del_struct(aview->ViewId);
57
58   call_func_set_edit_mode(CALL_PHIGS_EDIT_INSERT);
59
60   call_func_open_struct(aview->ViewId);
61   call_func_label (View_LABViewIndex);
62   call_func_set_view_ind (aview->ViewId);
63
64   call_func_label (View_LABViewContext);
65   switch (aview->Context.Visualization)
66   {
67   case 0 : /* VISUAL3D_TOV_WIREFRAME */
68     call_func_appl_data (0);
69     break;
70   case 1 : /* VISUAL3D_TOV_SHADING */
71     switch (aview->Context.Model)
72     {
73     case 0 : /* VISUAL3D_TOM_NONE */
74       call_func_set_int_shad_meth (CALL_PHIGS_SD_NONE);
75       break;
76     case 1 : /* VISUAL3D_TOM_INTERP_COLOR */
77       call_func_set_int_shad_meth (CALL_PHIGS_SD_COLOUR);
78       break;
79     case 2 : /* VISUAL3D_TOM_FACET */
80       call_func_set_int_shad_meth
81         (CALL_PHIGS_SD_DOT_PRODUCT);
82       break;
83     case 3 : /* VISUAL3D_TOM_VERTEX */
84       call_func_set_int_shad_meth (CALL_PHIGS_SD_NORMAL);
85       break;
86     case 4 : /* VISUAL3D_TOM_HIDDENLINE */
87       call_func_set_int_shad_meth (CALL_PHIGS_SD_NONE);
88       break;
89     }
90     break;
91   }
92
93   call_func_label (View_LABHlhsr);
94   call_func_appl_data (0);
95
96   call_func_label (View_LABLight);
97   call_func_appl_data (0);
98
99   call_func_label (View_LABPlane);
100   call_func_appl_data (0);
101
102   call_func_label (View_LABAliasing);
103   call_func_appl_data (0);
104
105   call_func_label (View_LABDepthCueing);
106   call_func_appl_data (0);
107
108   call_func_label (View_LABPriority00);
109   call_func_label (View_LABPriority01);
110   call_func_label (View_LABPriority02);
111   call_func_label (View_LABPriority03);
112   call_func_label (View_LABPriority04);
113   call_func_label (View_LABPriority05);
114   call_func_label (View_LABPriority06);
115   call_func_label (View_LABPriority07);
116   call_func_label (View_LABPriority08);
117   call_func_label (View_LABPriority09);
118   call_func_label (View_LABPriority10);
119   call_func_label (View_LABEnd);
120   call_func_label (View_LABImmediat1);
121   call_func_label (View_LABImmediat2);
122   call_func_close_struct ();
123
124   if( call_viewrep.active_status == TOff )
125   {/* First time. Set defaults */
126     call_viewrep.active_status = TOn;
127     call_viewrep.shield_indicator = TOn;
128     call_viewrep.border_indicator = TOff; /* non utilise */
129     call_viewrep.shield_colour.rgb[0] = ( float )0.0,
130       call_viewrep.shield_colour.rgb[1] = ( float )0.0,
131       call_viewrep.shield_colour.rgb[2] = ( float )0.0;
132     call_viewrep.border_colour.rgb[0] = ( float )0.0,
133       call_viewrep.border_colour.rgb[1] = ( float )0.0,
134       call_viewrep.border_colour.rgb[2] = ( float )0.0;
135   }
136
137   return 1;
138 }