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)
}
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 )
wxYield();
}
struct vieport_params
struct viewport_params
{
GLint originx;
GLint originy;
......@@ -633,6 +634,10 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
GLint y;
} viewport;
// Be sure we have the latest 3D view (remember 3D view is buffered)
Refresh();
wxYield();
// Build image from the 3D buffer
wxWindowUpdateLocker noUpdates( this );
glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );
......
......@@ -46,6 +46,7 @@
class BOARD_DESIGN_SETTINGS;
class EDA_3D_FRAME;
class CPOLYGONS_LIST;
class VIA;
class D_PAD;
......@@ -134,15 +135,40 @@ public:
void CreateDrawGL_List();
void InitGL();
void SetLights();
void SetOffset(double aPosX, double aPosY)
{
m_draw3dOffset.x = aPosX;
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 );
/**
* Helper function SetGLCopperColor
* Initialize the copper color to draw the board
* in realistic mode (a golden yellow color )
*/
void SetGLCopperColor();
/**
* Helper function SetGLEpoxyColor
* Initialize the color to draw the epoxy body board in realistic mode.
*/
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
* Called by CreateDrawGL_List()
......@@ -187,7 +213,31 @@ public:
void Draw3DGrid( double aGriSizeMM );
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 );
/**
* 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 GenerateFakeShadowsTextures();
......
This diff is collapsed.
This diff is collapsed.
......@@ -522,15 +522,15 @@ void EDA_3D_FRAME::Set3DBgColor()
newcolor = wxGetColourFromUser( this, oldcolor );
if( !newcolor.IsOk() ) // Happens on cancel dialog
if( !newcolor.IsOk() ) // Cancel command
return;
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_Blue = (double) newcolor.Blue() / 255.0;
NewDisplay();
m_canvas->Redraw();
}
}
......
......@@ -17,6 +17,7 @@ set(3D-VIEWER_SRCS
3d_class.cpp
3d_draw.cpp
3d_draw_basic_functions.cpp
3d_draw_helper_functions.cpp
3d_frame.cpp
3d_material.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