0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_attri.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5File OpenGl_attri :
6
7
8REMARQUES:
9----------
10
11ATTENTION: Actuellement les materiaux ont le Front et Back identiques.
12(cf PRO6327). On met temporairement de cote le mode Distinguish.
13
14
15HISTORIQUE DES MODIFICATIONS :
16--------------------------------
17xx-xx-xx : xxx ; Creation.
1806-03-96 : FMN ; Ajout OpenGl_tgl_tox.h pour call_thedisplay
1901-04-96 : CAL ; Integration MINSK portage WNT
2012-04-96 : CAL ; Travail sur les materiaux
2107-05-96 : CAL ; Debug temporaire pour ROB, TelRobSetRGB ()
2210-06-96 : CAL ; Transparence dans TsmSetAttri
2313-06-96 : CAL ; Introduction de TsmPushAttriLight et TsmPopAttriLight
2428-06-96 : FMN ; Amelioration des performances sur les materiaux
2501-07-96 : FMN ; Correction + performance antialiasing;
2603-07-96 : FMN ; Test sur ZBuffer avant appel a TelUpdateMaterial.
2717-07-96 : FMN ; Suppression de HLHSRMode.
2807-10-96 : FMN ; Suppression appel TelUpdateMaterial et define TELCO.
2908-11-96 : FMN ; Suppression code CAL_OPTIM
3021-11-96 : FMN ; Correction PRO6181 et PRO4138 Suppression (balise FMN)
3105-12-96 : FMN ; PRO6327: Pas defaut on positionne les materiaux pour
32le front et le back.
3315-02-97 : FMN ; Suppression OpenGl_gl_compat.h
3425-02-97 : FMN ; Ajout print informations
3530-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
3603-07-97 : PCT ; Modif material.
3705-08-97 : PCT ; support texture mapping
3821-08-97 : PCT ; ajout deuxieme passe pour les textures
3908-12-97 : FMN ; Correction Flat/Gouraud
4009-12-97 : FMN ; Correction Antialing + Textures + Transparence
4122-12-97 : FMN ; Suppression DEBUG_TEMPO_FOR_ROB
42Correction PRO10217 sur le mode Transient
4323-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
44et TelBackInteriorShadingMethod
4530-12-97 : FMN ; CTS18312: Correction back material
4631-12-97 : FMN ; Optimisation gestion material
4715-01-98 : FMN ; Ajout Hidden line
4808-04-98 : FGU ; Ajout emission
4930-06-98 : FMN ; Correction init des materiaux dans TelUpdateMateriaux.
5008-07-98 : FMN ; PRO14399: Meilleure gestion de la matrice locale sur
51une structure.
5221-07-98 : FMN ; Correction init attri_default et du hatch
5330-11-98 : FMN ; S4069 : Textes toujours visibles
5405-01-99 : CAL ; Warning WNT
5522-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
56
57************************************************************************/
58
59#define BUC60577 /*GG_101099 Enable to compute correctly
60// transparency with more than one object in the view.
61*/
62
63#define IMP190100 /*GG Push and Pop polyline type and width
64// attributes correctly.
65*/
66
67#define G003 /*EUG degeneration mode management
68*/
69
70#define GER61394 /*GG 26/05/00 Enable AntiAliasing also on polygons.*/
71
72#define BUC60742 /*GG 18/09/00 Enable to use both animation and
73graphic structure transformation
74*/
75
76#define IMP250401 /*GG Sets always the current polyline colour
77used in immediat mode context.
78*/
79
80/*OCC8568 changes made by GG rolled back due to regression*/
81/*#define BUC60918*/ /*GG CADPAK_V2/RINA Enable transparency using Zbuffer
82 */
83
84/*----------------------------------------------------------------------*/
85/*
86* Constantes
87*/
88
89#define NO_TRACE
90#define NO_TRACE_UPMATERIAL
91#define NO_TRACE_MATERIAL
92#define NO_TRACE_LIGHT
93#define NO_TRACE_MATRIX
94#define NO_TRACE_TEXT
95
96/*----------------------------------------------------------------------*/
97/*
98* Includes
99*/
100
101/* OCC22218 NOTE: project dependency on gl2ps is specified by macro */
102#ifdef HAVE_GL2PS
103 #include <gl2ps.h>
104 /* OCC22216 NOTE: linker dependency can be switched off by undefining macro.
105 Pragma comment for gl2ps.lib is defined only here. */
106 #ifdef _MSC_VER
107 #pragma comment( lib, "gl2ps.lib" )
108 #endif
109#endif
110
111#include <OpenGl_tgl_all.hxx>
112
113#include <stdio.h>
114#include <string.h>
115
116#include <GL/gl.h>
117
118#include <OpenGl_cmn_varargs.hxx>
119#include <OpenGl_telem_attri.hxx>
120#include <OpenGl_telem_view.hxx>
121#include <OpenGl_telem_depthcue.hxx>
122#include <OpenGl_telem.hxx>
123#include <OpenGl_telem_util.hxx>
124#include <OpenGl_tsm.hxx>
125#include <OpenGl_tsm_ws.hxx>
126#include <OpenGl_tgl.hxx>
127#include <OpenGl_tgl_util.hxx>
128#include <OpenGl_tgl_tox.hxx>
129#include <OpenGl_animation.hxx>
130
131#include <OpenGl_trsf_stack.hxx>
132#include <OpenGl_tgl_funcs.hxx>
133
134#include <OpenGl_TextureBox.hxx>
135
136/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
137#include <Aspect_PolygonOffsetMode.hxx>
138/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
139
140/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
141#include <OpenGl_transform_persistence.hxx>
142/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
143
144#include <OpenGl_Memory.hxx>
145
146#include <OpenGl_TextRender.hxx>
147#include <OSD_FontAspect.hxx>
148
149
150/*----------------------------------------------------------------------*/
151/*
152* Definitions type
153*/
154
155struct TSM_ATTRI_BLK_STRUCT {
156 //struct TSM_ATTRI_BLK_STRUCT *next;
157 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
158 /*Tint TransPersFlag;*/
159 TEL_TRANSFORM_PERSISTENCE TransPers;
160 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
161 TEL_COLOUR PolylineColour;
162 Tfloat PolylineWidth;
163 Tint PolylineType;
164 TEL_COLOUR EdgeColour;
165 Tfloat EdgeWidth;
166 Tint EdgeType;
167 Tint AntiAliasing;
168 TEL_COLOUR InteriorColour;
169 Tint EdgeFlag;
170 Tint InteriorStyle;
171 Tint InteriorStyleIndex;
172 Tfloat PolymarkerSize;
173 TEL_COLOUR PolymarkerColour;
174 TEL_COLOUR BackInteriorColour;
175 Tint FaceDistinguishingMode;
176 TEL_COLOUR TextColour;
177 TEL_COLOUR TextColourSubTitle;
178 Tint TextStyle;
179 Tint TextDisplayType;
180 Tchar *TextFont;
181 Tfloat TextHeight;
182 Tfloat CharacterSpacing;
183 Tfloat CharacterExpansionFactor;
184 Tint TextZoomable;
185 Tfloat TextAngle;
186 OSD_FontAspect TextFontAspect;
187 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
188 TEL_ALIGN_DATA TextAlign;
189 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
190 Tint PolymarkerType;
191 Tint InteriorReflectanceEquation;
192 Tint BackInteriorReflectanceEquation;
193 TEL_SURF_PROP SurfaceAreaProperties;
194 TEL_SURF_PROP BackSurfaceAreaProperties;
195 TelCullMode FaceCullingMode;
196 Tint DepthCueIndex;
197 Tint InteriorShadingMethod;
198 Tint ViewIndex;
199 Tint HighlightIndex;
200 Tmatrix3 LocalTran3;
201 Tint DoTextureMap;
202 Tint TextureId;
203#ifdef G003
204 Tint DegenerationMode;
205#endif /* G003 */
206 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
207 TEL_POFFSET_PARAM PolygonOffsetParams;
208 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
209
210 IMPLEMENT_MEMORY_OPERATORS
211};
212typedef TSM_ATTRI_BLK_STRUCT TSM_ATTRI_BLK;
213typedef TSM_ATTRI_BLK_STRUCT* tsm_attri_blk;
214
215
216/*----------------------------------------------------------------------*/
217/*
218* Variables statiques
219*/
220typedef NCollection_Stack<tsm_attri_blk> Attri_Stack;
221static Attri_Stack attri_stk;
222
223/* FSXXX */
224static Tint need_reset = 0;
225
226/* Est-il necessaire de faire de la transparence ? */
227static Tint need_trans = 0;
228
229static TSM_ATTRI_BLK attri_default =
230{
231 {0 , 0.0F, 0.0F, 0.0F },
232 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
233 {{ 1.0F, 1.0F, 1.0F }}, /* PolylineColour */
234 1.0F, /* PolylineWidth */
235 TEL_LS_SOLID, /* PolylineType */
236 {{ 1.0F, 1.0F, 1.0F }}, /* EdgeColour */
237 1.0F, /* EdgeWidth */
238 0, /* EdgeType */
239 TOff, /* AntiAliasing */
240 {{ 1.0F, 1.0F, 1.0F }}, /* InteriorColour */
241 TOn, /* EdgeFlag */
242 TSM_SOLID, /* InteriorStyle */
243 TEL_HS_SOLID, /* InteriorStyleIndex */
244 1.0F, /* PolymarkerSize */
245 {{ 1.0F, 1.0F, 1.0F }}, /* PolymarkerColour */
246 {{ 1.0F, 1.0F, 1.0F }}, /* BackInteriorColour */
247 TOn, /* FaceDistinguishingMode */
248 {{ 1.0F, 1.0F, 1.0F }}, /* TextColour */
249 {{ 1.0F, 1.0F, 1.0F }}, /* TextColourSubTitle */
250 ASPECT_TOST_NORMAL, /* TextStyle */
251 ASPECT_TODT_NORMAL, /* TextDisplayType */
252 (Tchar*)"Courier", /* TextFont */
253 16.0F, /* TextHeight */
254 0.3F, /* CharacterSpacing */
255 1.0F, /* CharacterExpansionFactor */
256 0, /*TextZoomable*/
257 0, /*TextAngle*/
258 OSD_FA_Regular, /*TextFontAspect - OSD_FA_Regular*/
259 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
260 { 0, /*Horizontal Text Alignment*/
261 0 }, /*Vertical Text Alignment*/
262 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
263 TEL_PM_PLUS, /* PolymarkerType */
264 CALL_PHIGS_REFL_NONE, /* InteriorReflectanceEquation */
265 CALL_PHIGS_REFL_NONE, /* BackInteriorReflectanceEquation */
266 { 0.2F, 0.8F, 0.1F, 0.0F, /* Coef d eclairage */
267 1.0F, 10.0F, 0.0F,
268 1, 1, 1, 0, 0, /* Etat des eclairage */
269 {{ 1.0F, 1.0F, 1.0F }}, /* ambient color */
270 {{ 1.0F, 1.0F, 1.0F }}, /* diffuse color */
271 {{ 1.0F, 1.0F, 1.0F }}, /* specular color */
272 {{ 1.0F, 1.0F, 1.0F }}, /* emissive color */
273 {{ 1.0F, 1.0F, 1.0F }}}, /* material color */ /* SurfaceAreaProperties */
274 { 0.2F, 0.8F, 0.1F, 0.0F, /* Coef d eclairage */
275 1.0F, 10.0F, 0.0F,
276 1, 1, 1, 0, 0, /* Etat des eclairage */
277 {{ 1.0F, 1.0F, 1.0F }}, /* ambient color */
278 {{ 1.0F, 1.0F, 1.0F }}, /* diffuse color */
279 {{ 1.0F, 1.0F, 1.0F }}, /* specular color */
280 {{ 1.0F, 1.0F, 1.0F }}, /* emissive color */
281 {{ 1.0F, 1.0F, 1.0F }}}, /* material color */ /* BackSurfaceAreaProperties */
282 TelCullNone, /* FaceCullingMode */
283 0, /* DepthCueIndex */
284 TEL_SM_GOURAUD, /* InteriorShadingMethod */
285 0, /* ViewIndex */
286 0, /* HighlightIndex */
287 {
288 { 1.0F, 0.0F, 0.0F, 0.0F },
289 { 0.0F, 1.0F, 0.0F, 0.0F },
290 { 0.0F, 0.0F, 1.0F, 0.0F },
291 { 0.0F, 0.0F, 0.0F, 1.0F }
292 }, /* LocalTran3 */
293 TEL_SD_SHADING,
294 -1
295#ifdef G003
296 , 0 /* DegenerationMode */
297#endif /* G003 */
298 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
299 , { Aspect_POM_Fill, 1.0F, 0.0F }
300 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
301};
302
303#ifdef G003
304extern int g_nBackfacing;
305#endif /* G003 */
306
307/*----------------------------------------------------------------------*/
308/*
309* Prototypes
310*/
311
312static void TelUpdateFog( Tint, Tint, Tint ); /* ws, vid, dcid */
313static void TelSetViewMatrix( Tmatrix3, Tint ); /* mat, vid */
314static void call_util_transpose_mat (float tmat[16], float mat[4][4]);
315static void TelUpdatePolygonOffsets( tel_poffset_param );
316
317/*----------------------------------------------------------------------*/
318/*
319* Variables externes
320*/
321
322extern tsm_trsf_stack cur_trsf_stack;
323
324GLuint fontBase;
325extern GLuint linestyleBase;
326extern GLuint patternBase;
327
328extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
329extern Tint SecondPassNeeded; /* currently defined in tsm/tsm.c */
330extern Tint SecondPassDo; /* currently defined in tsm/tsm.c */
331
332/*----------------------------------------------------------------------*/
333
334
335TStatus
336TsmPushAttri( void )
337{
338 tsm_attri_blk node;
339
340 node = new TSM_ATTRI_BLK();
341
342 if( !attri_stk.IsEmpty() )
343 {
344 *node = *attri_stk.Top();
345#ifdef TRACE
346 printf("TsmPushAttri %x\n",attri_tail);
347#endif
348 }
349 else
350 {
351 *node = attri_default;
352#ifdef TRACE
353 printf("TsmPushAttri attri_default %x\n",attri_tail);
354#endif
355
356 /* Register all default attributes with gl */
357
358 glLineWidth( ( GLfloat )attri_default.PolylineWidth );
359#ifdef HAVE_GL2PS
360 gl2psLineWidth( ( GLfloat )attri_default.PolylineWidth );
361#endif
362
363 OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
364 textRender->FindFont(node->TextFont, node->TextFontAspect, node->TextHeight,1,1);
365
366#ifdef G003
367 if ( !g_nBackfacing )
368#endif /* G003 */
369 switch (node->FaceCullingMode) {
370case TelCullNone:
371 glDisable (GL_CULL_FACE);
372 break;
373
374case TelCullFront:
375 glCullFace (GL_FRONT);
376 glEnable (GL_CULL_FACE);
377 break;
378
379case TelCullBack:
380 glCullFace (GL_BACK);
381 glEnable (GL_CULL_FACE);
382 break;
383 }
384 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
385 transform_persistence_begin( 0, 0.0, 0.0, 0.0 );
386 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
387
388 }
389 attri_stk.Push( node );
390 return TSuccess;
391}
392
393/*----------------------------------------------------------------------*/
394
395TStatus
396TsmPopAttri( void )
397{
398 tsm_attri_blk node;
399
400 if ( attri_stk.IsEmpty() )
401 return TFailure; /* Underflow */
402
403 node = attri_stk.ChangeTop();
404 attri_stk.Pop();
405
406#ifdef TRACE
407 printf("TsmPopAttri %x\n",attri_tail);
408#endif
409
410 if( !attri_stk.IsEmpty() )
411 {
412 tsm_attri_blk attri_tail = attri_stk.Top();
413
414 /* Reset the attributes */
415 Tint i;
416 Tfloat f;
417
418 f = attri_tail->PolylineWidth;
419 if( node->PolylineWidth != f ) {
420#ifdef TRACE
421 printf("TsmPopAttri.linewidth %f\n",f);
422#endif
423
424 glLineWidth( (GLfloat)f );
425#ifdef HAVE_GL2PS
426 gl2psLineWidth( (GLfloat)f );
427#endif
428 }
429
430 i = attri_tail->InteriorStyle;
431 if( node->InteriorStyle != i )
432 {
433 switch( i )
434 {
435 case TSM_SOLID:
436 case TSM_HIDDENLINE:
437 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
438 glDisable(GL_POLYGON_STIPPLE);
439 break;
440
441 case TSM_HOLLOW:
442 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
443 break;
444
445 case TSM_EMPTY:
446 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
447 break;
448
449 case TSM_HATCH:
450 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
451 if( node->InteriorStyleIndex ) {
452 glCallList( patternBase + node->InteriorStyleIndex );
453 glEnable(GL_POLYGON_STIPPLE);
454 } else
455 glDisable(GL_POLYGON_STIPPLE);
456 break;
457
458 case TSM_POINT:
459 glPolygonMode(GL_FRONT_AND_BACK, GL_POINT );
460 break;
461 }
462 }
463
464 i = attri_tail->PolylineType;
465 if( node->PolylineType != i ) {
466#ifdef TRACE
467 printf("TsmPopAttri.linetype %d\n",i);
468#endif
469 if (i) {
470 glCallList( linestyleBase+i );
471
472 glEnable( GL_LINE_STIPPLE );
473#ifdef HAVE_GL2PS
474 gl2psEnable( GL2PS_LINE_STIPPLE );
475#endif
476 } else {
477
478 glDisable( GL_LINE_STIPPLE );
479#ifdef HAVE_GL2PS
480 gl2psDisable( GL2PS_LINE_STIPPLE );
481#endif
482 }
483 }
484
485 if( strcmp( (char*)attri_tail->TextFont, (char*)node->TextFont ) ||
486 ( attri_tail->TextHeight != node->TextHeight ) )
487 {
488
489 OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
490 textRender->FindFont(attri_tail -> TextFont, attri_tail->TextFontAspect, attri_tail -> TextHeight);
491 }
492#ifdef G003
493 if ( !g_nBackfacing )
494#endif /* G003 */
495 {
496 if( attri_tail->FaceCullingMode != node->FaceCullingMode )
497 {
498 switch( attri_tail->FaceCullingMode )
499 {
500 case TelCullNone:
501 glDisable(GL_CULL_FACE);
502 break;
503
504 case TelCullFront:
505 glCullFace(GL_FRONT) ;
506 glEnable(GL_CULL_FACE);
507 break;
508
509 case TelCullBack:
510 glCullFace(GL_BACK);
511 glEnable(GL_CULL_FACE);
512 break;
513 }
514 }
515 }
516
517 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
518 if( attri_tail->PolygonOffsetParams.mode != node->PolygonOffsetParams.mode ||
519 attri_tail->PolygonOffsetParams.factor != node->PolygonOffsetParams.factor ||
520 attri_tail->PolygonOffsetParams.units != node->PolygonOffsetParams.units )
521 {
522 TelUpdatePolygonOffsets( &attri_tail->PolygonOffsetParams );
523 }
524 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
525
526 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
527 if( attri_tail->TransPers.mode != node->TransPers.mode ||
528 attri_tail->TransPers.pointX != node->TransPers.pointX ||
529 attri_tail->TransPers.pointY != node->TransPers.pointY ||
47d31ec6 530 attri_tail->TransPers.pointZ != node->TransPers.pointZ )
7fd59977 531
532 {
533 transform_persistence_begin( attri_tail->TransPers.mode,
534 attri_tail->TransPers.pointX,
535 attri_tail->TransPers.pointY,
536 attri_tail->TransPers.pointZ );
537 }
538 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
539
540 if( attri_tail->ViewIndex != node->ViewIndex )
541 {
542 TelSetViewProjection( TglActiveWs, attri_tail->ViewIndex );
543#ifdef TRACE_MATRIX
544 printf("TsmPopAttri::TelSetViewMatrix::attri_tail->ViewIndex != node->ViewIndex \n");
545#endif
546 TelSetViewMatrix( attri_tail->LocalTran3, attri_tail->ViewIndex );
547 TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, attri_tail->DepthCueIndex );
548 }
549 else
550 {
551 if( attri_tail->DepthCueIndex != node->DepthCueIndex )
552 TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, attri_tail->DepthCueIndex );
553 if( memcmp( node->LocalTran3, attri_tail->LocalTran3, sizeof(Tmatrix3) ) )
554 {
555#ifdef TRACE_MATRIX
556 printf("TsmPopAttri::TelSetViewMatrix::memcmp( node->LocalTran3, attri_tail->LocalTran3, sizeof(Tmatrix3) ) \n");
557#endif
558 TelSetViewMatrix(attri_tail->LocalTran3,attri_tail->ViewIndex);
559 }
560 }
561 }
562#ifdef IMP190100 /* Reset default attribs at the top */
563 else {
564 Tint i;
565 Tfloat f;
566
567 f = attri_default.PolylineWidth;
568 if( node->PolylineWidth != f ) {
569
570
571 glLineWidth( (GLfloat)f );
572#ifdef HAVE_GL2PS
573 gl2psLineWidth( (GLfloat)f );
574#endif
575
576#ifdef TRACE
577 printf("TsmPopAttri.defaultlinewidth %f\n",f);
578#endif
579 }
580
581 i = attri_default.PolylineType;
582 if( node->PolylineType != i ) {
583 if (i) {
584 glCallList( linestyleBase+i );
585
586 glEnable( GL_LINE_STIPPLE );
587#ifdef HAVE_GL2PS
588 gl2psEnable( GL2PS_LINE_STIPPLE );
589#endif
590 } else {
591
592 glDisable( GL_LINE_STIPPLE );
593#ifdef HAVE_GL2PS
594 gl2psDisable( GL2PS_LINE_STIPPLE );
595#endif
596 }
597
598
599#ifdef TRACE
600 printf("TsmPopAttri.defaultlinetype %d\n",i);
601#endif
602 }
603 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
604 TelUpdatePolygonOffsets( &attri_default.PolygonOffsetParams );
605 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
606
607 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
608 /*transform_persistence_begin( attri_default.TransPersFlag );*/
609 transform_persistence_begin( attri_default.TransPers.mode,
610 attri_default.TransPers.pointX,
611 attri_default.TransPers.pointY,
612 attri_default.TransPers.pointZ );
613 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
614 }
615#endif /*IMP190100*/
616
617 /* abd
618 cmn_stg_tbl_free( (void *) node );*/
619 delete node;
620
621 return TSuccess;
622}
623
624/*----------------------------------------------------------------------*/
625
626TStatus
627TsmSetAttri( Tint n, ... )
628{
629 Tint i;
630
631#if defined (SOLARIS) || defined (IRIXO32)
632 cmn_key *k;
633#else
634 cmn_key k[TMaxArgs];
635#endif
636
637#ifdef GER61394
638 static int antiAliasingMode = -1;
639 if( antiAliasingMode < 0 ) {
640 char string[64];
641 if (call_util_osd_getenv("CALL_OPENGL_ANTIALIASING_MODE", string, 64) ) {
642 int v;
643 if( sscanf(string,"%d",&v) > 0 ) antiAliasingMode = v;
644 printf(".OpenGl driver.AntiAliasing mode is %d\n",antiAliasingMode);
645 } else {
646 antiAliasingMode = 3;
647 }
648 }
649#endif
650
651 if (attri_stk.IsEmpty())
652 return TFailure;
653
654 tsm_attri_blk attri_tail = attri_stk.ChangeTop();
655
656 CMN_GET_STACK( n, k );
657 for( i = 0; i < n; i++ )
658 {
659 switch( k[i]->id )
660 {
661 case TelTextureId:
662 attri_tail->TextureId = k[i]->data.ldata;
663
664 if (!ForbidSetTextureMapping) {
665 if (attri_tail->DoTextureMap)
666 {
667 DisableTexture();
668 SetCurrentTexture(attri_tail->TextureId);
669 EnableTexture();
670 }
671 else
672 DisableTexture();
673 }
674 break;
675
676 case TelDoTextureMap:
677 attri_tail->DoTextureMap = k[i]->data.ldata;
678 break;
679
680 case TelTextStyle:
681 attri_tail->TextStyle = k[i]->data.ldata;
682 break;
683
684 case TelTextDisplayType:
685 attri_tail->TextDisplayType = k[i]->data.ldata;
686 break;
687
688 case TelPolylineColour:
689 attri_tail->PolylineColour = *(tel_colour)(k[i]->data.pdata);
690#ifdef IMP250401
691 glColor3f(attri_tail->PolylineColour.rgb[0],
692 attri_tail->PolylineColour.rgb[1],
693 attri_tail->PolylineColour.rgb[2]);
694#endif
695 break;
696
697 case TelPolylineWidth:
698 {
699 Tfloat w;
700
701 w = k[i]->data.fdata;
702 if( attri_tail->PolylineWidth != w )
703 {
704#ifdef TRACE
705 printf("TsmSetAttri.linewidth %f\n",w);
706#endif
707 attri_tail->PolylineWidth = w;
708
709 glLineWidth( (GLfloat)w );
710#ifdef HAVE_GL2PS
711 gl2psLineWidth( (GLfloat)w );
712#endif
713 }
714 break;
715 }
716
717 case TelPolylineType:
718 {
719 Tint ls;
720
721 ls = k[i]->data.ldata;
722 if( attri_tail->PolylineType != ls )
723 {
724#ifdef TRACE
725 printf("TsmSetAttri.linetype %d\n",ls);
726#endif
727 attri_tail->PolylineType = ls;
728 if (ls) {
729 glCallList(linestyleBase+ls);
730
731 glEnable( GL_LINE_STIPPLE );
732#ifdef HAVE_GL2PS
733 gl2psEnable( GL2PS_LINE_STIPPLE );
734#endif
735 } else {
736
737 glDisable( GL_LINE_STIPPLE );
738#ifdef HAVE_GL2PS
739 gl2psDisable( GL2PS_LINE_STIPPLE );
740#endif
741 }
742 }
743 break;
744 }
745
746 case TelEdgeType:
747 attri_tail->EdgeType = k[i]->data.ldata;
748 break;
749
750 case TelEdgeWidth:
751 attri_tail->EdgeWidth = k[i]->data.fdata;
752 break;
753
754 case TelEdgeColour:
755 attri_tail->EdgeColour = *(tel_colour)(k[i]->data.pdata);
756 break;
757
758 case TelAntiAliasing:
759 {
760 attri_tail->AntiAliasing = k[i]->data.ldata;
761
762 if (!SecondPassNeeded)
763 {
764 if( attri_tail->AntiAliasing == TOff )
765 {
766 glDisable(GL_POINT_SMOOTH);
767 glDisable(GL_LINE_SMOOTH);
768#ifdef GER61394
769 if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
770#endif
771 glBlendFunc (GL_ONE, GL_ZERO);
772 glDisable (GL_BLEND);
773 }
774 else /* TOn */
775 {
776 glEnable(GL_POINT_SMOOTH);
777 glEnable(GL_LINE_SMOOTH);
778#ifdef GER61394
779 if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
780#endif
781 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
782 glEnable (GL_BLEND);
783 }
784 }
785 break;
786 }
787
788 case TelInteriorColour:
789 {
790 attri_tail->InteriorColour = *(tel_colour)(k[i]->data.pdata);
791 break;
792 }
793
794 case TelEdgeFlag:
795 {
796 attri_tail->EdgeFlag = k[i]->data.ldata;
797 break;
798 }
799
800 case TelInteriorStyle:
801 {
802 Tint s;
803
804 s = k[i]->data.ldata;
805 if( attri_tail->InteriorStyle != s )
806 {
807 attri_tail->InteriorStyle = s;
808 switch( s )
809 {
810 case TSM_SOLID:
811 case TSM_HIDDENLINE:
812 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
813 glDisable(GL_POLYGON_STIPPLE);
814 break;
815
816 case TSM_HOLLOW:
817 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
818 break;
819
820 case TSM_EMPTY:
821 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
822 break;
823
824 case TSM_HATCH:
825 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
826 if( attri_tail->InteriorStyleIndex ) {
827 glCallList( patternBase + attri_tail->InteriorStyleIndex );
828 glEnable(GL_POLYGON_STIPPLE);
829 } else
830 glDisable(GL_POLYGON_STIPPLE);
831 break;
832
833 case TSM_POINT:
834 glPolygonMode(GL_FRONT_AND_BACK, GL_POINT );
835 break;
836 }
837 }
838 break;
839 }
840
841 case TelInteriorStyleIndex:
842 {
843 Tint is = k[i]->data.ldata;
844 if( attri_tail->InteriorStyleIndex != is )
845 {
846 attri_tail->InteriorStyleIndex = is;
847 if( attri_tail->InteriorStyle == TSM_HATCH )
848 {
849 if (is)
850 {
851 glCallList( patternBase + is );
852 glEnable(GL_POLYGON_STIPPLE);
853 } else
854 glDisable(GL_POLYGON_STIPPLE);
855 }
856 }
857 break;
858 }
859
860 case TelPolymarkerColour:
861 attri_tail->PolymarkerColour = *(tel_colour)(k[i]->data.pdata);
862 break;
863
864 case TelPolymarkerSize:
865 attri_tail->PolymarkerSize = k[i]->data.fdata;
866 break;
867
868 case TelLocalTran3:
869 {
870 tel_matrix3_data d = ((tel_matrix3_data)(k[i]->data.pdata));
871 switch(d->mode)
872 {
873 case TPreConcatenate: /* not used */
874 TelMultiplymat3( attri_tail->LocalTran3,
875 d->mat, attri_tail->LocalTran3 );
876 break;
877
878 case TPostConcatenate: /* not used */
879 TelMultiplymat3( attri_tail->LocalTran3,
880 attri_tail->LocalTran3, d->mat );
881 break;
882
883 case TReplace:
884#ifdef BUC60742
885 matcpy( attri_tail->LocalTran3, d->mat );
886 TelTransposemat3( attri_tail->LocalTran3 );
887#else
888 /*
889 * On multiplie la trsf courante par la trsf
890 * de la structure que l'on est en train de
891 * parcourir.
892 */
893 TelMultiplymat3( cur_trsf_stack->LocalTran3,
894 cur_trsf_stack->LocalTran3, d->mat );
895 /*
896 * On copie de resultat dans la queue d'attributs
897 * pour pouvoir changer l'orientation du reste
898 * du trace.
899 */
900 matcpy( attri_tail->LocalTran3,
901 cur_trsf_stack->LocalTran3 );
902 /*
903 * Transformation definie dans un repere direct
904 * a appliquer dans un repere indirect
905 */
906 TelTransposemat3( attri_tail->LocalTran3 );
907#endif /*BUC60742*/
908 break;
909 }
910#ifdef TRACE_MATRIX
911 printf("TsmSetAttri::TelSetViewMatrix::TelLocalTran3 \n");
912#endif
913 TelSetViewMatrix(attri_tail->LocalTran3,attri_tail->ViewIndex);
914 break;
915 }
916
917 case TelBackInteriorColour:
918 {
919 attri_tail->BackInteriorColour = *(tel_colour)(k[i]->data.pdata);
920 break;
921 }
922
923 case TelFaceDistinguishingMode:
924 {
925 attri_tail->FaceDistinguishingMode = (Tint) k[i]->data.ldata;
926 break;
927 }
928
929 case TelTextColour:
930 attri_tail->TextColour = *(tel_colour)(k[i]->data.pdata);
931 break;
932
933 case TelTextColourSubTitle:
934 attri_tail->TextColourSubTitle = *(tel_colour)(k[i]->data.pdata);
935 break;
936
937 case TelTextFont:
938 {
939 Tchar *fn = (Tchar*)k[i]->data.pdata;
940#ifdef TRACE_TEXT
941 printf ("TelTextFont:: %s %s \n", fn, attri_tail->TextFont);
942#endif
943 if( strcmp( (char*)fn, (char*)attri_tail->TextFont ) )
944 {
945 OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
946 textRender->FindFont ( fn, attri_tail->TextFontAspect, attri_tail -> TextHeight );
947 attri_tail->TextFont = fn;
948 }
949 break;
950 }
951
952 case TelTextHeight:
953 {
954 Tfloat h;
955
956 h = k[i]->data.fdata;
957#ifdef TRACE_TEXT
958 printf ("TelTextHeight:: %f %f \n", h, attri_tail->TextHeight);
959#endif
960 if( h != attri_tail->TextHeight )
961 {
962 OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
963 textRender->FindFont (attri_tail->TextFont, attri_tail->TextFontAspect,h );
964 attri_tail->TextHeight = h;
965 }
966 break;
967 }
968
969 case TelCharacterSpacing:
970 attri_tail->CharacterSpacing = k[i]->data.fdata;
971 break;
972
973 case TelCharacterExpansionFactor:
974 {
975 attri_tail->CharacterExpansionFactor = k[i]->data.fdata;
976 break;
977 }
978
979 case TelTextZoomable:
980 attri_tail->TextZoomable = k[i]->data.ldata;
981 break;
982 case TelTextAngle:
983 attri_tail->TextAngle = k[i]->data.ldata;
984 break;
985 case TelTextFontAspect:
986 attri_tail->TextFontAspect = OSD_FontAspect(k[i]->data.ldata);
987 break;
988
989 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
990 case TelTextAlign:
991 attri_tail->TextAlign = *(tel_align_data)k[i]->data.pdata;
992 break;
993 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
994
995 case TelPolymarkerType:
996 attri_tail->PolymarkerType = k[i]->data.ldata;
997 break;
998
999 case TelInteriorReflectanceEquation:
1000 attri_tail->InteriorReflectanceEquation =
1001 (Tint) k[i]->data.ldata;
1002 break;
1003
1004 case TelBackInteriorReflectanceEquation:
1005 attri_tail->BackInteriorReflectanceEquation =
1006 (Tint) k[i]->data.ldata;
1007 break;
1008
1009 case TelSurfaceAreaProperties:
1010 attri_tail->SurfaceAreaProperties =
1011 *(tel_surf_prop)(k[i]->data.pdata);
1012#ifdef TRACE_UPMATERIAL
1013 printf("TsmSetAttri::TelSurfaceAreaProperties:TelUpdateMaterial (TEL_FRONT_MATERIAL)\n");
1014#endif
1015 TelUpdateMaterial( TEL_FRONT_MATERIAL );
1016 break;
1017
1018 case TelBackSurfaceAreaProperties:
1019 attri_tail->BackSurfaceAreaProperties =
1020 *(tel_surf_prop)(k[i]->data.pdata);
1021#ifdef TRACE_UPMATERIAL
1022 printf("TsmSetAttri::TelBackSurfaceAreaProperties:TelUpdateMaterial (TEL_BACK_MATERIAL)\n");
1023#endif
1024 if (attri_tail->FaceDistinguishingMode == TOn)
1025 TelUpdateMaterial( TEL_BACK_MATERIAL );
1026 break;
1027
1028 case TelFaceCullingMode:
1029#ifdef G003
1030 if ( !g_nBackfacing )
1031#endif /* G003 */
1032 {
1033 TelCullMode mode = (TelCullMode) k[i]->data.ldata;
1034 if( mode != attri_tail->FaceCullingMode )
1035 {
1036 attri_tail->FaceCullingMode = mode;
1037 switch( mode )
1038 {
1039 case TelCullNone:
1040 glDisable(GL_CULL_FACE);
1041 break;
1042
1043 case TelCullFront:
1044 glCullFace(GL_FRONT);
1045 glEnable(GL_CULL_FACE);
1046 break;
1047
1048 case TelCullBack:
1049 glCullFace(GL_BACK);
1050 glEnable(GL_CULL_FACE);
1051 break;
1052 }
1053 }
1054 }
1055 break;
1056
1057 case TelDepthCueIndex:
1058 {
1059 Tint dc;
1060
1061 dc = k[i]->data.ldata;
1062 if( dc != attri_tail->DepthCueIndex )
1063 {
1064 attri_tail->DepthCueIndex = dc;
1065 TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, dc );
1066 }
1067 break;
1068 }
1069
1070 case TelInteriorShadingMethod:
1071 {
1072 Tint a;
1073
1074 a = k[i]->data.ldata;
1075 attri_tail->InteriorShadingMethod = a;
1076 a == TEL_SM_FLAT ? glShadeModel( GL_FLAT ) :
1077 glShadeModel( GL_SMOOTH );
1078 break;
1079 }
1080
1081 case TelViewIndex:
1082 {
1083 Tint vid = k[i]->data.ldata;
1084
1085 if( vid != attri_tail->ViewIndex )
1086 {
1087 attri_tail->ViewIndex = vid;
1088 TelUpdateFog( TglActiveWs, vid, attri_tail->DepthCueIndex );
1089 }
1090 break;
1091 }
1092
1093 case TelHighlightIndex:
1094 attri_tail->HighlightIndex = k[i]->data.ldata;
1095 break;
1096#ifdef G003
1097 case TelDegenerationMode:
1098 attri_tail -> DegenerationMode = k[ i ] -> data.ldata;
1099 break;
1100#endif /* G003 */
1101
1102 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
1103 case TelPolygonOffset:
1104 {
1105 tel_poffset_param pdata = (tel_poffset_param)(k[i]->data.pdata);
1106 /* Aspect_POM_None means: do not change current settings */
1107 if ( ( pdata->mode & Aspect_POM_None ) == Aspect_POM_None )
1108 break;
1109 attri_tail->PolygonOffsetParams = *pdata;
1110 TelUpdatePolygonOffsets( pdata );
1111 break;
1112 }
1113 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
1114
1115
1116 case TelTransformPersistence:
1117 {
1118 attri_tail->TransPers = *(tel_transform_persistence)(k[i]->data.pdata);
1119 transform_persistence_begin( attri_tail->TransPers.mode,
1120 attri_tail->TransPers.pointX,
1121 attri_tail->TransPers.pointY,
1122 attri_tail->TransPers.pointZ );
1123
1124 break;
1125 }
1126 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
1127
1128 default:
1129 break;
1130 }
1131 }
1132 return TSuccess;
1133}
1134
1135/*----------------------------------------------------------------------*/
1136
1137TStatus
1138TsmGetAttri( Tint n, ... )
1139{
1140 Tint i;
1141#if defined (SOLARIS) || defined (IRIXO32)
1142 cmn_key *k;
1143#else
1144 cmn_key k[TMaxArgs];
1145#endif
1146
1147 tsm_attri_blk attri_tail = NULL;
1148
1149 if (attri_stk.IsEmpty())
1150 {
1151#ifdef TRACE
1152 printf ("TsmGetAttri with attri_tail == NULL\n");
1153#endif
1154 attri_tail = &attri_default;
1155 } else {
1156 attri_tail = attri_stk.Top();
1157 }
1158
1159 CMN_GET_STACK( n, k );
1160 for( i = 0; i < n; i++ )
1161 {
1162 switch( k[i]->id )
1163 {
1164 case TelTextureId:
1165 k[i]->data.ldata = attri_tail->TextureId;
1166 break;
1167
1168 case TelDoTextureMap:
1169 k[i]->data.ldata = attri_tail->DoTextureMap;
1170 break;
1171
1172 case TelTextStyle:
1173 k[i]->data.ldata = attri_tail->TextStyle;
1174 break;
1175
1176 case TelTextDisplayType:
1177 k[i]->data.ldata = attri_tail->TextDisplayType;
1178 break;
1179
1180 case TelPolylineColour:
1181 *(tel_colour)(k[i]->data.pdata) = attri_tail->PolylineColour;
1182 break;
1183
1184 case TelPolylineWidth:
1185 k[i]->data.fdata = attri_tail->PolylineWidth;
1186 break;
1187
1188 case TelPolylineType:
1189 k[i]->data.ldata = attri_tail->PolylineType;
1190 break;
1191
1192 case TelEdgeType:
1193 k[i]->data.ldata = attri_tail->EdgeType;
1194 break;
1195
1196 case TelEdgeWidth:
1197 k[i]->data.fdata = attri_tail->EdgeWidth;
1198 break;
1199
1200 case TelEdgeColour:
1201 *(tel_colour)(k[i]->data.pdata) = attri_tail->EdgeColour;
1202 break;
1203
1204 case TelAntiAliasing:
1205 k[i]->data.ldata = attri_tail->AntiAliasing;
1206 break;
1207
1208 case TelInteriorColour:
1209 *(tel_colour)(k[i]->data.pdata) = attri_tail->InteriorColour;
1210 break;
1211
1212 case TelEdgeFlag:
1213 k[i]->data.ldata = attri_tail->EdgeFlag;
1214 break;
1215
1216 case TelInteriorStyle:
1217 k[i]->data.ldata = attri_tail->InteriorStyle;
1218 break;
1219
1220 case TelInteriorStyleIndex:
1221 k[i]->data.ldata = attri_tail->InteriorStyleIndex;
1222 break;
1223
1224 case TelPolymarkerColour:
1225 *(tel_colour)(k[i]->data.pdata) = attri_tail->PolymarkerColour;
1226 break;
1227
1228 case TelPolymarkerSize:
1229 k[i]->data.fdata = attri_tail->PolymarkerSize;
1230 break;
1231
1232 case TelLocalTran3:
1233 matcpy( k[i]->data.pdata, attri_tail->LocalTran3 );
1234 break;
1235
1236 case TelBackInteriorColour:
1237 *(tel_colour)(k[i]->data.pdata) = attri_tail->BackInteriorColour;
1238 break;
1239
1240 case TelFaceDistinguishingMode:
1241 k[i]->data.ldata = attri_tail->FaceDistinguishingMode;
1242 break;
1243
1244 case TelTextColour:
1245 *(tel_colour)(k[i]->data.pdata) = attri_tail->TextColour;
1246 break;
1247
1248 case TelTextColourSubTitle:
1249 *(tel_colour)(k[i]->data.pdata) = attri_tail->TextColourSubTitle;
1250 break;
1251
1252 case TelTextFont:
1253 k[i]->data.pdata = attri_tail->TextFont;
1254 break;
1255
1256 case TelTextHeight:
1257 k[i]->data.fdata = attri_tail->TextHeight;
1258 break;
1259
1260 case TelCharacterSpacing:
1261 k[i]->data.fdata = attri_tail->CharacterSpacing;
1262 break;
1263
1264 case TelCharacterExpansionFactor:
1265 k[i]->data.fdata = attri_tail->CharacterExpansionFactor;
1266 break;
1267
1268 case TelTextZoomable:
1269 k[i]->data.ldata = attri_tail->TextZoomable;
1270 break;
1271 case TelTextAngle:
1272 k[i]->data.ldata = attri_tail->TextAngle;
1273 break;
1274 case TelTextFontAspect:
1275 k[i]->data.ldata = attri_tail->TextFontAspect;
1276 break;
1277 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
1278 case TelTextAlign:
1279 *(tel_align_data)(k[i]->data.pdata) = attri_tail->TextAlign;
1280 break;
1281 /*OCC7456 abd 14.12.2004 Text alingnment attributes */
1282 case TelPolymarkerType:
1283 k[i]->data.ldata = attri_tail->PolymarkerType;
1284 break;
1285
1286 case TelInteriorReflectanceEquation:
1287 k[i]->data.ldata = attri_tail->InteriorReflectanceEquation;
1288 break;
1289
1290 case TelBackInteriorReflectanceEquation:
1291 k[i]->data.ldata = attri_tail->BackInteriorReflectanceEquation;
1292 break;
1293
1294 case TelSurfaceAreaProperties:
1295 *(tel_surf_prop)(k[i]->data.pdata) =
1296 attri_tail->SurfaceAreaProperties;
1297 break;
1298
1299 case TelBackSurfaceAreaProperties:
1300 *(tel_surf_prop)(k[i]->data.pdata) =
1301 attri_tail->BackSurfaceAreaProperties;
1302 break;
1303
1304 case TelFaceCullingMode:
1305 k[i]->data.ldata = attri_tail->FaceCullingMode;
1306 break;
1307
1308 case TelDepthCueIndex:
1309 k[i]->data.ldata = attri_tail->DepthCueIndex;
1310 break;
1311
1312 case TelInteriorShadingMethod:
1313 k[i]->data.ldata = attri_tail->InteriorShadingMethod;
1314 break;
1315
1316 case TelViewIndex:
1317 k[i]->data.ldata = attri_tail->ViewIndex;
1318 break;
1319
1320 case TelHighlightIndex:
1321 k[i]->data.ldata = attri_tail->HighlightIndex;
1322 break;
1323
1324#ifdef G003
1325 case TelDegenerationMode:
1326 k[ i ] -> data.ldata = attri_tail -> DegenerationMode;
1327 break;
1328#endif /* G003 */
1329
1330 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
1331 case TelPolygonOffset:
1332 *(tel_poffset_param)(k[i]->data.pdata) = attri_tail->PolygonOffsetParams;
1333 break;
1334 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
1335
1336 case TelTransformPersistence:
1337 *(tel_transform_persistence)(k[i]->data.pdata) = attri_tail->TransPers;
1338 break;
1339 /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
1340
1341 default:
1342 break;
1343 }
1344 }
1345
1346 return TSuccess;
1347}
1348
1349/*----------------------------------------------------------------------*/
1350
1351void TelUpdateMaterial( Tint flag )
1352{
1353 GLenum face=0;
1354 tel_colour col=NULL;
1355 tel_surf_prop prop=NULL;
1356 Tint rm=CALL_PHIGS_REFL_NONE;
1357 static float mAmb[4];
1358 static float mDiff[4];
1359 static float mSpec[4];
1360 static float mEmsv[4];
1361 static float mShin;
1362 static float r, g, b;
1363 static int physic;
1364 CMN_KEY_DATA key;
1365 Tfloat *rgb;
1366 Tfloat newDiff3;
1367
1368 if (attri_stk.IsEmpty())
1369 return;
1370
1371 tsm_attri_blk attri_tail = attri_stk.ChangeTop();
1372
1373 /* Hors Hiddenline */
1374 if (attri_tail->InteriorStyle != TSM_HIDDENLINE)
1375 {
1376 if( flag == TEL_FRONT_MATERIAL ) {
1377 col = &attri_tail->InteriorColour;
1378 rm = attri_tail->InteriorReflectanceEquation;
1379 prop = &attri_tail->SurfaceAreaProperties;
1380 face = GL_FRONT_AND_BACK;
1381 }
1382 if( flag == TEL_BACK_MATERIAL ) {
1383 col = &attri_tail->BackInteriorColour;
1384 rm = attri_tail->BackInteriorReflectanceEquation;
1385 prop = &attri_tail->BackSurfaceAreaProperties;
1386 face = GL_BACK;
1387 }
1388 }
1389 /* Cas HiddenLine */
1390 else
1391 {
1392#ifdef TRACE_UPMATERIAL
1393 printf("OpenGl_attri::TelUpdateMaterial HiddenLine\n");
1394#endif
1395 TsmGetWSAttri (TglActiveWs, WSBackground, &key);
1396 rgb = (Tfloat*)key.pdata;
1397
1398 attri_tail->InteriorColour.rgb[0]=rgb[0];
1399 attri_tail->InteriorColour.rgb[1]=rgb[1];
1400 attri_tail->InteriorColour.rgb[2]=rgb[2];
1401 attri_tail->InteriorReflectanceEquation = CALL_PHIGS_REFL_NONE;
1402 attri_tail->BackInteriorReflectanceEquation = CALL_PHIGS_REFL_NONE;
1403 return;
1404 }
1405
1406 /* Type material */
1407 physic = prop->isphysic;
1408
1409#ifdef TRACE_UPMATERIAL
1410 if( flag == TEL_FRONT_MATERIAL ) printf("OpenGl_attri::TelUpdateMaterial TEL_FRONT_MATERIAL\n");
1411 else printf("OpenGl_attri::TelUpdateMaterial TEL_BACK_MATERIAL\n");
1412#endif
1413#ifdef TRACE_MATERIAL
1414 printf(" InteriorReflectanceEquation: %d\n", attri_tail->InteriorReflectanceEquation);
1415 printf(" controle mode rm == CALL_PHIGS_REFL_NONE : %d\n", rm == CALL_PHIGS_REFL_NONE);
1416#endif
1417
1418 if( rm == CALL_PHIGS_REFL_NONE ) return;
1419
1420 /*
1421 * Gestion de la transparence
1422 */
1423
1424 if (!SecondPassDo) {
1425 /* Passage en transparence */
1426 if (need_trans && prop->trans != 1.0F) {
1427 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1428 glEnable (GL_BLEND);
1429 glDepthMask (GL_FALSE);
1430 }
1431
1432 /* Passage en opaque */
1433#ifdef BUC60577
1434 else
1435#else
1436 if (need_trans && prop->trans == 1.0F)
1437#endif
1438 {
1439 if( attri_tail->AntiAliasing == TOff )
1440 {
1441 glBlendFunc (GL_ONE, GL_ZERO);
1442 glDisable (GL_BLEND);
1443 }
1444 glDepthMask (GL_TRUE);
1445 }
1446 }
1447
1448 /*
1449 * Reset Material
1450 */
1451 if( need_reset )
1452 {
1453 /* Composant ambient */
1454 if( rm & AMBIENT_MASK )
1455 {
1456 /* Type materiau */
1457 if( physic )
1458 {r=prop->ambcol.rgb[0];g=prop->ambcol.rgb[1];b=prop->ambcol.rgb[2];}
1459 else
1460 {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
1461
1462 mAmb[0] = prop->amb * r;
1463 mAmb[1] = prop->amb * g;
1464 mAmb[2] = prop->amb * b;
1465 mAmb[3] = 1.0F;
1466 }
1467 else
1468 {
1469 mAmb[0] = 0.0;
1470 mAmb[1] = 0.0;
1471 mAmb[2] = 0.0;
1472 mAmb[3] = 1.0F;
1473 }
1474
1475 /* Composant diffus */
1476 if( rm & DIFFUSE_MASK )
1477 {
1478 /* Type materiau */
1479 if( physic )
1480 {r=prop->difcol.rgb[0];g=prop->difcol.rgb[1];b=prop->difcol.rgb[2];}
1481 else
1482 {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
1483
1484 mDiff[0] = prop->diff * r;
1485 mDiff[1] = prop->diff * g;
1486 mDiff[2] = prop->diff * b;
1487 mDiff[3] = 1.0F;
1488 }
1489 else
1490 {
1491 mDiff[0] = 0.0;
1492 mDiff[1] = 0.0;
1493 mDiff[2] = 0.0;
1494 mDiff[3] = 1.0F;
1495 }
1496
1497 if (SecondPassDo)
1498 {
1499 mDiff[3] = prop->env_reflexion;
1500 }
1501 else
1502 {
1503 if (need_trans) mDiff[3] = prop->trans;
1504 /* si le materiau reflechi la scene environnante,
1505 alors il faudra faire une seconde passe */
1506 if (prop->env_reflexion != 0.0) SecondPassNeeded = 1;
1507 }
1508
1509 /* Composant speculaire */
1510 if( rm & SPECULAR_MASK )
1511 {
1512 if( physic )
1513 {r=prop->speccol.rgb[0];g=prop->speccol.rgb[1];b=prop->speccol.rgb[2];}
1514 else
1515 {r=1.0;g=1.0;b=1.0;} /* cas des generiques */
1516
1517 mSpec[0] = prop->spec * r;
1518 mSpec[1] = prop->spec * g;
1519 mSpec[2] = prop->spec * b;
1520 mSpec[3] = 1.0F;
1521 }
1522 else {
1523 mSpec[0] = 0.0F;
1524 mSpec[1] = 0.0F;
1525 mSpec[2] = 0.0F;
1526 mSpec[3] = 1.0F;
1527 }
1528
1529
1530 /* Composant emission */
1531 if( rm & EMISSIVE_MASK )
1532 {
1533 if( physic )
1534 {r=prop->emscol.rgb[0];g=prop->emscol.rgb[1];b=prop->emscol.rgb[2];}
1535 else
1536 {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
1537
1538 mEmsv[0] = prop->emsv * r;
1539 mEmsv[1] = prop->emsv * g;
1540 mEmsv[2] = prop->emsv * b;
1541 mEmsv[3] = 1.0F;
1542 }
1543 else {
1544 mEmsv[0] = 0.0F;
1545 mEmsv[1] = 0.0F;
1546 mEmsv[2] = 0.0F;
1547 mEmsv[3] = 1.0F;
1548 }
1549
1550 /* Coeficient de brillance */
1551 mShin = prop -> shine;
1552
1553 glMaterialfv(face, GL_AMBIENT, mAmb );
1554 glMaterialfv(face, GL_DIFFUSE, mDiff );
1555 glMaterialfv(face, GL_SPECULAR, mSpec);
1556 glMaterialfv(face, GL_EMISSION, mEmsv);
1557 glMaterialf(face, GL_SHININESS, mShin);
1558
1559#ifdef TRACE_MATERIAL
1560 printf(" Material Properties are need_reset:\n") ;
1561 printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]);
1562 printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]);
1563 printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]);
1564 printf(" Emission color is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]);
1565 printf(" Shininess: %f Transparency: %f EnvReflexion: %f \n", mShin, prop->trans, prop->env_reflexion);
1566 printf(" Prop Specular %f Prop Emissive %f \n", prop->spec, prop->emsv);
1567 printf(" materiel de type physic : %d\n", prop->isphysic);
1568#endif
1569
1570 need_reset = 0;
1571 }
1572
1573 /*
1574 * Set Material Optimize
1575 */
1576
1577 else
1578 {
1579 physic = prop->isphysic;
1580 /* Composant ambient */
1581 if( rm & AMBIENT_MASK )
1582 {
1583 /* Type materiau */
1584 if( physic )
1585 {r=prop->ambcol.rgb[0];g=prop->ambcol.rgb[1];b=prop->ambcol.rgb[2];}
1586 else
1587 {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
1588
1589 if (mAmb[0] != prop->amb * r ||
1590 mAmb[1] != prop->amb * g ||
1591 mAmb[2] != prop->amb * b )
1592 {
1593 mAmb[0] = prop->amb * r;
1594 mAmb[1] = prop->amb * g;
1595 mAmb[2] = prop->amb * b;
1596 mAmb[3] = 1.0F;
1597
1598 glMaterialfv(face, GL_AMBIENT, mAmb );
1599#ifdef TRACE_MATERIAL
1600 printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]);
1601#endif
1602 }
1603 }
1604 else
1605 {
1606 if ( mAmb[0] != 0.0 || mAmb[1] != 0.0 || mAmb[2] != 0.0 )
1607 {
1608 mAmb[0] = 0.0F;
1609 mAmb[1] = 0.0F;
1610 mAmb[2] = 0.0F;
1611 mAmb[3] = 1.0F;
1612
1613 glMaterialfv(face, GL_AMBIENT, mAmb);
1614#ifdef TRACE_MATERIAL
1615 printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]);
1616#endif
1617 }
1618 }
1619
1620 /* Composant diffus */
1621 if( rm & DIFFUSE_MASK )
1622 {
1623 /* Type materiau */
1624 if( physic )
1625 {r=prop->difcol.rgb[0];g=prop->difcol.rgb[1];b=prop->difcol.rgb[2];}
1626 else
1627 {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
1628
1629 if (mDiff[0] != prop->diff * r ||
1630 mDiff[1] != prop->diff * g ||
1631 mDiff[2] != prop->diff * b ||
1632#ifdef BUC60577
1633 mDiff[3] != (SecondPassDo ? prop->env_reflexion :
1634 (need_trans ? prop->trans : 1.0F)) )
1635#else
1636 mDiff[3] != (SecondPassDo ? prop->env_reflexion : 1.0F) )
1637#endif
1638 {
1639 mDiff[0] = prop->diff * r;
1640 mDiff[1] = prop->diff * g;
1641 mDiff[2] = prop->diff * b;
1642 mDiff[3] = 1.0F;
1643
1644 if (SecondPassDo)
1645 {
1646 mDiff[3] = prop->env_reflexion;
1647 }
1648 else
1649 {
1650 if (need_trans) mDiff[3] = prop->trans;
1651 /* si le materiau reflechi la scene environnante,
1652 alors il faudra faire une seconde passe */
1653 if (prop->env_reflexion != 0.0) SecondPassNeeded = 1;
1654 }
1655
1656 glMaterialfv(face, GL_DIFFUSE, mDiff );
1657#ifdef TRACE_MATERIAL
1658 printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]);
1659#endif
1660 }
1661 }
1662 else
1663 {
1664 newDiff3 = 1.0F;
1665 if (SecondPassDo)
1666 {
1667 newDiff3 = prop->env_reflexion;
1668 }
1669 else
1670 {
1671 if (need_trans) newDiff3 = prop->trans;
1672 /* si le materiau reflechi la scene environnante,
1673 alors il faudra faire une seconde passe */
1674 if (prop->env_reflexion != 0.0) SecondPassNeeded = 1;
1675 }
1676
1677 /* OCC19915: Even if diffuse reflectance is disabled,
1678 still trying to update the current transparency if it
1679 differs from the previous value */
1680 if ( mDiff[0] != 0.0 || mDiff[1] != 0.0 || mDiff[2] != 0.0
1681 || fabs(mDiff[3] - newDiff3) > 0.01 )
1682 {
1683 mDiff[0] = 0.0F;
1684 mDiff[1] = 0.0F;
1685 mDiff[2] = 0.0F;
1686 mDiff[3] = newDiff3;
1687
1688 glMaterialfv(face, GL_DIFFUSE, mDiff);
1689#ifdef TRACE_MATERIAL
1690 printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]);
1691#endif
1692 }
1693 }
1694
1695 /* composant speculaire */
1696 if( rm & SPECULAR_MASK )
1697 {
1698 /* Type materiau */
1699 if( physic )
1700 {r=prop->speccol.rgb[0];g=prop->speccol.rgb[1];b=prop->speccol.rgb[2];}
1701 else
1702 {r=1.0;g=1.0;b=1.0;} /* cas des generiques */
1703
1704 if (mSpec[0] != prop->spec * r ||
1705 mSpec[1] != prop->spec * g ||
1706 mSpec[2] != prop->spec * b)
1707 {
1708 mSpec[0] = prop->spec * r;
1709 mSpec[1] = prop->spec * g;
1710 mSpec[2] = prop->spec * b;
1711 mSpec[3] = 1.0F;
1712 glMaterialfv(face, GL_SPECULAR, mSpec);
1713
1714#ifdef TRACE_MATERIAL
1715 printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]);
1716#endif
1717 }
1718 }
1719 else
1720 {
1721 if ( mSpec[0] != 0.0 || mSpec[1] != 0.0 || mSpec[2] != 0.0 )
1722 {
1723 mSpec[0] = 0.0F;
1724 mSpec[1] = 0.0F;
1725 mSpec[2] = 0.0F;
1726 mSpec[3] = 1.0F;
1727
1728 glMaterialfv(face, GL_SPECULAR, mSpec);
1729#ifdef TRACE_MATERIAL
1730 printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]);
1731#endif
1732 }
1733 }
1734
1735 /* Composant emission */
1736 if( rm & EMISSIVE_MASK )
1737 {
1738 /* type materiau */
1739 if( physic )
1740 {r=prop->emscol.rgb[0];g=prop->emscol.rgb[1];b=prop->emscol.rgb[2];}
1741 else
1742 {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
1743
1744 if ( mEmsv[0] != prop->emsv * r ||
1745 mEmsv[1] != prop->emsv * g ||
1746 mEmsv[2] != prop->emsv * b )
1747 {
1748 mEmsv[0] = prop->emsv * r;
1749 mEmsv[1] = prop->emsv * g;
1750 mEmsv[2] = prop->emsv * b;
1751 mEmsv[3] = 1.0F;
1752 glMaterialfv(face, GL_EMISSION, mEmsv);
1753#ifdef TRACE_MATERIAL
1754 printf(" Emissive color is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]);
1755#endif
1756 }
1757 }
1758 else
1759 {
1760 if ( mEmsv[0] != 0.0 || mEmsv[1] != 0.0 || mEmsv[2] != 0.0 )
1761 {
1762 mEmsv[0] = 0.0F;
1763 mEmsv[1] = 0.0F;
1764 mEmsv[2] = 0.0F;
1765 mEmsv[3] = 1.0F;
1766
1767 glMaterialfv(face, GL_EMISSION, mEmsv);
1768#ifdef TRACE_MATERIAL
1769 printf(" Emissive surface is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]);
1770#endif
1771 }
1772 }
1773
1774 /* coef de brillance */
1775 if( mShin != prop->shine )
1776 {
1777 mShin = prop->shine;
1778 glMaterialf(face, GL_SHININESS, mShin);
1779#ifdef TRACE_MATERIAL
1780 printf(" Shininess factor is %f\n", mShin);
1781#endif
1782 }
1783 } /* need_reset */
1784}
1785
1786/*----------------------------------------------------------------------*/
1787void TelResetMaterial() /* force material definition, called by TelClearViews */
1788{
1789 need_reset = 1;
1790}
1791
1792/*----------------------------------------------------------------------*/
1793void TelSetTransparency( Tint tag )
1794/* force transparency managment, called by redraw_all_structs */
1795{
1796 need_trans = tag;
1797}
1798
1799/*----------------------------------------------------------------------*/
1800
1801static void
1802TelUpdateFog( Tint ws, Tint vid, Tint dcid )
1803{
1804 TEL_GL_DEPTHCUE dcrep;
1805 float params[5];
1806
1807 if( TelGetGLDepthCue( ws, vid, dcid, &dcrep ) == TSuccess )
1808 {
1809 if( dcrep.dcrep.mode == TelDCAllowed )
1810 {
1811 params[0] = dcrep.dcrep.col.rgb[0],
1812 params[1] = dcrep.dcrep.col.rgb[1],
1813 params[2] = dcrep.dcrep.col.rgb[2];
1814 params[3] = 1.0F;
1815 glFogi(GL_FOG_MODE, GL_LINEAR);
1816 glFogf(GL_FOG_START, dcrep.dist[0]);
1817 glFogf(GL_FOG_END, dcrep.dist[1]);
1818 glFogfv(GL_FOG_COLOR, params);
1819 glEnable(GL_FOG);
1820#ifdef TRACE
1821 printf(" *** TelUpdateFog START %f END %f\n",dcrep.dist[0],dcrep.dist[1]);
1822#endif
1823 return;
1824 }
1825 }
1826 glDisable(GL_FOG);
1827 return;
1828}
1829
1830/*----------------------------------------------------------------------*/
1831
1832static void TelSetViewMatrix( Tmatrix3 mat, Tint vid )
1833{
1834 TEL_VIEW_REP vrep;
1835 Tmatrix3 rmat;
1836 float mat16[16];
1837#ifdef TRACE_MATRIX
1838 int i, j;
1839 GLfloat pmat[4][4];
1840#endif
1841
1842 if( TelGetViewRepresentation( TglActiveWs, vid, &vrep ) == TSuccess )
1843 {
1844#ifdef TRACE_MATRIX
1845 printf ("LocalTran3 :\n");
1846 for (i = 0; i < 4; i++) {
1847 printf ("\t");
1848 for (j = 0; j < 4; j++)
1849 printf ("%f ", mat[i][j]);
1850 printf ("\n");
1851 }
1852#endif
1853 if ((!animationUseFlag) || (animationUseFlag && !animationFlag))
1854 {
1855#ifdef TRACE_MATRIX
1856 printf ("vrep.orientation_matrix :\n");
1857 for (i = 0; i < 4; i++) {
1858 printf ("\t");
1859 for (j = 0; j < 4; j++)
1860 printf ("%f ", vrep.orientation_matrix[i][j]);
1861 printf ("\n");
1862 }
1863#endif
1864 TelMultiplymat3( rmat, mat, vrep.orientation_matrix );
1865#ifdef TRACE_MATRIX
1866 printf("OpenGl_attri.c::TelSetViewMatrix::glLoadMatrixf \n");
1867#endif
1868 glMatrixMode(GL_MODELVIEW);
1869 glLoadMatrixf((GLfloat *) rmat);
1870#ifdef TRACE_MATRIX
1871 printf ("GL_MODELVIEW_MATRIX set :\n");
1872 for (i = 0; i < 4; i++) {
1873 printf ("\t");
1874 for (j = 0; j < 4; j++)
1875 printf ("%f ", rmat[i][j]);
1876 printf ("\n");
1877 }
1878#endif
1879 }
1880 else /* animationUseFlag */
1881 {
1882 call_util_transpose_mat (mat16, mat);
1883 glMatrixMode (GL_MODELVIEW);
1884#ifdef TRACE_MATRIX
1885 glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) pmat );
1886 printf ("GL_MODELVIEW_MATRIX :\n");
1887 for (i = 0; i < 4; i++) {
1888 printf ("\t");
1889 for (j = 0; j < 4; j++)
1890 printf ("%f ", pmat[i][j]);
1891 printf ("\n");
1892 }
1893#endif
1894#ifdef TRACE_MATRIX
1895 printf("OpenGl_attri.c::TelSetViewMatrix::glMultMatrixf \n");
1896#endif
1897 glMultMatrixf ((GLfloat *)mat);
1898#ifdef TRACE_MATRIX
1899 glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) pmat );
1900 printf ("GL_MODELVIEW_MATRIX set :\n");
1901 for (i = 0; i < 4; i++) {
1902 printf ("\t");
1903 for (j = 0; j < 4; j++)
1904 printf ("%f ", pmat[i][j]);
1905 printf ("\n");
1906 }
1907#endif
1908 }
1909 }
1910 return;
1911}
1912
1913/*----------------------------------------------------------------------*/
1914
1915TStatus
1916TsmPushAttriLight( void )
1917{
1918 tsm_attri_blk node;
1919
1920 node = new TSM_ATTRI_BLK();
1921
1922 if( !attri_stk.IsEmpty() )
1923 *node = *attri_stk.Top();
1924 else
1925 *node = attri_default;
1926
1927 attri_stk.Push( node );
1928 return TSuccess;
1929}
1930
1931/*----------------------------------------------------------------------*/
1932
1933TStatus
1934TsmPopAttriLight( void )
1935{
1936 tsm_attri_blk node;
1937
1938 if ( attri_stk.IsEmpty() )
1939 return TFailure; /* Underflow */
1940
1941 node = attri_stk.ChangeTop();
1942 attri_stk.Pop();
1943 delete node;
1944
1945 return TSuccess;
1946}
1947
1948/*----------------------------------------------------------------------*/
1949
1950static void call_util_transpose_mat (float tmat[16], float mat[4][4]) {
1951 int i, j;
1952
1953 for (i=0; i<4; i++)
1954 for (j=0; j<4; j++)
1955 tmat[j*4+i] = mat[i][j];
1956
1957#ifdef TRACE
1958 printf ("Transposee :\n");
1959 for (i = 0; i < 4; i++) {
1960 printf ("\t");
1961 for (j = 0; j < 4; j++)
1962 printf ("%f ", tmat[i*4+j]);
1963 printf ("\n");
1964 }
1965#endif
1966}
1967/*----------------------------------------------------------------------*/
1968
1969/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
1970static void TelUpdatePolygonOffsets( tel_poffset_param pdata )
1971{
1972#ifdef TRACE
1973 printf(" *** TelUpdatePolygonOffsets: mode = %x, factor = %f, units = %f",
1974 pdata->mode, pdata->factor, pdata->units );
1975#endif
1976 if ( ( pdata->mode & Aspect_POM_Fill ) == Aspect_POM_Fill )
1977 glEnable ( GL_POLYGON_OFFSET_FILL );
1978 else
1979 glDisable ( GL_POLYGON_OFFSET_FILL );
1980
1981 if ( ( pdata->mode & Aspect_POM_Line ) == Aspect_POM_Line )
1982 glEnable ( GL_POLYGON_OFFSET_LINE );
1983 else
1984 glDisable( GL_POLYGON_OFFSET_LINE );
1985
1986 if ( ( pdata->mode & Aspect_POM_Point ) == Aspect_POM_Point )
1987 glEnable ( GL_POLYGON_OFFSET_POINT );
1988 else
1989 glDisable( GL_POLYGON_OFFSET_POINT );
1990
1991 glPolygonOffset( pdata->factor, pdata->units );
1992}
1993/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */