Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
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
43namespace OGF {
44
45 class RenderingContext;
46
57 class RENDERER_API Overlay {
58 public:
59
60 Overlay(
61 RenderingContext* rendering_context
62 ) : rendering_context_(rendering_context) {
63 }
64
68 void clear();
69
76 void playback();
77
87 void segment(vec2 p1, vec2 p2, Color color, double thickness=1.0);
88
98 void rect(vec2 p1, vec2 p2, Color color, double thickness=1.0);
99
107 void fillrect(vec2 p1, vec2 p2, Color color);
108
119 void circle(vec2 p1, double R, Color color, double thickness=1.0);
120
129 void fillcircle(vec2 p1, double R, Color color);
130
138 void filltriangle(vec2 p1, vec2 p2, vec2 p3, Color color);
139
147 void fillquad(vec2 p1, vec2 p2, vec2 p3, vec2 p4, Color color);
148
149
157 vec2f imgui_to_GL(const vec2f& XY_imgui) const;
158
166 vec2f GL_to_imgui(const vec2f& XY_GL) const;
167
175 vec2f GL_to_imgui(const vec2& XY_GL) const {
176 return GL_to_imgui(vec2f(float(XY_GL.x), float(XY_GL.y)));
177 }
178
179 private:
180 enum PrimitiveType {
181 OVL_SEGMENT =0,
182 OVL_RECT =1,
183 OVL_CIRCLE =2,
184 OVL_TRIANGLE=3,
185 OVL_QUAD =4
186 };
187 struct Primitive {
188 PrimitiveType type;
189 vec2f p[4];
190 float R;
191 float thickness;
192 Numeric::uint32 color;
193 bool filled;
194 };
195
196 void add_primitive(Primitive& prim);
197 vector<Primitive> primitives_;
198 RenderingContext* rendering_context_;
199 };
200
201}
202
203#endif
A display list that memorizes simple graphic primitives to be displayed over the 3D rendering window.
Definition overlay.h:57
void segment(vec2 p1, vec2 p2, Color color, double thickness=1.0)
Adds a segment to the display list.
vec2f GL_to_imgui(const vec2f &XY_GL) const
Converts OpenGL coordinates to Dear ImGui coordinate.
vec2f GL_to_imgui(const vec2 &XY_GL) const
Converts OpenGL coordinates to Dear ImGui coordinate.
Definition overlay.h:175
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.
vec2f imgui_to_GL(const vec2f &XY_imgui) const
Converts Dear ImGui coordinates to OpenGL coordinate.
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.
Helper class for OpenGL context management.
Color types.
Global Graphite namespace.
Definition common.h:76
Definitions common to all include files in the renderer library.