void RenderingQueue::Draw( void ) { m_switches_cost = 0; Renderer* renderer = SingletonPlugin<Renderer>::GetInstance()->m_interface; if( m_target ) { renderer->BeginTarget( m_target ); } else { renderer->BeginScreen(); } if( m_clear_depth ) { renderer->ClearDepth(); } if( m_clear_target ) { renderer->ClearScreen( m_target_clear_color_r, m_target_clear_color_g, m_target_clear_color_b ); } //for( size_t i = 0; i < m_outputqueue.size(); i++ ) for( std::list<Operation>::iterator it = m_outputqueue.begin(); it != m_outputqueue.end(); ++it ) { //Operation curr_operation = m_outputqueue[i]; Operation curr_operation = (*it); switch( curr_operation.type ) { case SET_TEXTURE: renderer->SetTexture( curr_operation.data, curr_operation.texture_stage ); m_switches_cost++; break; case UNSET_TEXTURE: renderer->UnsetTexture( curr_operation.texture_stage ); m_switches_cost++; break; case SET_FX: renderer->SetFx( curr_operation.data ); m_switches_cost++; break; case UNSET_FX: renderer->UnsetFx( curr_operation.data ); m_switches_cost++; break; case SET_MESHE: renderer->SetMeshe( curr_operation.data ); m_switches_cost++; break; case SET_SHADERS_PARAMS: renderer->SetFxShaderParams( curr_operation.shader_params->shader_index, curr_operation.shader_params->param_register, curr_operation.shader_params->param_values ); break; case DRAW_NODE: curr_operation.node->OnDraw(); break; } } if( m_target ) { renderer->EndTarget( m_target ); } else { renderer->EndScreen(); } }