moss-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Moss-devel] CVS: moss/3Dsia/client/3Dcf/src World.cxx,1.8,1.9 main.cxx


From: Felix Morgner <address@hidden>
Subject: [Moss-devel] CVS: moss/3Dsia/client/3Dcf/src World.cxx,1.8,1.9 main.cxx,1.6,1.7
Date: Mon, 24 Mar 2003 17:06:30 -0500

Update of /cvsroot/moss/moss/3Dsia/client/3Dcf/src
In directory subversions:/tmp/cvs-serv11871

Modified Files:
        World.cxx main.cxx 
Log Message:
Hmmmm ... added a sinless feature :) and redisigned the DrawLabel function


Index: World.cxx
===================================================================
RCS file: /cvsroot/moss/moss/3Dsia/client/3Dcf/src/World.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** World.cxx   2 Feb 2003 20:03:47 -0000       1.8
--- World.cxx   24 Mar 2003 22:06:27 -0000      1.9
***************
*** 35,40 ****
--- 35,44 ----
  #include <iostream>
  
+ 
  using namespace std;
  
+   float afErrorTextColor[] = {1.0, 0.0, 0.0};
+ 
+ 
  CWorld::CWorld(int nParams, char* aszParams[])
    {
***************
*** 53,57 ****
    m_dYrot = .0;
    m_dZrot = .0;
-   m_dZoom = 6.0;
    m_nWidth      = 640;
    m_nHeight     = 480;
--- 57,60 ----
***************
*** 60,63 ****
--- 63,67 ----
    m_nWindow = 0;
  
+   
    glutInit(&nParams, aszParams);
    glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH);
***************
*** 66,69 ****
--- 70,74 ----
    m_nWindow = glutCreateWindow("3df.client");
    cout << "GLUT Window created. Handle: " << m_nWindow << endl;
+   cout << "Program runtime output:" << endl;
  
    } // CWorld::CWorld(int nParams, char* aszParams[])
***************
*** 80,84 ****
    m_nHeight     = nHeight;
    m_bFullScreen = bFullScreen;
! 
    if (m_bFullScreen)
      {
--- 85,89 ----
    m_nHeight     = nHeight;
    m_bFullScreen = bFullScreen;
!   
    if (m_bFullScreen)
      {
***************
*** 113,117 ****
    glLoadIdentity();
    gluPerspective(45.f, (GLfloat)nWidth/(GLfloat)nHeight, .1f, 100.f);
!   gluLookAt(2, 2, m_dZoom, 0, 0, 0, 0, 1, 0);
    glMatrixMode(GL_MODELVIEW);
    } // void CWorld::InitGL(int nWidth, int nHeight)
--- 118,122 ----
    glLoadIdentity();
    gluPerspective(45.f, (GLfloat)nWidth/(GLfloat)nHeight, .1f, 100.f);
!   gluLookAt(2, 2, 6, 0, 0, 0, 0, 1, 0);
    glMatrixMode(GL_MODELVIEW);
    } // void CWorld::InitGL(int nWidth, int nHeight)
***************
*** 139,145 ****
    glLoadIdentity();
  
  
    glPushMatrix();
!   glTranslatef(0.0, 0.0, 0.0);
    glRotatef(m_dXrot,1.0,0.0,0.0);
    glRotatef(m_dYrot,0.0,1.0,0.0);
--- 144,151 ----
    glLoadIdentity();
  
+   float afTextColor[] = {1.0, 1.0, 0.0};
  
    glPushMatrix();
!   glTranslatef(0.0, 0.0, m_dZoom);
    glRotatef(m_dXrot,1.0,0.0,0.0);
    glRotatef(m_dYrot,0.0,1.0,0.0);
***************
*** 156,160 ****
    glPushMatrix();
    glColor3f(1.f,1.f,.0f);
!   glTranslatef(2.f, 5.f, -5.f);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glutSolidSphere(.2f, 32, 32);
--- 162,166 ----
    glPushMatrix();
    glColor3f(1.f,1.f,.0f);
!   glTranslatef(2.f, 5.f, -5.0);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glutSolidSphere(.2f, 32, 32);
***************
*** 162,166 ****
    glPopMatrix();
  
!     DrawLabel(1, "Welcome to 3Dcf");
    // Creating the world cube
    // all entities have to be in them
--- 168,172 ----
    glPopMatrix();
  
!     DrawLabel("Welcome to \"3Dcf\"", afTextColor, -1.8, 1.0, -1.5, 0.003);
    // Creating the world cube
    // all entities have to be in them
***************
*** 229,232 ****
--- 235,239 ----
      case 'z': m_dZrot += .8; break;
      case 'Z': m_dZrot -= .8; break;
+     
  
      case 'f':
***************
*** 243,260 ****
        break;
  
      default: return;
      }
    glutPostRedisplay();
    } // void CWorld::KeyPressed(unsigned char key, int x, int y)
  
! void CWorld::DrawLabel(int row, string sLabel)
    {
!   double scalefactor = 0.003;
!   GLfloat z = (row * 30.0/20) + .8;
    
    glPushMatrix();
!   glTranslatef(-1.5, 1.5, z);
    glScalef(scalefactor, scalefactor, 1);
!   glColor3f(1.0f, .3f, 0.2f);
    for(string::const_iterator i = sLabel.begin(); i != sLabel.end(); i++)
      {
--- 250,283 ----
        break;
  
+ 
      default: return;
      }
+ 
    glutPostRedisplay();
    } // void CWorld::KeyPressed(unsigned char key, int x, int y)
  
