33 #include <GLUT/glut.h>
38 #include <QtGui/QCloseEvent>
39 #include <QtGui/QMouseEvent>
41 using namespace GMap3d ;
50 GLWindow ( VIEW_ISO , parent , owner , share , selection ),
56 parent->addWindow(
this);
77 {
return string(
"Multi-vue"); }
81 assert (0<=FCliqued && FCliqued<=3 );
83 return FViewIds[FCliqued];
88 assert (0<=FDoubleCliqued && FDoubleCliqued<=3 );
90 return FViewIds[FDoubleCliqued];
97 int GLMultiWindow :: cadre (
int x ,
int y )
99 int w = width ( ) / 2 ;
100 int h = height ( ) / 2 ;
122 FOwner -> getControler ( ) -> viewDestroy ( FViewIds [ 0 ] ) ;
123 FOwner -> getControler ( ) -> viewDestroy ( FViewIds [ 1 ] ) ;
124 FOwner -> getControler ( ) -> viewDestroy ( FViewIds [ 2 ] ) ;
125 FOwner -> getControler ( ) -> viewDestroy ( FViewIds [ 3 ] ) ;
141 glDisable(GL_SCISSOR_TEST);
142 glClearColor(0,0,0, 1);
143 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
144 glEnable(GL_SCISSOR_TEST);
147 int x = 0 ;
int y = height ( ) / 2 ;
148 int w = width ( ) / 2 ;
int h = height ( ) / 2 ;
151 for (
unsigned int i = 0 ; i < 4 ; i++ )
153 if ( i == 1 || i == 3 )
161 glViewport ( x+1 , y+1 , w-2 , h-2 );
162 glScissor ( x+1 , y+1 , w-2 , h-2 ) ;
164 FOwner -> getControler ( ) -> viewInit(FViewIds[i]);
165 FOwner -> getControler ( ) -> viewDraw(FViewIds[i]);
177 glEnable(GL_DEPTH_TEST);
178 glDepthFunc(GL_LEQUAL);
183 glEnable(GL_POLYGON_MODE);
184 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
186 ::glEnable(GL_POLYGON_OFFSET_FILL);
187 ::glPolygonOffset(1.0f,1.0f);
190 static const GLfloat Material_Ks[] = {0.5, 0.5, 0.5, 1.0};
191 static const GLfloat Material_Ke[] = {0.0, 0.0, 0.0, 1.0};
192 static const GLfloat Material_Se = 100;
194 glEnable(GL_COLOR_MATERIAL);
195 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR , Material_Ks);
196 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION , Material_Ke);
197 glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, Material_Se);
200 static const GLfloat Light_Ka[] = {0.1, 0.1, 0.1, 1.0};
201 static const GLfloat Light_Kd[] = {1.0, 1.0, 1.0, 1.0};
202 static const GLfloat Light_Ks[] = {0.5, 0.5, 0.5, 1.0};
204 glLightfv(GL_LIGHT0, GL_AMBIENT , Light_Ka);
205 glLightfv(GL_LIGHT0, GL_DIFFUSE , Light_Kd);
206 glLightfv(GL_LIGHT0, GL_SPECULAR, Light_Ks);
226 GMap3d :: CControlerGMap* controler =
FOwner -> getControler ( ) ;
228 FViewIds [ 0 ] = controler->viewCreate(VIEW_XYZ);
229 FViewIds [ 1 ] = controler->viewCreate(VIEW_XY);
230 FViewIds [ 2 ] = controler->viewCreate(VIEW_XZ);
231 FViewIds [ 3 ] = controler->viewCreate(VIEW_YZ);
233 for (
int i = 0 ; i < 4 ; i++ )
235 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_GRID);
236 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_AXIS);
237 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_AIMED_POINT);
238 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_OBJECT_TRANSFORMATION);
239 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_PREVIEW);
240 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_NORMAL_VECTOR);
241 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_SEW);
242 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_VERTEX);
244 controler->viewAddPrecompile (FViewIds [ i ], PRECOMPILE_SPAMOD);
245 controler->viewDisablePrecompile(FViewIds [ i ], PRECOMPILE_SPAMOD);
246 controler->getParameterSpamod(FViewIds [ i ])->setViewMode(SPAMOD_NONE);
247 #endif // MODULE_SPAMOD
248 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_DART);
249 controler->viewAddPrecompile(FViewIds [ i ], PRECOMPILE_FACE);
251 controler->viewDisablePrecompile(FViewIds [ i ], PRECOMPILE_SEW);
253 controler->viewDisablePrecompile(FViewIds [ i ], PRECOMPILE_VERTEX);
255 controler->viewDisablePrecompile(FViewIds [ i ], PRECOMPILE_FACE);
257 controler->viewDisablePrecompile(FViewIds [ i ], PRECOMPILE_NORMAL_VECTOR);
259 controler->loadAllParameters(FViewIds [ i ]);
279 CControlerGMap * controler =
FOwner -> getControler ( ) ;
280 int y =
this -> height ( ) - eb -> y ( ) ;
282 FCliqued = cadre ( eb -> x() , y );
284 if ( eb -> modifiers () == Qt :: ControlModifier )
286 switch ( eb -> button ( ) )
291 operationModeIndependentStart(MODE_OPERATION_SCENE_TRANSLATION ,
292 FViewIds [ cadre ( eb -> x() , y ) ],
293 int ( eb -> x ( ) ) ,
298 operationModeIndependentStart(MODE_OPERATION_SCENE_ROTATION,
299 FViewIds[ cadre ( eb -> x() , y ) ],
304 case Qt::RightButton :
306 operationModeIndependentStart(MODE_OPERATION_SCENE_SCALE,
307 FViewIds[ cadre ( eb -> x() , y ) ],
318 if ( eb -> button ( ) == Qt :: LeftButton )
320 controler -> setHalfSelectionOrbit
321 ( eb -> modifiers ( ) == Qt :: ShiftModifier ) ;
322 controler -> operationModeStart( FViewIds[ cadre ( eb -> x() , y ) ] ,
329 boite -> update ( ) ;
340 else if ( eb -> button ( ) == Qt::MidButton)
342 if (controler->isInCreationMode())
347 boite -> create ( ) ;
353 #ifdef MODULE_ARCHITECTURE
354 FOwner -> getFlapSelection() -> nextLevel();
358 else if ( eb -> button ( ) == Qt :: RightButton )
360 FOwner -> getControler ( ) -> lookAtMouseClick(FViewIds[cadre(eb -> x(),y)],eb -> x(),y);
371 int y =
this -> height ( ) - em -> y ( ) ;
372 FOwner -> getControler ( ) -> operationModeMove (
int ( em -> x ( ) ), y ) ;
375 boite -> update ( ) ;
391 int y =
this -> height ( ) - eb -> y () ;
392 FOwner -> getControler() -> operationModeStop (
int(eb->x()),
396 boite -> update ( ) ;
411 if ( e -> button ( ) == Qt::LeftButton )
413 int y =
this -> height ( ) - e -> y ( ) ;
414 FDoubleCliqued = cadre ( e -> x() , y );
415 FOwner -> setDoubleCliquee (
this ) ;