summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_togl_setvisualisation.cxx
blob: ecaa905320e5d2b88d47cad2c63339f189ef2aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/***********************************************************************

FONCTION :
----------
File OpenGl_togl_setvisualisation :

TEST :
------

Le main TestOfDesktop.c permet de tester cette classe.


REMARQUES:
---------- 


HISTORIQUE DES MODIFICATIONS   :
--------------------------------
xx-xx-xx : xxx ; Creation.
17-07-96 : FMN ; Simplification du code
05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
24-12-97 : FMN ; Suppression de call_func_set_back_int_shad_meth()

************************************************************************/

/*----------------------------------------------------------------------*/
/*
* Includes
*/


#include <OpenGl_tgl_all.hxx>

#include <InterfaceGraphic_Labels.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>

#include <OpenGl_tgl_funcs.hxx>
#include <OpenGl_tgl_subrvis.hxx>

/*----------------------------------------------------------------------*/

void EXPORT
call_togl_setvisualisation
(
 CALL_DEF_VIEW * aview
 )
{
  /* activation */
  call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
  call_func_open_struct( aview->ViewId );
  call_func_set_elem_ptr( 0 );
  call_func_set_elem_ptr_label( View_LABViewContext );
  call_func_offset_elem_ptr( 1 );

  switch( aview->Context.Visualization )
  {
  case 0 : /* VISUAL3D_TOV_WIREFRAME */
    call_func_appl_data( 0 );

    call_func_set_elem_ptr( 0 );
    call_func_set_elem_ptr_label( View_LABHlhsr );
    call_func_offset_elem_ptr( 1 );
    call_util_setvisualization (
      aview, 
      aview->Context.ZBufferActivity,
      CALL_DEF_DISABLE_ZBUFFER);
    break;

  case 1 : /* VISUAL3D_TOV_SHADING */
    switch( aview->Context.Model )
    {
    case 0 : /* VISUAL3D_TOM_NONE */
      call_func_set_int_shad_meth( CALL_PHIGS_SD_NONE );

      break;

    case 1 : /* VISUAL3D_TOM_INTERP_COLOR */
      call_func_set_int_shad_meth( CALL_PHIGS_SD_COLOUR );
      break;

    case 2 : /* VISUAL3D_TOM_FACET */
      call_func_set_int_shad_meth( CALL_PHIGS_SD_NORMAL );
      break;

    case 3 : /* VISUAL3D_TOM_VERTEX */
      call_func_set_int_shad_meth( CALL_PHIGS_SD_COLOUR );
      break;

    case 4 : /* VISUAL3D_TOM_HIDDENLINE */
      call_func_set_int_shad_meth( CALL_PHIGS_SD_NONE );
      break;
    }
    call_func_set_elem_ptr( 0 );
    call_func_set_elem_ptr_label( View_LABHlhsr );
    call_func_offset_elem_ptr( 1 );
    call_util_setvisualization (
      aview, 
      aview->Context.ZBufferActivity,
      CALL_DEF_ENABLE_ZBUFFER);
    break;
  }

  call_func_close_struct();

  return;
}

/*----------------------------------------------------------------------*/

void call_util_setvisualization
(
 CALL_DEF_VIEW * aView, 
 int ZBuffer,
 int Mode
 )
{
  switch (ZBuffer) {
    case -1 : /* non force */
      call_subr_hlhsr (aView, Mode);
      break;
    case 0 : /* force a "disable" */
      call_subr_hlhsr (aView, CALL_DEF_DISABLE_ZBUFFER);
      break;
    case 1 : /* force a "enable" */
      call_subr_hlhsr (aView, CALL_DEF_ENABLE_ZBUFFER);
      break;
  }
}

/*----------------------------------------------------------------------*/