Exemplo n.º 1
0
void RPCCamera::Init(const RPCModel & model, double sx, double sy)
{
   rpcModel = model;
   scaleX = sx;
   scaleY = sy;
   CreateTransforms();
}
Exemplo n.º 2
0
// Creates a particular deserializer based on the config: its loads the external module and calls CreateDeserializer
// factory function for a particular deserializer type.
IDataDeserializerPtr CompositeDataReader::CreateDeserializer(const ConfigParameters& deserializerConfig, bool primary)
{
    typedef bool(*CreateDeserializerFactory) (IDataDeserializer** d, const std::wstring& type, const ConfigParameters& cfg, CorpusDescriptorPtr corpus, bool primary);

    std::string deserializerModule = deserializerConfig("module");
    CreateDeserializerFactory f = (CreateDeserializerFactory)Plugin::Load(deserializerModule, "CreateDeserializer");

    std::wstring deserializerType = deserializerConfig("type");
    IDataDeserializer* d;
    if (!f(&d, deserializerType, deserializerConfig, m_corpus, primary))
    {
        RuntimeError("Cannot create deserializer. Please check module and type in the configuration.");
    }

    // Create transformers if necessary.
    CreateTransforms(deserializerConfig);

    assert(d != nullptr);
    return IDataDeserializerPtr(d);
}
Exemplo n.º 3
0
void RPCCamera::Init(const std::string &filename)
{ 
   rpcModel.Parse(filename); 
   scaleX = scaleY = 1.0;
   CreateTransforms();
}
Exemplo n.º 4
0
/*-----------------------------------------------------------------------------
 *  Draw
 *  The Draw function is the main loop for the Graphics process. Draws each
 *  viewport and the lines within them
 *-----------------------------------------------------------------------------*/
void Draw( void )
{
    char buf[BUF_SIZ];
    GLdouble answer[MATRIX_SIZE];
    GLdouble attempt[MATRIX_SIZE];

    /* Clear the screen ... */
    glClear( GL_COLOR_BUFFER_BIT );

    if(gameComplete)
    {
        DrawText(-25.0, -25.0, DEFAULT_FONT, "GAME OVER! YOU WIN!");
    }
    else if(levelComplete)
    {
        DrawText(-25.0, -25.0, DEFAULT_FONT, "LEVEL COMPLETE!");
    }
    else
    {
        glPushMatrix( );
            /* Draw the Outlines for Transforms */
            glCallList('a');
            glCallList('s');

            /* Draw the Axes */
            glBegin( GL_LINES );
                glColor3f( 0.5, 0.5, 0.5 );
                glVertex3f( 100.0, 0.0, 0.0 );
                glVertex3f(-100.0, 0.0, 0.0 );
                glVertex3f( 0.0, 100.0, 0.0 );
                glVertex3f( 0.0,-100.0, 0.0 );
                glColor3f( 1.0, 1.0, 1.0 );
            glEnd( );
        glPopMatrix( );

        /* Draw the first set of Available Transforms */
        glPushMatrix( );
            /* Move to origin of first list */
            glTranslatef( 115.0, 90.0, 0.0 );

            /* List drawing */
            CreateTransforms( &tlAvailableTransforms, VERTICAL, AVAILABLE );
        glPopMatrix( );

        /* Draw the second set of Used Transforms */
        glPushMatrix( );
            /* Move to origin of first list */
            glTranslatef( -85.0, -120.0, 0.0 );

            /* List drawing */
            CreateTransforms( &tlSelectedTransforms, HORIZONTAL, SELECTED );
        glPopMatrix( );

        glPushMatrix( );
            /* Do all level transforms */
            RunTransformList( &tlLevel );

            /* Create model house */
            glLoadName( 1 );
            glCallList( 'l' );

            /* Get the modelview matrix */
            glGetDoublev( GL_MODELVIEW_MATRIX, answer );
        glPopMatrix( );

        /* Create the new house */
        glPushMatrix(  );
            /* Do all user selected transforms */
            RunTransformList( &tlSelectedTransforms );

            /* Create attempt house */
            glLoadName( HOUSE );
            glCallList( 'h' );

            /* Get the modelview matrix */
            glGetDoublev( GL_MODELVIEW_MATRIX, attempt );
        glPopMatrix( );

        /* Compare the model */
        if(CompareMatrices(answer, attempt))
        {
            levelComplete = TRUE;
            glutPostRedisplay( );
        }
    }

    /* Flush the buffer */
    glutSwapBuffers();

    return;
}