mirror of https://github.com/CGAL/cgal
Implementation of draw_points
just added the same function as polygon_soup_item and it works perfectly.
This commit is contained in:
parent
585e3adb76
commit
140a6b408a
|
|
@ -852,6 +852,22 @@ void Scene_polyhedron_item::draw_edges(Viewer_interface* viewer) const {
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
Scene_polyhedron_item::draw_points(Viewer_interface* viewer) const {
|
||||
|
||||
glBindVertexArray(vao);
|
||||
|
||||
// tells the GPU to use the program just created
|
||||
glUseProgram(rendering_program);
|
||||
|
||||
uniform_attrib(viewer);
|
||||
|
||||
//draw the points
|
||||
glDrawArrays(GL_POINTS, 0, positions_facets.size()/4);
|
||||
|
||||
// Clean-up
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
Polyhedron*
|
||||
Scene_polyhedron_item::polyhedron() { return poly; }
|
||||
|
|
|
|||
|
|
@ -17,111 +17,111 @@ class QMenu;
|
|||
|
||||
// This class represents a polyhedron in the OpenGL scene
|
||||
class SCENE_POLYHEDRON_ITEM_EXPORT Scene_polyhedron_item
|
||||
: public Scene_item{
|
||||
Q_OBJECT
|
||||
: public Scene_item{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Scene_polyhedron_item();
|
||||
// Scene_polyhedron_item(const Scene_polyhedron_item&);
|
||||
Scene_polyhedron_item(const Polyhedron& p);
|
||||
Scene_polyhedron_item(Polyhedron* const p);
|
||||
~Scene_polyhedron_item();
|
||||
Scene_polyhedron_item();
|
||||
// Scene_polyhedron_item(const Scene_polyhedron_item&);
|
||||
Scene_polyhedron_item(const Polyhedron& p);
|
||||
Scene_polyhedron_item(Polyhedron* const p);
|
||||
~Scene_polyhedron_item();
|
||||
|
||||
Scene_polyhedron_item* clone() const;
|
||||
|
||||
// IO
|
||||
bool load(std::istream& in);
|
||||
bool save(std::ostream& out) const;
|
||||
Scene_polyhedron_item* clone() const;
|
||||
|
||||
// Function for displaying meta-data of the item
|
||||
virtual QString toolTip() const;
|
||||
// IO
|
||||
bool load(std::istream& in);
|
||||
bool save(std::ostream& out) const;
|
||||
|
||||
// Function to override the context menu
|
||||
QMenu* contextMenu();
|
||||
|
||||
// Indicate if rendering mode is supported
|
||||
virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
|
||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||
void draw() const {}
|
||||
virtual void draw(Viewer_interface*) const;
|
||||
virtual void draw_edges() const {}
|
||||
virtual void draw_edges(Viewer_interface* viewer) const;
|
||||
// Function for displaying meta-data of the item
|
||||
virtual QString toolTip() const;
|
||||
|
||||
// Get wrapped polyhedron
|
||||
Polyhedron* polyhedron();
|
||||
const Polyhedron* polyhedron() const;
|
||||
// Function to override the context menu
|
||||
QMenu* contextMenu();
|
||||
|
||||
// Indicate if rendering mode is supported
|
||||
virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
|
||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||
void draw() const {}
|
||||
virtual void draw(Viewer_interface*) const;
|
||||
virtual void draw_edges() const {}
|
||||
virtual void draw_edges(Viewer_interface* viewer) const;
|
||||
void draw_points(Viewer_interface*) const;
|
||||
// Get wrapped polyhedron
|
||||
Polyhedron* polyhedron();
|
||||
const Polyhedron* polyhedron() const;
|
||||
|
||||
// Get dimensions
|
||||
bool isFinite() const { return true; }
|
||||
bool isEmpty() const;
|
||||
Bbox bbox() const;
|
||||
std::vector<QColor>& color_vector() {return colors_;}
|
||||
void set_color_vector_read_only(bool on_off) {plugin_has_set_color_vector_m=on_off;}
|
||||
|
||||
// Get dimensions
|
||||
bool isFinite() const { return true; }
|
||||
bool isEmpty() const;
|
||||
Bbox bbox() const;
|
||||
std::vector<QColor>& color_vector() {return colors_;}
|
||||
void set_color_vector_read_only(bool on_off) {plugin_has_set_color_vector_m=on_off;}
|
||||
|
||||
public slots:
|
||||
virtual void changed();
|
||||
virtual void shading_mode_changed();
|
||||
virtual void selection_changed(bool);
|
||||
void show_only_feature_edges(bool);
|
||||
void enable_facets_picking(bool);
|
||||
void set_erase_next_picked_facet(bool);
|
||||
virtual void changed();
|
||||
virtual void shading_mode_changed();
|
||||
virtual void selection_changed(bool);
|
||||
void show_only_feature_edges(bool);
|
||||
void enable_facets_picking(bool);
|
||||
void set_erase_next_picked_facet(bool);
|
||||
|
||||
void select(double orig_x,
|
||||
double orig_y,
|
||||
double orig_z,
|
||||
double dir_x,
|
||||
double dir_y,
|
||||
double dir_z);
|
||||
void select(double orig_x,
|
||||
double orig_y,
|
||||
double orig_z,
|
||||
double dir_x,
|
||||
double dir_y,
|
||||
double dir_z);
|
||||
|
||||
void update_vertex_indices();
|
||||
void update_facet_indices();
|
||||
void update_halfedge_indices();
|
||||
void update_vertex_indices();
|
||||
void update_facet_indices();
|
||||
void update_halfedge_indices();
|
||||
|
||||
signals:
|
||||
void selected_vertex(void*);
|
||||
void selected_facet(void*);
|
||||
void selected_edge(void*);
|
||||
void selected_halfedge(void*);
|
||||
void item_is_about_to_be_changed(); // emitted in changed()
|
||||
void selected_vertex(void*);
|
||||
void selected_facet(void*);
|
||||
void selected_edge(void*);
|
||||
void selected_halfedge(void*);
|
||||
void item_is_about_to_be_changed(); // emitted in changed()
|
||||
|
||||
private:
|
||||
// Initialization
|
||||
void init();
|
||||
|
||||
private:
|
||||
Polyhedron* poly;
|
||||
// Initialization
|
||||
void init();
|
||||
|
||||
private:
|
||||
typedef Scene_item Base;
|
||||
typedef std::vector<QColor> Color_vector;
|
||||
Polyhedron* poly;
|
||||
|
||||
private:
|
||||
typedef Scene_item Base;
|
||||
typedef std::vector<QColor> Color_vector;
|
||||
|
||||
Color_vector colors_;
|
||||
Color_vector colors_;
|
||||
|
||||
bool show_only_feature_edges_m;
|
||||
bool facet_picking_m;
|
||||
bool erase_next_picked_facet_m;
|
||||
//the following variable is used to indicate if the color vector must not be automatically updated.
|
||||
bool plugin_has_set_color_vector_m;
|
||||
bool show_only_feature_edges_m;
|
||||
bool facet_picking_m;
|
||||
bool erase_next_picked_facet_m;
|
||||
//the following variable is used to indicate if the color vector must not be automatically updated.
|
||||
bool plugin_has_set_color_vector_m;
|
||||
|
||||
std::vector<float> positions_lines;
|
||||
std::vector<float> positions_facets;
|
||||
std::vector<float> normals;
|
||||
std::vector<float> color_lines;
|
||||
std::vector<float> color_facets;
|
||||
std::vector<float> positions_lines;
|
||||
std::vector<float> positions_facets;
|
||||
std::vector<float> normals;
|
||||
std::vector<float> color_lines;
|
||||
std::vector<float> color_facets;
|
||||
|
||||
GLuint rendering_program;
|
||||
GLint location[8];
|
||||
GLuint rendering_program;
|
||||
GLint location[8];
|
||||
|
||||
|
||||
GLuint vertex_shader;
|
||||
GLuint fragment_shader;
|
||||
GLuint program;
|
||||
GLuint vao;
|
||||
GLuint buffer[5];
|
||||
void initialize_buffers();
|
||||
GLuint compile_shaders(void);
|
||||
void compute_normals_and_vertices(void);
|
||||
void uniform_attrib(Viewer_interface*) const;
|
||||
void compute_colors();
|
||||
GLuint vertex_shader;
|
||||
GLuint fragment_shader;
|
||||
GLuint program;
|
||||
GLuint vao;
|
||||
GLuint buffer[5];
|
||||
void initialize_buffers();
|
||||
GLuint compile_shaders(void);
|
||||
void compute_normals_and_vertices(void);
|
||||
void uniform_attrib(Viewer_interface*) const;
|
||||
void compute_colors();
|
||||
|
||||
}; // end class Scene_polyhedron_item
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue