Reimplemented from OglGui::Window. Definition at line 291 of file ViewSphere.h. References DoViewTransRot(), HandleAnimation(), mAdjustViewDims, mDblRing, mHorRingNr, OglGui::OglWindow::mOglWnd, mRadius, mRotRingAngle, mShowText, mSphereRotX, mSphereRotY, mSphereRotZ, mSphereX, mSphereY, mSphereZ, mStdStickOut, mStdVertRing, mVertRingNr, MyFabs, NCOL, NROW, and txtFontBase. 00292 { 00293 SCENE3D *scene3D; 00294 LIST *obj; 00295 OGLVIEW3D *view; 00296 OGC myOGC; 00297 int i, j; 00298 float angle, rad, stickOut; 00299 float hW, hH; 00300 00301 if( (scene3D = (SCENE3D *) mOglWnd->sceneInfo) ){ 00302 if (scene3D->isLighting) 00303 glEnable(GL_LIGHTING); 00304 } 00305 00306 OGCSave( &myOGC ); 00307 HandleAnimation(); 00308 00309 view3DSys.View3DCameraTransform( mOglWnd ); 00310 00311 glTranslatef( mSphereX, mSphereY, mSphereZ ); 00312 glRotatef( mSphereRotX, 1.0f, 0.0f, 0.0f ); // Rotate X 00313 glRotatef( mSphereRotY, 0.0f, 1.0f, 0.0f ); // Rotate Y 00314 glRotatef( mSphereRotZ, 0.0f, 0.0f, 1.0f ); // Rotate Z 00315 obj = mOglWnd->objectList; 00316 for( i=0; i<NCOL; i++) 00317 { 00318 glPushMatrix(); 00319 glRotatef( i * 180/NCOL, 0.0f, 1.0f, 0.0f ); 00320 00321 for( j=0; j<NROW; j++) 00322 { 00323 angle = stickOut = 0.f; 00324 view = (OGLVIEW3D *) obj->info; 00325 00326 // Prevent all overlapping at poles 00327 if( (i%NCOL) && (j==NROW/4 || j==3*NROW/4) ){ 00328 obj = obj->next; 00329 continue; 00330 } 00331 00332 glPushMatrix(); 00333 00334 if( (mDblRing || mStdVertRing) && i==mVertRingNr ) 00335 { 00336 glRotatef( mRotRingAngle, 1.0f, 0.0f, 0.0f ); 00337 stickOut = mStdStickOut + (mDblRing ? 0.2f : 0.0f ); 00338 angle += mRotRingAngle; 00339 } 00340 else if( (mDblRing || !mStdVertRing) && (j==mHorRingNr || 00341 (j == ((mHorRingNr<=NROW/2) ? NROW/2-mHorRingNr : NROW + (NROW/2-mHorRingNr))) ) ) 00342 { 00343 glRotatef( mRotRingAngle, 0.0f, 1.0f, 0.0f ); 00344 stickOut = mStdStickOut; 00345 } 00346 00347 // Rotate view into place 00348 rad = mRadius + stickOut; 00349 angle += (j*360/NROW); 00350 glRotatef( j * 360/NROW, 1.0f, 0.0f, 0.0f ); 00351 glTranslatef( 0.0f, 0.0f, -rad); 00352 00353 hH = (OGL_PI * rad) / NROW; 00354 hW = (OGL_PI * (rad*MyFabs(cos(DEG2RAD(angle))))) / (2 * NCOL); 00355 if( mAdjustViewDims ) 00356 view3DSys.SetDimensions(view, FRETAIN, FRETAIN, FRETAIN, 2*hW, 2*hH, FRETAIN); 00357 00358 view3DSys.DrawView( (OGLVIEW3D *) obj->info ); 00359 00360 DoViewTransRot( view ); 00361 00362 // If object3D == 0, no image is drawn. So we draw our own 00363 if( !view->object3D ) 00364 { 00365 float hW0, hW1; 00366 hW0 = (float) (OGL_PI_05 * rad*MyFabs(cos(DEG2RAD(angle - 90.0/NCOL )))) / NCOL; 00367 hW1 = (float) (OGL_PI_05 * rad*MyFabs(cos(DEG2RAD(angle + 90.0/NCOL )))) / NCOL; 00368 glColor3f( 1.0f, 1.0f, 1.0f ); 00369 glEnable( GL_TEXTURE_2D ); 00370 #ifndef OGL_USING_GLUT 00371 glNormal3f( 0.f, 0.f, 1.f ); 00372 #else 00373 glNormal3f( 0.f, 0.f, -1.f ); 00374 #endif 00375 glBegin( GL_QUADS ); 00376 glTexCoord2f(0.f, 1.f); glVertex3f( hW1, hH, -0.01f ); 00377 glTexCoord2f(1.f, 1.f); glVertex3f( -hW1, hH, -0.01f ); 00378 glTexCoord2f(1.f, 0.f); glVertex3f( -hW0, -hH, -0.01f ); 00379 glTexCoord2f(0.f, 0.f); glVertex3f( hW0, -hH, -0.01f ); 00380 00381 glEnd(); 00382 glDisable( GL_TEXTURE_2D ); 00383 } 00384 00385 // Show in 3D text the indices. Trial for later use with 3D text menus 00386 // on a sphere 00387 if( mShowText ){ 00388 char buf[100]; 00389 sprintf( buf, "%d,%d", i, j ); 00390 glPushMatrix(); 00391 glRotatef( 180.0f, 1.0f, 0.0f, 0.0f ); 00392 glColor3f( 1.0f, 1.0f, 0.0f ); 00393 float oldLineWidth = GetLineWidth(); 00394 SetLineWidth(2.0f); 00395 oglSys.Printf3D( txtFontBase, -0.25f, 0.0f, 0.1f, 0.4f, 0.4f, 0.2f, buf ); 00396 SetLineWidth(oldLineWidth); 00397 glPopMatrix(); 00398 } 00399 obj = obj->next; 00400 glPopMatrix(); 00401 } 00402 glPopMatrix(); 00403 } 00404 glLoadName(0); 00405 00406 if( mShowCentralView ) 00407 { 00408 view3DSys.View3DCameraTransform( mOglWnd ); 00409 view3DSys.DrawView( centralView ); 00410 } 00411 00412 // If rotation is not halted, advance rotation angles 00413 if( mSphereRotating ){ 00414 // Change the orientation variables 00415 mSphereRotX += mSphereRotDx; 00416 mSphereRotY += mSphereRotDy; 00417 mSphereRotZ += mSphereRotDz; 00418 } 00419 if ( mAutoRotateRing ) 00420 mRotRingAngle += mRotRingDelta; 00421 00422 { 00423 SCENE3D *scene3D = (SCENE3D *) mOglWnd->sceneInfo; 00424 if( scene3D->showKeys ){ 00425 oglSys.InfoBoxCenter( mOglWnd, view3DKeyInfoBox ); 00426 oglSys.InfoBoxDraw( mOglWnd, view3DKeyInfoBox ); 00427 } 00428 } 00429 00430 if( !mOglWnd->hitDetecting && mKeyInfo ){ 00431 oglSys.InfoBoxCenter( mOglWnd, sphereInfoBox ); 00432 oglSys.InfoBoxDraw( mOglWnd, sphereInfoBox ); 00433 } 00434 OGCRestore( &myOGC ); 00435 glDisable(GL_LIGHTING); 00436 }
Here is the call graph for this function:
|