C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyViewCamera.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t diguyViewCamera
30  **
31  */
32 
33 #ifndef __diguyViewCamera_H
34 #define __diguyViewCamera_H
35 
36 #ifdef SWIG
37 %module diguyViewCamera
38 #else
39 #define CPLUSPLUS_ONLY
40 #endif
41 
42 #ifdef CPLUSPLUS_ONLY
43 class bdiCamera;
44 class diguyViewCamera;
46 
47 #include <stdio.h> // for NULL definition
48 #include <diguy_constants.h>
49 #include <diguy_typedefs.h>
50 
51 
52 #endif
53 
54 
55 #include <declspec_diguy.h>
56 
57 /****************************************************************************/
58 class BDI_DECLSPEC_diguy diguyViewCamera
59 {
60 
61 public:
62 
63 /*****************************************************************************/
73  /*l
74  *b Description:
75  **
76  ** Returns the name of the object. This pointer will never be NULL.
77  **
78  *b Returns:
79  **
80  ** name of the object
81  */
82  const char* get_name();
83 
84  /*l
85  *b Description:
86  **
87  ** Returns the type name of the object. This pointer will never be
88  ** NULL.
89  **
90  *b Returns:
91  **
92  ** type name of the object
93  */
94  const char* get_type_name();
95 
96  /*l
97  *b Description:
98  **
99  ** This sets the distance from the camera to the near plane.
100  **
101  *b Arguments:
102  **
103  *a near_plane - distance to near plane, in meters
104  */
105  void set_near_plane(float near_plane);
106 
107  /*l
108  *b Returns:
109  **
110  ** distance from the camera to the near plane, in meters
111  */
112  float get_near_plane();
113 
114  /*l
115  *b Description:
116  **
117  ** This sets the distance from the camera to the far plane.
118  **
119  *b Arguments:
120  **
121  *a far_plane - distance to far plane, in meters
122  */
123  void set_far_plane(float far_plane);
124 
125  /*l
126  *b Returns:
127  **
128  ** distance from the camera to the far plane, in meters
129  */
130  float get_far_plane();
131 
132  /*l
133  *b Description:
134  **
135  ** This sets the field-of-view of the current camera.
136  **
137  *b Arguments:
138  **
139  *a fov - field-of-view, in degrees
140  */
141  void set_fov(float fov);
142 
143  /*l
144  *b Description:
145  **
146  ** This sets the maximum field-of-view of the current camera. This
147  ** affects the FOV that can be set via set_fov.
148  **
149  *b Arguments:
150  **
151  *a fov - max field-of-view, in degrees
152  */
153  void set_max_fov(float fov);
154 
155  /*l
156  *b Description:
157  **
158  ** This sets the minimum field-of-view of the current camera. This
159  ** affects the FOV that can be set via set_fov.
160  **
161  *b Arguments:
162  **
163  *a fov - min field-of-view, in degrees
164  */
165  void set_min_fov(float fov);
166 
167  /*l
168  *b Returns:
169  **
170  ** field-of-view of the camera, in degrees
171  */
172  float get_fov();
173 
174  /*l
175  *b Returns:
176  **
177  ** min field-of-view of the camera, in degrees
178  */
179  float get_min_fov();
180 
181  /*l
182  *b Returns:
183  **
184  ** max field-of-view of the camera, in degrees
185  */
186  float get_max_fov();
187 
188  /*l
189  *b Description:
190  **
191  ** This function sets the aspect ratio of the camera.
192  **
193  *b Arguments:
194  **
195  *a aspect - aspect ratio; 1.3333 (4/3) is the default
196  */
197  void set_aspect(float aspect);
198 
199  /*l
200  *b Returns:
201  **
202  ** aspect ratio of the camera
203  */
204  float get_aspect();
205 
206  /*l
207  *b Description:
208  **
209  ** This function sets the position of the camera.
210  **
211  *b Arguments:
212  **
213  *a x, y, z - position in meters from the origin
214  */
215  void set_position(float x, float y, float z);
216 
217  /*l
218  *b Returns:
219  **
220  ** x position, in meters from the origin
221  */
222  float get_position_x();
223 
224  /*l
225  *b Returns:
226  **
227  ** y position, in meters from the origin
228  */
229  float get_position_y();
230 
231  /*l
232  *b Returns:
233  **
234  ** z position, in meters from the origin
235  */
236  float get_position_z();
237 
238  /*l
239  *b Description:
240  **
241  ** This function sets the desired position of the camera. The camera will
242  ** interpolate over time to this position.
243  **
244  *b Arguments:
245  **
246  *a x, y, z - position in meters from the origin
247  */
248  void set_desired_position(float x, float y, float z, bool preserve_fix = false);
249 
250  /*l
251  *b Description:
252  **
253  ** This function sets the orientation of the camera. Note that this
254  ** affects the fix.
255  **
256  ** *NOTE*: Pitch angles are positive for looking down, not up!
257  **
258  *b Arguments:
259  **
260  *a yaw - rotation about z axis, in degrees
261  *a roll - rotation about x axis, in degrees
262  *a pitch - rotation about y axis, in degrees
263  */
264  void set_orientation(float yaw, float roll, float pitch);
265 
266  /*l
267  *b Description:
268  **
269  ** This function sets the roll of the camera.
270  **
271  *b Arguments:
272  **
273  *a roll - rotation about x axis, in radians
274  */
275  void set_orientation_roll(float roll);
276 
277  /*l
278  *b Returns:
279  **
280  ** rotation about z axis, in degrees
281  */
282  float get_orientation_yaw();
283 
284  /*l
285  *b Returns:
286  **
287  ** rotation about x axis, in degrees
288  */
289  float get_orientation_roll();
290 
291  /*l
292  *b Returns:
293  **
294  ** rotation about y axis, in degrees
295  */
296  float get_orientation_pitch();
297 
298  /*l
299  *b Description:
300  **
301  ** Sets the lower limit of the camera pitch *up*. Default is
302  ** very close to -90 degrees.
303  **
304  ** *NOTE*: Pitch angles are positive for looking down, not up!
305  **
306  *b Arguments:
307  **
308  *a limit - rotation about y axis, in degrees
309  */
310  void set_pitch_lower_limit(float limit);
311 
312  /*l
313  *b Returns:
314  **
315  ** lower limit of the camera pitch (up/down)
316  */
317  float get_pitch_lower_limit();
318 
319  /*l
320  *b Description:
321  **
322  ** Sets the upper limit of the camera pitch *down*. Default is
323  ** very close to 90 degrees.
324  **
325  ** *NOTE*: Pitch angles are positive for looking down, not up!
326  **
327  *b Arguments:
328  **
329  *a limit - rotation about y axis, in degrees
330  */
331  void set_pitch_upper_limit(float limit);
332 
333  /*l
334  *b Returns:
335  **
336  ** upper limit of the camera pitch (up/down)
337  */
338  float get_pitch_upper_limit();
339 
340  /*l
341  *b Returns:
342  **
343  ** 1 if pitch has limits, 0 if not
344  */
345  int get_pitch_has_limits();
346 
347  /*l
348  *b Description:
349  **
350  ** This function sets the distance from the position to the fix
351  ** point. Note that this affects the fix values.
352  **
353  *b Arguments:
354  **
355  *a distance - distance in meters
356  */
357  void set_distance(float distance);
358 
359  /*l
360  *b Description:
361  **
362  ** This function sets the maximum allowed distance from the position
363  ** to the fix point.
364  **
365  *b Arguments:
366  **
367  *a distance - distance in meters; set to -1 if no max to be used
368  */
369  void set_max_track_distance(float distance);
370 
371  /*l
372  *b Description:
373  **
374  ** This function sets the minimum allowed distance from the position
375  ** to the fix point.
376  **
377  *b Arguments:
378  **
379  *a distance - distance in meters; set to -1 if no min to be used
380  */
381  void set_min_track_distance(float distance);
382 
383  /*l
384  *b Returns:
385  **
386  ** distance from position to fix point, in meters
387  */
388  float get_distance();
389 
390  /*l
391  *b Returns:
392  **
393  ** minimum allowed tracking distance, in meters; will be less than
394  ** zero if not applicable
395  */
396  float get_min_track_distance();
397 
398  /*l
399  *b Returns:
400  **
401  ** maximum allowed tracking distance, in meters; will be less than
402  ** zero if not applicable
403  */
404  float get_max_track_distance();
405 
406  /*l
407  *b Description:
408  **
409  ** This function sets the fix point of the camera. Note that this
410  ** affects the orientation.
411  **
412  *b Arguments:
413  **
414  *a x, y, z - position in meters from the origin
415  */
416  void set_fix(float x, float y, float z);
417 
418  /*l
419  *b Returns:
420  **
421  ** fix point in x, in meters
422  */
423  float get_fix_x();
424 
425  /*l
426  *b Returns:
427  **
428  ** fix point in y, in meters
429  */
430  float get_fix_y();
431 
432  /*l
433  *b Returns:
434  **
435  ** fix point in z, in meters
436  */
437  float get_fix_z();
438 
439  /*l
440  *b Description:
441  **
442  ** This function sets the desired fix point of the camera. The camera
443  ** will interpolate to there from its current fix over time.
444  **
445  *b Arguments:
446  **
447  *a x, y, z - position in meters from the origin
448  */
449  void set_desired_fix(float x, float y, float z);
450 
451  /*l
452  *b Description:
453  **
454  ** This function sets the movement mode of the camera.
455  **
456  ** In DI-Guy Scenario in Camera Input Mode, the movement mode of the
457  ** camera determines what will happen when mouse buttons are pressed
458  ** in the view window.
459  **
460  *b Arguments:
461  **
462  *a move_mode - new movement mode of the camera; enumeration
463  *a of type diguyViewCameraMoveMode
464  **
465  *a DIGUY_CAMERA_MOVE_FORWARD - left mouse press moves camera
466  *a forward, right mouse press moves
467  *a camera back
468  *a DIGUY_CAMERA_MOVE_SIDEWAYS - left mouse press moves camera
469  *a left, right mouse press moves
470  *a camera right
471  *a DIGUY_CAMERA_MOVE_VERTICAL - left mouse press moves camera
472  *a up, right mouse press moves
473  *a camera down
474  **
475  *b Returns:
476  **
477  ** 0 on success, -1 on failure
478  */
479  int set_move_mode(diguyViewCameraMoveMode move_mode);
480 
481  /*l
482  *b Returns:
483  **
484  ** the most recent setting made by set_move_mode()
485  */
486  diguyViewCameraMoveMode get_move_mode();
487 
488  /*l
489  *b Description:
490  **
491  ** This function sets the movement speed of the camera when the
492  ** camera is translating due to user input.
493  **
494  ** In DI-Guy Scenario in Camera Input Mode, the movement speed of the
495  ** camera determines how fast the camera will move when mouse buttons
496  ** are pressed in the view window.
497  **
498  *b Arguments:
499  **
500  *a speed - speed of camera movement is meters per second
501  **
502  *b Returns:
503  **
504  ** 0 on success, -1 on failure
505  */
506  int set_speed(float speed);
507 
508  /*l
509  *b Returns:
510  **
511  ** the most recent setting made by set_speed()
512  */
513  float get_speed();
514 
515  /*l
516  *b Description:
517  **
518  ** This function increases the movement speed of the camera
519  ** when the camera is translating due to user input. The
520  ** increase is typically by a factor of 2.
521  **
522  *b Returns:
523  **
524  ** 0 on success, -1 on failure
525  */
526  int increase_speed();
527 
528  /*l
529  *b Description:
530  **
531  ** This function decreases the movement speed of the camera
532  ** when the camera is translating due to user input. The
533  ** decrease is typically by a factor of 2.
534  **
535  *b Returns:
536  **
537  ** 0 on success, -1 on failure
538  */
539  int decrease_speed();
540 
541  /*l
542  *b Description:
543  **
544  ** This function sets the projection mode of the camera.
545  **
546  ** In DI-Guy Scenario in Camera Input Mode, the movement
547  ** mode of the camera determines what will happen when
548  ** mouse buttons are pressed in the view window.
549  **
550  *b Arguments:
551  **
552  *a projection_mode - new projection mode of the camera;
553  *a enumeration of type
554  *a diguyViewCameraProjectionMode
555  **
556  *a DIGUY_CAMERA_PROJECTION_PERSPECTIVE - standard perspective
557  *a camera, can move and
558  *a rotate freely
559  *a DIGUY_CAMERA_PROJECTION_PLANVIEW_XY - always views in negative
560  *a Z direction
561  *a DIGUY_CAMERA_PROJECTION_PLANVIEW_XZ - always views in negative
562  *a Y direction
563  *a DIGUY_CAMERA_PROJECTION_PLANVIEW_YZ - always views in negative
564  *a X direction
565  **
566  */
567  int set_projection_mode(diguyViewCameraProjectionMode projection_mode);
568 
569  /*l
570  *b Returns:
571  **
572  ** the most recent setting made by set_projection_mode()
573  */
574  diguyViewCameraProjectionMode get_projection_mode();
575 
576 
577 /*****************************************************************************/
587  /*l
588  *b Description:
589  **
590  ** Loads the specified settings into this camera.
591  **
592  *b Returns:
593  **
594  ** 0 on success, -1 on failure
595  */
596  int load_settings(const char* settings_name);
597 
598  /*l
599  *b Description:
600  **
601  ** Loads the specified settings into this camera.
602  **
603  *b Returns:
604  **
605  ** 0 on success, -1 on failure
606  */
607  int load_settings(diguyViewCameraSettings* settings);
608 
609  /*l
610  *b Description:
611  **
612  ** This function applies this camera's settings.
613  **
614  *i OpenGL Version:
615  **
616  ** This function sets the current viewpoint in these
617  ** environments based on information in this camera.
618  **
619  *i Direct3D Version:
620  **
621  ** This function has no effect. The viewpoint in
622  ** these environments must be set manually.
623  */
624  void apply_settings();
625 
626 
627 /*****************************************************************************/
704  /*l
705  *b Description:
706  **
707  ** This function sets the position of this camera using
708  ** double precision floating point numbers. The numbers
709  ** will be converted internally into a DI-Guy far position.
710  **
711  *b Arguments:
712  **
713  *a x - x position, in meters
714  *a y - y position, in meters
715  *a z - z position, in meters
716  */
717  void set_position_double(double x, double y, double z);
718 
719  /*l
720  *b Description:
721  **
722  ** This function returns the world-space position of this
723  ** camera. These values are computed from the DI-Guy
724  ** far position of the camera. The results are placed into
725  ** the passed pointers.
726  **
727  *b Arguments:
728  **
729  *a x - x position, in meters
730  *a y - y position, in meters
731  *a z - z position, in meters
732  */
733  void get_position_double(double* x, double* y, double* z);
734 
735  /*l
736  *b Description:
737  **
738  ** This function returns the world-space origin of the far
739  ** position segment the camera is in. This segment origin
740  ** plus the position segment offset returned by
741  ** get_position_segment_offset() yields the final world-space
742  ** position of the camera.
743  **
744  ** The results are placed into the passed pointers.
745  **
746  *b Arguments:
747  **
748  *a x - x component of origin, in meters
749  *a y - y component of origin, in meters
750  *a z - z component of origin, in meters
751  */
752  void get_segment_origin(float* x, float* y, float* z);
753 
754  /*l
755  *b Description:
756  **
757  ** This function returns the far position segment offset
758  ** part of the camera's position. The results are placed
759  ** into the passed pointers.
760  **
761  *b Arguments:
762  **
763  *a x - x component of segment offset, in meters
764  *a y - y component of segment offset, in meters
765  *a z - z component of segment offset, in meters
766  */
767  void get_position_segment_offset(float* x, float* y, float* z);
768 
769  /*l
770  *b Description:
771  **
772  ** This function returns the far position offset portion of
773  ** the camera's fix point. The results are placed into the
774  ** passed pointers.
775  **
776  *b Arguments:
777  **
778  *a x - x component of fix segment offset, in meters
779  *a y - y component of fix segment offset, in meters
780  *a z - z component of fix segment offset, in meters
781  */
782  void get_fix_segment_offset(float* x, float* y, float* z);
783 
784  /*l
785  *b Description:
786  **
787  ** This function sets the fix point of the camera using
788  ** double precision floating point numbers. The numbers
789  ** will be converted internally into a DI-Guy far position. Note
790  ** that this affects the orientation.
791  **
792  *b Arguments:
793  **
794  *a x - x position, in meters
795  *a y - y position, in meters
796  *a z - z position, in meters
797  */
798  void set_fix_double(double x, double y, double z);
799 
800 /*****************************************************************************/
810  /*l
811  *b Description:
812  **
813  ** This function sets the name of the character the camera should
814  ** look at, if such an character can be found. This will cause
815  ** fix values to change over time.
816  **
817  ** By default the camera will look at the idealized position of
818  ** the character (a spot on the ground typically under the center
819  ** of gravity for human characters). To look at a particular part
820  ** of a character, call set_track_link_name().
821  **
822  ** The spot looked at on a link can be offset by calling
823  ** set_track_offset(). Whether the offset is in world coordinates
824  ** or character-local coordinates is controlled by a call to
825  ** set_track_offset_is_in_world_coordinates().
826  **
827  *b Arguments:
828  **
829  *a track_name - name of character to look at, or NULL if no character
830  *a is to be tracked
831  **
832  **
833  *b C++ Example
834  **
835  ** The following example shows how to use some of the pose
836  ** functions.
837  **
838  *e //
839  *e // Get a pointer to the primary view's camera, and
840  *e // to the first character.
841  *e //
842  *e diguyViewCamera* camera = scenario->get_scenario_camera();
843  *e diguyCharacter* character = scenario->get_character_at_index(0);
844  *e
845  *e //
846  *e // Look just a little bit above the character's head.
847  *e //
848  *e camera->set_track_name(character->get_name());
849  *e camera->set_track_link_name("cervical");
850  *e camera->set_track_offset(0.0f, 0.0f, 0.1f);
851  */
852  void set_track_name(const char* track_name);
853 
854  /*l
855  *b Returns:
856  **
857  ** name of character to be looked at; see set_track_name()
858  */
859  const char* get_track_name();
860 
861  /*l
862  *b Description:
863  **
864  ** This function sets the name of the group the camera will track.
865  **
866  *b Arguments:
867  **
868  *a track_name - name of group to look at; pass NULL to un-set track
869  *a group
870  */
871  void set_track_group_name(const char* track_name);
872 
873  /*l
874  *b Returns:
875  **
876  ** name of group to be looked at; see set_track_group_name()
877  */
878  const char* get_track_group_name();
879 
880  /*l
881  *b Description:
882  **
883  ** This function sets the name of the link to be tracked on
884  ** the character specified by set_track_name(). See
885  ** set_track_name() for more information.
886  **
887  *b Arguments:
888  **
889  *a track_link_name - name of link to look at, or NULL if the base
890  *a link is to be tracked
891  */
892  void set_track_link_name(const char* track_link_name);
893 
894  /*l
895  *b Returns:
896  **
897  ** name of link to be looked at; see set_track_link_name()
898  */
899  const char* get_track_link_name();
900 
901  /*l
902  *b Description:
903  **
904  ** This function sets the offset of the track position on
905  ** the character specified by set_track_name(). See
906  ** set_track_name() for more information.
907  **
908  ** Whether the offset is in world coordinates or character-local
909  ** coordinates is controlled by a call to
910  ** set_track_offset_is_in_world_coordinates().
911  **
912  *b Arguments:
913  **
914  *a x, y, z - offset, in meters, of track point
915  */
916  void set_track_offset(float x, float y, float z);
917 
918  /*l
919  *b Returns:
920  **
921  ** x component of track offset; see set_track_offset()
922  */
923  float get_track_offset_x();
924 
925  /*l
926  *b Returns:
927  **
928  ** y component of track offset; see set_track_offset()
929  */
930  float get_track_offset_y();
931 
932  /*l
933  *b Returns:
934  **
935  ** z component of track offset; see set_track_offset()
936  */
937  float get_track_offset_z();
938 
939  /*l
940  *b Description:
941  **
942  ** This function sets whether the offset of the track
943  ** position is character-relative (pass 0) or in
944  ** world coordinates (pass 1).
945  **
946  ** Default value is 0.
947  **
948  *b Arguments:
949  **
950  *a value - pass 0 for character-relative, 0 for world coordinates
951  */
952  void set_track_offset_is_in_world_coordinates(int value);
953 
954  /*l
955  *b Returns:
956  **
957  ** the most recent setting made by set_track_offset_is_in_world_coordinates().
958  */
959  int get_track_offset_is_in_world_coordinates();
960 
961  /*l
962  *b Description:
963  **
964  ** This function sets the name of the entity this camera should
965  ** look from, if such an entity can be found. This will cause
966  ** position values to change over time.
967  **
968  *b Arguments:
969  **
970  *a dolly_name - name of entity to look from, or NULL if no entity
971  *a is to influence camera position
972  */
973  void set_dolly_name(const char* dolly_name);
974 
975  /*l
976  *b Description:
977  **
978  ** This function sets the name of the character the camera should
979  ** look from, if such an character can be found. This will cause
980  ** position values to change over time.
981  **
982  *b Arguments:
983  **
984  *a dolly_name - name of character to look from, or NULL if no character
985  *a is to influence camera position
986  */
987  const char* get_dolly_name();
988 
989  /*l
990  *b Description:
991  **
992  ** This function sets the offset of the dolly position on
993  ** the character specified by set_dolly_name(). See
994  ** set_dolly_name() for more information.
995  **
996  ** Whether the offset is in world coordinates or character-local
997  ** coordinates is controlled by a call to
998  ** set_dolly_offset_is_in_world_coordinates().
999  **
1000  *b Arguments:
1001  **
1002  *a x, y, z - offset, in meters, of dolly point
1003  */
1004  void set_dolly_offset(float x, float y, float z);
1005 
1006  /*l
1007  *b Returns:
1008  **
1009  ** x component of track offset; see set_dolly_offset()
1010  */
1011  float get_dolly_offset_x();
1012 
1013  /*l
1014  *b Returns:
1015  **
1016  ** y component of track offset; see set_dolly_offset()
1017  */
1018  float get_dolly_offset_y();
1019 
1020  /*l
1021  *b Returns:
1022  **
1023  ** z component of track offset; see set_dolly_offset()
1024  */
1025  float get_dolly_offset_z();
1026 
1027  /*l
1028  *b Description:
1029  **
1030  ** This function sets the name of the link to be dollied on
1031  ** the character specified by set_dolly_name().
1032  **
1033  *b Arguments:
1034  **
1035  *a dolly_link_name - name of link to look from, or NULL if the
1036  *a position link is to influence camera position
1037  */
1038  void set_dolly_link_name(const char* dolly_link_name);
1039 
1040  /*l
1041  *b Returns:
1042  **
1043  ** name of link to be looked from; see set_dolly_link_name()
1044  */
1045  const char* get_dolly_link_name();
1046 
1047  /*l
1048  *b Description:
1049  **
1050  ** This function sets whether the offset of the dolly
1051  ** position is character-relative (pass 0) or in
1052  ** world coordinates (pass 1).
1053  **
1054  ** Default value is 0.
1055  **
1056  *b Arguments:
1057  **
1058  *a value - pass 0 for character-relative, 0 for world coordinates
1059  */
1060  void set_dolly_offset_is_in_world_coordinates(int value);
1061 
1062  /*l
1063  *b Returns:
1064  **
1065  ** the most recent setting made by
1066  ** set_dolly_offset_is_in_world_coordinates().
1067  */
1068  int get_dolly_offset_is_in_world_coordinates();
1069 
1070  /*l
1071  *b Returns:
1072  **
1073  ** if DI-Guy Scenario is rendering simplified 2D representations of
1074  ** characters.
1075  */
1076  int get_symbolic_view();
1077 
1078 
1079 /*****************************************************************************/
1085  /*l
1086  *b Description:
1087  **
1088  ** This is an enumeration of the different callbacks
1089  ** that can be registered with add_callback() and
1090  ** add_callback_script().
1091  **
1092  *b Usable From:
1093  **
1094  *- - C++
1095  *- - Script
1096  */
1097  enum {
1098  CALLBACK_ID_SETTINGS_CHANGED = 1
1099  };
1100 
1101 #ifdef CPLUSPLUS_ONLY
1102 
1103  /*l
1104  *b Description:
1105  **
1106  ** This function adds a user callback.
1107  **
1108  *b Arguments:
1109  **
1110  *a callback - pointer to function with prototype
1111  *a diguyViewCameraCallback (typedefed above)
1112  *a callback_id - integer id of when this callback is to be called
1113  *a callback_params - struct containing additional parameters
1114  *a needed by some callbacks; actual type depends
1115  *a on callback_id
1116  *a callback_user_data - pointer for user's own use; DI-Guy will
1117  *a do nothing to the contents of this pointer
1118  *a beyond passing it back when the callback is
1119  *a invoked
1120  **
1121  ** callback_id should be one of the following values:
1122  **
1123  *i CALLBACK_ID_SETTINGS_CHANGED
1124  **
1125  ** This callback will be called if the current settings of this
1126  ** camera change
1127  **
1128  ** Callbacks return a value of type diguyCallbackReturn,
1129  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
1130  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
1131  ** of the function will not be called; the callback is asserting
1132  ** that it has done everything necessary for the function call.
1133  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
1134  ** handler for the function will be called after the callback.
1135  **
1136  *b Returns:
1137  **
1138  ** 0 on success, -1 on failure
1139  */
1140  int add_callback(int callback_id,
1141  diguyViewCameraCallback* callback,
1142  void* callback_params = 0,
1143  void* callback_user_data = 0);
1144 
1145  /*l
1146  *b Description:
1147  **
1148  ** This function removes a user callback. All callbacks matching
1149  ** the specified callback_id and callback function will be removed.
1150  **
1151  *b Arguments:
1152  **
1153  *a callback_id - integer id of when this callback is to be called
1154  *a callback - pointer to function with prototype
1155  *a diguyViewCameraCallback (typedefed above)
1156  **
1157  *b Returns:
1158  **
1159  ** 0 on success, -1 on failure
1160  */
1161  int remove_callback(int callback_id,
1162  diguyViewCameraCallback* callback);
1163 
1164  /*l
1165  *b Description:
1166  **
1167  ** This function removes a user callback. All callbacks matching
1168  ** the specified callback_id and callback_user_data pointer will
1169  ** be removed.
1170  **
1171  *b Arguments:
1172  **
1173  *a callback_id - integer id of when this callback is to be called
1174  *a callback_user_data - pointer for user's own use
1175  **
1176  *b Returns:
1177  **
1178  ** 0 on success, -1 on failure
1179  */
1180  int remove_callback_with_user_data(int callback_id,
1181  void* callback_user_data);
1182 
1183 #endif
1184 
1185 /*****************************************************************************/
1190  /*l
1191  *b Description:
1192  **
1193  ** This function adds a user callback script. Callback scripts can
1194  ** be removed with remove_callback_script().
1195  **
1196  *b Arguments:
1197  **
1198  *a callback_id - integer id of the callback
1199  *a callback_script - script text of callback to be added
1200  *a callback_script_type - the type of script contained in
1201  *a callback_script
1202  **
1203  ** If NULL is passed for callback_script_type, a default script type
1204  ** will be derived based on the default script interpreter of the
1205  ** scenario.
1206  **
1207  *i lua specific:
1208  **
1209  ** When the script is called, the object for which it is being called
1210  ** will be in the callback_object local.
1211  **
1212  ** To pass NULL when calling from a lua script, use nil.
1213  **
1214  *b Returns:
1215  **
1216  ** 0 on success, -1 on failure
1217  */
1218  int add_callback_script(int callback_id,
1219  const char* callback_script,
1220  const char* callback_script_type = NULL);
1221 
1222  /*l
1223  *b Description:
1224  **
1225  ** This function removes a user callback script previously added with
1226  ** add_callback_script().
1227  **
1228  *b Arguments:
1229  **
1230  *a callback_id - integer id of the callback
1231  *a callback_script - script text of callback previously added
1232  *a callback_script_type - the type of script contained in
1233  *a callback_script
1234  **
1235  ** If NULL is passed for callback_script, all callback
1236  ** scripts whose ids match callback_id and whose types match
1237  ** callback_script_type will be removed.
1238  **
1239  ** If NULL is passed for callback_script_type, a default script type
1240  ** will be derived based on the default script interpreter of the
1241  ** scenario.
1242  **
1243  *i lua specific:
1244  **
1245  ** To pass NULL when calling from a lua script, use nil.
1246  **
1247  *b Returns:
1248  **
1249  ** 0 on success, -1 on failure
1250  */
1251  int remove_callback_script(int callback_id,
1252  const char* callback_script,
1253  const char* callback_script_type = NULL);
1254 
1255 
1256 /****************************************************************************/
1257 /****************************************************************************/
1258 /****************************************************************************/
1270 /****************************************************************************/
1271 /****************************************************************************/
1272 /****************************************************************************/
1273 
1274  /*l
1275  *b Description:
1276  **
1277  ** Sets number of degrees by which the camera FOV should change
1278  ** whenever the user moves the mouse wheel.
1279  **
1280  *b Arguments:
1281  **
1282  *a fov_change - change to FOV in degrees
1283  **
1284  */
1285  void set_speed_fov_degrees_per_wheel_click(float fov_change);
1286 
1287  /*l
1288  *b Description:
1289  **
1290  ** Gets the number of degrees by which the camera FOV should change
1291  ** whenever the user moves the mouse wheel.
1292  **
1293  *b Returns:
1294  **
1295  ** change to FOV, in degrees
1296  */
1297  float get_speed_fov_degrees_per_wheel_click();
1298 
1299  /*l
1300  *b Description:
1301  **
1302  ** Sets how fast the camera should move in various flyaround modes.
1303  **
1304  *b Arguments:
1305  **
1306  *a speed - flying speed in meters per second
1307  */
1308  void set_speed_meters_per_second(float speed);
1309 
1310  /*l
1311  *b Description:
1312  **
1313  ** Gets how fast the camera should move in various flyaround modes.
1314  **
1315  *b Returns:
1316  **
1317  ** speed in meters per second
1318  */
1319  float get_speed_meters_per_second();
1320 
1321  /*l
1322  *b Description:
1323  **
1324  ** Sets whether the camera should smoothly servo to its new desired
1325  ** position/heading (as opposed to instantly popping there).
1326  **
1327  *b Arguments:
1328  **
1329  *a require - 0 for smooth servoing
1330  */
1331  void set_require_smooth_servo(int require);
1333  /*l
1334  *b Description:
1335  **
1336  ** Gets whether the camera should smoothly servo to its new desired
1337  ** position/heading (as opposed to instantly popping there).
1338  **
1339  *b Returns:
1340  **
1341  ** 1 if smooth servoing is required; 0 if not
1342  */
1343  int get_require_smooth_servo();
1344 
1345  /*l
1346  *b Description:
1347  **
1348  ** Sets a factor that determines how smoothly the camera should servo.
1349  ** If a high number (e.g. 10.0), the camera will servo quickly. If
1350  ** a low number (e.g. 1.0), it will servo more slowly.
1351  **
1352  *b Arguments:
1353  **
1354  *a modifier
1355  */
1356  void set_servo_time_modifier( float modifier );
1357 
1358  /*l
1359  *b Returns:
1360  **
1361  ** The servo modifier time that determines how smoothly the camera
1362  ** should servo.
1363  */
1364  float get_servo_time_modifier();
1365 
1366  /*l
1367  *b Description:
1368  **
1369  ** Sets if the camera mover should make an effort to avoid obstacles
1370  ** that block visibility while a character or group is being tracked.
1371  **
1372  *b Arguments:
1373  **
1374  *a avoids - true for avoidance
1375  */
1376  void set_track_camera_avoids_obstacles(int avoid);
1377 
1378  /*l
1379  *b Description:
1380  **
1381  ** Gets whether the camera mover should make an effort to avoid
1382  ** obstacles that block visibility while a character or group is
1383  ** being tracked.
1384  **
1385  *b Returns:
1386  **
1387  ** 1 if obstacle avoidance should be attempted
1388  */
1389  int get_track_camera_avoids_obstacles();
1390 
1391  /*l
1392  *b Description:
1393  **
1394  ** Sets if the camera should not respond to mouse drags. Responding
1395  ** is the default.
1396  **
1397  *b Arguments:
1398  **
1399  *a avoids - 1 to ignore mouse drags; 0 if not
1400  */
1401  void set_ignore_mouse_drags(int ignore);
1402 
1403  /*l
1404  *b Description:
1405  **
1406  ** Gets whether the camera should ignore mouse drags.
1407  **
1408  *b Returns:
1409  **
1410  ** 1 if mouse drags are to be ignored; 0 if not
1411  */
1412  int get_ignore_mouse_drags();
1413 
1414 #ifdef CPLUSPLUS_ONLY
1415  /*l
1416  *b Description:
1417  **
1418  ** Allows the diguy camera to build an internal frustum needed for
1419  ** doing character and scene object culling. projection_matrix and
1420  ** model_matrix should be pointers to 16 floats in OpenGL style matrix
1421  ** format.
1422  **
1423  *b This function is not callable from lua.
1424  */
1425  void update_frustum(float* proj_matrix, float* model_matrix);
1426 
1427 #endif
1428 
1433 #ifdef CPLUSPLUS_ONLY
1434 
1435  bdiCamera* get_scripted_object() {return m_camera;}
1436 
1437 private:
1438 
1439  /*l
1440  ** A private constructor.
1441  */
1442  diguyViewCamera(bdiCamera* camera);
1443 
1444  /*l
1445  ** A pointer to internal data.
1446  */
1447  bdiCamera* m_camera;
1448 
1449  friend class bdiCamera;
1450 
1451 #endif
1452 
1453 };
1454 
1455 #endif /* __diguyViewCamera_H */
1456