viewportcamera.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include "viewportcamera.h"
  11. #include "gui.h"
  12. #include <math.h>
  13. #include <glcomp/glcompbutton.h>
  14. #include <glcomp/glcomplabel.h>
  15. #include <glcomp/glcomppanel.h>
  16. #include <util/alloc.h>
  17. static viewport_camera *new_viewport_camera(void) {
  18. return gv_alloc(sizeof(viewport_camera));
  19. }
  20. static viewport_camera *add_camera_to_viewport(ViewInfo *vi) {
  21. vi->cameras = gv_recalloc(vi->cameras, vi->camera_count,
  22. vi->camera_count + 1,
  23. sizeof(viewport_camera*));
  24. vi->camera_count++;
  25. vi->cameras[vi->camera_count - 1] = new_viewport_camera();
  26. vi->active_camera = vi->camera_count - 1;
  27. return vi->cameras[vi->camera_count - 1];
  28. }
  29. void menu_click_add_camera(void)
  30. {
  31. viewport_camera *c;
  32. /*add test cameras */
  33. c = add_camera_to_viewport(view);
  34. c->targetx = view->panx;
  35. c->targety = view->pany;
  36. c->targetz = view->panz;
  37. c->x = view->panx;
  38. c->y = view->pany;
  39. c->z = view->zoom;
  40. c->r = view->zoom * -1;
  41. }