OCC22108 Cutting plane unpredictable behaviour in V3d_View
[occt.git] / src / OpenGl / OpenGl_intshademtd.cxx
1
2 #include <OpenGl_tgl_all.hxx>
3
4 #include <stddef.h>
5 #include <stdio.h>
6 #include <GL/gl.h>
7 #include <GL/glu.h>
8
9 #include <OpenGl_cmn_varargs.hxx>
10 #include <OpenGl_telem_attri.hxx>
11 #include <OpenGl_tsm.hxx>
12 #include <OpenGl_telem.hxx>
13 #include <OpenGl_telem_inquire.hxx>
14
15 static  TStatus  InteriorShadingMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* );
16 static  TStatus  InteriorShadingMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
17 static  TStatus  InteriorShadingMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* );
18 static  TStatus  InteriorShadingMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* );
19
20 static  TStatus  (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
21 {
22   0,             /* PickTraverse */
23   InteriorShadingMethodDisplay,
24   InteriorShadingMethodAdd,
25   0,             /* Delete */
26   InteriorShadingMethodPrint,
27   InteriorShadingMethodInquire
28 };
29
30
31 MtblPtr
32 TelInteriorShadingMethodInitClass( TelType *el )
33 {
34   *el = TelInteriorShadingMethod;
35   return MtdTbl;
36 }
37
38 static  TStatus
39 InteriorShadingMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
40 {
41   ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
42
43   return TSuccess;
44 }
45
46
47 static  TStatus
48 InteriorShadingMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
49 {
50   CMN_KEY  key;
51
52   key.id = TelInteriorShadingMethod;
53   key.data.ldata = d.ldata;
54   TsmSetAttri( 1, &key );
55   return TSuccess;
56 }
57
58
59 static  TStatus
60 InteriorShadingMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
61 {
62   switch( data.ldata )
63   {
64   case TEL_SM_FLAT:
65     fprintf( stdout, "TelInteriorShadingMethod. Value = GL_FLAT\n" );
66     break;
67
68   case TEL_SM_GOURAUD:
69     fprintf( stdout, "TelInteriorShadingMethod. Value = GL_SMOOTH\n" );
70     break;
71   }
72
73   fprintf( stdout, "\n" );
74
75   return TSuccess;
76 }
77
78
79 static TStatus
80 InteriorShadingMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
81 {
82   Tint i;
83
84   for( i = 0; i < n; i++ )
85   {
86     switch( k[i]->id )
87     {
88     case INQ_GET_SIZE_ID:
89       {
90         k[i]->data.ldata = sizeof( Tint );
91         break;
92       }
93     case INQ_GET_CONTENT_ID:
94       {
95         TEL_INQ_CONTENT *c;
96         Teldata         *w;
97
98         c = (tel_inq_content)k[i]->data.pdata;
99         w = c->data;
100         c->act_size = 0;
101         w->idata = data.ldata;
102         break;
103       }
104     }
105   }
106
107   return TSuccess;
108 }