//=============================================================================

#ifndef GRAPHENE_CORRESPONDENCES_NODE_H
#define GRAPHENE_CORRESPONDENCES_NODE_H

//=============================================================================

#include <graphene/scene_graph/Object_node.h>
#include <graphene/geometry/Point_set.h>
#include <graphene/surface_mesh/algorithms/templatefitting/types/Correspondence.h>

#include <set>

//=============================================================================

namespace graphene {
namespace scene_graph {

//=============================================================================


class Correspondences_node : public Object_node
{
public:

    typedef graphene::geometry::Point_set Point_set;


public:

    typedef graphene::surface_mesh::Correspondence Correspondence;
    Correspondences_node(std::vector<Correspondence>& correspondences, const std::string& _name = "Correspondences");
    virtual ~Correspondences_node();

    void draw(gl::GL_state* _gl);
    Bounding_box bbox() const;

    void update_correspondences();

    void initialize_buffers();

    std::string info() const;

protected:

    std::vector<Correspondence>& correspondences_;

    const Vec3f  color_;
    const Vec3f  selection_color_;


private:

    // OpenGL buffers
    GLuint vertex_array_object_;
    GLuint vertex_buffer_;
    GLuint normal_buffer_;
    GLuint color_buffer_;

    GLuint selection_index_buffer_;

};


//=============================================================================
} // namespace scene_graph
} // namespace graphene
//=============================================================================
#endif // GRAPHENE_CORRESPONDENCES_NODE_H
//=============================================================================
