Graphite  Version 3
An experimental 3D geometry processing program
overlay.h
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_OGF_RENDERER_CONTEXT_OVERLAY_H
38 #define H_OGF_RENDERER_CONTEXT_OVERLAY_H
39 
41 #include <geogram/image/color.h>
42 
43 namespace OGF {
44 
53  class RENDERER_API Overlay {
54  public:
58  void clear();
59 
66  void playback();
67 
77  void segment(vec2 p1, vec2 p2, Color color, double thickness=1.0);
78 
88  void rect(vec2 p1, vec2 p2, Color color, double thickness=1.0);
89 
97  void fillrect(vec2 p1, vec2 p2, Color color);
98 
109  void circle(vec2 p1, double R, Color color, double thickness=1.0);
110 
119  void fillcircle(vec2 p1, double R, Color color);
120 
128  void filltriangle(vec2 p1, vec2 p2, vec2 p3, Color color);
129 
137  void fillquad(vec2 p1, vec2 p2, vec2 p3, vec2 p4, Color color);
138 
139  private:
140  enum PrimitiveType {
141  OVL_SEGMENT =0,
142  OVL_RECT =1,
143  OVL_CIRCLE =2,
144  OVL_TRIANGLE=3,
145  OVL_QUAD =4
146  };
147  struct Primitive {
148  PrimitiveType type;
149  float x1,y1,x2,y2,x3,y3,x4,y4,R;
150  float thickness;
151  Numeric::uint32 color;
152  bool filled;
153  };
154  vector<Primitive> primitives_;
155  };
156 
157 }
158 
159 #endif
160 
A display list that memorizes simple graphic primitives to be displayed over the 3D rendering window.
Definition: overlay.h:53
void segment(vec2 p1, vec2 p2, Color color, double thickness=1.0)
Adds a segment to the display list.
void fillquad(vec2 p1, vec2 p2, vec2 p3, vec2 p4, Color color)
Adds a filled triangle to the display list.
void fillrect(vec2 p1, vec2 p2, Color color)
Adds a filled rectangle to the display list.
void rect(vec2 p1, vec2 p2, Color color, double thickness=1.0)
Adds a rectangle to the display list.
void circle(vec2 p1, double R, Color color, double thickness=1.0)
Adds a circle to the display list.
void fillcircle(vec2 p1, double R, Color color)
Adds a filled circle to the display list.
void clear()
Removes all primitives to be displayed.
void playback()
Plays back this overlay to the current ImGui context.
void filltriangle(vec2 p1, vec2 p2, vec2 p3, Color color)
Adds a filled triangle to the display list.
Color types.
uint32_t uint32
Definition: numeric.h:141
Global Graphite namespace.
Definition: common.h:76
Definitions common to all include files in the renderer library.