Loading 3d-viewer/3d_aux.cpp +3 −46 Original line number Diff line number Diff line Loading @@ -45,16 +45,11 @@ #include <info3d_visu.h> #include <trackball.h> // Exported function: void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ); void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices ) void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices ) { unsigned ii; /* adjust object scale, rotation and offset position */ for( ii = 0; ii < aVertices.size(); ii++ ) for( unsigned ii = 0; ii < aVertices.size(); ii++ ) { aVertices[ii].x *= m_MatScale.x; aVertices[ii].y *= m_MatScale.y; Loading @@ -79,7 +74,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices ) } void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ) void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ) { unsigned ii; GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r; Loading Loading @@ -138,44 +133,6 @@ void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits glEnd(); } GLuint EDA_3D_CANVAS::DisplayCubeforTest() { GLuint gllist = glGenLists( 1 ); glNewList( gllist, GL_COMPILE_AND_EXECUTE ); /* draw six faces of a cube */ glBegin( GL_QUADS ); glNormal3f( 0.0F, 0.0F, 1.0F ); glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F ); glNormal3f( 0.0F, 0.0F, -1.0F ); glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F ); glNormal3f( 0.0F, 1.0F, 0.0F ); glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F ); glNormal3f( 0.0F, -1.0F, 0.0F ); glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F ); glNormal3f( 1.0F, 0.0F, 0.0F ); glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F ); glNormal3f( -1.0F, 0.0F, 0.0F ); glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F ); glEnd(); glEndList(); return gllist; } VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer ) { wxString text; Loading 3d-viewer/3d_canvas.h +0 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ public: void OnEnterWindow( wxMouseEvent& event ); // Display functions GLuint DisplayCubeforTest(); // Just a test function void SetView3D( int keycode ); void DisplayStatus(); void Redraw(); Loading 3d-viewer/3d_class.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -41,9 +41,14 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) : m_Name = name; } void S3D_MATERIAL::SetMaterial() { S3D_MASTER * s3dParent = (S3D_MASTER *) GetParent(); s3dParent->SetLastTransparency( m_Transparency ); if( ! s3dParent->IsOpenGlAllowed() ) return; glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColor4f( m_DiffuseColor.x * m_AmbientIntensity, m_DiffuseColor.y * m_AmbientIntensity, Loading @@ -56,6 +61,20 @@ void S3D_MATERIAL::SetMaterial() #endif } bool S3D_MASTER::IsOpenGlAllowed() { if( m_loadNonTransparentObjects ) // return true for non transparent objects only { if( m_lastTransparency == 0.0 ) return true; } if( m_loadTransparentObjects ) // return true for transparent objects only if( m_lastTransparency != 0.0 ) return true; return false; } void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial ) { Loading @@ -79,6 +98,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) : EDA_ITEM( aParent, NOT_USED ) { m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0; m_lastTransparency = 0.0; m_3D_Drawings = NULL; m_Materials = NULL; m_ShapeType = FILE3D_NONE; Loading 3d-viewer/3d_draw.cpp +35 −15 Original line number Diff line number Diff line Loading @@ -356,7 +356,7 @@ void EDA_3D_CANVAS::BuildBoard3DView() } } // draw graphic items // draw graphic items on copper layers (texts) for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() ) { if( !item->IsOnLayer( layer ) ) Loading @@ -364,11 +364,9 @@ void EDA_3D_CANVAS::BuildBoard3DView() switch( item->Type() ) { case PCB_LINE_T: case PCB_LINE_T: // should not exist on copper layers ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( bufferPolys, 0, segcountforcircle, correctionFactor ); bufferPolys, 0, segcountforcircle, correctionFactor ); break; case PCB_TEXT_T: Loading Loading @@ -505,8 +503,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView() // a fine representation CPOLYGONS_LIST bufferPolys; bufferPolys.reserve( 200000 ); // Reserve for large board (tracks mainly) bufferPolys.reserve( 100000 ); // Reserve for large board CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once allLayerHoles.reserve( 20000 ); Loading @@ -522,11 +519,6 @@ void EDA_3D_CANVAS::BuildTechLayers3DView() wxMessageBox( msg ); } CPOLYGONS_LIST bufferZonesPolys; bufferZonesPolys.reserve( 500000 ); // Reserve for large board ( copper zones mainly ) CPOLYGONS_LIST currLayerHoles; // Contains holes for the current layer int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU(); for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() ) { Loading @@ -544,6 +536,16 @@ void EDA_3D_CANVAS::BuildTechLayers3DView() } } // draw pads holes for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() ) { // Add pad hole, if any D_PAD* pad = module->Pads(); for( ; pad != NULL; pad = pad->Next() ) pad->BuildPadDrillShapePolygon( allLayerHoles, 0, segcountLowQuality ); } // draw graphic items, on technical layers Loading Loading @@ -852,6 +854,7 @@ void EDA_3D_CANVAS::CreateDrawGL_List() #endif } void EDA_3D_CANVAS::BuildFootprintShape3DList( GLuint aOpaqueList, GLuint aTransparentList) { Loading @@ -860,10 +863,21 @@ void EDA_3D_CANVAS::BuildFootprintShape3DList( GLuint aOpaqueList, // which need to be drawn after all other items BOARD* pcb = GetBoard(); glNewList( m_glLists[GL_ID_3DSHAPES_SOLID], GL_COMPILE ); glNewList( aOpaqueList, GL_COMPILE ); bool loadTransparentObjects = false; for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) module->ReadAndInsert3DComponentShape( this ); module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects, loadTransparentObjects ); glEndList(); glNewList( aTransparentList, GL_COMPILE ); loadTransparentObjects = true; for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects, loadTransparentObjects ); glEndList(); } Loading Loading @@ -1055,8 +1069,11 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia ) } void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas ) void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas, bool aAllowNonTransparentObjects, bool aAllowTransparentObjects ) { // Read from disk and draws the footprint 3D shapes if exists S3D_MASTER* shape3D = m_3D_Drawings; double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() ); Loading @@ -1078,6 +1095,9 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas ) for( ; shape3D != NULL; shape3D = shape3D->Next() ) { shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects ); shape3D->SetLoadTransparentObjects( aAllowTransparentObjects ); if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) ) shape3D->ReadData(); } Loading 3d-viewer/3d_draw_basic_functions.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ #include <3d_draw_basic_functions.h> // Imported function: extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits ); extern void TransfertToGLlist( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits ); extern void CheckGLError(); // Number of segments to approximate a circle by segments Loading Loading @@ -116,7 +116,7 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList, coords[3].y = coords[2].y; // only z change // Creates the GL_QUAD Set_Object_Data( coords, aBiuTo3DUnits ); TransfertToGLlist( coords, aBiuTo3DUnits ); } } Loading Loading
3d-viewer/3d_aux.cpp +3 −46 Original line number Diff line number Diff line Loading @@ -45,16 +45,11 @@ #include <info3d_visu.h> #include <trackball.h> // Exported function: void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ); void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices ) void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices ) { unsigned ii; /* adjust object scale, rotation and offset position */ for( ii = 0; ii < aVertices.size(); ii++ ) for( unsigned ii = 0; ii < aVertices.size(); ii++ ) { aVertices[ii].x *= m_MatScale.x; aVertices[ii].y *= m_MatScale.y; Loading @@ -79,7 +74,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices ) } void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ) void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ) { unsigned ii; GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r; Loading Loading @@ -138,44 +133,6 @@ void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits glEnd(); } GLuint EDA_3D_CANVAS::DisplayCubeforTest() { GLuint gllist = glGenLists( 1 ); glNewList( gllist, GL_COMPILE_AND_EXECUTE ); /* draw six faces of a cube */ glBegin( GL_QUADS ); glNormal3f( 0.0F, 0.0F, 1.0F ); glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F ); glNormal3f( 0.0F, 0.0F, -1.0F ); glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F ); glNormal3f( 0.0F, 1.0F, 0.0F ); glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F ); glNormal3f( 0.0F, -1.0F, 0.0F ); glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F ); glNormal3f( 1.0F, 0.0F, 0.0F ); glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F ); glNormal3f( -1.0F, 0.0F, 0.0F ); glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F ); glEnd(); glEndList(); return gllist; } VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer ) { wxString text; Loading
3d-viewer/3d_canvas.h +0 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ public: void OnEnterWindow( wxMouseEvent& event ); // Display functions GLuint DisplayCubeforTest(); // Just a test function void SetView3D( int keycode ); void DisplayStatus(); void Redraw(); Loading
3d-viewer/3d_class.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -41,9 +41,14 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) : m_Name = name; } void S3D_MATERIAL::SetMaterial() { S3D_MASTER * s3dParent = (S3D_MASTER *) GetParent(); s3dParent->SetLastTransparency( m_Transparency ); if( ! s3dParent->IsOpenGlAllowed() ) return; glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColor4f( m_DiffuseColor.x * m_AmbientIntensity, m_DiffuseColor.y * m_AmbientIntensity, Loading @@ -56,6 +61,20 @@ void S3D_MATERIAL::SetMaterial() #endif } bool S3D_MASTER::IsOpenGlAllowed() { if( m_loadNonTransparentObjects ) // return true for non transparent objects only { if( m_lastTransparency == 0.0 ) return true; } if( m_loadTransparentObjects ) // return true for transparent objects only if( m_lastTransparency != 0.0 ) return true; return false; } void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial ) { Loading @@ -79,6 +98,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) : EDA_ITEM( aParent, NOT_USED ) { m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0; m_lastTransparency = 0.0; m_3D_Drawings = NULL; m_Materials = NULL; m_ShapeType = FILE3D_NONE; Loading
3d-viewer/3d_draw.cpp +35 −15 Original line number Diff line number Diff line Loading @@ -356,7 +356,7 @@ void EDA_3D_CANVAS::BuildBoard3DView() } } // draw graphic items // draw graphic items on copper layers (texts) for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() ) { if( !item->IsOnLayer( layer ) ) Loading @@ -364,11 +364,9 @@ void EDA_3D_CANVAS::BuildBoard3DView() switch( item->Type() ) { case PCB_LINE_T: case PCB_LINE_T: // should not exist on copper layers ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( bufferPolys, 0, segcountforcircle, correctionFactor ); bufferPolys, 0, segcountforcircle, correctionFactor ); break; case PCB_TEXT_T: Loading Loading @@ -505,8 +503,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView() // a fine representation CPOLYGONS_LIST bufferPolys; bufferPolys.reserve( 200000 ); // Reserve for large board (tracks mainly) bufferPolys.reserve( 100000 ); // Reserve for large board CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once allLayerHoles.reserve( 20000 ); Loading @@ -522,11 +519,6 @@ void EDA_3D_CANVAS::BuildTechLayers3DView() wxMessageBox( msg ); } CPOLYGONS_LIST bufferZonesPolys; bufferZonesPolys.reserve( 500000 ); // Reserve for large board ( copper zones mainly ) CPOLYGONS_LIST currLayerHoles; // Contains holes for the current layer int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU(); for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() ) { Loading @@ -544,6 +536,16 @@ void EDA_3D_CANVAS::BuildTechLayers3DView() } } // draw pads holes for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() ) { // Add pad hole, if any D_PAD* pad = module->Pads(); for( ; pad != NULL; pad = pad->Next() ) pad->BuildPadDrillShapePolygon( allLayerHoles, 0, segcountLowQuality ); } // draw graphic items, on technical layers Loading Loading @@ -852,6 +854,7 @@ void EDA_3D_CANVAS::CreateDrawGL_List() #endif } void EDA_3D_CANVAS::BuildFootprintShape3DList( GLuint aOpaqueList, GLuint aTransparentList) { Loading @@ -860,10 +863,21 @@ void EDA_3D_CANVAS::BuildFootprintShape3DList( GLuint aOpaqueList, // which need to be drawn after all other items BOARD* pcb = GetBoard(); glNewList( m_glLists[GL_ID_3DSHAPES_SOLID], GL_COMPILE ); glNewList( aOpaqueList, GL_COMPILE ); bool loadTransparentObjects = false; for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) module->ReadAndInsert3DComponentShape( this ); module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects, loadTransparentObjects ); glEndList(); glNewList( aTransparentList, GL_COMPILE ); loadTransparentObjects = true; for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects, loadTransparentObjects ); glEndList(); } Loading Loading @@ -1055,8 +1069,11 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia ) } void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas ) void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas, bool aAllowNonTransparentObjects, bool aAllowTransparentObjects ) { // Read from disk and draws the footprint 3D shapes if exists S3D_MASTER* shape3D = m_3D_Drawings; double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() ); Loading @@ -1078,6 +1095,9 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas ) for( ; shape3D != NULL; shape3D = shape3D->Next() ) { shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects ); shape3D->SetLoadTransparentObjects( aAllowTransparentObjects ); if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) ) shape3D->ReadData(); } Loading
3d-viewer/3d_draw_basic_functions.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ #include <3d_draw_basic_functions.h> // Imported function: extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits ); extern void TransfertToGLlist( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits ); extern void CheckGLError(); // Number of segments to approximate a circle by segments Loading Loading @@ -116,7 +116,7 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList, coords[3].y = coords[2].y; // only z change // Creates the GL_QUAD Set_Object_Data( coords, aBiuTo3DUnits ); TransfertToGLlist( coords, aBiuTo3DUnits ); } } Loading