Commit 79a10860 authored by Garth Corral's avatar Garth Corral
Browse files

Merge trunk @ 5288

parents c3a3ac9d 1dc51780
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            return 0;
            return 0;
        }
        }
@@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            return 0;
            return 0;
        }
        }
@@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            return 0;
            return 0;
        }
        }
+9 −9
Original line number Original line Diff line number Diff line
@@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "  } Exit Transform\n" ) );
            // DBG( printf( "  } Exit Transform\n" ) );
            break;
            break;
@@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "  } Exit DEF\n") );
            // DBG( printf( "  } Exit DEF\n") );
            return 0;
            return 0;
@@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "  } Exit Shape\n") );
            // DBG( printf( "  } Exit Shape\n") );
            return 0;
            return 0;
@@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            return 0;
            return 0;
        }
        }
@@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            return 0;
            return 0;
        }
        }
@@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "  } Exit IndexedFaceSet\n") );
            // DBG( printf( "  } Exit IndexedFaceSet\n") );
            return 0;
            return 0;
@@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "    m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
            // DBG( printf( "    m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
            return 0;
            return 0;
@@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "    m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
            // DBG( printf( "    m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
            return 0;
            return 0;
@@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate()
            continue;
            continue;
        }
        }


        if( ( *text == '}' ) )
        if( *text == '}' )
        {
        {
            // DBG( printf( "    m_Point.size: %lu\n", m_model->m_Point.size() ) );
            // DBG( printf( "    m_Point.size: %lu\n", m_model->m_Point.size() ) );
            return 0;
            return 0;
+3 −1
Original line number Original line Diff line number Diff line
@@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData,
{
{
    wxStringTokenizer tokens( aData );
    wxStringTokenizer tokens( aData );


    double x, y, z;
    double x = 0;
    double y = 0;
    double z = 0;


    bool ret = tokens.GetNextToken().ToDouble( &x )
    bool ret = tokens.GetNextToken().ToDouble( &x )
               && tokens.GetNextToken().ToDouble( &y )
               && tokens.GetNextToken().ToDouble( &y )
+28 −11
Original line number Original line Diff line number Diff line
@@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
                // Every coordinate description of the Hershey format has an offset,
                // Every coordinate description of the Hershey format has an offset,
                // it has to be subtracted
                // it has to be subtracted
                point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX;
                point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX;
                point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE;
				// -10 is here to keep GAL rendering consistent with the legacy gfx stuff
                point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE;
                pointList.push_back( point );
                pointList.push_back( point );
            }
            }


@@ -161,25 +162,41 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo


    // Single line height
    // Single line height
    int lineHeight = getInterline( );
    int lineHeight = getInterline( );
    int lineCount = linesCount( aText );
    
    
    // The overall height of all lines of text
    // align the 1st line of text
    double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 );

    switch( m_verticalJustify )
    switch( m_verticalJustify )
    {
    {
    case GR_TEXT_VJUSTIFY_TOP:
        m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) );
        break;

    case GR_TEXT_VJUSTIFY_CENTER:
    case GR_TEXT_VJUSTIFY_CENTER:
        m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) );
        m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) );
        break;
        break;


    case GR_TEXT_VJUSTIFY_BOTTOM:
    case GR_TEXT_VJUSTIFY_BOTTOM:
        m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) );
        break;
        break;


    default:
        break;
    }

    if( lineCount > 1 )
    {
        switch( m_verticalJustify )
        {
        case GR_TEXT_VJUSTIFY_TOP:
        case GR_TEXT_VJUSTIFY_TOP:
            break;
            break;


    default:
        case GR_TEXT_VJUSTIFY_CENTER:
            m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) );
            break;
            break;

        case GR_TEXT_VJUSTIFY_BOTTOM:
            m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) );
            break;
        }
    }
    }


    m_gal->SetIsStroke( true );
    m_gal->SetIsStroke( true );
+22 −9
Original line number Original line Diff line number Diff line
@@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i


    if( col && aNeedMTV )
    if( col && aNeedMTV )
    {
    {
        aMTV = pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2);
        aMTV = -pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2);
    }
    }
    return col;
    return col;
}
}
@@ -231,14 +231,26 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB,
}
}




template<class ShapeAType, class ShapeBType> bool
template<class ShapeAType, class ShapeBType> 
CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
inline bool CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{
{
	return Collide (*static_cast<const ShapeAType*>( aA ),
	return Collide (*static_cast<const ShapeAType*>( aA ),
					*static_cast<const ShapeBType*>( aB ),
					*static_cast<const ShapeBType*>( aB ),
					aClearance, aNeedMTV, aMTV);
					aClearance, aNeedMTV, aMTV);
}
}


template<class ShapeAType, class ShapeBType> 
inline bool CollCaseReversed ( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{
    bool rv = Collide (*static_cast<const ShapeBType*>( aB ),
                       *static_cast<const ShapeAType*>( aA ),
                        aClearance, aNeedMTV, aMTV);
    if(rv && aNeedMTV) 
        aMTV = -aMTV;
    return rv;
}


bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{   
{   
	switch( aA->Type() )
	switch( aA->Type() )
@@ -263,7 +275,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
			switch( aB->Type() )
			switch( aB->Type() )
			{
			{
				case SH_RECT:
				case SH_RECT:
					return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aB, aA, aClearance, aNeedMTV, aMTV );
                    return CollCaseReversed<SHAPE_CIRCLE, SHAPE_RECT>( aA, aB, aClearance, aNeedMTV, aMTV );
                
                
				case SH_CIRCLE:
				case SH_CIRCLE:
					return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
					return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
@@ -273,6 +285,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed


				case SH_SEGMENT:
				case SH_SEGMENT:
                    return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
                    return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
                
                default:
                default:
					break;
					break;
			}
			}
@@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
					return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
					return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );


				case SH_CIRCLE:
				case SH_CIRCLE:
					return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
                    return CollCaseReversed<SHAPE_SEGMENT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );


				case SH_LINE_CHAIN:
				case SH_LINE_CHAIN:
					return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
					return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
Loading