0023000: Improve the way the gradient and textured background is managed in 3d viewer
[occt.git] / src / OpenGl / OpenGl_Polygon.hxx
1 // File:      OpenGl_Polygon.hxx
2 // Created:   13 July 2011
3 // Author:    Sergey ZERCHANINOV
4 // Copyright: OPEN CASCADE 2011
5
6 #ifndef OpenGl_Polygon_Header
7 #define OpenGl_Polygon_Header
8
9 #include <InterfaceGraphic_telem.hxx>
10 #include <Graphic3d_Array1OfVertex.hxx>
11 #include <Graphic3d_TypeOfPolygon.hxx>
12 #include <Aspect_InteriorStyle.hxx>
13
14 #include <OpenGl_Element.hxx>
15
16 struct OPENGL_DISPLAY_PGN;
17
18 struct TEL_POLYGON_DATA
19 {
20   Tint       num_vertices;  /* Number of vertices */
21   Tint       facet_flag;  /* TEL_FA_NONE or TEL_FA_NORMAL */
22   Tint       vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
23   Tint       shape_flag;  /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
24                           TEL_SHAPE_CONVEX  or TEL_SHAPE_CONCAVE */
25   Tint reverse_order; /* 1 if polygon vertex must be display in reverse order */
26   TEL_POINT  fnormal;   /* Facet normal */
27   tel_colour fcolour;   /* Facet colour */
28   tel_point  vertices;    /* Vertices */
29   tel_colour vcolours;    /* Vertex colour values */
30   tel_point  vnormals;    /* Vertex normals */
31   tel_texture_coord vtexturecoord; /* Texture Coordinates */
32   OPENGL_DISPLAY_PGN *dsply;
33   IMPLEMENT_MEMORY_OPERATORS
34 };
35
36 class OpenGl_Polygon : public OpenGl_Element
37 {
38  public:
39
40   OpenGl_Polygon (const Graphic3d_Array1OfVertex& AListVertex,
41                  const Graphic3d_TypeOfPolygon AType);
42   virtual ~OpenGl_Polygon ();
43
44   virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
45
46  protected:
47
48   void draw_polygon_concav (const Handle(OpenGl_Workspace) &AWorkspace, Tint) const;
49
50   void draw_polygon (const Handle(OpenGl_Workspace) &AWorkspace, Tint) const;
51
52   void draw_tmesh (Tint) const;
53
54   void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, const Handle(OpenGl_Workspace) &) const;
55
56   TEL_POLYGON_DATA myData;
57
58  public:
59   IMPLEMENT_MEMORY_OPERATORS
60 };
61
62 #endif //OpenGl_Polygon_Header