Graphviz 14.1.2~dev.20260118.1035
Loading...
Searching...
No Matches
glexpose.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include "config.h"
12
13#include "glexpose.h"
14#include "draw.h"
15#include "topviewfuncs.h"
16#include <glcomp/glutils.h>
17#include "topfisheyeview.h"
19#include "arcball.h"
20#include "hotkeymap.h"
21#include "polytess.h"
22#include <stdbool.h>
23#include <stdint.h>
24
25static void drawRotatingAxis(void)
26{
27 static GLUquadricObj *quadratic;
28 float AL = 45;
29
30 if (get_mode(view) != MM_ROTATE)
31 return;
32
33 if (!quadratic) {
34 quadratic = gluNewQuadric(); // Create A Pointer To The Quadric Object
35 gluQuadricNormals(quadratic, GLU_SMOOTH); // Create Smooth Normals
36 gluQuadricDrawStyle(quadratic, GLU_LINE);
37
38
39 }
40
41 glPushMatrix();
42 glLoadIdentity();
43 glMultMatrixf(view->arcball->Transform.M); /*arcball transformations , experimental */
44 glLineWidth(3);
45 glBegin(GL_LINES);
46 glColor3f(1, 1, 0);
47
48 glVertex3f(0, 0, 0);
49 glVertex3f(0, AL, 0);
50
51 glVertex3f(0, 0, 0);
52 glVertex3f(AL, 0, 0);
53
54 glVertex3f(0, 0, 0);
55 glVertex3f(0, 0, AL);
56
57 glEnd();
58 glColor4f(0, 1, 0, 0.3f);
59 gluSphere(quadratic, AL, 20, 20);
60 glLineWidth(1);
61 glPopMatrix();
62
63
64}
65
66
67
68/*
69 refreshes camera settings using view parameters such as pan zoom etc
70 if a camera is selected viewport is switched to 3D
71 params:ViewInfo , global view variable defined in viewport.c
72 return value:always 1
73*/
74static int glupdatecamera(ViewInfo * vi)
75{
76 if (vi->active_camera == SIZE_MAX)
77 glTranslated(-vi->panx, -vi->pany, 0);
78
79
80 /*toggle to active camera */
81 else {
82 glMultMatrixf(vi->arcball->Transform.M); /*arcball transformations , experimental */
83 glTranslated(-vi->cameras[vi->active_camera]->targetx,
84 -vi->cameras[vi->active_camera]->targety, 0);
85 }
86 vi->clipX1=0;
87 vi->clipX2=0;
88 vi->clipY1=0;
89 vi->clipY2=0;
90 GetOGLPosRef(1, vi->h - 5, &vi->clipX1, &vi->clipY1);
91 GetOGLPosRef(vi->w - 1, 1, &vi->clipX2, &vi->clipY2);
92
93 if (vi->active_camera == SIZE_MAX) {
94 glScaled(1 / vi->zoom * -1, 1 / vi->zoom * -1, 1 / vi->zoom * -1);
95 } else {
96 glScaled(1 / vi->cameras[vi->active_camera]->r,
97 1 / vi->cameras[vi->active_camera]->r,
98 1 / vi->cameras[vi->active_camera]->r);
99 }
100
101
102 return 1;
103}
104
105/*
106 draws grid (little dots , with no use)
107 params:ViewInfo , global view variable defined in viewport.c
108 return value:none
109*/
110static void glexpose_grid(ViewInfo * vi)
111{
112 //drawing grids
113 if (vi->gridVisible) {
114 glPointSize(1);
115 glBegin(GL_POINTS);
116 glColor4d(vi->gridColor.R, vi->gridColor.G, vi->gridColor.B,
117 vi->gridColor.A);
118 for (double x = vi->bdxLeft; x <= vi->bdxRight; x += vi->gridSize) {
119 for (double y = vi->bdyBottom; y <= vi->bdyTop; y += vi->gridSize) {
120 glVertex3d(x, y, 0);
121 }
122 }
123 glEnd();
124 }
125}
126
127/*
128 draws active graph depending on graph type
129 params:ViewInfo , global view variable defined in viewport.c
130 return value:1 if there is a graph to draw else 0
131*/
133{
134
135 if (vi->activeGraph > -1) {
136 if (!vi->Topview->fisheyeParams.active)
138 else {
140 }
141
142 return 1;
143 }
144 return 0;
145}
146
148{
149 static bool doonce;
150 if (!glupdatecamera(vi))
151 return 0;
152
153 if (vi->activeGraph >= 0) {
154 if (!doonce) {
155 doonce = true;
158 }
159 }
160 else
161 return 0;
162
163
164
165 glexpose_grid(vi);
166 drawBorders(vi);
171
172 /*DEBUG*/ return 1;
173}
void draw_selpoly(glCompPoly_t *selPoly)
Definition draw.c:393
void drawBorders(ViewInfo *vi)
Definition draw.c:348
void glCompSetDraw(glCompSet *s)
Definition glcompset.c:230
static int glupdatecamera(ViewInfo *vi)
Definition glexpose.c:74
static void drawRotatingAxis(void)
Definition glexpose.c:25
static void glexpose_grid(ViewInfo *vi)
Definition glexpose.c:110
static int glexpose_drawgraph(ViewInfo *vi)
Definition glexpose.c:132
int glexpose_main(ViewInfo *vi)
Definition glexpose.c:147
void GetOGLPosRef(int x, int y, float *X, float *Y)
Definition glutils.c:21
#define SIZE_MAX
Definition gmlscan.c:347
node NULL
Definition grammar.y:181
int get_mode(ViewInfo *v)
Definition hotkeymap.c:168
ViewInfo * view
Definition viewport.c:40
#define MM_ROTATE
Definition smyrnadefs.h:41
Matrix4fT Transform
Definition arcball.h:423
ArcBall_t * arcball
Definition smyrnadefs.h:331
topview * Topview
Definition smyrnadefs.h:305
double bdxRight
Definition smyrnadefs.h:283
float clipX2
Definition smyrnadefs.h:253
double bdyBottom
Definition smyrnadefs.h:283
double zoom
Definition smyrnadefs.h:250
double bdyTop
Definition smyrnadefs.h:282
glCompSet * widgets
Definition smyrnadefs.h:324
float gridSize
Definition smyrnadefs.h:276
int activeGraph
Definition smyrnadefs.h:292
viewport_camera ** cameras
Definition smyrnadefs.h:297
double bdxLeft
Definition smyrnadefs.h:282
int gridVisible
Definition smyrnadefs.h:274
double panx
Definition smyrnadefs.h:248
double pany
Definition smyrnadefs.h:249
float clipY1
Definition smyrnadefs.h:253
float clipX1
Definition smyrnadefs.h:253
glCompColor gridColor
Definition smyrnadefs.h:262
float clipY2
Definition smyrnadefs.h:253
size_t active_camera
<number of cameras
Definition smyrnadefs.h:299
glCompPoly_t selPoly
Definition smyrnadefs.h:206
struct topview::@22 fisheyeParams
int active
Definition smyrnadefs.h:214
selection sel
Definition smyrnadefs.h:235
void btnToolZoomFit_clicked(GtkWidget *widget, void *user_data)
void drawtopologicalfisheye(topview *t)
void renderSmGraph(topview *t)
float M[16]
Definition arcball.h:110