Beispiel #1
0
/*
 * Run engine until stop() is called.
 *
 * The virtual member frame() will be called once for
 * each control system frame. pre_render() and
 * post_render() will be called before/after the engine
 * renders each video frame.
 */
void gfxengine_t::run()
{
	open();
	show();
	start_engine();
	is_running = 1;
	double toframe = 0.0f;
	double fdt = 1.0f;
	cs_engine_advance(csengine, 0);
	while(is_running)
	{
		int t = (int)SDL_GetTicks();
		int dt = t - last_tick;
		last_tick = t;
		if(abs(dt) > 500)
			last_tick = t;
		if(dt > 250)
			dt = (int)ticks_per_frame;
		if(_timefilter)
			fdt += (dt - fdt) * _timefilter;
		else
			fdt = ticks_per_frame;
		toframe += fdt / ticks_per_frame;
		cs_engine_advance(csengine, toframe);
		pre_render();
		window->select();
		cs_engine_render(csengine);
		post_render();
		if(_autoinvalidate)
			window->invalidate();
		flip();
	}
	stop_engine();
}
Beispiel #2
0
    bool renderer::render(const crowd & people, const platform::tstring & text)
    {
        if (!pre_render()) { return false; }

        D3DXMATRIX skel_transform;
        ::D3DXMatrixScaling(&skel_transform, 0.5, 0.5, 0.5);
        
        for (crowd::size_type i = 0; i < people.size(); ++i)
        {
            skeleton s = people.person(i);
            draw_skeleton(*s.bind_pose(), *s.structure(), visuals, skel_transform);
        }

        if (scene_visual->reflective())
        {
            pipeline.culling(D3DCULL_CCW);
            D3DXMATRIX invert_transform;
            ::D3DXMatrixScaling(&invert_transform, 1.0f, -1.0f, 1.0f);
            D3DXMATRIX reflection_transform;
            ::D3DXMatrixMultiply(&reflection_transform, &skel_transform, &invert_transform);
       
            for (crowd::size_type i = 0; i < people.size(); ++i)
            {
                skeleton s = people.person(i);
                draw_skeleton(*s.bind_pose(), *s.structure(), visuals, reflection_transform);
            }

            pipeline.culling();
        }

        return post_render(text);
    }
void TileCallbackBase::post_render(const Frame& frame)
{
    const CanvasProperties& frame_props = frame.image().properties();

    for (size_t ty = 0; ty < frame_props.m_tile_count_y; ++ty)
    {
        for (size_t tx = 0; tx < frame_props.m_tile_count_x; ++tx)
            post_render(frame, tx, ty);
    }
}
Beispiel #4
0
void Renderer::render_frame()
{
	begin_frame();
	
	if (scene_to_render != nullptr)
	{
		pre_render();

		gbuffer_render();

		main_render();

		post_render();
	}

	gui.render_frame();

	end_frame();
}