Exemple #1
0
void PhysicsApplication::handle_event( const SDL_Event& event )
{
    camera_control.handle_event( this, event );

    switch ( event.type )
    {
    case SDL_KEYDOWN:
        switch ( event.key.keysym.sym )
        {
        case KEY_SCREENSHOT:
            take_screenshot();
            break;
        case SDLK_UP:
            speed *= 2;
            break;
        case SDLK_DOWN:
            speed /= 2;
            break;
        case SDLK_SPACE:
            pause = !pause;
            break;
        default:
            break;
        }
    default:
        break;
    }
}
Exemple #2
0
void RaytracerApplication::handle_event( const SDL_Event& event )
{
    int width, height;

    if ( !raytracing ) {
        camera_control.handle_event( this, event );
    }

    switch ( event.type )
    {
    case SDL_KEYDOWN:
        switch ( event.key.keysym.sym )
        {
        case KEY_RAYTRACE:
            get_dimension( &width, &height );
            toggle_raytracing( width, height );
            break;
        case KEY_SCREENSHOT:
            output_image();
            break;
        default:
            break;
        }
    default:
        break;
    }
}
Exemple #3
0
void RaytracerApplication::handle_event( const SDL_Event& event )
{
    int width, height;

    if ( !raytracing ) {
        camera_control.handle_event( this, event );
    }

    switch ( event.type )
    {
    case SDL_KEYDOWN:
        switch ( event.key.keysym.sym )
        {
        case KEY_RAYTRACE:
            get_dimension( &width, &height );
            toggle_raytracing( width, height );
            break;
        case KEY_SEND_PHOTONS:
            raytracer.initialize(&scene, options.num_samples, 0, 0);
            queue_render_photon=true;
            
        case KEY_SCREENSHOT:
            output_image();
            break;
        default:
            break;
        }
    default:
        break;
    }
}
Exemple #4
0
void OpenglApplication::handle_event( const SDL_Event& event )
{
    camera_control.handle_event( this, event );

    // open to add more event handlers
    switch ( event.type )
    {
    case SDL_KEYDOWN:
        switch ( event.key.keysym.sym )
        {
        case KEY_SCREENSHOT:
            take_screenshot();
            break;
		case KEY_PAUSE:
			isUpdateAll = !isUpdateAll;
			project.modifyWaterStatus(isUpdateAll);
			break;
		case KEY_MESH:
			isMeshOnly = !isMeshOnly;
			project.modifyMesh(isMeshOnly);
			break;
		case KEY_TRANSPARENT:
			isTransparent = !isTransparent;
			project.modifyTransparency(isTransparent);
        default:
            break;
        }
    default:
        break;
    }
}
Exemple #5
0
void OpenglApplication::update( real_t dt )
{
    // update camera
    camera_control.update( dt );
    // update project
    project.update( dt );
}
Exemple #6
0
void RaytracerApplication::update( real_t delta_time )
{
    if ( raytracing ) {
        // do part of the raytrace
        if ( !raytrace_finished ) {
            assert( buffer );
            raytrace_finished = raytracer.raytrace( buffer, &delta_time );
        }
    } else {
        // copy camera over from camera control (if not raytracing)
        camera_control.update( delta_time );
        scene.camera = camera_control.camera;
    }
}
Exemple #7
0
void PhysicsApplication::update( real_t delta_time )
{
    // copy camera over from camera control (if not raytracing)
    camera_control.update( delta_time );
    scene.camera = camera_control.camera;

    static const size_t NUM_ITER = 20;

    // step the simulation
    if ( !pause ) {
        real_t step_size = delta_time / NUM_ITER;
        for ( size_t i = 0; i < NUM_ITER; i++ ) {
            scene.update( step_size * speed );
        }
    }
}
Exemple #8
0
void GlslApplication::handle_event( const SDL_Event& event )
{
    camera_control.handle_event( this, event );

    switch ( event.type )
    {
    case SDL_KEYDOWN:
        switch ( event.key.keysym.sym )
        {
        case KEY_SCREENSHOT:
            take_screenshot();
            break;
        default:
            break;
        }
    default:
        break;
    }
}
Exemple #9
0
void GlslApplication::update( real_t dt )
{
    // update camera
    camera_control.update( dt );
}