Commit 4578ea8b authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

1) Add 32 Cu Layers.

2) Change from legacy Cu stack to counting down from top=(F_Cu or 0).
   The old Cu stack required knowing the count of Cu layers to make
   sense of the layer number when converting to many exported file types.
   The new Cu stack is more commonly used, although ours still gives
   B_Cu a fixed number.
3) Introduce class LSET and enum LAYER_ID.
4) Change *.kicad_pcb file format version to 4 from 3.
5) Change fixed names Inner1_Cu-Inner14_Cu to In1_Cu-In30_Cu and their
   meanings are typically flipped.
6) Moved the #define LAYER_N_* stuff into legacy_plugin.cpp where they
   can die a quiet death, and switch to enum LAYER_ID symbols throughout.
7) Removed the LEGACY_PLUGIN::Save() and FootprintSave() functions.
   You will need to convert to the format immediately, *.kicad_pcb and
   *.kicad_mod (=pretty) since legacy format was never going to know
   about 32 Cu layers and additional technical layers and the reversed Cu
   stack.
parent 21b70093
Loading
Loading
Loading
Loading
+106 −69
Original line number Original line Diff line number Diff line
@@ -55,11 +55,11 @@ extern void CheckGLError();
/* Helper function
/* Helper function
 * returns true if aLayer should be displayed, false otherwise
 * returns true if aLayer should be displayed, false otherwise
 */
 */
static bool     Is3DLayerEnabled( LAYER_NUM aLayer );
static bool     Is3DLayerEnabled( LAYER_ID aLayer );


/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
 * Z orientation is 1.0 for all layers but "back" layers:
 * Z orientation is 1.0 for all layers but "back" layers:
 *  LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
 *  B_Cu , B_Adhes, B_Paste ), B_SilkS
 * used to calculate the Z orientation parameter for glNormal3f
 * used to calculate the Z orientation parameter for glNormal3f
 */
 */