! void CWorld::SpecialKeyPressed(int key, int x, int y)
!   {
!   switch(key)
!     {
!     case 103 : 
!       m_dZoom += .8; 
!       cout << m_dZoom << endl; break;
!       glutPostRedisplay();
!     case 108 : 
!       m_dZoom -= .8; 
!       cout << m_dZoom << endl; break;
!       glutPostRedisplay();
!     }
!   } // void SpecialKeyPressed(int key, int x, int y)
! 
! void CWorld::DrawLabel(string sLabel, float afColor[3], double x, double row, 
double z, double scalefactor)
    {
!   GLfloat y = row ;
    
    glPushMatrix();
!   glTranslatef(x, -y+3, y);
    glScalef(scalefactor, scalefactor, 1);
!   glColor3f(afColor[0], afColor[1], afColor[2]);
    for(string::const_iterator i = sLabel.begin(); i != sLabel.end(); i++)
      {
***************
*** 280,313 ****
      m_nFirst = 0;
      }
!   
    if(nButton == GLUT_MIDDLE_BUTTON && nStatus == GLUT_DOWN)
      {
      glutSetCursor(GLUT_CURSOR_UP_DOWN);
!     m_nZooming = 1;
!     m_dMouseZ = y - 3 * 9;
      }
    else if(nButton == GLUT_MIDDLE_BUTTON && nStatus == GLUT_UP)
      {
!     glutSetCursor(GLUT_CURSOR_INHERIT);
!     m_nZooming = 0;
!     }
! 
! /*  else if(nButton == 0 && nStatus == 1)
!     {
!     m_nDragging = 0;
!     glutSetCursor(GLUT_CURSOR_INHERIT);
!     }
!   if(nButton == 1 && nStatus == 0)
!     {
!     m_nFirst = m_nZooming = 1;
!     glutSetCursor(GLUT_CURSOR_UP_DOWN);
!     }
!   else if(nButton == 1 && nStatus  == 1)
!     {
!     m_nZooming = 0;
      glutSetCursor(GLUT_CURSOR_INHERIT);
      }
- */
-     
    glutPostRedisplay();
    } // void CWorld::MouseFunction(int nButton, int nStatus, int x, int y)
--- 303,319 ----
      m_nFirst = 0;
      }
!     
    if(nButton == GLUT_MIDDLE_BUTTON && nStatus == GLUT_DOWN)
      {
+     m_nMiddle = 1;
      glutSetCursor(GLUT_CURSOR_UP_DOWN);
!     cout << "\tNotify ==>  Sorry, but zooming is not fully implementet 
yet.\n";
!     cout << "\tIf you want to help us, send an e-mail to address@hidden \n";
      }
    else if(nButton == GLUT_MIDDLE_BUTTON && nStatus == GLUT_UP)
      {
!     m_nMiddle = 0;
      glutSetCursor(GLUT_CURSOR_INHERIT);
      }
    glutPostRedisplay();
    } // void CWorld::MouseFunction(int nButton, int nStatus, int x, int y)
***************
*** 315,323 ****
  void CWorld::MouseMotion(int x, int y)
    {
!   
!   if(m_nFirst == 1)
      {
!     m_dXrot = m_dXrot - (y - m_dMouseY);
!     m_dYrot = m_dYrot - (x - m_dMouseX);
      
      m_dMouseX = x;
--- 321,328 ----
  void CWorld::MouseMotion(int x, int y)
    {
!   if(m_nFirst)
      {
!     m_dXrot = m_dXrot + (y - m_dMouseY);
!     m_dYrot = m_dYrot + (x - m_dMouseX);
      
      m_dMouseX = x;
***************
*** 327,337 ****
      
      }
-     
-   if(m_nZooming == 1)
-     {
- //    m_dMouseZ = (y - m_dMouseY) / 3.0;
-     m_dZoom = m_dMouseZ;
-     glutPostRedisplay();
-     
-     }
    } // void CWorld::MouseMotion(int x, int y)
--- 332,335 ----
      
      }
    } // void CWorld::MouseMotion(int x, int y)
+ 

Index: main.cxx
===================================================================
RCS file: /cvsroot/moss/moss/3Dsia/client/3Dcf/src/main.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** main.cxx    2 Feb 2003 16:11:13 -0000       1.6
--- main.cxx    24 Mar 2003 22:06:27 -0000      1.7
***************
*** 58,61 ****
--- 58,67 ----
    }
  
+ void SpecialKeyPressed(int key, int x, int y)
+   {
+   if (g_poWorld == 0) return;
+   g_poWorld->SpecialKeyPressed(key, x, y);
+   }
+ 
  void MouseFunction(int nButton, int nState, int x, int y)
    {
***************
*** 82,85 ****
--- 88,92 ----
    glutIdleFunc(Idle);
    glutKeyboardFunc(KeyPressed);
+   glutSpecialFunc(SpecialKeyPressed);
    glutMouseFunc(MouseFunction);
    glutMotionFunc(MouseMotion);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]