Esempio n. 1
0
void CLevelGraph::render	()
{
	if (psAI_Flags.test(aiDrawGameGraph)) {
//		if (psHUD_Flags.test(HUD_DRAW))
			draw_game_graph	();
	}

	if (!bDebug && !psAI_Flags.test(aiMotion))
		return;

	if (bDebug && psAI_Flags.test(aiDebug))
		draw_nodes			();

	draw_restrictions		();

	if (psAI_Flags.test(aiCover))
		draw_covers			();

	if (!psHUD_Flags.test(HUD_DRAW))
		return;

	if (psAI_Flags.test(aiMotion))
		draw_objects		();

#ifdef DEBUG
	draw_debug_node			();
#endif
}
Esempio n. 2
0
void	draw_main()
#endif
{
	debugmessage("draw_main","");

	start_time();
	draw_nodes();
	stop_time("draw_main draw_nodes");
	start_time();
	draw_edges();
	stop_time("draw_main draw_edges");
}
Esempio n. 3
0
void Renderer::draw() {
    ci::gl::setMatricesWindow(AdjApp::instance().getWindowSize());
    ci::gl::clear(background_color_);

    ci::gl::pushMatrices();

        Camera::instance().transform_draw();

        draw_connections();
        draw_nodes();

    ci::gl::popMatrices();
}
void Canvas_Delegate_Tests::paint_event()
{
    draw_segment(segment(Point(complex_number(-1.25, -1.5)), Point(complex_number(-1.25, 1.5))));
    draw_segment(segment(Point(complex_number(-1.5, -1.25)), Point(complex_number(1.5, -1.25))));

    draw_incomplete_curve(curve_points_, QColor("blue"));
    draw_nodes(curve_points_, points_radius_, QColor("green"));

    if (is_curve_point_under_mouse_)
    {
        mark_circle(Circle(curve_points_[curve_point_under_mouse_], points_radius_), QColor("red"));
    }
    return;
}
void Canvas_Delegate_Riemann_Mapping::paint_event()
{
    /*if (left_canvas_)
    {
        std::cout << "Entering left Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl;
    }
    else
    {
        std::cout << "Entering right Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl;
    }*/

    if (image_mode_ && *draw_2_curves_flag_ == DRAWING_CURVES && !shower_)
    {
        draw_background_image();
    }


    if (tiling_->nb_vertices()>0 && *draw_2_curves_flag_ == DRAWING_CURVES)
    {
        draw_tiling(*tiling_);
    }

    if ((*draw_2_curves_flag_ == DRAWING_CURVES || !shower_)
            && input_triangulation_->nb_triangles() > 0)
    {
        if (input_triangulation_->nb_triangles() == input_triangulation_->nb_colors())
        {
            if (shower_)
            {
                draw_empty_triangulation(*input_triangulation_);
            }
            else
            {

                if (image_mode_)
                {
                    draw_triangulation_from_image();
                }
                else
                {
                    draw_triangulation(*input_triangulation_);
                }
            }
        }
        else
        {
            std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: tried to draw unfit triangulation" << std::endl;
        }
    }
    else if(shower_)
    {
        if (image_mode_)
        {
            draw_shower_triangulation_from_image();
        }
        else
        {
            draw_triangulation(*output_triangulation_);
        }
    }

    if (is_vertex_highlighted_ && (!is_node_point_under_mouse_) && (!is_node_point_selected_) &&
            (*draw_2_curves_flag_==DRAW_2_CURVES_DONE || !shower_) && (!is_tangent_control_point_under_mouse_))
    {
        //std::cout << "about to hightlight triangle" << std::endl;
        if (*draw_2_curves_flag_ == DRAW_2_CURVES_DONE && shower_)
        {
            if (index_vertex_highlighted_ < output_triangulation_->nb_triangles())
            {
                Triangle T;
                if (output_triangulation_->get_triangle(index_vertex_highlighted_, T))
                {
                    mark_triangle(T, QColor("red"));
                }
            }
            else
            {
                std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: tried to draw a triangle with bad index" << std::endl;
            }
        }
        else
        {
            if (index_vertex_highlighted_ < input_triangulation_->nb_triangles())
            {
                Triangle T;
                if (input_triangulation_->get_triangle(index_vertex_highlighted_, T))
                {
                    mark_triangle(T, QColor("red"));
                }
            }
            else
            {
                std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: tried to draw a triangle with bad index" << std::endl;
            }
        }
        //std::cout << "triangle highlighted" << std::endl;
    }

    draw_nodes(*nodes_, nodes_radius_in_pixels_/scale_);

    if (*draw_curve_flag_==DRAW_CURVE_NODES && nodes_->size()>0)
    {
        mark_circle(Circle((*nodes_)[0], nodes_radius_in_pixels_/scale_), QColor("red"));
        draw_incomplete_curve(*nodes_);
    }
    else
    {
        draw_curve(*curve_);
    }

    if (beziers_mode())
    {
        draw_tangents(*nodes_, *tangent_factors_, 0.8*nodes_radius_in_pixels_/scale_);
    }

    if (is_node_point_under_mouse_)
    {
        if(node_point_under_mouse_<nodes_->size())
        {
            mark_circle(Circle((*nodes_)[node_point_under_mouse_], nodes_radius_in_pixels_/scale_), QColor("green"));
        }
        else
        {
            std::cout << "ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: node index problem" << std::endl;
            throw(QString("ERROR in Canvas_Delegate_Riemann_Mapping::paint_event: node index problem"));
        }
    }

    if (is_tangent_control_point_under_mouse_ && !is_node_point_under_mouse_ && beziers_mode())
    {
        if(tangent_control_point_under_mouse_<nodes_->size() && tangent_factors_->size() == nodes_->size())
        {
            unsigned int i = tangent_control_point_under_mouse_, N = nodes_->size();
            Point T((*nodes_)[i].get_affix() +
                    (*tangent_factors_)[i] * ((*nodes_)[(i+1)%N].get_affix() - (*nodes_)[(N+i-1)%N].get_affix()));
            mark_circle(Circle(T, 0.8*nodes_radius_in_pixels_/scale_), QColor("green"));
        }
        else
        {
            std::cout << "ERROR in Canvas_Delegate_Draw_Curve::paint_event: tangent index problem" << std::endl;
            throw(QString("ERROR in Canvas_Delegate_Draw_Curve::paint_event: tangent index problem"));
        }
    }

    /*if (left_canvas_)
    {
        std::cout << "Leaving left Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl;
    }
    else
    {
        std::cout << "Leaving right Canvas_Delegate_Riemann_Mapping::paint_event" << std::endl;
    }*/
    return;
}