Loading 3d-viewer/3d_canvas.cpp +22 −9 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,7 @@ Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) : m_init = FALSE; m_init = FALSE; m_gllist = 0; m_gllist = 0; m_Parent = parent; m_Parent = parent; m_ortho = false; #if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 ) Loading Loading @@ -498,32 +499,44 @@ void Pcb3D_GLCanvas::InitGL() glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); } } /* set viewing projection */ // set viewing projection // Ratio width / height of the window display double ratio_HV = (double) size.x / size.y; glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glLoadIdentity(); #define MAX_VIEW_ANGLE 160.0 / 45.0 #define MAX_VIEW_ANGLE 160.0 / 45.0 if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE ) if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE ) g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE; g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE; if( ModeIsOrtho() ) { // OrthoReductionFactor is chosen so as to provide roughly the same size as Perspective View const double orthoReductionFactor = 400/g_Parm_3D_Visu.m_Zoom; // Initialize Projection Matrix for Ortographic View glOrtho(-size.x/orthoReductionFactor, size.x/orthoReductionFactor, -size.y/orthoReductionFactor, size.y/orthoReductionFactor, 1, 10); } else { // Ratio width / height of the window display double ratio_HV = (double) size.x / size.y; // Initialize Projection Matrix for Perspective View gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 10 ); gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 10 ); } // glFrustum(-1., 1.1F, -1.1F, 1.1F, ZBottom, ZTop); /* position viewer */ // position viewer glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glLoadIdentity(); glTranslatef( 0.0F, 0.0F, -( ZBottom + ZTop) / 2 ); glTranslatef( 0.0F, 0.0F, -( ZBottom + ZTop) / 2 ); /* clear color and depth buffers */ // clear color and depth buffers glClearColor( g_Parm_3D_Visu.m_BgColor.m_Red, glClearColor( g_Parm_3D_Visu.m_BgColor.m_Red, g_Parm_3D_Visu.m_BgColor.m_Green, g_Parm_3D_Visu.m_BgColor.m_Green, g_Parm_3D_Visu.m_BgColor.m_Blue, 1 ); g_Parm_3D_Visu.m_BgColor.m_Blue, 1 ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); /* Setup light souces: */ // Setup light souces: SetLights(); SetLights(); } } Loading 3d-viewer/3d_frame.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -293,6 +293,10 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event ) m_Canvas->SetView3D( WXK_DOWN ); m_Canvas->SetView3D( WXK_DOWN ); return; return; case ID_ORTHO: m_Canvas->ToggleOrtho(); return; case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_JPEG: case ID_MENU_SCREENCOPY_JPEG: Loading 3d-viewer/3d_toolbar.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -89,6 +89,11 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar() m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ), m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ), _( "Move down" ) ); _( "Move down" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_ORTHO, wxEmptyString, wxBitmap( ortho_xpm ), _( "Enable/Disable ortographic projection" ), wxITEM_CHECK ); m_HToolBar->Realize(); m_HToolBar->Realize(); } } Loading 3d-viewer/3d_viewer.h +11 −1 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,7 @@ enum id_3dview_frm ID_MOVE3D_RIGHT, ID_MOVE3D_RIGHT, ID_MOVE3D_UP, ID_MOVE3D_UP, ID_MOVE3D_DOWN, ID_MOVE3D_DOWN, ID_ORTHO, ID_MENU3D_BGCOLOR_SELECTION, ID_MENU3D_BGCOLOR_SELECTION, ID_MENU3D_AXIS_ONOFF, ID_MENU3D_AXIS_ONOFF, ID_MENU3D_MODULE_ONOFF, ID_MENU3D_MODULE_ONOFF, Loading Loading @@ -137,6 +138,9 @@ public: private: private: bool m_init; bool m_init; GLuint m_gllist; GLuint m_gllist; /// Tracks whether to use Orthographic or Perspective projection //TODO: Does this belong here, or in WinEDA3D_DrawFrame ??? bool m_ortho; #if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 ) wxGLContext* m_glRC; wxGLContext* m_glRC; #endif #endif Loading Loading @@ -182,6 +186,12 @@ public: void Draw3D_DrawSegment( DRAWSEGMENT* segment ); void Draw3D_DrawSegment( DRAWSEGMENT* segment ); void Draw3D_DrawText( TEXTE_PCB* text ); void Draw3D_DrawText( TEXTE_PCB* text ); /// Toggles ortographic projection on and off void ToggleOrtho(){ m_ortho = !m_ortho ; Refresh(true);}; /// Returns the orthographic projection flag bool ModeIsOrtho() { return m_ortho ;}; //int Get3DLayerEnable(int act_layer); //int Get3DLayerEnable(int act_layer); DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE() Loading Loading @@ -223,7 +233,7 @@ public: /** function ReloadRequest /** function ReloadRequest * must be called when reloading data from Pcbnew is needed * must be called when reloading data from Pcbnew is needed * mainly after edition of the board or footprint beeing displayed. * mainly after edition of the board or footprint beeing displayed. * mainly for the mudule editor. * mainly for the module editor. */ */ void ReloadRequest( ) void ReloadRequest( ) { { Loading bitmaps/CMakeLists.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -285,6 +285,7 @@ set(BITMAP_SRCS Options_Vias.xpm Options_Vias.xpm opt_show_polygon.xpm opt_show_polygon.xpm Orient.xpm Orient.xpm ortho.xpm Pad_Sketch.xpm Pad_Sketch.xpm pad.xpm pad.xpm pads_mask_layers.xpm pads_mask_layers.xpm Loading Loading
3d-viewer/3d_canvas.cpp +22 −9 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,7 @@ Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) : m_init = FALSE; m_init = FALSE; m_gllist = 0; m_gllist = 0; m_Parent = parent; m_Parent = parent; m_ortho = false; #if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 ) Loading Loading @@ -498,32 +499,44 @@ void Pcb3D_GLCanvas::InitGL() glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); } } /* set viewing projection */ // set viewing projection // Ratio width / height of the window display double ratio_HV = (double) size.x / size.y; glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glLoadIdentity(); #define MAX_VIEW_ANGLE 160.0 / 45.0 #define MAX_VIEW_ANGLE 160.0 / 45.0 if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE ) if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE ) g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE; g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE; if( ModeIsOrtho() ) { // OrthoReductionFactor is chosen so as to provide roughly the same size as Perspective View const double orthoReductionFactor = 400/g_Parm_3D_Visu.m_Zoom; // Initialize Projection Matrix for Ortographic View glOrtho(-size.x/orthoReductionFactor, size.x/orthoReductionFactor, -size.y/orthoReductionFactor, size.y/orthoReductionFactor, 1, 10); } else { // Ratio width / height of the window display double ratio_HV = (double) size.x / size.y; // Initialize Projection Matrix for Perspective View gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 10 ); gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 10 ); } // glFrustum(-1., 1.1F, -1.1F, 1.1F, ZBottom, ZTop); /* position viewer */ // position viewer glMatrixMode( GL_MODELVIEW ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glLoadIdentity(); glTranslatef( 0.0F, 0.0F, -( ZBottom + ZTop) / 2 ); glTranslatef( 0.0F, 0.0F, -( ZBottom + ZTop) / 2 ); /* clear color and depth buffers */ // clear color and depth buffers glClearColor( g_Parm_3D_Visu.m_BgColor.m_Red, glClearColor( g_Parm_3D_Visu.m_BgColor.m_Red, g_Parm_3D_Visu.m_BgColor.m_Green, g_Parm_3D_Visu.m_BgColor.m_Green, g_Parm_3D_Visu.m_BgColor.m_Blue, 1 ); g_Parm_3D_Visu.m_BgColor.m_Blue, 1 ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); /* Setup light souces: */ // Setup light souces: SetLights(); SetLights(); } } Loading
3d-viewer/3d_frame.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -293,6 +293,10 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event ) m_Canvas->SetView3D( WXK_DOWN ); m_Canvas->SetView3D( WXK_DOWN ); return; return; case ID_ORTHO: m_Canvas->ToggleOrtho(); return; case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_JPEG: case ID_MENU_SCREENCOPY_JPEG: Loading
3d-viewer/3d_toolbar.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -89,6 +89,11 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar() m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ), m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ), _( "Move down" ) ); _( "Move down" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_ORTHO, wxEmptyString, wxBitmap( ortho_xpm ), _( "Enable/Disable ortographic projection" ), wxITEM_CHECK ); m_HToolBar->Realize(); m_HToolBar->Realize(); } } Loading
3d-viewer/3d_viewer.h +11 −1 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,7 @@ enum id_3dview_frm ID_MOVE3D_RIGHT, ID_MOVE3D_RIGHT, ID_MOVE3D_UP, ID_MOVE3D_UP, ID_MOVE3D_DOWN, ID_MOVE3D_DOWN, ID_ORTHO, ID_MENU3D_BGCOLOR_SELECTION, ID_MENU3D_BGCOLOR_SELECTION, ID_MENU3D_AXIS_ONOFF, ID_MENU3D_AXIS_ONOFF, ID_MENU3D_MODULE_ONOFF, ID_MENU3D_MODULE_ONOFF, Loading Loading @@ -137,6 +138,9 @@ public: private: private: bool m_init; bool m_init; GLuint m_gllist; GLuint m_gllist; /// Tracks whether to use Orthographic or Perspective projection //TODO: Does this belong here, or in WinEDA3D_DrawFrame ??? bool m_ortho; #if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 ) wxGLContext* m_glRC; wxGLContext* m_glRC; #endif #endif Loading Loading @@ -182,6 +186,12 @@ public: void Draw3D_DrawSegment( DRAWSEGMENT* segment ); void Draw3D_DrawSegment( DRAWSEGMENT* segment ); void Draw3D_DrawText( TEXTE_PCB* text ); void Draw3D_DrawText( TEXTE_PCB* text ); /// Toggles ortographic projection on and off void ToggleOrtho(){ m_ortho = !m_ortho ; Refresh(true);}; /// Returns the orthographic projection flag bool ModeIsOrtho() { return m_ortho ;}; //int Get3DLayerEnable(int act_layer); //int Get3DLayerEnable(int act_layer); DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE() Loading Loading @@ -223,7 +233,7 @@ public: /** function ReloadRequest /** function ReloadRequest * must be called when reloading data from Pcbnew is needed * must be called when reloading data from Pcbnew is needed * mainly after edition of the board or footprint beeing displayed. * mainly after edition of the board or footprint beeing displayed. * mainly for the mudule editor. * mainly for the module editor. */ */ void ReloadRequest( ) void ReloadRequest( ) { { Loading
bitmaps/CMakeLists.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -285,6 +285,7 @@ set(BITMAP_SRCS Options_Vias.xpm Options_Vias.xpm opt_show_polygon.xpm opt_show_polygon.xpm Orient.xpm Orient.xpm ortho.xpm Pad_Sketch.xpm Pad_Sketch.xpm pad.xpm pad.xpm pads_mask_layers.xpm pads_mask_layers.xpm Loading