static GLfloat  Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
static GLfloat  Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
@@ -205,18 +205,18 @@ static inline void SetGLTechLayersColor( LAYER_NUM aLayer )
    {
    {
        switch( aLayer )
        switch( aLayer )
        {
        {
        case SOLDERPASTE_N_BACK:
        case B_Paste:
        case SOLDERPASTE_N_FRONT:
        case F_Paste:
            SetGLColor( DARKGRAY, 0.7 );
            SetGLColor( DARKGRAY, 0.7 );
            break;
            break;


        case SILKSCREEN_N_BACK:
        case B_SilkS:
        case SILKSCREEN_N_FRONT:
        case F_SilkS:
            SetGLColor( LIGHTGRAY, 0.9 );
            SetGLColor( LIGHTGRAY, 0.9 );
            break;
            break;


        case SOLDERMASK_N_BACK:
        case B_Mask:
        case SOLDERMASK_N_FRONT:
        case F_Mask:
            SetGLEpoxyColor( 0.7 );
            SetGLEpoxyColor( 0.7 );
            break;
            break;


@@ -278,12 +278,21 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    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
    bool            hightQualityMode = false;
    bool            hightQualityMode = false;


    for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
    LSET            cu_set = LSET::AllCuMask( g_Parm_3D_Visu.m_CopperLayersCount );
         ++layer )

#if 1
    LAYER_ID        cu_seq[MAX_CU_LAYERS];          // preferred sequence, could have called CuStack()
                                                    // but I assume that's backwards

    for( unsigned i=0; i<DIM(cu_seq); ++i )
        cu_seq[i] = LAYER_ID( B_Cu - i );

    for( LSEQ cu = cu_set.Seq( cu_seq, DIM(cu_seq) );  cu;  ++cu )
#else
    for( LSEQ cu = cu_set.CuStack();  cu;  ++cu )
#endif
    {
    {
        if( layer != LAST_COPPER_LAYER
        LAYER_ID layer = *cu;
            && layer >= g_Parm_3D_Visu.m_CopperLayersCount )
            continue;


        // Skip non enabled layers in normal mode,
        // Skip non enabled layers in normal mode,
        // and internal layers in realistic mode
        // and internal layers in realistic mode
@@ -295,7 +304,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
        currLayerHoles.RemoveAllContours();
        currLayerHoles.RemoveAllContours();


        // Draw tracks:
        // Draw tracks:
        for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
        for( TRACK* track = pcb->m_Track;  track;  track = track->Next() )
        {
        {
            if( !track->IsOnLayer( layer ) )
            if( !track->IsOnLayer( layer ) )
                continue;
                continue;
@@ -325,7 +334,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
        }
        }


        // draw pads
        // draw pads
        for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
        for( MODULE* module = pcb->m_Modules;  module;  module = module->Next() )
        {
        {
            module->TransformPadsShapesWithClearanceToPolygon( layer,
            module->TransformPadsShapesWithClearanceToPolygon( layer,
                                                               bufferPolys,
                                                               bufferPolys,
@@ -345,7 +354,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
            {
            {
                D_PAD* pad = module->Pads();
                D_PAD* pad = module->Pads();


                for( ; pad != NULL; pad = pad->Next() )
                for( ; pad; pad = pad->Next() )
                    pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
                    pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
                                                    segcountLowQuality );
                                                    segcountLowQuality );
            }
            }
@@ -439,7 +448,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    }
    }


    // Draw vias holes (vertical cylinders)
    // Draw vias holes (vertical cylinders)
    for( const TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
    for( const TRACK* track = pcb->m_Track;  track;  track = track->Next() )
    {
    {
        const VIA *via = dynamic_cast<const VIA*>(track);
        const VIA *via = dynamic_cast<const VIA*>(track);


@@ -448,9 +457,9 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    }
    }


    // Draw pads holes (vertical cylinders)
    // Draw pads holes (vertical cylinders)
    for( const MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
    for( const MODULE* module = pcb->m_Modules;  module;  module = module->Next() )
    {
    {
        for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
        for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
            Draw3DPadHole( pad );
            Draw3DPadHole( pad );
    }
    }


@@ -459,12 +468,14 @@ void EDA_3D_CANVAS::BuildBoard3DView()
        ( realistic_mode || g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) ) )
        ( realistic_mode || g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) ) )
    {
    {
        int copper_thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
        int copper_thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();

        // a small offset between substrate and external copper layer to avoid artifacts
        // a small offset between substrate and external copper layer to avoid artifacts
        // when drawing copper items on board
        // when drawing copper items on board
        int epsilon = Millimeter2iu( 0.01 );
        int epsilon = Millimeter2iu( 0.01 );
        int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
        int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
        int board_thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT )
        int board_thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu )
                            - g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
                            - g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );

        // items on copper layers and having a thickness = copper_thickness
        // items on copper layers and having a thickness = copper_thickness
        // are drawn from zpos - copper_thickness/2 to zpos + copper_thickness
        // are drawn from zpos - copper_thickness/2 to zpos + copper_thickness
        // therefore substrate position is copper_thickness/2 to
        // therefore substrate position is copper_thickness/2 to
@@ -476,11 +487,11 @@ void EDA_3D_CANVAS::BuildBoard3DView()
            SetGLEpoxyColor();
            SetGLEpoxyColor();
        else
        else
        {
        {
            EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( EDGE_N );
            EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( Edge_Cuts );
            SetGLColor( color, 0.7 );
            SetGLColor( color, 0.7 );
        }
        }


        glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( LAYER_N_FRONT ) );
        glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( F_Cu ) );
        KI_POLYGON_SET  currLayerPolyset;
        KI_POLYGON_SET  currLayerPolyset;
        KI_POLYGON_SET  polysetHoles;
        KI_POLYGON_SET  polysetHoles;


@@ -515,6 +526,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
                                                // to reduce time calculations
                                                // to reduce time calculations
                                                // for holes and items which do not need
                                                // for holes and items which do not need
                                                // a fine representation
                                                // a fine representation

    double          correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );
    double          correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );


    CPOLYGONS_LIST  bufferPolys;
    CPOLYGONS_LIST  bufferPolys;
