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