Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
viewportcamera.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 "
viewportcamera.h
"
12
#include "
gui.h
"
13
#include <math.h>
14
#include <
glcomp/glcompbutton.h
>
15
#include <
glcomp/glcomplabel.h
>
16
#include <
glcomp/glcomppanel.h
>
17
#include <
util/alloc.h
>
18
19
static
viewport_camera
*
new_viewport_camera
(
void
) {
20
return
gv_alloc
(
sizeof
(
viewport_camera
));
21
}
22
23
static
viewport_camera
*
add_camera_to_viewport
(
ViewInfo
*vi) {
24
vi->
cameras
=
gv_recalloc
(vi->
cameras
, vi->
camera_count
,
25
vi->
camera_count
+ 1,
26
sizeof
(
viewport_camera
*));
27
vi->
camera_count
++;
28
vi->
cameras
[vi->
camera_count
- 1] =
new_viewport_camera
();
29
vi->
active_camera
= vi->
camera_count
- 1;
30
return
vi->
cameras
[vi->
camera_count
- 1];
31
}
32
33
void
menu_click_add_camera
(
void
)
34
{
35
viewport_camera
*c;
36
/*add test cameras */
37
c =
add_camera_to_viewport
(
view
);
38
c->
targetx
=
view
->
panx
;
39
c->
targety
=
view
->
pany
;
40
c->
targetz
=
view
->
panz
;
41
c->
x
=
view
->
panx
;
42
c->
y
=
view
->
pany
;
43
c->
z
=
view
->
zoom
;
44
45
c->
r
=
view
->
zoom
* -1;
46
}
alloc.h
Memory allocation wrappers that exit on failure.
gv_recalloc
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
Definition
alloc.h:73
gv_alloc
static void * gv_alloc(size_t size)
Definition
alloc.h:47
glcompbutton.h
glcomplabel.h
glcomppanel.h
gui.h
view
ViewInfo * view
Definition
viewport.c:37
_ViewInfo
Definition
smyrnadefs.h:252
_ViewInfo::pany
float pany
Definition
smyrnadefs.h:256
_ViewInfo::camera_count
size_t camera_count
Definition
smyrnadefs.h:306
_ViewInfo::panx
float panx
Definition
smyrnadefs.h:255
_ViewInfo::cameras
viewport_camera ** cameras
Definition
smyrnadefs.h:305
_ViewInfo::zoom
float zoom
Definition
smyrnadefs.h:258
_ViewInfo::panz
float panz
Definition
smyrnadefs.h:257
_ViewInfo::active_camera
size_t active_camera
<number of cameras
Definition
smyrnadefs.h:307
_viewport_camera
Definition
smyrnadefs.h:132
_viewport_camera::targetx
float targetx
Definition
smyrnadefs.h:137
_viewport_camera::targetz
float targetz
Definition
smyrnadefs.h:139
_viewport_camera::targety
float targety
Definition
smyrnadefs.h:138
_viewport_camera::y
float y
Definition
smyrnadefs.h:134
_viewport_camera::z
float z
Definition
smyrnadefs.h:135
_viewport_camera::x
float x
Definition
smyrnadefs.h:133
_viewport_camera::r
float r
Definition
smyrnadefs.h:141
add_camera_to_viewport
static viewport_camera * add_camera_to_viewport(ViewInfo *vi)
Definition
viewportcamera.c:23
new_viewport_camera
static viewport_camera * new_viewport_camera(void)
Definition
viewportcamera.c:19
menu_click_add_camera
void menu_click_add_camera(void)
Definition
viewportcamera.c:33
viewportcamera.h
cmd
smyrna
viewportcamera.c
Generated by
1.9.8