@@ -537,7 +549,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
    int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();


    // Add via holes
    // Add via holes
    for( VIA* via = GetFirstVia( pcb->m_Track ); via != NULL;
    for( VIA* via = GetFirstVia( pcb->m_Track ); via;
            via = GetFirstVia( via->Next() ) )
            via = GetFirstVia( via->Next() ) )
    {
    {
        VIATYPE_T viatype = via->GetViaType();
        VIATYPE_T viatype = via->GetViaType();
@@ -551,12 +563,12 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    }
    }


    // draw pads holes
    // draw pads holes
    for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
    for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
    {
    {
        // Add pad hole, if any
        // Add pad hole, if any
        D_PAD* pad = module->Pads();
        D_PAD* pad = module->Pads();


        for( ; pad != NULL; pad = pad->Next() )
        for( ; pad; pad = pad->Next() )
            pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
            pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
                                                segcountLowQuality );
                                                segcountLowQuality );
    }
    }
@@ -566,9 +578,21 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    KI_POLYGON_SET  brdpolysetHoles;
    KI_POLYGON_SET  brdpolysetHoles;
    allLayerHoles.ExportTo( brdpolysetHoles );
    allLayerHoles.ExportTo( brdpolysetHoles );


    for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
    static const LAYER_ID sequence[] = {
         ++layer )
        B_Adhes,
        F_Adhes,
        B_Paste,
        F_Paste,
        B_SilkS,
        F_SilkS,
        B_Mask,
        F_Mask,
    };

    for( LSEQ seq = pcb->GetEnabledLayers().Seq( sequence, DIM( sequence ) );  seq;  ++seq )
    {
    {
        LAYER_ID layer = *seq;

        // Skip user layers, which are not drawn here
        // Skip user layers, which are not drawn here
        if( IsUserLayer( layer) )
        if( IsUserLayer( layer) )
            continue;
            continue;
@@ -576,7 +600,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
        if( !Is3DLayerEnabled( layer ) )
        if( !Is3DLayerEnabled( layer ) )
            continue;
            continue;


        if( layer == EDGE_N && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY )  )
        if( layer == Edge_Cuts && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY )  )
            continue;
            continue;


        bufferPolys.RemoveAllContours();
        bufferPolys.RemoveAllContours();
@@ -603,14 +627,14 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
            }
            }
        }
        }


        for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
        for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
        {
        {
            if( layer == SILKSCREEN_N_FRONT || layer == SILKSCREEN_N_BACK )
            if( layer == F_SilkS || layer == B_SilkS )
            {
            {
                D_PAD*  pad = module->Pads();
                D_PAD*  pad = module->Pads();
                int     linewidth = g_DrawDefaultLineThickness;
                int     linewidth = g_DrawDefaultLineThickness;


                for( ; pad != NULL; pad = pad->Next() )
                for( ; pad; pad = pad->Next() )
                {
                {
                    if( !pad->IsOnLayer( layer ) )
                    if( !pad->IsOnLayer( layer ) )
                        continue;
                        continue;
@@ -651,7 +675,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()


        // Solder mask layers are "negative" layers.
        // Solder mask layers are "negative" layers.
        // Shapes should be removed from the full board area.
        // Shapes should be removed from the full board area.
        if( layer == SOLDERMASK_N_BACK || layer == SOLDERMASK_N_FRONT )
        if( layer == B_Mask || layer == F_Mask )
        {
        {
            bufferPcbOutlines.ExportTo( currLayerPolyset );
            bufferPcbOutlines.ExportTo( currLayerPolyset );
            bufferPolys.Append( allLayerHoles );
            bufferPolys.Append( allLayerHoles );
@@ -659,8 +683,8 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
            currLayerPolyset -= polyset;
            currLayerPolyset -= polyset;
        }
        }
        // Remove holes from Solder paste layers and siklscreen
        // Remove holes from Solder paste layers and siklscreen
        else if( layer == SOLDERPASTE_N_BACK || layer == SOLDERPASTE_N_FRONT
        else if( layer == B_Paste || layer == F_Paste
                 || layer == SILKSCREEN_N_BACK || layer == SILKSCREEN_N_FRONT  )
                 || layer == B_SilkS || layer == F_SilkS  )
        {
        {
            bufferPolys.ExportTo( currLayerPolyset );
            bufferPolys.ExportTo( currLayerPolyset );
            currLayerPolyset -= brdpolysetHoles;
            currLayerPolyset -= brdpolysetHoles;
@@ -674,11 +698,11 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
        int         thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
        int         thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
        int         zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
        int         zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );


        if( layer == EDGE_N )
        if( layer == Edge_Cuts )
        {
        {
            thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT )
            thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu )
                        - g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
                        - g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
            zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK )
            zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu )
                   + (thickness / 2);
                   + (thickness / 2);
        }
        }
        else
        else
@@ -703,6 +727,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    }
    }
}
}



