3D viewer: minor fixes. Use our class REPORTER to show warning messages and activity info when building the 3D board view. Add a few comments in sources.
Very minor other fixes.
This commit is contained in:
parent
ae57c4692a
commit
19347b1243
|
@ -50,6 +50,7 @@
|
||||||
class BOARD_DESIGN_SETTINGS;
|
class BOARD_DESIGN_SETTINGS;
|
||||||
class EDA_3D_FRAME;
|
class EDA_3D_FRAME;
|
||||||
class CPOLYGONS_LIST;
|
class CPOLYGONS_LIST;
|
||||||
|
class REPORTER;
|
||||||
|
|
||||||
class VIA;
|
class VIA;
|
||||||
class D_PAD;
|
class D_PAD;
|
||||||
|
@ -80,7 +81,8 @@ class EDA_3D_CANVAS : public wxGLCanvas
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool m_init;
|
bool m_init;
|
||||||
bool m_reportWarnings; ///< true to report all wranings when build the 3D scene false to report errors only
|
bool m_reportWarnings; ///< true to report all warnings when building the 3D scene
|
||||||
|
///< false to report errors only
|
||||||
GLuint m_glLists[GL_ID_END]; ///< GL lists
|
GLuint m_glLists[GL_ID_END]; ///< GL lists
|
||||||
wxGLContext* m_glRC;
|
wxGLContext* m_glRC;
|
||||||
wxRealPoint m_draw3dOffset; ///< offset to draw the 3D mesh.
|
wxRealPoint m_draw3dOffset; ///< offset to draw the 3D mesh.
|
||||||
|
@ -148,11 +150,11 @@ public:
|
||||||
* Function CreateDrawGL_List
|
* Function CreateDrawGL_List
|
||||||
* Prepares the parameters of the OpenGL draw list
|
* Prepares the parameters of the OpenGL draw list
|
||||||
* creates the OpenGL draw list items (board, grid ...)
|
* creates the OpenGL draw list items (board, grid ...)
|
||||||
* @param aErrorMessages = a wxString which will filled with error messages,
|
* @param aErrorMessages = a REPORTER which will filled with error messages,
|
||||||
* if any
|
* if any
|
||||||
* @param aShowWarnings = true to show all messages, false to show errors only
|
* @param aActivity = a REPORTER to display activity state
|
||||||
*/
|
*/
|
||||||
void CreateDrawGL_List( wxString* aErrorMessages, bool aShowWarnings );
|
void CreateDrawGL_List( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||||
void InitGL();
|
void InitGL();
|
||||||
|
|
||||||
void ReportWarnings( bool aReport ) { m_reportWarnings = aReport; }
|
void ReportWarnings( bool aReport ) { m_reportWarnings = aReport; }
|
||||||
|
@ -231,24 +233,25 @@ private:
|
||||||
* Populates the OpenGL GL_ID_BOARD draw list with board items only on copper layers.
|
* Populates the OpenGL GL_ID_BOARD draw list with board items only on copper layers.
|
||||||
* 3D footprint shapes, tech layers and aux layers are not on this list
|
* 3D footprint shapes, tech layers and aux layers are not on this list
|
||||||
* Fills aErrorMessages with error messages created by some calculation function
|
* Fills aErrorMessages with error messages created by some calculation function
|
||||||
|
* display activity state
|
||||||
* @param aBoardList =
|
* @param aBoardList =
|
||||||
* @param aBodyOnlyList =
|
* @param aBodyOnlyList =
|
||||||
* @param aErrorMessages = a wxString to add error and warning messages
|
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||||
* created by the build process (can be NULL)
|
* created by the build process (can be NULL)
|
||||||
* @param aShowWarnings = true to show all messages, false to show errors only
|
* @param aActivity = a REPORTER to display activity state
|
||||||
*/
|
*/
|
||||||
void buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
void buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
wxString* aErrorMessages, bool aShowWarnings );
|
REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function buildTechLayers3DView
|
* Function buildTechLayers3DView
|
||||||
* Called by CreateDrawGL_List()
|
* Called by CreateDrawGL_List()
|
||||||
* Populates the OpenGL GL_ID_TECH_LAYERS draw list with items on tech layers
|
* Populates the OpenGL GL_ID_TECH_LAYERS draw list with items on tech layers
|
||||||
* @param aErrorMessages = a wxString to add error and warning messages
|
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||||
* created by the build process (can be NULL)
|
* created by the build process (can be NULL)
|
||||||
* @param aShowWarnings = true to show all messages, false to show errors only
|
* @param aActivity = a REPORTER to display activity state
|
||||||
*/
|
*/
|
||||||
void buildTechLayers3DView( wxString* aErrorMessages, bool aShowWarnings );
|
void buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function buildShadowList
|
* Function buildShadowList
|
||||||
|
@ -263,17 +266,25 @@ private:
|
||||||
* draw lists with 3D footprint shapes
|
* draw lists with 3D footprint shapes
|
||||||
* @param aOpaqueList is the gl list for non transparent items
|
* @param aOpaqueList is the gl list for non transparent items
|
||||||
* @param aTransparentList is the gl list for non transparent items,
|
* @param aTransparentList is the gl list for non transparent items,
|
||||||
|
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||||
|
* created by the build process (can be NULL)
|
||||||
|
* @param aActivity = a REPORTER to display activity state
|
||||||
* which need to be drawn after all other items
|
* which need to be drawn after all other items
|
||||||
*/
|
*/
|
||||||
void buildFootprintShape3DList( GLuint aOpaqueList,
|
void buildFootprintShape3DList( GLuint aOpaqueList,
|
||||||
GLuint aTransparentList );
|
GLuint aTransparentList,
|
||||||
|
REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||||
/**
|
/**
|
||||||
* Function buildBoard3DAuxLayers
|
* Function buildBoard3DAuxLayers
|
||||||
* Called by CreateDrawGL_List()
|
* Called by CreateDrawGL_List()
|
||||||
* Fills the OpenGL GL_ID_AUX_LAYERS draw list
|
* Fills the OpenGL GL_ID_AUX_LAYERS draw list
|
||||||
* with items on aux layers only
|
* with items on aux layers only
|
||||||
|
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||||
|
* created by the build process (can be NULL)
|
||||||
|
* @param aActivity = a REPORTER to display activity state
|
||||||
|
* which need to be drawn after all other items
|
||||||
*/
|
*/
|
||||||
void buildBoard3DAuxLayers();
|
void buildBoard3DAuxLayers( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||||
|
|
||||||
void draw3DGrid( double aGriSizeMM );
|
void draw3DGrid( double aGriSizeMM );
|
||||||
void draw3DAxis();
|
void draw3DAxis();
|
||||||
|
@ -329,11 +340,11 @@ private:
|
||||||
* function generateFakeShadowsTextures
|
* function generateFakeShadowsTextures
|
||||||
* creates shadows of the board an footprints
|
* creates shadows of the board an footprints
|
||||||
* for aesthetical purpose
|
* for aesthetical purpose
|
||||||
* @param aErrorMessages = a wxString to add error and warning messages
|
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||||
* created by the build process (can be NULL)
|
* created by the build process (can be NULL)
|
||||||
* @param aShowWarnings = true to show all messages, false to show errors only
|
* @param aActivity = a REPORTER to display activity state
|
||||||
*/
|
*/
|
||||||
void generateFakeShadowsTextures( wxString* aErrorMessages, bool aShowWarnings );
|
void generateFakeShadowsTextures( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include <3d_draw_basic_functions.h>
|
#include <3d_draw_basic_functions.h>
|
||||||
|
|
||||||
#include <CImage.h>
|
#include <CImage.h>
|
||||||
|
#include <reporter.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +70,41 @@
|
||||||
static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
|
static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class STATUS_TEXT_REPORTER
|
||||||
|
* is a wrapper for reporting to a wxString in a wxFrame status text.
|
||||||
|
*/
|
||||||
|
class STATUS_TEXT_REPORTER : public REPORTER
|
||||||
|
{
|
||||||
|
wxFrame * m_frame;
|
||||||
|
int m_position;
|
||||||
|
bool m_hasMessage;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
STATUS_TEXT_REPORTER( wxFrame* aFrame, int aPosition = 0 ) :
|
||||||
|
REPORTER(),
|
||||||
|
m_frame( aFrame ), m_position( aPosition )
|
||||||
|
{
|
||||||
|
SetReportAll( true );
|
||||||
|
SetReportWarnings( true );
|
||||||
|
SetReportErrors( true );
|
||||||
|
m_hasMessage = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
REPORTER& Report( const wxString& aText )
|
||||||
|
{
|
||||||
|
if( !aText.IsEmpty() )
|
||||||
|
m_hasMessage = true;
|
||||||
|
|
||||||
|
m_frame->SetStatusText( aText, m_position );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasMessage() const { return m_hasMessage; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_CANVAS::create_and_render_shadow_buffer( GLuint *aDst_gl_texture,
|
void EDA_3D_CANVAS::create_and_render_shadow_buffer( GLuint *aDst_gl_texture,
|
||||||
GLuint aTexture_size, bool aDraw_body, int aBlurPasses )
|
GLuint aTexture_size, bool aDraw_body, int aBlurPasses )
|
||||||
{
|
{
|
||||||
|
@ -157,7 +193,7 @@ void EDA_3D_CANVAS::create_and_render_shadow_buffer( GLuint *aDst_gl_texture,
|
||||||
/// Scale factor to make a bigger BBox in order to blur the texture and dont have artifacts in the edges
|
/// Scale factor to make a bigger BBox in order to blur the texture and dont have artifacts in the edges
|
||||||
#define SHADOW_BOUNDING_BOX_SCALE 1.25f
|
#define SHADOW_BOUNDING_BOX_SCALE 1.25f
|
||||||
|
|
||||||
void EDA_3D_CANVAS::generateFakeShadowsTextures( wxString* aErrorMessages, bool aShowWarnings )
|
void EDA_3D_CANVAS::generateFakeShadowsTextures( REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||||
{
|
{
|
||||||
if( m_shadow_init == true )
|
if( m_shadow_init == true )
|
||||||
{
|
{
|
||||||
|
@ -165,7 +201,7 @@ void EDA_3D_CANVAS::generateFakeShadowsTextures( wxString* aErrorMessages, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init info 3d parameters and create gl lists:
|
// Init info 3d parameters and create gl lists:
|
||||||
CreateDrawGL_List( aErrorMessages, aShowWarnings );
|
CreateDrawGL_List( aErrorMessages, aActivity );
|
||||||
|
|
||||||
DBG( unsigned strtime = GetRunningMicroSecs() );
|
DBG( unsigned strtime = GetRunningMicroSecs() );
|
||||||
|
|
||||||
|
@ -259,8 +295,14 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
if( !IsShown() )
|
if( !IsShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString errorMessages;
|
wxString err_messages;
|
||||||
bool showWarnings = m_reportWarnings;
|
WX_STRING_REPORTER errorReporter( &err_messages );
|
||||||
|
STATUS_TEXT_REPORTER activityReporter( Parent(), 0 );
|
||||||
|
errorReporter.SetReportAll( false );
|
||||||
|
errorReporter.SetReportWarnings( m_reportWarnings );
|
||||||
|
|
||||||
|
// Display build time at the end of build
|
||||||
|
unsigned strtime = GetRunningMicroSecs();
|
||||||
|
|
||||||
SetCurrent( *m_glRC );
|
SetCurrent( *m_glRC );
|
||||||
|
|
||||||
|
@ -274,10 +316,9 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
|
|
||||||
InitGL();
|
InitGL();
|
||||||
|
|
||||||
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
if( isRealisticMode() && isEnabled( FL_RENDER_SHADOWS ) )
|
||||||
isEnabled( FL_RENDER_SHADOWS ) )
|
|
||||||
{
|
{
|
||||||
generateFakeShadowsTextures( &errorMessages, showWarnings );
|
generateFakeShadowsTextures( &errorReporter, &activityReporter );
|
||||||
}
|
}
|
||||||
|
|
||||||
// *MUST* be called *after* SetCurrent( ):
|
// *MUST* be called *after* SetCurrent( ):
|
||||||
|
@ -375,7 +416,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
|
|
||||||
|
|
||||||
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
||||||
CreateDrawGL_List( &errorMessages, showWarnings );
|
CreateDrawGL_List( &errorReporter, &activityReporter );
|
||||||
|
|
||||||
if( isEnabled( FL_AXIS ) && m_glLists[GL_ID_AXIS] )
|
if( isEnabled( FL_AXIS ) && m_glLists[GL_ID_AXIS] )
|
||||||
glCallList( m_glLists[GL_ID_AXIS] );
|
glCallList( m_glLists[GL_ID_AXIS] );
|
||||||
|
@ -388,7 +429,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
if( isEnabled( FL_MODULE ) )
|
if( isEnabled( FL_MODULE ) )
|
||||||
{
|
{
|
||||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
||||||
CreateDrawGL_List( &errorMessages, showWarnings );
|
CreateDrawGL_List( &errorReporter, &activityReporter );
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable( GL_LIGHTING );
|
glEnable( GL_LIGHTING );
|
||||||
|
@ -451,7 +492,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
if( isEnabled( FL_COMMENTS ) || isEnabled( FL_COMMENTS ) )
|
if( isEnabled( FL_COMMENTS ) || isEnabled( FL_COMMENTS ) )
|
||||||
{
|
{
|
||||||
if( ! m_glLists[GL_ID_AUX_LAYERS] )
|
if( ! m_glLists[GL_ID_AUX_LAYERS] )
|
||||||
CreateDrawGL_List( &errorMessages, showWarnings );
|
CreateDrawGL_List( &errorReporter, &activityReporter );
|
||||||
|
|
||||||
glCallList( m_glLists[GL_ID_AUX_LAYERS] );
|
glCallList( m_glLists[GL_ID_AUX_LAYERS] );
|
||||||
}
|
}
|
||||||
|
@ -503,7 +544,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
if( isEnabled( FL_MODULE ) )
|
if( isEnabled( FL_MODULE ) )
|
||||||
{
|
{
|
||||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
||||||
CreateDrawGL_List( &errorMessages, showWarnings );
|
CreateDrawGL_List( &errorReporter, &activityReporter );
|
||||||
|
|
||||||
glCallList( m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] );
|
glCallList( m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] );
|
||||||
}
|
}
|
||||||
|
@ -561,8 +602,20 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
if( !errorMessages.IsEmpty() )
|
// Show calculation time if some activity was reported
|
||||||
wxLogMessage( errorMessages );
|
if( activityReporter.HasMessage() )
|
||||||
|
{
|
||||||
|
// Calculation time in seconds
|
||||||
|
double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e6;
|
||||||
|
|
||||||
|
activityReporter.Report( wxString::Format( _( "Build time %3f s" ),
|
||||||
|
calculation_time ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
activityReporter.Report( wxEmptyString );
|
||||||
|
|
||||||
|
if( !err_messages.IsEmpty() )
|
||||||
|
wxLogMessage( err_messages );
|
||||||
|
|
||||||
ReportWarnings( false );
|
ReportWarnings( false );
|
||||||
}
|
}
|
||||||
|
@ -633,7 +686,7 @@ void EDA_3D_CANVAS::buildShadowList( GLuint aFrontList, GLuint aBacklist, GLuint
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
wxString* aErrorMessages, bool aShowWarnings )
|
REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||||
{
|
{
|
||||||
BOARD* pcb = GetBoard();
|
BOARD* pcb = GetBoard();
|
||||||
|
|
||||||
|
@ -660,7 +713,8 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2.0) );
|
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2.0) );
|
||||||
|
|
||||||
CPOLYGONS_LIST bufferPolys;
|
CPOLYGONS_LIST bufferPolys;
|
||||||
bufferPolys.reserve( 200000 ); // Reserve for large board (tracks mainly)
|
bufferPolys.reserve( 500000 ); // Reserve for large board: tracks mainly
|
||||||
|
// + zones when holes are removed from zones
|
||||||
|
|
||||||
CPOLYGONS_LIST bufferPcbOutlines; // stores the board main outlines
|
CPOLYGONS_LIST bufferPcbOutlines; // stores the board main outlines
|
||||||
CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once
|
CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once
|
||||||
|
@ -671,7 +725,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
|
|
||||||
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
||||||
{
|
{
|
||||||
if( aErrorMessages && aShowWarnings )
|
if( aErrorMessages && aErrorMessages->ReportWarnings() )
|
||||||
{
|
{
|
||||||
*aErrorMessages << msg << wxT("\n") <<
|
*aErrorMessages << msg << wxT("\n") <<
|
||||||
_("Unable to calculate the board outlines.\n"
|
_("Unable to calculate the board outlines.\n"
|
||||||
|
@ -680,7 +734,8 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
}
|
}
|
||||||
|
|
||||||
CPOLYGONS_LIST bufferZonesPolys;
|
CPOLYGONS_LIST bufferZonesPolys;
|
||||||
bufferZonesPolys.reserve( 500000 ); // Reserve for large board ( copper zones mainly )
|
bufferZonesPolys.reserve( 300000 ); // Reserve for large board ( copper zones mainly )
|
||||||
|
// when holes are not removed from zones
|
||||||
|
|
||||||
CPOLYGONS_LIST currLayerHoles; // Contains holes for the current layer
|
CPOLYGONS_LIST currLayerHoles; // Contains holes for the current layer
|
||||||
bool throughHolesListBuilt = false; // flag to build the through hole polygon list only once
|
bool throughHolesListBuilt = false; // flag to build the through hole polygon list only once
|
||||||
|
@ -708,6 +763,9 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
if( !is3DLayerEnabled( layer ) )
|
if( !is3DLayerEnabled( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( aActivity )
|
||||||
|
aActivity->Report( wxString::Format( _( "Build layer %s" ), LSET::Name( layer ) ) );
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
bufferZonesPolys.RemoveAllContours();
|
bufferZonesPolys.RemoveAllContours();
|
||||||
currLayerHoles.RemoveAllContours();
|
currLayerHoles.RemoveAllContours();
|
||||||
|
@ -745,6 +803,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
// draw pads
|
// draw pads
|
||||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
|
int thickness = GetPrm3DVisu().GetCopperThicknessBIU();
|
||||||
// Note: NPTH pads are not drawn on copper layers when the pad
|
// Note: NPTH pads are not drawn on copper layers when the pad
|
||||||
// has same shape as its hole
|
// has same shape as its hole
|
||||||
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||||
|
@ -788,7 +847,14 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
// 48 segm for a circle is a very good approx.
|
// 48 segm for a circle is a very good approx.
|
||||||
segcount = Clamp( segcountLowQuality, segcount, 48 );
|
segcount = Clamp( segcountLowQuality, segcount, 48 );
|
||||||
|
|
||||||
pad->BuildPadDrillShapePolygon( allLayerHoles, 0, segcount );
|
// The hole in the body is inflated by copper thickness.
|
||||||
|
int inflate = thickness;
|
||||||
|
|
||||||
|
// If not plated, no copper.
|
||||||
|
if( pad->GetAttribute () == PAD_HOLE_NOT_PLATED )
|
||||||
|
inflate = 0;
|
||||||
|
|
||||||
|
pad->BuildPadDrillShapePolygon( allLayerHoles, inflate, segcount );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -891,10 +957,15 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
throughHolesListBuilt = true;
|
throughHolesListBuilt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( aActivity )
|
||||||
|
aActivity->Report( _( "Build board body" ) );
|
||||||
|
|
||||||
|
|
||||||
|
// Draw plated vertical holes inside the board, but not always. They are drawn:
|
||||||
|
// - if the board body is not shown, to show the holes.
|
||||||
|
// - or if the copper thickness is shown
|
||||||
if( !isEnabled( FL_SHOW_BOARD_BODY ) || isEnabled( FL_USE_COPPER_THICKNESS ) )
|
if( !isEnabled( FL_SHOW_BOARD_BODY ) || isEnabled( FL_USE_COPPER_THICKNESS ) )
|
||||||
{
|
{
|
||||||
setGLCopperColor();
|
|
||||||
|
|
||||||
// Draw vias holes (vertical cylinders)
|
// Draw vias holes (vertical cylinders)
|
||||||
for( const TRACK* track = pcb->m_Track; track; track = track->Next() )
|
for( const TRACK* track = pcb->m_Track; track; track = track->Next() )
|
||||||
{
|
{
|
||||||
|
@ -971,7 +1042,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_CANVAS::buildTechLayers3DView( wxString* aErrorMessages, bool aShowWarnings )
|
void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||||
{
|
{
|
||||||
BOARD* pcb = GetBoard();
|
BOARD* pcb = GetBoard();
|
||||||
bool useTextures = isRealisticMode() && isEnabled( FL_RENDER_TEXTURES );
|
bool useTextures = isRealisticMode() && isEnabled( FL_RENDER_TEXTURES );
|
||||||
|
@ -998,7 +1069,7 @@ void EDA_3D_CANVAS::buildTechLayers3DView( wxString* aErrorMessages, bool aShowW
|
||||||
|
|
||||||
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
||||||
{
|
{
|
||||||
if( aErrorMessages && aShowWarnings )
|
if( aErrorMessages && aErrorMessages->ReportWarnings() )
|
||||||
{
|
{
|
||||||
*aErrorMessages << msg << wxT("\n") <<
|
*aErrorMessages << msg << wxT("\n") <<
|
||||||
_("Unable to calculate the board outlines.\n"
|
_("Unable to calculate the board outlines.\n"
|
||||||
|
@ -1060,6 +1131,10 @@ void EDA_3D_CANVAS::buildTechLayers3DView( wxString* aErrorMessages, bool aShowW
|
||||||
if( layer == Edge_Cuts && isEnabled( FL_SHOW_BOARD_BODY ) )
|
if( layer == Edge_Cuts && isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( aActivity )
|
||||||
|
aActivity->Report( wxString::Format( _( "Build layer %s" ), LSET::Name( layer ) ) );
|
||||||
|
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
|
|
||||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||||
|
@ -1195,7 +1270,7 @@ void EDA_3D_CANVAS::buildTechLayers3DView( wxString* aErrorMessages, bool aShowW
|
||||||
* Fills the OpenGL GL_ID_BOARD draw list with items
|
* Fills the OpenGL GL_ID_BOARD draw list with items
|
||||||
* on aux layers only
|
* on aux layers only
|
||||||
*/
|
*/
|
||||||
void EDA_3D_CANVAS::buildBoard3DAuxLayers()
|
void EDA_3D_CANVAS::buildBoard3DAuxLayers( REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||||
{
|
{
|
||||||
const int segcountforcircle = 18;
|
const int segcountforcircle = 18;
|
||||||
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
||||||
|
@ -1221,6 +1296,9 @@ void EDA_3D_CANVAS::buildBoard3DAuxLayers()
|
||||||
if( !is3DLayerEnabled( layer ) )
|
if( !is3DLayerEnabled( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( aActivity )
|
||||||
|
aActivity->Report( wxString::Format( _( "Build layer %s" ), LSET::Name( layer ) ) );
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
|
|
||||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||||
|
@ -1290,7 +1368,7 @@ void EDA_3D_CANVAS::buildBoard3DAuxLayers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EDA_3D_CANVAS::CreateDrawGL_List( wxString* aErrorMessages, bool aShowWarnings )
|
void EDA_3D_CANVAS::CreateDrawGL_List( REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||||
{
|
{
|
||||||
BOARD* pcb = GetBoard();
|
BOARD* pcb = GetBoard();
|
||||||
|
|
||||||
|
@ -1312,7 +1390,7 @@ void EDA_3D_CANVAS::CreateDrawGL_List( wxString* aErrorMessages, bool aShowWarni
|
||||||
|
|
||||||
m_glLists[GL_ID_BOARD] = glGenLists( 1 );
|
m_glLists[GL_ID_BOARD] = glGenLists( 1 );
|
||||||
m_glLists[GL_ID_BODY] = glGenLists( 1 );
|
m_glLists[GL_ID_BODY] = glGenLists( 1 );
|
||||||
buildBoard3DView(m_glLists[GL_ID_BOARD], m_glLists[GL_ID_BODY], aErrorMessages, aShowWarnings );
|
buildBoard3DView(m_glLists[GL_ID_BOARD], m_glLists[GL_ID_BODY], aErrorMessages, aActivity );
|
||||||
CheckGLError( __FILE__, __LINE__ );
|
CheckGLError( __FILE__, __LINE__ );
|
||||||
|
|
||||||
DBG( printf( " buildBoard3DView total time %f ms\n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) );
|
DBG( printf( " buildBoard3DView total time %f ms\n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) );
|
||||||
|
@ -1326,7 +1404,10 @@ void EDA_3D_CANVAS::CreateDrawGL_List( wxString* aErrorMessages, bool aShowWarni
|
||||||
glNewList( m_glLists[GL_ID_TECH_LAYERS], GL_COMPILE );
|
glNewList( m_glLists[GL_ID_TECH_LAYERS], GL_COMPILE );
|
||||||
// when calling BuildTechLayers3DView,
|
// when calling BuildTechLayers3DView,
|
||||||
// do not show warnings, which are the same as buildBoard3DView
|
// do not show warnings, which are the same as buildBoard3DView
|
||||||
buildTechLayers3DView( aErrorMessages, false );
|
bool report_warn = aErrorMessages->ReportWarnings();
|
||||||
|
aErrorMessages->SetReportWarnings( false );
|
||||||
|
buildTechLayers3DView( aErrorMessages, aActivity );
|
||||||
|
aErrorMessages->SetReportWarnings( report_warn );
|
||||||
glEndList();
|
glEndList();
|
||||||
CheckGLError( __FILE__, __LINE__ );
|
CheckGLError( __FILE__, __LINE__ );
|
||||||
|
|
||||||
|
@ -1339,7 +1420,7 @@ void EDA_3D_CANVAS::CreateDrawGL_List( wxString* aErrorMessages, bool aShowWarni
|
||||||
|
|
||||||
m_glLists[GL_ID_AUX_LAYERS] = glGenLists( 1 );
|
m_glLists[GL_ID_AUX_LAYERS] = glGenLists( 1 );
|
||||||
glNewList( m_glLists[GL_ID_AUX_LAYERS], GL_COMPILE );
|
glNewList( m_glLists[GL_ID_AUX_LAYERS], GL_COMPILE );
|
||||||
buildBoard3DAuxLayers();
|
buildBoard3DAuxLayers( aErrorMessages, aActivity );
|
||||||
glEndList();
|
glEndList();
|
||||||
CheckGLError( __FILE__, __LINE__ );
|
CheckGLError( __FILE__, __LINE__ );
|
||||||
|
|
||||||
|
@ -1364,7 +1445,8 @@ void EDA_3D_CANVAS::CreateDrawGL_List( wxString* aErrorMessages, bool aShowWarni
|
||||||
m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] = 0;
|
m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] = 0;
|
||||||
|
|
||||||
buildFootprintShape3DList( m_glLists[GL_ID_3DSHAPES_SOLID_FRONT],
|
buildFootprintShape3DList( m_glLists[GL_ID_3DSHAPES_SOLID_FRONT],
|
||||||
m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] );
|
m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT],
|
||||||
|
aErrorMessages, aActivity );
|
||||||
|
|
||||||
CheckGLError( __FILE__, __LINE__ );
|
CheckGLError( __FILE__, __LINE__ );
|
||||||
}
|
}
|
||||||
|
@ -1471,10 +1553,15 @@ void EDA_3D_CANVAS::calcBBox()
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_CANVAS::buildFootprintShape3DList( GLuint aOpaqueList,
|
void EDA_3D_CANVAS::buildFootprintShape3DList( GLuint aOpaqueList,
|
||||||
GLuint aTransparentList )
|
GLuint aTransparentList,
|
||||||
|
REPORTER* aErrorMessages,
|
||||||
|
REPORTER* aActivity )
|
||||||
{
|
{
|
||||||
DBG( unsigned strtime = GetRunningMicroSecs() );
|
DBG( unsigned strtime = GetRunningMicroSecs() );
|
||||||
|
|
||||||
|
if( aActivity )
|
||||||
|
aActivity->Report( _( "Load 3D Shapes" ) );
|
||||||
|
|
||||||
// clean the parser list if it have any already loaded files
|
// clean the parser list if it have any already loaded files
|
||||||
m_model_parsers_list.clear();
|
m_model_parsers_list.clear();
|
||||||
m_model_filename_list.clear();
|
m_model_filename_list.clear();
|
||||||
|
|
|
@ -368,8 +368,9 @@ void EDA_3D_CANVAS::draw3DPadHole( const D_PAD* aPad )
|
||||||
|
|
||||||
if( drillsize.x == drillsize.y ) // usual round hole
|
if( drillsize.x == drillsize.y ) // usual round hole
|
||||||
{
|
{
|
||||||
|
int hole_radius = ( drillsize.x + thickness ) / 2;
|
||||||
Draw3D_ZaxisCylinder( aPad->GetPosition(),
|
Draw3D_ZaxisCylinder( aPad->GetPosition(),
|
||||||
(drillsize.x + thickness / 2) / 2, holeHeight,
|
hole_radius, holeHeight,
|
||||||
thickness, holeZpoz, GetPrm3DVisu().m_BiuTo3Dunits );
|
thickness, holeZpoz, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||||
}
|
}
|
||||||
else // Oblong hole
|
else // Oblong hole
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class WX_STRING_REPROTER
|
* Class WX_STRING_REPORTER
|
||||||
* is a wrapper for reporting to a wxString object.
|
* is a wrapper for reporting to a wxString object.
|
||||||
*/
|
*/
|
||||||
class WX_STRING_REPORTER : public REPORTER
|
class WX_STRING_REPORTER : public REPORTER
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
// std::vector templates
|
// std::vector templates
|
||||||
|
|
||||||
%template(VIA_DIMENSION_Vector) std::vector<VIA_DIMENSION>;
|
%template(VIA_DIMENSION_Vector) std::vector<VIA_DIMENSION>;
|
||||||
%template (RASTNET_Vector) std::vector<RATSNEST_ITEM>;
|
%template (RATSNET_Vector) std::vector<RATSNEST_ITEM>;
|
||||||
|
|
||||||
%extend BOARD
|
%extend BOARD
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue