OCC22391 Polylines arrays not drawn for mesh with VBO flag enabled
[occt.git] / src / OpenGl / OpenGl_bsurfprop.cxx
CommitLineData
7fd59977 1
2#include <OpenGl_tgl_all.hxx>
3
4#include <stddef.h>
5#include <stdio.h>
6
7#include <OpenGl_cmn_varargs.hxx>
8#include <OpenGl_telem_attri.hxx>
9#include <OpenGl_tsm.hxx>
10#include <OpenGl_telem.hxx>
11#include <OpenGl_telem_inquire.hxx>
12
13static TStatus BackSurfaceAreaPropertiesDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
14static TStatus BackSurfaceAreaPropertiesAdd( TSM_ELEM_DATA, Tint, cmn_key* );
15static TStatus BackSurfaceAreaPropertiesDelete( TSM_ELEM_DATA, Tint, cmn_key* );
16static TStatus BackSurfaceAreaPropertiesPrint( TSM_ELEM_DATA, Tint, cmn_key* );
17static TStatus BackSurfaceAreaPropertiesInquire( TSM_ELEM_DATA, Tint, cmn_key* );
18
19static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
20{
21 0, /* PickTraverse */
22 BackSurfaceAreaPropertiesDisplay,
23 BackSurfaceAreaPropertiesAdd,
24 BackSurfaceAreaPropertiesDelete,
25 BackSurfaceAreaPropertiesPrint,
26 BackSurfaceAreaPropertiesInquire
27};
28
29
30MtblPtr
31TelBackSurfaceAreaPropertiesInitClass( TelType *el )
32{
33 *el = TelBackSurfaceAreaProperties;
34 return MtdTbl;
35}
36
37static TStatus
38BackSurfaceAreaPropertiesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
39{
40 tel_surf_prop data = new TEL_SURF_PROP();
41 if( !data )
42 return TFailure;
43
44 *data = *(tel_surf_prop)(k[0]->data.pdata);
45
46 ((tsm_elem_data)(d.pdata))->pdata = data;
47
48 return TSuccess;
49}
50
51
52static TStatus
53BackSurfaceAreaPropertiesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
54{
55 CMN_KEY key;
56
57 key.id = TelBackSurfaceAreaProperties;
58 key.data.pdata = data.pdata;
59 TsmSetAttri( 1, &key );
60
61 return TSuccess;
62}
63
64
65static TStatus
66BackSurfaceAreaPropertiesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
67{
68 if (data.pdata)
69 delete data.pdata;
70 return TSuccess;
71}
72
73
74
75
76static TStatus
77BackSurfaceAreaPropertiesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
78{
79 tel_surf_prop p = (tel_surf_prop)data.pdata;
80
81 fprintf( stdout, "TelBackSurfaceAreaProperties\n" );
82 fprintf( stdout, "\tAmbient Coeff: %f\n", p->amb );
83 fprintf( stdout, "\tDiffuse Coeff: %f\n", p->diff );
84 fprintf( stdout, "\tSpecular Coeff: %f\n", p->spec );
85 fprintf( stdout, "\tTransparency Coeff: %f\n", p->trans );
86 fprintf( stdout, "\tShininess: %f\n", p->shine );
87 fprintf( stdout, "\tSpecular colour: R = %f, G = %f, B = %f\n",
88 p->speccol.rgb[0], p->speccol.rgb[1], p->speccol.rgb[2] );
89 fprintf( stdout, "\n" );
90
91 return TSuccess;
92}
93
94
95static TStatus
96BackSurfaceAreaPropertiesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
97{
98 Tint i;
99 tel_surf_prop p = (tel_surf_prop)data.pdata;
100
101 for( i = 0; i < n; i++ )
102 {
103 switch( k[i]->id )
104 {
105 case INQ_GET_SIZE_ID:
106 {
107 k[i]->data.ldata = sizeof( Tint );
108 break;
109 }
110 case INQ_GET_CONTENT_ID:
111 {
112 TEL_INQ_CONTENT *c;
113 Teldata *w;
114
115 c = (tel_inq_content)k[i]->data.pdata;
116 w = c->data;
117 c->act_size = 0;
118 w->surf_prop = *p;
119 break;
120 }
121 }
122 }
123
124 return TSuccess;
125}