7fd59977 |
1 | /*********************************************************************** |
2 | |
3 | FONCTION : |
4 | ---------- |
5 | File OpenGl_togl_begin_animation : |
6 | |
7 | |
8 | REMARQUES: |
9 | ---------- |
10 | |
11 | HISTORIQUE DES MODIFICATIONS : |
12 | -------------------------------- |
13 | 05-01-98 : CAL ; Creation. |
14 | 21-01-98 : FMN ; Ajout call_togl_end_animation(). |
15 | 17-03-98 : FMN ; Ajout mode animation |
16 | 08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode() |
17 | -> call_togl_erase_animation_mode. |
18 | 24-08-98 : BGN ; Correction de diag de compilation sur NT : |
19 | Suppression de l'include OpenGl_animation.h qui |
20 | provoque des doubles declarations. |
21 | |
22 | ************************************************************************/ |
23 | |
24 | #define G003 /* EUG 07-10-99 Animation management |
25 | */ |
26 | |
27 | #define BUC60876 /* GG 5/4/2001 Disable local display list |
28 | // when animation is not required |
29 | */ |
30 | |
31 | /*----------------------------------------------------------------------*/ |
32 | /* |
33 | * Includes |
34 | */ |
35 | |
36 | #include <OpenGl_tgl_all.hxx> |
37 | |
38 | #include <InterfaceGraphic_Labels.hxx> |
39 | #include <InterfaceGraphic_Graphic3d.hxx> |
40 | #include <InterfaceGraphic_Visual3d.hxx> |
41 | |
42 | /* 24-08-98 : BGN ; include <OpenGl_animation.h> */ |
43 | |
44 | #include <GL/gl.h> |
45 | #ifdef G003 |
46 | # include <OpenGl_tsm_ws.hxx> |
47 | void EXPORT call_togl_erase_animation_mode ( void ); |
48 | #endif /* G003 */ |
49 | |
50 | /*----------------------------------------------------------------------*/ |
51 | /* |
52 | * Constantes |
53 | */ |
54 | |
55 | #define NO_DEBUG |
56 | |
57 | |
58 | /*----------------------------------------------------------------------*/ |
59 | /* |
60 | * Variables statiques |
61 | */ |
62 | |
63 | /* Indique si la display-list a ete cree */ |
64 | static GLboolean listIndexCreate = GL_FALSE; |
65 | |
66 | /*----------------------------------------------------------------------*/ |
67 | /* |
68 | * Variables externes |
69 | */ |
70 | |
71 | /* La display-list utilisee pour le mode animation */ |
72 | GLuint listIndex = 0; |
73 | |
74 | /* La vue de reference pour le mode animation */ |
75 | int listIndexView = -1; |
76 | |
77 | /* Flag si la display-list a ete initialise*/ |
78 | GLboolean listIndexFlag = GL_FALSE; |
79 | |
80 | /* Flag mode animation en cours */ |
81 | GLboolean animationFlag = GL_FALSE; |
82 | |
83 | /* Flag si le mode animation est disponible |
84 | * (cf. var environnement CALL_ANIMATION) */ |
85 | #ifdef G003 |
86 | GLboolean animationUseFlag = GL_TRUE; |
87 | GLboolean g_fAnimation; |
88 | GLboolean g_fUpdateAM; |
89 | GLboolean g_fDegeneration; |
90 | GLboolean g_fList; |
91 | #else |
92 | GLboolean animationUseFlag = GL_FALSE; |
93 | #endif /* G003 */ |
94 | |
95 | /*----------------------------------------------------------------------*/ |
96 | |
97 | int EXPORT |
98 | call_togl_begin_animation |
99 | ( |
100 | CALL_DEF_VIEW * aview |
101 | ) |
102 | { |
103 | #ifdef G003 |
104 | g_fAnimation = GL_TRUE; |
105 | g_fList = GL_FALSE; |
106 | g_fDegeneration = aview -> IsDegenerates; |
107 | g_fUpdateAM = ( aview -> IsDegenerates == |
108 | aview -> IsDegeneratesPrev |
109 | ) ? GL_FALSE : GL_TRUE; |
110 | aview -> IsDegeneratesPrev = aview -> IsDegenerates; |
111 | #endif /* G003 */ |
112 | |
113 | if (animationUseFlag) |
114 | { |
115 | if (!listIndexCreate) |
116 | { |
117 | listIndex = glGenLists(1); |
118 | listIndexCreate = GL_TRUE; |
119 | } |
120 | |
121 | if (listIndex == 0) |
122 | animationFlag = GL_FALSE; |
123 | else |
124 | animationFlag = GL_TRUE; |
125 | } |
126 | #ifdef DEBUG |
127 | printf("call_togl_begin_animation(%d) animationFlag: %d\n", aview->WsId, animationFlag); |
128 | #endif |
129 | return (animationFlag); |
130 | } |
131 | |
132 | /*----------------------------------------------------------------------*/ |
133 | |
134 | void EXPORT |
135 | call_togl_end_animation |
136 | ( |
137 | CALL_DEF_VIEW * aview |
138 | ) |
139 | { |
140 | #ifdef G003 |
141 | CMN_KEY_DATA data; |
142 | |
143 | #ifdef BUC60876 |
144 | if( !g_fAnimation ) return; |
145 | #else |
146 | if( !animationFlag ) return; |
147 | #endif |
148 | |
149 | data.ldata = TNotDone; |
150 | TsmSetWSAttri ( aview -> WsId, WSUpdateState, &data ); |
151 | g_fAnimation = GL_FALSE; |
152 | #ifndef BUC60876 |
153 | g_fUpdateAM = GL_TRUE; |
154 | #endif |
155 | g_fDegeneration = GL_FALSE; |
156 | #endif /* G003 */ |
157 | |
158 | #ifdef DEBUG |
159 | printf("call_togl_end_animation(%d) \n", aview->WsId); |
160 | #endif |
161 | animationFlag = GL_FALSE; |
162 | |
163 | } |
164 | |
165 | /*----------------------------------------------------------------------*/ |
166 | /* |
167 | * Permet de terminer effectivement le mode Animation. |
168 | * Ceci est realise des qu'une structure a ete modifiee. |
169 | */ |
170 | |
171 | void EXPORT call_togl_erase_animation_mode(void) |
172 | { |
173 | #ifdef DEBUG |
174 | printf("call_togl_erase_animation_mode \n"); |
175 | #endif |
176 | listIndexView = -1; |
177 | listIndexFlag = GL_FALSE; |
178 | animationFlag = GL_FALSE; |
179 | #ifdef G003 |
180 | g_fAnimation = GL_FALSE; |
181 | g_fUpdateAM = GL_FALSE; |
182 | g_fDegeneration = GL_FALSE; |
183 | g_fList = GL_FALSE; |
184 | #endif /* G003 */ |
185 | } |
186 | |
187 | /*----------------------------------------------------------------------*/ |