/**
/**
 * Function BuildBoard3DAuxLayers
 * Function BuildBoard3DAuxLayers
 * Called by CreateDrawGL_List()
 * Called by CreateDrawGL_List()
@@ -714,12 +739,24 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
    const int   segcountforcircle   = 16;
    const int   segcountforcircle   = 16;
    double      correctionFactor    = 1.0 / cos( M_PI / (segcountforcircle * 2) );
    double      correctionFactor    = 1.0 / cos( M_PI / (segcountforcircle * 2) );
    BOARD*      pcb = GetBoard();
    BOARD*      pcb = GetBoard();

    CPOLYGONS_LIST  bufferPolys;
    CPOLYGONS_LIST  bufferPolys;

    bufferPolys.reserve( 5000 );    // Reserve for items not on board
    bufferPolys.reserve( 5000 );    // Reserve for items not on board


    for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
    static const LAYER_ID sequence[] = {
         ++layer )
        Dwgs_User,
        Cmts_User,
        Eco1_User,
        Eco2_User,
        Edge_Cuts,
        Margin
    };

    for( LSEQ aux( sequence, sequence+DIM(sequence) );  aux;  ++aux )
    {
    {
        LAYER_ID layer = *aux;

        if( !Is3DLayerEnabled( layer ) )
        if( !Is3DLayerEnabled( layer ) )
            continue;
            continue;


@@ -747,7 +784,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
            }
            }
        }
        }


        for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
        for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
        {
        {
            module->TransformPadsShapesWithClearanceToPolygon( layer,
            module->TransformPadsShapesWithClearanceToPolygon( layer,
                                                               bufferPolys,
                                                               bufferPolys,
@@ -1067,7 +1104,7 @@ void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )


void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
{
{
    LAYER_NUM   top_layer, bottom_layer;
    LAYER_ID    top_layer, bottom_layer;
    int         inner_radius    = aVia->GetDrillValue() / 2;
    int         inner_radius    = aVia->GetDrillValue() / 2;
    int         thickness       = g_Parm_3D_Visu.GetCopperThicknessBIU();
    int         thickness       = g_Parm_3D_Visu.GetCopperThicknessBIU();


@@ -1115,7 +1152,7 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,
        glRotatef( 180.0, 0.0, 0.0, 1.0 );
        glRotatef( 180.0, 0.0, 0.0, 1.0 );
    }
    }


    for( ; shape3D != NULL; shape3D = shape3D->Next() )
    for( ; shape3D; shape3D = shape3D->Next() )
    {
    {
        shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects );
        shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects );
        shape3D->SetLoadTransparentObjects( aAllowTransparentObjects );
        shape3D->SetLoadTransparentObjects( aAllowTransparentObjects );
@@ -1141,15 +1178,15 @@ void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
    // Store here the points to approximate hole by segments
    // Store here the points to approximate hole by segments
    CPOLYGONS_LIST  holecornersBuffer;
    CPOLYGONS_LIST  holecornersBuffer;
    int             thickness   = g_Parm_3D_Visu.GetCopperThicknessBIU();
    int             thickness   = g_Parm_3D_Visu.GetCopperThicknessBIU();
    int             height      = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT ) -
    int             height      = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu ) -
                                  g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
                                  g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );


    if( g_Parm_3D_Visu.IsRealisticMode() )
    if( g_Parm_3D_Visu.IsRealisticMode() )
        SetGLCopperColor();
        SetGLCopperColor();
    else
    else
        SetGLColor( DARKGRAY );
        SetGLColor( DARKGRAY );


    int holeZpoz    = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK ) + thickness / 2;
    int holeZpoz    = g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu ) + thickness / 2;
    int holeHeight  = height - thickness;
    int holeHeight  = height - thickness;


    if( drillsize.x == drillsize.y )    // usual round hole
    if( drillsize.x == drillsize.y )    // usual round hole
@@ -1187,7 +1224,7 @@ void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
}
}




bool Is3DLayerEnabled( LAYER_NUM aLayer )
static bool Is3DLayerEnabled( LAYER_ID aLayer )
{
{
    DISPLAY3D_FLG flg;
    DISPLAY3D_FLG flg;
    bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
    bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
@@ -1196,44 +1233,44 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
    // check the flags
    // check the flags
    switch( aLayer )
    switch( aLayer )
    {
    {
    case ADHESIVE_N_BACK:
    case B_Adhes:
    case ADHESIVE_N_FRONT:
    case F_Adhes:
        flg = FL_ADHESIVE;
        flg = FL_ADHESIVE;
        break;
        break;


    case SOLDERPASTE_N_BACK:
    case B_Paste:
    case SOLDERPASTE_N_FRONT:
    case F_Paste:
        flg = FL_SOLDERPASTE;
        flg = FL_SOLDERPASTE;
        break;
        break;


    case SILKSCREEN_N_BACK:
    case B_SilkS:
    case SILKSCREEN_N_FRONT:
    case F_SilkS:
        flg = FL_SILKSCREEN;
        flg = FL_SILKSCREEN;
        break;
        break;


    case SOLDERMASK_N_BACK:
    case B_Mask:
    case SOLDERMASK_N_FRONT:
    case F_Mask:
        flg = FL_SOLDERMASK;
        flg = FL_SOLDERMASK;
        break;
        break;


    case DRAW_N:
    case Dwgs_User:
    case COMMENT_N:
    case Cmts_User:
        if( realistic_mode )
        if( realistic_mode )
            return false;
            return false;


        flg = FL_COMMENTS;
        flg = FL_COMMENTS;
        break;
        break;


    case ECO1_N:
    case Eco1_User:
    case ECO2_N:
    case Eco2_User:
        if( realistic_mode )
        if( realistic_mode )
            return false;
            return false;


        flg = FL_ECO;
        flg = FL_ECO;
        break;
        break;


    case LAYER_N_BACK:
    case B_Cu:
    case LAYER_N_FRONT:
    case F_Cu:
        return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer )
        return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer )
               || realistic_mode;
               || realistic_mode;
        break;
        break;
@@ -1256,11 +1293,11 @@ GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer )
{
{
    double nZ = 1.0;
    double nZ = 1.0;


    if( ( aLayer == LAYER_N_BACK )
    if( ( aLayer == B_Cu )
        || ( aLayer == ADHESIVE_N_BACK )
        || ( aLayer == B_Adhes )
        || ( aLayer == SOLDERPASTE_N_BACK )
        || ( aLayer == B_Paste )
        || ( aLayer == SILKSCREEN_N_BACK )
        || ( aLayer == B_SilkS )
        || ( aLayer == SOLDERMASK_N_BACK ) )
        || ( aLayer == B_Mask ) )
        nZ = -1.0;
        nZ = -1.0;


    return nZ;
    return nZ;
+13 −14
Original line number Original line Diff line number Diff line
@@ -132,53 +132,52 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
    // Fill remaining unused copper layers and front layer zpos
    // Fill remaining unused copper layers and front layer zpos
    // with m_EpoxyThickness
    // with m_EpoxyThickness
    // Solder mask and Solder paste have the same Z position
    // Solder mask and Solder paste have the same Z position
    for( ; layer <= LAST_COPPER_LAYER; layer++ )
    for( ; layer < MAX_CU_LAYERS; layer++ )
    {
    {
        m_LayerZcoord[layer] = m_EpoxyThickness;
        m_LayerZcoord[layer] = m_EpoxyThickness;
    }
    }


    // calculate z position for each non copper layer
    // calculate z position for each non copper layer
    for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
    for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; layer_id++ )
    {
    {
        double zpos;
        double zpos;


        switch( layer_id )
        switch( layer_id )
        {
        {
        case ADHESIVE_N_BACK:
        case B_Adhes:
            zpos = zpos_copper_back - 3 * zpos_offset;
            zpos = zpos_copper_back - 3 * zpos_offset;
            break;
            break;


        case ADHESIVE_N_FRONT:
        case F_Adhes:
            zpos = zpos_copper_front + 3 * zpos_offset;
            zpos = zpos_copper_front + 3 * zpos_offset;
            break;
            break;


        case SOLDERPASTE_N_BACK:
        case B_Paste:
            zpos = zpos_copper_back - 1 * zpos_offset;
            zpos = zpos_copper_back - 1 * zpos_offset;
            break;
            break;


        case SOLDERPASTE_N_FRONT:
        case F_Paste:
            zpos = zpos_copper_front + 1 * zpos_offset;
            zpos = zpos_copper_front + 1 * zpos_offset;
            break;
            break;


        case SOLDERMASK_N_BACK:
        case B_Mask:
            zpos = zpos_copper_back - 1 * zpos_offset;
            zpos = zpos_copper_back - 1 * zpos_offset;
            break;
            break;


        case SOLDERMASK_N_FRONT:
        case F_Mask:
            zpos = zpos_copper_front + 1 * zpos_offset;
            zpos = zpos_copper_front + 1 * zpos_offset;
            break;
            break;


        case SILKSCREEN_N_BACK:
        case B_SilkS:
            zpos = zpos_copper_back - 2 * zpos_offset;
            zpos = zpos_copper_back - 2 * zpos_offset;
            break;
            break;


        case SILKSCREEN_N_FRONT:
        case F_SilkS:
            zpos = zpos_copper_front + 2 * zpos_offset;
            zpos = zpos_copper_front + 2 * zpos_offset;
            break;
            break;


        default:
        default:
            zpos = zpos_copper_front +
            zpos = zpos_copper_front + (layer_id - MAX_CU_LAYERS + 4) * zpos_offset;
                   (layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
            break;
            break;
        }
        }


@@ -196,8 +195,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
{
{
    if(  aIsFlipped )
    if(  aIsFlipped )
        return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 );
        return m_LayerZcoord[B_Cu] - ( m_CopperThickness / 2 );
    else
    else
        return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 );
        return m_LayerZcoord[F_Cu] + ( m_CopperThickness / 2 );
}
}
+6 −5
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ public:
    double  m_CurrentZpos;                          // temporary storage of current value of Z position,
    double  m_CurrentZpos;                          // temporary storage of current value of Z position,
                                                    // used in some calculation
                                                    // used in some calculation
private:
private:
    double  m_LayerZcoord[NB_LAYERS];               // Z position of each layer (normalized)
    double  m_LayerZcoord[LAYER_ID_COUNT];          // Z position of each layer (normalized)
    double  m_CopperThickness;                      // Copper thickness (normalized)
    double  m_CopperThickness;                      // Copper thickness (normalized)
    double  m_EpoxyThickness;                       // Epoxy thickness (normalized)
    double  m_EpoxyThickness;                       // Epoxy thickness (normalized)
    double  m_NonCopperLayerThickness;              // Non copper layers thickness
    double  m_NonCopperLayerThickness;              // Non copper layers thickness
@@ -190,9 +190,10 @@ public: INFO3D_VISU();
     */
     */
    int GetLayerObjectThicknessBIU( int aLayerId ) const
    int GetLayerObjectThicknessBIU( int aLayerId ) const
    {
    {
        return aLayerId >= FIRST_NON_COPPER_LAYER ?
        return IsCopperLayer( aLayerId ) ?
                        GetNonCopperLayerThicknessBIU() :
                        GetCopperThicknessBIU() :
                        GetCopperThicknessBIU();
                        GetNonCopperLayerThicknessBIU()
                        ;
    }
    }


    bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
    bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
+1 −1
Original line number Original line Diff line number Diff line
@@ -355,7 +355,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )


    case PCBNEW_LEGACY_EMP:
    case PCBNEW_LEGACY_EMP:
    {
    {
        LAYER_NUM layer = SILKSCREEN_N_FRONT;
        LAYER_NUM layer = F_SilkS;
        int width = 1;
        int width = 1;
        fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
        fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
                 0, 0, 0, 0,
                 0, 0, 0, 0,
+1 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,7 @@ set( PCB_COMMON_SRCS
    eda_text.cpp
    eda_text.cpp
    class_page_info.cpp
    class_page_info.cpp
    pcbcommon.cpp
    pcbcommon.cpp
    lset.cpp
    footprint_info.cpp
    footprint_info.cpp
    ../pcbnew/basepcbframe.cpp
    ../pcbnew/basepcbframe.cpp
    ../pcbnew/class_board.cpp
    ../pcbnew/class_board.cpp
Loading