Commit 5f63becf authored by jean-pierre charras's avatar jean-pierre charras

3D viewer: move helper functions from 3d_draw.cpp to...

3D viewer: move helper functions from 3d_draw.cpp to 3d_draw_helper_functions.cpp. Add comments in .h sources. Better management of background color. coding style fixes.
parent 64a9ebc7
...@@ -52,8 +52,9 @@ void CheckGLError(const char *aFileName, int aLineNumber) ...@@ -52,8 +52,9 @@ void CheckGLError(const char *aFileName, int aLineNumber)
} }
errLast = err; errLast = err;
wxLogError( wxT( "OpenGL error %d At: %s, line: %d" ), err, GetChars( FROM_UTF8( aFileName ) ), aLineNumber ); wxLogError( wxT( "OpenGL error %d At: %s, line: %d" ), err,
GetChars( FROM_UTF8( aFileName ) ), aLineNumber );
} }
} }
...@@ -625,7 +626,7 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event ) ...@@ -625,7 +626,7 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
wxYield(); wxYield();
} }
struct vieport_params struct viewport_params
{ {
GLint originx; GLint originx;
GLint originy; GLint originy;
...@@ -633,6 +634,10 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event ) ...@@ -633,6 +634,10 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
GLint y; GLint y;
} viewport; } viewport;
// Be sure we have the latest 3D view (remember 3D view is buffered)
Refresh();
wxYield();
// Build image from the 3D buffer // Build image from the 3D buffer
wxWindowUpdateLocker noUpdates( this ); wxWindowUpdateLocker noUpdates( this );
glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport ); glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
class BOARD_DESIGN_SETTINGS; class BOARD_DESIGN_SETTINGS;
class EDA_3D_FRAME; class EDA_3D_FRAME;
class CPOLYGONS_LIST;
class VIA; class VIA;
class D_PAD; class D_PAD;
...@@ -134,15 +135,40 @@ public: ...@@ -134,15 +135,40 @@ public:
void CreateDrawGL_List(); void CreateDrawGL_List();
void InitGL(); void InitGL();
void SetLights(); void SetLights();
void SetOffset(double aPosX, double aPosY) void SetOffset(double aPosX, double aPosY)
{ {
m_draw3dOffset.x = aPosX; m_draw3dOffset.x = aPosX;
m_draw3dOffset.y = aPosY; m_draw3dOffset.y = aPosY;
} }
private:
/**
* Helper function SetGLTechLayersColor
* Initialize the color to draw the non copper layers
* in realistic mode and normal mode.
*/
void SetGLTechLayersColor( LAYER_NUM aLayer ); void SetGLTechLayersColor( LAYER_NUM aLayer );
/**
* Helper function SetGLCopperColor
* Initialize the copper color to draw the board
* in realistic mode (a golden yellow color )
*/
void SetGLCopperColor(); void SetGLCopperColor();
/**
* Helper function SetGLEpoxyColor
* Initialize the color to draw the epoxy body board in realistic mode.
*/
void SetGLEpoxyColor( double aTransparency = 1.0 ); void SetGLEpoxyColor( double aTransparency = 1.0 );
/**
* Helper function SetGLSolderMaskColor
* Initialize the color to draw the solder mask layers in realistic mode.
*/
void SetGLSolderMaskColor( double aTransparency = 1.0 );
/** /**
* Function BuildBoard3DView * Function BuildBoard3DView
* Called by CreateDrawGL_List() * Called by CreateDrawGL_List()
...@@ -187,7 +213,31 @@ public: ...@@ -187,7 +213,31 @@ public:
void Draw3DGrid( double aGriSizeMM ); void Draw3DGrid( double aGriSizeMM );
void Draw3DAxis(); void Draw3DAxis();
/**
* Helper function BuildPadShapeThickOutlineAsPolygon:
* Build a pad outline as non filled polygon, to draw pads on silkscreen layer
* with a line thickness = aWidth
* Used only to draw pads outlines on silkscreen layers.
*/
void BuildPadShapeThickOutlineAsPolygon( const D_PAD* aPad,
CPOLYGONS_LIST& aCornerBuffer,
int aWidth,
int aCircleToSegmentsCount,
double aCorrectionFactor );
/**
* Helper function Draw3DViaHole:
* Draw the via hole:
* Build a vertical hole (a cylinder) between the first and the last via layers
*/
void Draw3DViaHole( const VIA * aVia ); void Draw3DViaHole( const VIA * aVia );
/**
* Helper function Draw3DPadHole:
* Draw the pad hole:
* Build a vertical hole (round or oblong) between the front and back layers
*/
void Draw3DPadHole( const D_PAD * aPad ); void Draw3DPadHole( const D_PAD * aPad );
void GenerateFakeShadowsTextures(); void GenerateFakeShadowsTextures();
......
This diff is collapsed.
This diff is collapsed.
...@@ -522,15 +522,15 @@ void EDA_3D_FRAME::Set3DBgColor() ...@@ -522,15 +522,15 @@ void EDA_3D_FRAME::Set3DBgColor()
newcolor = wxGetColourFromUser( this, oldcolor ); newcolor = wxGetColourFromUser( this, oldcolor );
if( !newcolor.IsOk() ) // Happens on cancel dialog if( !newcolor.IsOk() ) // Cancel command
return; return;
if( newcolor != oldcolor ) if( newcolor != oldcolor )
{ {
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0;
g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0;
NewDisplay(); m_canvas->Redraw();
} }
} }
......
...@@ -17,6 +17,7 @@ set(3D-VIEWER_SRCS ...@@ -17,6 +17,7 @@ set(3D-VIEWER_SRCS
3d_class.cpp 3d_class.cpp
3d_draw.cpp 3d_draw.cpp
3d_draw_basic_functions.cpp 3d_draw_basic_functions.cpp
3d_draw_helper_functions.cpp
3d_frame.cpp 3d_frame.cpp
3d_material.cpp 3d_material.cpp
3d_mesh_model.cpp 3d_mesh_model.cpp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment