#include <TAPsWXOpenGLCanvas.hpp>
Public Member Functions | |
| void | Action (long code, unsigned long lastTime, unsigned long accelTime) |
| void | CreateMenuPopup1 () |
| Real *const | GetCameraLookAt () |
| Real *const | GetCameraPosition () |
| Real *const | GetCameraUpVector () |
| GLenum | GetDrawStyle () |
| bool | GetStatusDrawLinesConnectedControlPts () |
| bool | GetStatusDrawPlatform () |
| bool | GetStatusDrawRefObject () |
| bool | GetStatusDrawShadow () |
| bool | GetStatusDrawTexts () |
| bool | GetStatusShowCtrlPts () |
| bool | GetStatusUseFancyColor () |
| Real | GetViewAngle () |
| void | InitGL () |
| void | OnChar (wxKeyEvent &event) |
| void | OnEnterWindow (wxMouseEvent &event) |
| void | OnEraseBackground (wxEraseEvent &event) |
| void | OnIdle (wxIdleEvent &event) |
| void | OnKeyDown (wxKeyEvent &event) |
| void | OnKeyUp (wxKeyEvent &event) |
| void | OnMouse (wxMouseEvent &event) |
| void | OnMouseRightClick (wxMouseEvent &event) |
| void | OnPaint (wxPaintEvent &event) |
| void | OnPopupMenu1 (wxCommandEvent &event) |
| void | OnSize (wxSizeEvent &event) |
| GLdouble *const | RetModelMatrixPtr () |
| wxMenu *const | RetPopupMenu1 () |
| GLdouble *const | RetProjMatrixPtr () |
| GLint *const | RetViewportPtr () |
| void | Rotate (GLfloat deg) |
| void | SetDrawStyle (GLenum drawStyle) |
| void | SetOpenGLLookAt () |
| void | SetStatusDrawLinesConnectedControlPts (bool b) |
| void | SetStatusDrawPlatform (bool b) |
| void | SetStatusDrawRefObject (bool b) |
| void | SetStatusDrawShadow (bool b) |
| void | SetStatusDrawTexts (bool b) |
| void | SetStatusShowCtrlPts (bool b) |
| void | SetStatusUseFancyColor (bool b) |
| virtual void | Setup (OpenGL::BaseOpenGLManager< Real > *pGLManager) |
| void | SetViewAngle (Real angle) |
| void | ToggleStatusDrawLinesConnectedControlPts () |
| void | ToggleStatusDrawPlatform () |
| void | ToggleStatusDrawRefObject () |
| void | ToggleStatusDrawTexts () |
| void | ToggleStatusShadow () |
| void | ToggleStatusShowCtrlPts () |
| void | ToggleStatusUseFancyColor () |
| void | UpdateMenuPopup1 () |
| WXOpenGLCanvas (wxWindow *parent, const WXOpenGLCanvas *other, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxT("WXOpenGLCanvas")) | |
| WXOpenGLCanvas (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxT("WXOpenGLCanvas")) | |
| virtual | ~WXOpenGLCanvas () |
Static Public Member Functions | |
| static GLfloat | CalcRotateAngle (unsigned long lastTime, unsigned long accelTime) |
| static GLfloat | CalcRotateSpeed (unsigned long accelTime) |
Protected Member Functions | |
| virtual void | CreationAddOn () |
Protected Attributes | |
| GLdouble | m_adModelMatrix [16] |
| GLdouble | m_adProjMatrix [16] |
| GLint | m_aiViewport [4] |
| Real | m_arCameraLookAt [3] |
| Real | m_arCameraPosition [3] |
| Real | m_arCameraUpVector [3] |
| bool | m_bDrawLinesConnectedControlPts |
| bool | m_bDrawPlatform |
| bool | m_bDrawRefObject |
| bool | m_bDrawShadow |
| bool | m_bDrawTexts |
| bool | m_bShowCtrlPts |
| bool | m_bUseFancyColor |
| char | m_cstrDebug [256] |
| GLenum | m_eDrawStyle |
| GLint | m_iHeight |
| int | m_iMouseX |
| int | m_iMouseY |
| GLint | m_iWidth |
| long | m_lKey |
| long | m_lRotateLeft |
| long | m_lRotateRight |
| wxMenu * | m_menuPopup1 |
| OpenGL::BaseOpenGLManager< Real > * | m_pGLManager |
| Real | m_rOrthoAdjuster |
| Real | m_rViewAngle |
| GLuint | m_uiGLList |
| unsigned long | m_ulLastRedraw |
| unsigned long | m_ulLastTime |
| unsigned long | m_ulStartTime |
Static Protected Attributes | |
| static int | m_siTimeInitialized = 0 |
| static unsigned long | m_sulGSynct |
| static unsigned long | m_sulSecBase = 0 |
| static unsigned long | m_sulXSynct |
Friends | |
| class | WXFrameSupportGLCanvas |
Definition at line 30 of file TAPsWXOpenGLCanvas.hpp.
| WXOpenGLCanvas::WXOpenGLCanvas | ( | wxWindow * | parent, | |
| wxWindowID | id = wxID_ANY, |
|||
| const wxPoint & | pos = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = 0, |
|||
| const wxString & | name = wxT( "WXOpenGLCanvas" ) | |||
| ) |
Definition at line 65 of file TAPsWXOpenGLCanvas.cpp.
00068 : wxGLCanvas( parent, (wxGLCanvas *)NULL, id, pos, size, 00069 style | wxFULL_REPAINT_ON_RESIZE, name ) 00070 { 00071 m_uiGLList = 0; 00072 m_lRotateLeft = WXK_LEFT; 00073 m_lRotateRight = WXK_RIGHT; 00074 //--------------------------------------------------------------- 00075 CreationAddOn(); 00076 }
| WXOpenGLCanvas::WXOpenGLCanvas | ( | wxWindow * | parent, | |
| const WXOpenGLCanvas * | other, | |||
| wxWindowID | id = wxID_ANY, |
|||
| const wxPoint & | pos = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = 0, |
|||
| const wxString & | name = wxT( "WXOpenGLCanvas" ) | |||
| ) |
Definition at line 78 of file TAPsWXOpenGLCanvas.cpp.
00081 : wxGLCanvas( parent, other->GetContext(), id, pos, size, 00082 style | wxFULL_REPAINT_ON_RESIZE, name ) 00083 { 00084 m_uiGLList = other->m_uiGLList; // share display list 00085 m_lRotateLeft = WXK_LEFT; 00086 m_lRotateRight = WXK_RIGHT; 00087 //--------------------------------------------------------------- 00088 CreationAddOn(); 00089 }
| WXOpenGLCanvas::~WXOpenGLCanvas | ( | ) | [virtual] |
Definition at line 91 of file TAPsWXOpenGLCanvas.cpp.
00092 { 00093 // if ( m_pTrackballWorld ) { 00094 // delete m_pTrackballWorld; 00095 // } 00096 // if ( m_pTrackballModel ) { 00097 // delete m_pTrackballModel; 00098 // } 00099 if ( m_menuPopup1 ) { 00100 delete m_menuPopup1; 00101 } 00102 if ( m_pGLManager ) { 00103 m_pGLManager = NULL; 00104 } 00105 }
| void WXOpenGLCanvas::Action | ( | long | code, | |
| unsigned long | lastTime, | |||
| unsigned long | accelTime | |||
| ) |
Definition at line 246 of file TAPsWXOpenGLCanvas.cpp.
00247 { 00248 GLfloat angle = CalcRotateAngle( lastTime, accelTime ); 00249 if ( code == m_lRotateLeft ) Rotate( angle ); 00250 else if ( code == m_lRotateRight ) Rotate( -angle ); 00251 }
| GLfloat WXOpenGLCanvas::CalcRotateAngle | ( | unsigned long | lastTime, | |
| unsigned long | accelTime | |||
| ) | [static] |
Definition at line 237 of file TAPsWXOpenGLCanvas.cpp.
00238 { 00239 GLfloat t, s1, s2; 00240 t = ( (GLfloat)(accelTime - lastTime) ) / 1000.0f; 00241 s1 = CalcRotateSpeed( lastTime ); 00242 s2 = CalcRotateSpeed( accelTime ); 00243 return t * (s1+s2) * 135.0f; 00244 }
| GLfloat WXOpenGLCanvas::CalcRotateSpeed | ( | unsigned long | accelTime | ) | [static] |
Definition at line 227 of file TAPsWXOpenGLCanvas.cpp.
00228 { 00229 GLfloat t, v; 00230 t = ( (GLfloat) accelTime ) / 1000.0f; 00231 if ( t < 0.5f ) v = t; 00232 else if ( t < 1.0f ) v = t * (2.0f - t); 00233 else v = 0.75f; 00234 return v; 00235 }
| void WXOpenGLCanvas::CreateMenuPopup1 | ( | ) |
Definition at line 561 of file TAPsWXOpenGLCanvas.cpp.
00562 { 00563 if ( m_menuPopup1 ) { 00564 delete m_menuPopup1; 00565 } 00566 //--------------------------------------------------------------- 00567 m_menuPopup1 = new wxMenu; 00568 m_menuPopup1->AppendCheckItem( WXID::PATCH_SELECTION_MODE, 00569 wxT( "Patch Selection Mode" ) ); 00570 m_menuPopup1->AppendCheckItem( WXID::POINT_SELECTION_MODE, 00571 wxT( "Point Selection Mode" ) ); 00572 m_menuPopup1->AppendSeparator(); 00573 m_menuPopup1->AppendCheckItem( WXID::USE_FANCY_COLORS, 00574 wxT( "Use &Fancy Color" ) ); 00575 m_menuPopup1->AppendSeparator(); 00576 m_menuPopup1->AppendCheckItem( WXID::DRAW_STYLE_FILL, 00577 wxT( "Fill Draw Style" ) ); 00578 m_menuPopup1->AppendCheckItem( WXID::DRAW_STYLE_LINE, 00579 wxT( "Line Draw Style" ) ); 00580 m_menuPopup1->AppendCheckItem( WXID::DRAW_STYLE_POINT, 00581 wxT( "Point Draw Style" ) ); 00582 m_menuPopup1->AppendSeparator(); 00583 m_menuPopup1->AppendCheckItem( WXID::DRAW_TEXTS, 00584 wxT( "Show &Texts" ) ); 00585 m_menuPopup1->AppendCheckItem( WXID::DRAW_CTRL_PT, 00586 wxT( "Show &Ctrl Pts" ) ); 00587 m_menuPopup1->AppendCheckItem( WXID::DRAW_CTRL_PT_POLYGON, 00588 wxT( "Show &Lines" ) ); 00589 m_menuPopup1->AppendSeparator(); 00590 m_menuPopup1->AppendCheckItem( WXID::DRAW_SHADOW, 00591 wxT( "Show &Shadow" ) ); 00592 m_menuPopup1->AppendCheckItem( WXID::DRAW_PLATFORM, 00593 wxT( "Show &Platform" ) ); 00594 //--------------------------------------------------------------- 00595 this->Connect( WXID::PATCH_SELECTION_MODE, 00596 wxEVT_COMMAND_MENU_SELECTED, 00597 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00598 this->Connect( WXID::POINT_SELECTION_MODE, 00599 wxEVT_COMMAND_MENU_SELECTED, 00600 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00601 this->Connect( WXID::USE_FANCY_COLORS, 00602 wxEVT_COMMAND_MENU_SELECTED, 00603 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00604 this->Connect( WXID::DRAW_STYLE_FILL, 00605 wxEVT_COMMAND_MENU_SELECTED, 00606 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00607 this->Connect( WXID::DRAW_STYLE_LINE, 00608 wxEVT_COMMAND_MENU_SELECTED, 00609 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00610 this->Connect( WXID::DRAW_STYLE_POINT, 00611 wxEVT_COMMAND_MENU_SELECTED, 00612 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00613 this->Connect( WXID::DRAW_TEXTS, 00614 wxEVT_COMMAND_MENU_SELECTED, 00615 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00616 this->Connect( WXID::DRAW_CTRL_PT, 00617 wxEVT_COMMAND_MENU_SELECTED, 00618 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00619 this->Connect( WXID::DRAW_CTRL_PT_POLYGON, 00620 wxEVT_COMMAND_MENU_SELECTED, 00621 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00622 this->Connect( WXID::DRAW_SHADOW, 00623 wxEVT_COMMAND_MENU_SELECTED, 00624 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00625 this->Connect( WXID::DRAW_PLATFORM, 00626 wxEVT_COMMAND_MENU_SELECTED, 00627 wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00628 }
| void WXOpenGLCanvas::CreationAddOn | ( | ) | [protected, virtual] |
Definition at line 107 of file TAPsWXOpenGLCanvas.cpp.
00108 { 00109 m_pGLManager = NULL; 00110 //--------------------------------------------------------------- 00111 // Drawing Properties 00112 m_eDrawStyle = GL_FILL; 00113 m_bShowCtrlPts = false; 00114 m_bDrawTexts = true; 00115 m_bUseFancyColor = false; 00116 m_bDrawRefObject = false; 00117 m_bDrawPlatform = true; 00118 m_bDrawShadow = true; 00119 m_bDrawLinesConnectedControlPts = false; 00120 //--------------------------------------------------------------- 00121 // View 00122 //m_rViewAngle = VIEW_ANGLE; 00123 //--------------------------------------------------------------- 00124 // Camera 00125 //m_arCameraPosition[0] = EYE_X; 00126 //m_arCameraPosition[1] = EYE_Y; 00127 //m_arCameraPosition[2] = EYE_Z; 00128 //m_arCameraLookAt[0] = CAMERA_CENTER_X; 00129 //m_arCameraLookAt[1] = CAMERA_CENTER_Y; 00130 //m_arCameraLookAt[2] = CAMERA_CENTER_Z; 00131 //m_arCameraUpVector[0] = CAMERA_UP_X; 00132 //m_arCameraUpVector[1] = CAMERA_UP_Y; 00133 //m_arCameraUpVector[2] = CAMERA_UP_Z; 00134 //--------------------------------------------------------------- 00135 // Trackball(s) 00136 // m_pTrackballWorld = new Trackball_GL( true ); // true for accumulation 00137 // m_pTrackballModel = new Trackball_GL( true ); // false for no accumulation 00138 //--------------------------------------------------------------- 00139 // Menu(s) 00140 m_menuPopup1 = NULL; 00141 CreateMenuPopup1(); 00142 }
| Real* const WXOpenGLCanvas::GetCameraLookAt | ( | ) | [inline] |
| Real* const WXOpenGLCanvas::GetCameraPosition | ( | ) | [inline] |
| Real* const WXOpenGLCanvas::GetCameraUpVector | ( | ) | [inline] |
| GLenum WXOpenGLCanvas::GetDrawStyle | ( | ) | [inline] |
| bool WXOpenGLCanvas::GetStatusDrawLinesConnectedControlPts | ( | ) | [inline] |
Definition at line 138 of file TAPsWXOpenGLCanvas.hpp.
00139 { return m_bDrawLinesConnectedControlPts; }
| bool WXOpenGLCanvas::GetStatusDrawPlatform | ( | ) | [inline] |
| bool WXOpenGLCanvas::GetStatusDrawRefObject | ( | ) | [inline] |
| bool WXOpenGLCanvas::GetStatusDrawShadow | ( | ) | [inline] |
| bool WXOpenGLCanvas::GetStatusDrawTexts | ( | ) | [inline] |
| bool WXOpenGLCanvas::GetStatusShowCtrlPts | ( | ) | [inline] |
| bool WXOpenGLCanvas::GetStatusUseFancyColor | ( | ) | [inline] |
| Real WXOpenGLCanvas::GetViewAngle | ( | ) | [inline] |
| void WXOpenGLCanvas::InitGL | ( | ) |
Definition at line 216 of file TAPsWXOpenGLCanvas.cpp.
00217 { 00218 //--------------------------------------------------------------- 00219 // wxWidgets Fn: Sets this canvas as the current recipient of OpenGL calls 00220 SetCurrent(); 00221 //--------------------------------------------------------------- 00222 // if ( m_pGLManager ) { 00223 // m_pGLManager->InitGL(); 00224 // } 00225 }
| void WXOpenGLCanvas::OnChar | ( | wxKeyEvent & | event | ) |
Definition at line 253 of file TAPsWXOpenGLCanvas.cpp.
00254 { 00255 if ( event.AltDown() ) { 00256 event.Skip(); 00257 return; 00258 } 00259 int key = event.GetKeyCode(); 00260 //--------------------------------------------------------------- 00261 // sprintf( m_cstrDebug, "Key#%i: %c", key, key ); 00262 switch ( key ) { 00263 //--------------------------------------- 00264 // Reset 00265 case 'r': 00266 case 'R': 00267 // GFn_Reset( this ); 00268 break; 00269 //--------------------------------------- 00270 // Toggle showing texts 00271 case 't': 00272 case 'T': 00273 m_bDrawTexts = !m_bDrawTexts; 00274 break; 00275 //--------------------------------------- 00276 // Toggle showing platform 00277 case '-': 00278 m_bDrawPlatform = !m_bDrawPlatform; 00279 break; 00280 //--------------------------------------- 00281 case '0': 00282 m_bDrawRefObject = !m_bDrawRefObject; 00283 break; 00284 //--------------------------------------- 00285 // Zoom Out 00286 case 'Z': // for zoom out of orthographic view 11 steps 00287 // m_rOrthoAdjuster += 0.25; 00288 // m_rViewAngle += 1.0; 00289 // GFn_ReshapeOpenGLViewport ( this->GetWidth(), this->GetHeight(), this ); 00290 break; 00291 //--------------------------------------- 00292 // Zoom In 00293 case 'z': // for zoom in of orthographic view 11 steps 00294 // m_rOrthoAdjuster -= 0.25; 00295 // m_rViewAngle -= 1.0; 00296 // GFn_ReshapeOpenGLViewport ( this->GetWidth(), this->GetHeight(), this ); 00297 break; 00298 //--------------------------------------- 00299 // Show control points 00300 case 'e': 00301 case 'E': 00302 m_bShowCtrlPts = !m_bShowCtrlPts; 00303 break; 00304 //--------------------------------------- 00305 // Draw lines connecting control points 00306 case 'l': 00307 case 'L': 00308 m_bDrawLinesConnectedControlPts = !m_bDrawLinesConnectedControlPts; 00309 break; 00310 //--------------------------------------- 00311 // Enable/Disable fancy color 00312 case 'c': 00313 case 'C': 00314 m_bUseFancyColor = !m_bUseFancyColor; 00315 break; 00316 //--------------------------------------- 00317 // Change drawing style 00318 case 's': 00319 case 'S': 00320 switch ( this->GetDrawStyle() ) { 00321 case GL_FILL: 00322 this->SetDrawStyle( GL_LINE ); 00323 break; 00324 case GL_LINE: 00325 this->SetDrawStyle( GL_POINT ); 00326 break; 00327 case GL_POINT: 00328 this->SetDrawStyle( GL_FILL ); 00329 break; 00330 default: 00331 this->SetDrawStyle( GL_FILL ); 00332 break; 00333 } 00334 break; 00335 //--------------------------------------- 00336 /* 00337 case 27: // ESC for exit the program 00338 //ExitHandler(); // User defined function 00339 exit(0); 00340 //g_wxOpenGLMainWindow->OnFileExit( e ); 00341 break; 00342 //*/ 00343 //--------------------------------------- 00344 default: 00345 //sprintf( const_cast<char*>( g_strDebug ), "Key#%i: %c", key, key ); 00346 //sprintf( const_cast<char*>( g_strDebug ), "Invalid Key!" ); 00347 //sprintf( const_cast<char*>( g_strDebug ), "" ); 00348 break; 00349 } 00350 // Refresh(false); 00351 00352 /* 00353 if ( isalpha( event.GetKeyCode() ) ) { 00354 wxBell(); 00355 } 00356 else { 00357 wxBell(); 00358 } 00359 //*/ 00360 }
| void WXOpenGLCanvas::OnEnterWindow | ( | wxMouseEvent & | event | ) |
| void WXOpenGLCanvas::OnEraseBackground | ( | wxEraseEvent & | event | ) |
| void WXOpenGLCanvas::OnIdle | ( | wxIdleEvent & | event | ) |
| void WXOpenGLCanvas::OnKeyDown | ( | wxKeyEvent & | event | ) |
Definition at line 362 of file TAPsWXOpenGLCanvas.cpp.
00363 { 00364 //event.Skip(); 00365 //* 00366 int key = event.GetKeyCode(); 00367 if ( WXK_ALT == key ) { 00368 //event.Skip(); 00369 //sprintf( debugStr, "Key#%i: %c == WXK_LEFT", key, key ); 00370 } 00371 else if ( 0 < key && key < 256 && isalpha( event.GetKeyCode() ) ) { 00372 event.Skip(); 00373 } 00374 else if ( WXK_LEFT == key ) { 00375 //sprintf( debugStr, "Key#%i: %c == WXK_LEFT", key, key ); 00376 } 00377 else { 00378 //sprintf( debugStr, "Key#%i: %c", key, key ); 00379 //sprintf( debugStr, "Invalid Key!" ); 00380 //sprintf( debugStr, "" ); 00381 } 00382 Refresh(false); 00383 //*/ 00384 00385 00386 00387 00388 /* 00389 long evtKey = event.GetKeyCode(); 00390 if ( evtKey == 0 ) return; 00391 if ( !m_siTimeInitialized ) { 00392 m_siTimeInitialized = 1; 00393 m_sulXSynct = event.GetTimestamp(); 00394 m_sulGSynct = StopWatch( &m_sulSecBase ); 00395 m_lKey = evtKey; 00396 m_ulStartTime = 0; 00397 m_ulLastTime = 0; 00398 m_ulLastRedraw = 0; 00399 } 00400 00401 unsigned long currTime = event.GetTimestamp() - m_sulXSynct; 00402 if ( evtKey != m_lKey ) { 00403 m_lKey = evtKey; 00404 m_ulLastRedraw = m_ulStartTime = m_ulLastTime = currTime; 00405 } 00406 00407 if ( currTime >= m_ulLastRedraw ) { // redraw 00408 Action( m_lKey, m_ulLastTime - m_ulStartTime, currTime - m_ulStartTime ); 00409 #if defined (__WXMAC__) && !defined (__DARWIN__) 00410 m_ulLastRedraw = currTime; // StopWatch() doesn't work on Mac. 00411 #else 00412 m_ulLastRedraw = StopWatch( &m_sulSecBase ) - m_sulGSynct; 00413 #endif 00414 m_ulLastTime = currTime; 00415 } 00416 00417 event.Skip(); 00418 //*/ 00419 }
| void WXOpenGLCanvas::OnKeyUp | ( | wxKeyEvent & | event | ) |
| void WXOpenGLCanvas::OnMouse | ( | wxMouseEvent & | event | ) |
Definition at line 434 of file TAPsWXOpenGLCanvas.cpp.
00435 { 00436 //-------------------------------------------------------------------- 00437 //==================================================================== 00438 // BUTTON DOWN 00439 //-------------------------------------------------------------------- 00440 // LEFT BUTTON DOWN 00441 if ( event.LeftDown() ) { 00442 m_iMouseX = event.m_x; 00443 m_iMouseY = event.m_y; 00444 } 00445 //-------------------------------------------------------------------- 00446 // MIDDLE BUTTON DOWN 00447 else if ( event.MiddleDown() ) { 00448 m_iMouseX = event.m_x; 00449 m_iMouseY = event.m_y; 00450 } 00451 //-------------------------------------------------------------------- 00452 // RIGHT BUTTON DOWN 00453 else if ( event.RightDown() ) { 00454 m_iMouseX = event.m_x; 00455 m_iMouseY = event.m_y; 00456 //------------------------------------------------------- 00457 OnMouseRightClick( event ); 00458 } 00459 //-------------------------------------------------------------------- 00460 //==================================================================== 00461 // DRAGGING 00462 //-------------------------------------------------------------------- 00463 // LEFT BUTTON IS DOWN and Mouse is being dragged 00464 // Trackball Rotation for World/Model 00465 else if ( event.LeftIsDown() ) { 00466 if ( event.Dragging() ) { 00467 } 00468 } 00469 //-------------------------------------------------------------------- 00470 // MIDDLE BUTTON IS DOWN and Mouse is being dragged 00471 // Zoom In/Out 00472 else if ( event.MiddleIsDown() ) { 00473 if ( event.Dragging() ) { 00474 } 00475 } 00476 //-------------------------------------------------------------------- 00477 // RIGHT BUTTON IS DOWN and Mouse is being dragged 00478 // Panning the camera 00479 else if ( event.RightIsDown() ) { 00480 if ( event.Dragging() ) { 00481 } 00482 } 00483 //-------------------------------------------------------------------- 00484 // LEFT BUTTON UP or MIDDLE BUTTON UP or RIGHT BUTTON UP 00485 else if ( event.LeftUp() || event.MiddleUp() || event.RightUp() ) { 00486 } 00487 00488 // DEBUG 00489 sprintf( m_cstrDebug, "Mouse: (%i,%i)", event.m_x, event.m_y ); 00490 00491 //-------------------------------------------------------------------- 00492 Refresh(false); 00493 }
| void WXOpenGLCanvas::OnMouseRightClick | ( | wxMouseEvent & | event | ) |
Definition at line 501 of file TAPsWXOpenGLCanvas.cpp.
00502 { 00503 //--------------------------------------------------------------- 00504 UpdateMenuPopup1(); 00505 this->PopupMenu( m_menuPopup1, event.GetPosition() ); 00506 }
| void WXOpenGLCanvas::OnPaint | ( | wxPaintEvent & | event | ) |
| void WXOpenGLCanvas::OnPopupMenu1 | ( | wxCommandEvent & | event | ) |
Definition at line 509 of file TAPsWXOpenGLCanvas.cpp.
00510 { 00511 switch ( event.GetId() ) { 00512 case WXID::PATCH_SELECTION_MODE: 00513 WX::Debug::DisplayDialog( wxString( "Patch Selection Mode" ) ); 00514 //this->Disconnect( WXID::PATCH_SELECTION_MODE, 00515 // wxEVT_COMMAND_MENU_SELECTED, 00516 // wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) ); 00517 break; 00518 case WXID::POINT_SELECTION_MODE: 00519 WX::Debug::DisplayDialog( wxString( "Point Selection Mode" ) ); 00520 break; 00521 case WXID::USE_FANCY_COLORS: 00522 WX::Debug::DisplayDialog( wxString( "Use Fancy Color" ) ); 00523 m_bUseFancyColor = !m_bUseFancyColor; 00524 break; 00525 case WXID::DRAW_STYLE_FILL: 00526 WX::Debug::DisplayDialog( wxString( "Fill Draw Style" ) ); 00527 m_eDrawStyle = GL_FILL; 00528 break; 00529 case WXID::DRAW_STYLE_LINE: 00530 WX::Debug::DisplayDialog( wxString( "Line Draw Style" ) ); 00531 m_eDrawStyle = GL_LINE; 00532 break; 00533 case WXID::DRAW_STYLE_POINT: 00534 WX::Debug::DisplayDialog( wxString( "Point Draw Style" ) ); 00535 m_eDrawStyle = GL_POINT; 00536 break; 00537 case WXID::DRAW_TEXTS: 00538 WX::Debug::DisplayDialog( wxString( "Draw Texts" ) ); 00539 m_bDrawTexts = !m_bDrawTexts; 00540 break; 00541 case WXID::DRAW_CTRL_PT: 00542 WX::Debug::DisplayDialog( wxString( "Draw Control Points" ) ); 00543 m_bShowCtrlPts = !m_bShowCtrlPts; 00544 break; 00545 case WXID::DRAW_CTRL_PT_POLYGON: 00546 WX::Debug::DisplayDialog( wxString( "Draw Control Polygons" ) ); 00547 m_bDrawLinesConnectedControlPts = !m_bDrawLinesConnectedControlPts; 00548 break; 00549 case WXID::DRAW_SHADOW: 00550 WX::Debug::DisplayDialog( wxString( "Display Shadow" ) ); 00551 m_bDrawShadow = !m_bDrawShadow; 00552 break; 00553 case WXID::DRAW_PLATFORM: 00554 WX::Debug::DisplayDialog( wxString( "Display Platform" ) ); 00555 m_bDrawPlatform = !m_bDrawPlatform; 00556 break; 00557 } 00558 }
| void WXOpenGLCanvas::OnSize | ( | wxSizeEvent & | event | ) |
Definition at line 186 of file TAPsWXOpenGLCanvas.cpp.
00187 { 00188 // This is also necessary to update the context on some platforms 00189 wxGLCanvas::OnSize( event ); 00190 00191 // Set GL viewport (not called by wxGLCanvas::OnSize on all platforms 00192 int w, h; 00193 GetClientSize( &w, &h ); 00194 00195 #ifndef __WXMOTIF__ 00196 if ( GetContext() ) 00197 #endif 00198 { 00199 SetCurrent(); 00200 //------------------------------------------------- 00201 m_iWidth = w; 00202 m_iHeight = h; 00203 //------------------------------------------------- 00204 if ( m_pGLManager ) { 00205 m_pGLManager->RetViewManager()->ReshapeView( w, h ); 00206 } 00207 //------------------------------------------------- 00208 } 00209 }
| GLdouble* const WXOpenGLCanvas::RetModelMatrixPtr | ( | ) | [inline] |
| wxMenu* const WXOpenGLCanvas::RetPopupMenu1 | ( | ) | [inline] |
| GLdouble* const WXOpenGLCanvas::RetProjMatrixPtr | ( | ) | [inline] |
| GLint* const WXOpenGLCanvas::RetViewportPtr | ( | ) | [inline] |
| void WXOpenGLCanvas::Rotate | ( | GLfloat | deg | ) |
Definition at line 425 of file TAPsWXOpenGLCanvas.cpp.
00426 { 00427 SetCurrent(); 00428 00429 glMatrixMode( GL_MODELVIEW ); 00430 glRotatef( (GLfloat)deg, 0.0f, 0.0f, 1.0f ); 00431 Refresh( false ); 00432 }
| void WXOpenGLCanvas::SetDrawStyle | ( | GLenum | drawStyle | ) | [inline] |
| void WXOpenGLCanvas::SetOpenGLLookAt | ( | ) | [inline] |
Definition at line 156 of file TAPsWXOpenGLCanvas.hpp.
00156 { 00157 gluLookAt( m_arCameraPosition[0], m_arCameraPosition[1], m_arCameraPosition[2], 00158 m_arCameraLookAt[0], m_arCameraLookAt[1], m_arCameraLookAt[2], 00159 m_arCameraUpVector[0], m_arCameraUpVector[1], m_arCameraUpVector[2] ); 00160 }
| void WXOpenGLCanvas::SetStatusDrawLinesConnectedControlPts | ( | bool | b | ) | [inline] |
Definition at line 140 of file TAPsWXOpenGLCanvas.hpp.
00141 { m_bDrawLinesConnectedControlPts = b; }
| void WXOpenGLCanvas::SetStatusDrawPlatform | ( | bool | b | ) | [inline] |
| void WXOpenGLCanvas::SetStatusDrawRefObject | ( | bool | b | ) | [inline] |
| void WXOpenGLCanvas::SetStatusDrawShadow | ( | bool | b | ) | [inline] |
| void WXOpenGLCanvas::SetStatusDrawTexts | ( | bool | b | ) | [inline] |
| void WXOpenGLCanvas::SetStatusShowCtrlPts | ( | bool | b | ) | [inline] |
| void WXOpenGLCanvas::SetStatusUseFancyColor | ( | bool | b | ) | [inline] |
| void WXOpenGLCanvas::Setup | ( | OpenGL::BaseOpenGLManager< Real > * | pGLManager | ) | [virtual] |
Definition at line 144 of file TAPsWXOpenGLCanvas.cpp.
00145 { 00146 m_pGLManager = pGLManager; 00147 }
| void WXOpenGLCanvas::SetViewAngle | ( | Real | angle | ) | [inline] |
| void WXOpenGLCanvas::ToggleStatusDrawLinesConnectedControlPts | ( | ) | [inline] |
| void WXOpenGLCanvas::ToggleStatusDrawPlatform | ( | ) | [inline] |
Definition at line 128 of file TAPsWXOpenGLCanvas.hpp.
00129 { m_bDrawPlatform = !m_bDrawPlatform; }
| void WXOpenGLCanvas::ToggleStatusDrawRefObject | ( | ) | [inline] |
Definition at line 121 of file TAPsWXOpenGLCanvas.hpp.
00122 { m_bDrawRefObject = !m_bDrawRefObject; }
| void WXOpenGLCanvas::ToggleStatusDrawTexts | ( | ) | [inline] |
| void WXOpenGLCanvas::ToggleStatusShadow | ( | ) | [inline] |
| void WXOpenGLCanvas::ToggleStatusShowCtrlPts | ( | ) | [inline] |
| void WXOpenGLCanvas::ToggleStatusUseFancyColor | ( | ) | [inline] |
Definition at line 114 of file TAPsWXOpenGLCanvas.hpp.
00115 { m_bUseFancyColor = !m_bUseFancyColor; }
| void WXOpenGLCanvas::UpdateMenuPopup1 | ( | ) |
friend class WXFrameSupportGLCanvas [friend] |
Definition at line 31 of file TAPsWXOpenGLCanvas.hpp.
GLdouble WXOpenGLCanvas::m_adModelMatrix[16] [protected] |
Definition at line 197 of file TAPsWXOpenGLCanvas.hpp.
GLdouble WXOpenGLCanvas::m_adProjMatrix[16] [protected] |
Definition at line 198 of file TAPsWXOpenGLCanvas.hpp.
GLint WXOpenGLCanvas::m_aiViewport[4] [protected] |
Definition at line 199 of file TAPsWXOpenGLCanvas.hpp.
Real WXOpenGLCanvas::m_arCameraLookAt[3] [protected] |
Definition at line 205 of file TAPsWXOpenGLCanvas.hpp.
Real WXOpenGLCanvas::m_arCameraPosition[3] [protected] |
Definition at line 204 of file TAPsWXOpenGLCanvas.hpp.
Real WXOpenGLCanvas::m_arCameraUpVector[3] [protected] |
Definition at line 206 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bDrawLinesConnectedControlPts [protected] |
Definition at line 194 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bDrawPlatform [protected] |
Definition at line 192 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bDrawRefObject [protected] |
Definition at line 191 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bDrawShadow [protected] |
Definition at line 193 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bDrawTexts [protected] |
Definition at line 189 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bShowCtrlPts [protected] |
Definition at line 188 of file TAPsWXOpenGLCanvas.hpp.
bool WXOpenGLCanvas::m_bUseFancyColor [protected] |
Definition at line 190 of file TAPsWXOpenGLCanvas.hpp.
char WXOpenGLCanvas::m_cstrDebug[256] [protected] |
Definition at line 184 of file TAPsWXOpenGLCanvas.hpp.
GLenum WXOpenGLCanvas::m_eDrawStyle [protected] |
Definition at line 187 of file TAPsWXOpenGLCanvas.hpp.
GLint WXOpenGLCanvas::m_iHeight [protected] |
Definition at line 177 of file TAPsWXOpenGLCanvas.hpp.
int WXOpenGLCanvas::m_iMouseX [protected] |
Definition at line 180 of file TAPsWXOpenGLCanvas.hpp.
int WXOpenGLCanvas::m_iMouseY [protected] |
Definition at line 181 of file TAPsWXOpenGLCanvas.hpp.
GLint WXOpenGLCanvas::m_iWidth [protected] |
Definition at line 176 of file TAPsWXOpenGLCanvas.hpp.
long WXOpenGLCanvas::m_lKey [protected] |
Definition at line 221 of file TAPsWXOpenGLCanvas.hpp.
long WXOpenGLCanvas::m_lRotateLeft [protected] |
Definition at line 213 of file TAPsWXOpenGLCanvas.hpp.
long WXOpenGLCanvas::m_lRotateRight [protected] |
Definition at line 214 of file TAPsWXOpenGLCanvas.hpp.
wxMenu* WXOpenGLCanvas::m_menuPopup1 [protected] |
Definition at line 227 of file TAPsWXOpenGLCanvas.hpp.
OpenGL::BaseOpenGLManager<Real>* WXOpenGLCanvas::m_pGLManager [protected] |
Definition at line 230 of file TAPsWXOpenGLCanvas.hpp.
Real WXOpenGLCanvas::m_rOrthoAdjuster [protected] |
Definition at line 201 of file TAPsWXOpenGLCanvas.hpp.
Real WXOpenGLCanvas::m_rViewAngle [protected] |
Definition at line 200 of file TAPsWXOpenGLCanvas.hpp.
int WXOpenGLCanvas::m_siTimeInitialized = 0 [static, protected] |
Definition at line 217 of file TAPsWXOpenGLCanvas.hpp.
unsigned long WXOpenGLCanvas::m_sulGSynct [static, protected] |
Definition at line 219 of file TAPsWXOpenGLCanvas.hpp.
BEGIN_NAMESPACE_TAPs unsigned long WXOpenGLCanvas::m_sulSecBase = 0 [static, protected] |
Definition at line 216 of file TAPsWXOpenGLCanvas.hpp.
unsigned long WXOpenGLCanvas::m_sulXSynct [static, protected] |
Definition at line 218 of file TAPsWXOpenGLCanvas.hpp.
GLuint WXOpenGLCanvas::m_uiGLList [protected] |
Definition at line 212 of file TAPsWXOpenGLCanvas.hpp.
unsigned long WXOpenGLCanvas::m_ulLastRedraw [protected] |
Definition at line 224 of file TAPsWXOpenGLCanvas.hpp.
unsigned long WXOpenGLCanvas::m_ulLastTime [protected] |
Definition at line 223 of file TAPsWXOpenGLCanvas.hpp.
unsigned long WXOpenGLCanvas::m_ulStartTime [protected] |
Definition at line 222 of file TAPsWXOpenGLCanvas.hpp.
1.5.6