tags:

views:

110

answers:

1

hello, does somebody know how to move the camera to a specific position?

A: 

Just got started with SIO2. Impressive engine.

For reference, in template.mm, in the templateRender() method, once the reference to the camera is there, you can use the _SIO2transform to manipulate the camera.

e.g.

_SIO2camera->_SIO2transform->loc->x += 0.25f;

like so:

//in template.mm
void templateRender( void )
{
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

    glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );

    SIO2camera *_SIO2camera = ( SIO2camera * )sio2ResourceGet( sio2->_SIO2resource,
                                                               SIO2_CAMERA,
                                                               "camera/Camera" );

    if( _SIO2camera )
    {
        _SIO2camera->_SIO2transform->loc->x += 0.25f;


        sio2Perspective( _SIO2camera->fov,
                         sio2->_SIO2window->scl->x / sio2->_SIO2window->scl->y,
                         _SIO2camera->cstart,
                         _SIO2camera->cend );

        sio2WindowEnterLandscape3D();
        {
            sio2CameraRender( _SIO2camera );

            // Render all solid object inside our
            // main SIO2resource handle (in this
            // case just a cube but...)
            sio2ResourceRender( sio2->_SIO2resource,
                                sio2->_SIO2window,
                                _SIO2camera,
                                SIO2_RENDER_SOLID_OBJECT );
        }
        sio2WindowLeaveLandscape3D();
    }

    sio2ResetState();
}
George Profenza