Commit ea5a03f9 authored by jean-pierre charras's avatar jean-pierre charras

3D viewer: fix very minor issues (better rendering of 3D view).

parent 155a53dc
...@@ -506,7 +506,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) ...@@ -506,7 +506,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
Draw3D_ZaxisCylinder( via->GetStart(), (outer_radius + inner_radius)/2, Draw3D_ZaxisCylinder( via->GetStart(), (outer_radius + inner_radius)/2,
thickness, outer_radius - inner_radius, thickness, outer_radius - inner_radius,
zpos, biu_to_3Dunits ); zpos - (thickness/2), biu_to_3Dunits );
if( layer >= top_layer ) if( layer >= top_layer )
break; break;
} }
...@@ -515,7 +515,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) ...@@ -515,7 +515,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetShape() ); color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetShape() );
SetGLColor( color ); SetGLColor( color );
int height = g_Parm_3D_Visu.GetLayerZcoordBIU(top_layer) - int height = g_Parm_3D_Visu.GetLayerZcoordBIU(top_layer) -
g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ); g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ) - thickness;
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(bottom_layer) + thickness/2; int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(bottom_layer) + thickness/2;
Draw3D_ZaxisCylinder( via->GetStart(), inner_radius + thickness/2, height, Draw3D_ZaxisCylinder( via->GetStart(), inner_radius + thickness/2, height,
......
...@@ -212,7 +212,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysList, ...@@ -212,7 +212,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysList,
return; return;
// Build the 3D data : vertical side // Build the 3D data : vertical side
Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos, false, aBiuTo3DUnits ); Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos - (aThickness / 2), false, aBiuTo3DUnits );
} }
......
...@@ -192,3 +192,19 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) ...@@ -192,3 +192,19 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
m_LayerZcoord[layer_id] = zpos; m_LayerZcoord[layer_id] = zpos;
} }
} }
/* return the Z position of 3D shapes, in 3D Units
* aIsFlipped: true for modules on Front (top) layer, false
* if on back (bottom) layer
* Note: in draw functions, the copper has a thickness = m_CopperThickness
* Vias and tracks are draw with the top side position = m_CopperThickness/2
* and the bottom side position = -m_CopperThickness/2 from the Z layer position
*/
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
{
if( aIsFlipped )
return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 );
else
return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 );
}
...@@ -110,18 +110,11 @@ public: INFO3D_VISU(); ...@@ -110,18 +110,11 @@ public: INFO3D_VISU();
/** /**
* function GetModulesZcoord3DIU * function GetModulesZcoord3DIU
* @return the Z coordinate of the module, in 3D Units * @return the Z position of 3D shapes, in 3D Units
* @param aIsFlipped: true for modules on Front (top) layer, false * @param aIsFlipped: true for modules on Front (top) layer, false
* if on back (bottom) layer * if on back (bottom) layer
* Used to know the Z position of 3D shapes
*/ */
double GetModulesZcoord3DIU( bool aIsFlipped ) double GetModulesZcoord3DIU( bool aIsFlipped );
{
if( aIsFlipped )
return m_LayerZcoord[ADHESIVE_N_BACK] - m_NonCopperLayerThickness;
else
return m_LayerZcoord[ADHESIVE_N_FRONT] + m_NonCopperLayerThickness;
}
/** /**
* function GetLayerZcoordBIU * function GetLayerZcoordBIU
......
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