Commit 6bfff89f authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

merge tip in, resolve.

parents 2c67c3ff 898ed744
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
boost_root
.downloads-by-cmake
Build
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h
+3 −46
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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;
+22 −5
Original line number Diff line number Diff line
@@ -78,7 +78,11 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
                wxFULL_REPAINT_ON_RESIZE )
{
    m_init   = false;
    m_gllist = 0;

    // Clear all gl list identifiers:
    for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
        m_glLists[ii] = 0;

    // Explicitly create a new rendering context instance for this canvas.
    m_glRC = new wxGLContext( this );

@@ -94,12 +98,25 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS()
}


void EDA_3D_CANVAS::ClearLists()
void EDA_3D_CANVAS::ClearLists( GLuint aGlList )
{
    if( aGlList )
    {
        if( m_glLists[aGlList] > 0 )
            glDeleteLists( m_glLists[aGlList], 1 );

        m_glLists[aGlList] = 0;

        return;
    }

    for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
    {
    if( m_gllist > 0 )
        glDeleteLists( m_gllist, 1 );
        if( m_glLists[ii] > 0 )
            glDeleteLists( m_glLists[ii], 1 );

    m_gllist = 0;
        m_glLists[ii] = 0;
    }
}


+59 −8
Original line number Diff line number Diff line
@@ -50,14 +50,29 @@ class S3D_VERTEX;
class SEGVIA;
class D_PAD;

// We are using GL lists to store layers and other items
// to draw or not
// GL_LIST_ID are the GL lists indexes in m_glLists
enum GL_LIST_ID
{
    GL_ID_BEGIN = 0,
    GL_ID_AXIS = GL_ID_BEGIN,   // list id for 3D axis
    GL_ID_GRID,                 // list id for 3D grid
    GL_ID_BOARD,                // List id for copper layers
    GL_ID_TECH_LAYERS,          // List id for non copper layers (masks...)
    GL_ID_AUX_LAYERS,           // List id for user layers (draw, eco, comment)
    GL_ID_3DSHAPES_SOLID,       // List id for 3D shapes, non transparent entities
    GL_ID_3DSHAPES_TRANSP,      // List id for 3D shapes, transparent entities
    GL_ID_END
};

class EDA_3D_CANVAS : public wxGLCanvas
{
private:
    bool            m_init;
    GLuint          m_gllist;
    GLuint          m_glLists[GL_ID_END];    // GL lists
    wxGLContext*    m_glRC;
    wxRealPoint     m_draw3dOffset;     // offset to draw the 3 mesh.
    wxRealPoint     m_draw3dOffset;     // offset to draw the 3D mesh.
    double          m_ZBottom;          // position of the back layer
    double          m_ZTop;             // position of the front layer

@@ -67,7 +82,15 @@ public:

    EDA_3D_FRAME*   Parent() { return (EDA_3D_FRAME*)GetParent(); }

    void   ClearLists();
    BOARD* GetBoard() { return Parent()->GetBoard(); }

    /**
     * Function ClearLists
     * Clear the display list.
     * @param aGlList = the list to clear.
     * if 0 (default) all lists are cleared
     */
    void   ClearLists( GLuint aGlList = 0 );

    // Event functions:
    void   OnPaint( wxPaintEvent& event );
@@ -81,10 +104,9 @@ public:
    void   OnEnterWindow( wxMouseEvent& event );

    // Display functions
    GLuint DisplayCubeforTest();        // Just a test function
    void   SetView3D( int keycode );
    void   DisplayStatus();
    void   Redraw( bool finish = false );
    void   Redraw();
    void   Render();

    /**
@@ -92,7 +114,7 @@ public:
     * Prepares the parameters of the OpenGL draw list
     * creates the OpenGL draw list items (board, grid ...
     */
    GLuint CreateDrawGL_List();
    void   CreateDrawGL_List();
    void   InitGL();
    void   SetLights();
    void   SetOffset(double aPosX, double aPosY)
@@ -104,11 +126,40 @@ public:
    /**
     * Function BuildBoard3DView
     * Called by CreateDrawGL_List()
     * Fills the OpenGL draw list with board items draw list.
     * 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
     */
    void   BuildBoard3DView();

    void   DrawGrid( double aGriSizeMM );
    /**
     * Function BuildTechLayers3DView
     * Called by CreateDrawGL_List()
     * Populates the OpenGL GL_ID_BOARD draw list with items on tech layers
     */
    void   BuildTechLayers3DView();

    /**
     * Function BuildFootprintShape3DList
     * Called by CreateDrawGL_List()
     * Fills the OpenGL GL_ID_3DSHAPES_SOLID and GL_ID_3DSHAPES_TRANSP
     * draw lists with 3D footprint shapes
     * @param aOpaqueList is the gl list for non transparent items
     * @param aTransparentList is the gl list for non transparent items,
     * which need to be drawn after all other items
     */
    void   BuildFootprintShape3DList( GLuint aOpaqueList,
                                      GLuint aTransparentList);
    /**
     * Function BuildBoard3DAuxLayers
     * Called by CreateDrawGL_List()
     * Fills the OpenGL GL_ID_AUX_LAYERS draw list
     * with items on aux layers only
     */
    void   BuildBoard3DAuxLayers();

    void   Draw3DGrid( double aGriSizeMM );
    void   Draw3DAxis();

    void   Draw3DViaHole( SEGVIA * aVia );
    void   Draw3DPadHole( D_PAD * aPad );

+29 −2
Original line number Diff line number Diff line
@@ -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,
@@ -52,8 +57,29 @@ 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
}

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 )
{
    aMaterial->SetNext( m_Materials );
    m_Materials = aMaterial;
}


@@ -72,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