Commit 764b5c11 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Minor code cleanup in 3d viewer (remove dead or useless code). Some minor other fixes.

parent b33fa0cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ public:
    GLuint DisplayCubeforTest();        // Just a test function
    void   SetView3D( int keycode );
    void   DisplayStatus();
    void   Redraw( bool finish = false );
    void   Redraw();
    void   Render();

    /**
+8 −1
Original line number Diff line number Diff line
@@ -52,8 +52,15 @@ void S3D_MATERIAL::SetMaterial()
#if 0
    glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
    glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
#endif
    glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
#endif
}


void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
{
    aMaterial->SetNext( m_Materials );
    m_Materials = aMaterial;
}


+26 −38
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@
#include <3d_draw_basic_functions.h>

// Imported function:
extern void     Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void     CheckGLError();

/* returns true if aLayer should be displayed, false otherwise
@@ -99,7 +98,7 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
}


void EDA_3D_CANVAS::Redraw( bool finish )
void EDA_3D_CANVAS::Redraw()
{
    // SwapBuffer requires the window to be shown before calling
    if( !IsShown() )
@@ -139,11 +138,6 @@ void EDA_3D_CANVAS::Redraw( bool finish )
    else
        CreateDrawGL_List();

    glFlush();

    if( finish )
        glFinish();

    SwapBuffers();
}

@@ -593,9 +587,12 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    }

    // draw modules 3D shapes
    for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
    if( g_Parm_3D_Visu.GetFlag( FL_MODULE )  )
    {
        for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
            module->ReadAndInsert3DComponentShape( this );
    }
}


GLuint EDA_3D_CANVAS::CreateDrawGL_List()
@@ -831,17 +828,9 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )

void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
{
    // Draw module shape: 3D shape if exists (or module outlines if not exists)
    S3D_MASTER* struct3D = m_3D_Drawings;

    if( g_Parm_3D_Visu.GetFlag( FL_MODULE )  )
    {
        double zpos;

        if( IsFlipped() )
            zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true );
        else
            zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( false );
    // 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() );

    glPushMatrix();

@@ -858,15 +847,14 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
        glRotatef( 180.0, 0.0, 0.0, 1.0 );
    }

        for( ; struct3D != NULL; struct3D = struct3D->Next() )
    for( ; shape3D != NULL; shape3D = shape3D->Next() )
    {
            if( struct3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
                struct3D->ReadData();
        if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
            shape3D->ReadData();
    }

    glPopMatrix();
}
}


// Draw 3D pads.
+0 −17
Original line number Diff line number Diff line
@@ -38,9 +38,6 @@
#include "3d_struct.h"
#include "modelparsers.h"

// Imported function:
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );


S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
                                            const wxString aExtension )
@@ -96,9 +93,7 @@ const wxString S3D_MASTER::GetShape3DFullFilename()
int S3D_MASTER::ReadData()
{
    if( m_Shape3DName.IsEmpty() )
    {
        return 1;
    }

    wxString filename = GetShape3DFullFilename();

@@ -135,15 +130,3 @@ int S3D_MASTER::ReadData()

    return -1;
}


int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
{
    char line[512];

    while( GetLine( file, line, LineNum, 512 ) )
    {
    }

    return -1;
}
+1 −8
Original line number Diff line number Diff line
@@ -117,12 +117,7 @@ public:
    S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
    S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }

    void Insert( S3D_MATERIAL* aMaterial )
    {
        aMaterial->SetNext( m_Materials );
        m_Materials = aMaterial;
    }

    void Insert( S3D_MATERIAL* aMaterial );

    void Copy( S3D_MASTER* pattern );
    int  ReadData();
@@ -171,8 +166,6 @@ public:
    STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
    STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }

    int ReadData( FILE* file, int* LineNum );

#if defined(DEBUG)
    void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif
Loading