C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyApp.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 /*********************************************************************/
34 #ifndef __diguyApp_H
35 #define __diguyApp_H
36 
37 #ifdef SWIG
38 %module diguyApp
39 #else
40 #define CPLUSPLUS_ONLY
41 #endif
42 
43 #ifdef CPLUSPLUS_ONLY
44 
45 typedef int (*diguyModuleFunctionVoid)();
46 class bdiScenarioApp;
51 class diguyLoadManager;
52 class diguyLogChannel;
53 class diguyVariable;
54 class diguyViewPainter;
55 
56 #include <declspec_diguy.h>
57 #include <diguy_typedefs.h>
58 #include <diguy_constants.h>
59 // for NULL
60 #include <stdlib.h>
61 
62 #endif
63 
64 
65 /****************************************************************************/
66 class BDI_DECLSPEC_diguy diguyApp
67 {
68 
69 public:
70 /*****************************************************************************/
82  /*l
83  *b Description:
84  **
85  ** This static function returns a pointer to the DI-Guy
86  ** application. All functions below can then be called
87  ** through this pointer.
88  **
89  *b Returns:
90  **
91  ** a pointer of type diguyApp
92  **
93  *b C++ Example:
94  **
95  *e diguyApp* app = diguyApp::get_app();
96  **
97  */
98  static diguyApp* get_app();
99 
100  /*l
101  *b Returns:
102  **
103  ** number of scenarios in the app
104  */
105  int get_num_scenarios();
106 
107  /*l
108  *b Returns:
109  **
110  ** pointer of type diguyScenario; NULL if no
111  ** scenario at the specified index
112  **
113  *b Arguments:
114  **
115  *a index - index of the scenario; indices start at 0
116  */
117  diguyScenario* get_scenario_at_index(int index);
118 
119  /*l
120  *b Returns:
121  **
122  ** number of blend functions available
123  */
124  int get_num_blend_functions();
125 
126  /*l
127  *b Returns:
128  **
129  ** name of blend function at specified index; NULL if no blend
130  ** function at specified index
131  **
132  *b Arguments:
133  **
134  *a index - index of the blend function; indices start at 0
135  */
136  const char* get_blend_function_name_at_index(int index);
137 
138  /*l
139  *b Description:
140  **
141  ** This function returns whether or not the application is in debug
142  ** mode. Useful for choosing which versions of shared libraries to
143  ** load.
144  **
145  *b Returns:
146  **
147  ** 1 if app is in debug mode; 0 if not
148  */
149  int is_debug();
150 
151  /*l
152  *b Description:
153  **
154  ** This function returns whether or not the DI-Guy SDK is being used
155  ** inside of DI-Guy Scenario or as an embedded C++ library.
156  **
157  *b Returns:
158  **
159  ** 1 if being used as a library; 0 if not
160  */
161  int is_api_mode();
162 
163  /*l
164  *b Description:
165  **
166  ** This function returns whether or not the specified module is
167  ** currently enabled.
168  **
169  *b Returns:
170  **
171  ** 1 if module is enabled; 0 if not
172  */
173  int is_module_enabled(const char* module_name);
174 
175  /*l
176  *b Returns:
177  **
178  ** pointer of type diguyScenario; NULL if no current scenario
179  */
180  diguyScenario* get_current_scenario();
181 
182 
183 /*****************************************************************************/
193  /*l
194  *b Returns:
195  **
196  ** the path to the base directory of the DI-Guy installation;
197  ** this is typically set by the environment variable DIGUY
198  */
199  static const char* get_diguy_base_dir_path();
200 
201  /*l
202  *b Returns:
203  **
204  ** the path to a subdirectory of the DI-Guy installation;
205  ** this is typically derived from the environment variable
206  ** DIGUY, but is sometimes overridden by other environment
207  ** variables
208  **
209  *b Arguments:
210  **
211  *a subdir - name of the subdirectory
212  */
213  static const char* get_diguy_subdir_path(const char* subdir);
214 
215 
216 /*****************************************************************************/
226  /*l
227  *b Description:
228  **
229  ** Gets a pointer to the exercise interface. If DI-Guy is not
230  ** on the network, the returned pointer will be NULL.
231  **
232  *b Returns:
233  **
234  ** pointer of type diguyExerciseInterface on success,
235  ** NULL on failure or if not on the network
236  */
237  diguyExerciseInterface* get_exercise_interface();
238 
239 
240 /*****************************************************************************/
245 #ifdef CPLUSPLUS_ONLY
246 
247  /*l
248  *b Description:
249  **
250  ** This function sets a default user callback that will be added
251  ** to all new scenarios. See diguyScenario::add_callback() for
252  ** details.
253  */
254  int add_default_scenario_callback(int callback_id,
255  diguyScenarioCallback* callback,
256  void* callback_params = 0,
257  void* callback_user_data = 0,
258  int remove_on_scenario_load = 1);
259 
260  /*l
261  *b Description:
262  **
263  ** This function removes a default user callback previously added by
264  ** add_default_scenario_callback(). See
265  ** diguyScenario::remove_callback() for details.
266  **
267  *b Returns:
268  **
269  ** 0 on success, -1 on failure
270  */
271  int remove_default_scenario_callback(int callback_id,
272  diguyScenarioCallback* callback);
273 
274  /*l
275  *b Description:
276  **
277  ** This function removes a default user callback previously added by
278  ** add_default_scenario_callback(). See
279  ** diguyScenario::remove_callback_with_user_data() for details.
280  */
281  int remove_default_scenario_callback_with_user_data(int callback_id,
282  void* callback_user_data);
283 
284 #endif
285 
286 /*****************************************************************************/
290  /*l
291  *b Description:
292  **
293  ** This function adds a default scenario callback script.
294  ** The callback script will be added to all new scenarios.
295  ** See diguyScenario::add_callback_script() for
296  ** more details.
297  **
298  *b Returns:
299  **
300  ** 0 on success, -1 on failure
301  */
302  int add_default_scenario_callback_script(int callback_id,
303  const char* callback_script,
304  const char* callback_script_type,
305  int remove_on_scenario_load = 1);
306 
307  /*l
308  *b Description:
309  **
310  ** This function removes a default scenario callback script.
311  ** See diguyScenario::remove_callback_script() for
312  ** more details.
313  **
314  *b Returns:
315  **
316  ** 0 on success, -1 on failure
317  */
318  int remove_default_scenario_callback_script(int callback_id,
319  const char* callback_script,
320  const char* callback_script_type);
321 
322 
323 /*****************************************************************************/
334 #ifdef CPLUSPLUS_ONLY
335 
336  /*l
337  *b Description:
338  **
339  ** This function is analogous to the
340  ** diguyScenario::register_character_event_handler() function, but
341  ** is for scenarios rather than characters.
342  **
343  ** The registered event handler can be mapped to an event via the
344  ** DI-Guy Scenario UI, or by the function
345  ** diguyScenario::map_event_handler_to_callback_id().
346  **
347  ** It can also be manually invoked by the function call
348  ** diguyScenario::manually_invoke_event_handler().
349  **
350  *b Callable From:
351  **
352  *- - C++
353  */
354  int register_scenario_event_handler(const char* handler_name,
355  diguyScenarioCallback* callback,
356  void* callback_user_data = 0);
357 
358 #endif
359 
360  /*l
361  *b Description:
362  **
363  ** This function is analogous to the
364  ** diguyScenario::register_character_event_handler_from_library()
365  ** function, but is for scenarios rather than characters.
366  **
367  ** The registered event handler can be mapped to an event via the
368  ** DI-Guy Scenario UI, or by the function
369  ** diguyScenario::map_event_handler_to_callback_id().
370  **
371  ** It can also be manually invoked by the function call
372  ** diguyScenario::manually_invoke_event_handler().
373  */
374  int register_scenario_event_handler_from_library(const char* handler_name,
375  const char* library_name,
376  const char* function_name,
377  void* callback_user_data = 0);
378 
379  /*l
380  *b Description:
381  **
382  ** This function is analogous to the
383  ** diguyScenario::register_character_event_handler_script()
384  ** function, but is for scenarios rather than characters.
385  **
386  ** The registered event handler can be mapped to an event via the
387  ** DI-Guy Scenario UI, or by the function
388  ** diguyScenario::map_event_handler_to_callback_id().
389  **
390  ** It can also be manually invoked by the function call
391  ** diguyScenario::manually_invoke_event_handler().
392  */
393  int register_scenario_event_handler_script(const char* handler_name,
394  const char* handler_script,
395  const char* handler_script_type = NULL);
396 
397  /*l
398  *b Description:
399  **
400  ** This function is analogous to the
401  ** diguyScenario::has_registered_character_event_handler()
402  ** function, but is for scenarios rather than characters.
403  */
404  int has_registered_scenario_event_handler(const char* handler_name);
405 
406  /*l
407  *b Description:
408  **
409  ** This function is analogous to the
410  ** diguyScenario::unregister_character_event_handler()
411  ** function, but is for scenarios rather than characters.
412  */
413  int unregister_scenario_event_handler(const char* handler_name);
414 
415 
416 /*****************************************************************************/
611  /*l
612  *b Description:
613  **
614  ** This function adds a new dynamic library plugin to the app.
615  ** Plugins work within DI-Guy Scenario as well as the DI-Guy SDK.
616  **
617  *b Arguments:
618  **
619  *a plugin_name - name of the plugin; should be dynamic
620  *a library name without the extension
621  *a required_by_scenario - if set to 1, this plugin is required
622  *a for proper execution of this scenario;
623  *a when the scenario is loaded this plugin
624  *a will be loaded as well if it is not
625  *a already active; default value is 0
626  *a unload_on_scenario_close - if set to 1, this plugin will be
627  *a unloaded if this scenario is closed
628  *a or a new scenario is opened; default
629  *a value is 0
630  *a accepts_mouse_input - if set to 1, this plugin will receive
631  *a mouse events via the mouse plugin
632  *a functions when the input mode is
633  *a "Plugin"; default value is 1
634  **
635  *b Returns:
636  **
637  ** 0 on success, -1 on failure
638  **
639  *i Windows Specific:
640  **
641  ** The DLL should be placed in a directory that is in the path, or in
642  ** the same directory as the DI-Guy Scenario executable.
643  **
644  ** The DLL version of DI-Guy Scenario or the SDK must be used for
645  ** plugins to work.
646  **
647  ** See complete overview at \ref diguyScenarioPluginOverview
648  */
649  int load_plugin(const char* plugin_name,
650  int required_by_scenario = 0,
651  int unload_on_scenario_close = 0,
652  int accepts_mouse_input = 1);
653 
654  /*l
655  *b Description:
656  **
657  ** This function unloads a dynamic library plugin from the app
658  ** that was added using the load_plugin() function.
659  **
660  *b Arguments:
661  **
662  *a name - name of the plugin
663  **
664  *b Returns:
665  **
666  ** 0 on success, -1 on failure
667  **
668  ** See complete overview at \ref diguyScenarioPluginOverview
669  */
670  int unload_plugin(const char* plugin_name);
671 
672  /*l
673  *b Description:
674  **
675  ** Unloads all plug-ins.
676  */
677  void unload_all_plugins();
678 
679  /*l
680  *b Returns:
681  **
682  ** This function returns the number of dynamic library plugins
683  ** currently loaded.
684  **
685  ** See complete overview at \ref diguyScenarioPluginOverview
686  */
687  int get_num_plugins();
688 
689  /*l
690  *b Returns:
691  **
692  ** the name of a specific plug-in at a specified index
693  **
694  *b Arguments:
695  **
696  *- index - index of the plugin to query
697  **
698  ** See complete overview at \ref diguyScenarioPluginOverview
699  */
700  const char* get_name_of_plugin(int index);
701 
702 
703 /*****************************************************************************/
709  /*l
710  *b Description:
711  **
712  ** This function loads (or reloads) shader source files into a shader
713  ** program. The shader program can be attached to a character in two
714  ** ways:
715  **
716  ** First, a shader may be explicitly added to a character using the
717  ** diguyCharacter::set_shader_program() function.
718  **
719  ** Second, a shader may be implicitly added to a character if its
720  ** appearance specifies an associated shader required to make the
721  ** appearance look right. Most often this is for appearances that
722  ** are skinned, requiring a shader to transform the vertices
723  ** correctly. DI-Guy most often uses the 'diguy_object' shader for
724  ** this.
725  **
726  ** If a shader program with the same name has already been loaded,
727  ** this function will replace it.
728  **
729  ** DI-Guy Scenario uses GLSL shaders.
730  **
731  *b Arguments:
732  **
733  *- shader_name - name by which shader program will be
734  *- referenced
735  *- vertex_shader_filename - name of file containing vertex shader
736  *- source code
737  *- pixel_shader_filename - name of file containing vertex shader
738  *- source code
739  **
740  *b Returns:
741  **
742  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
743  ** on failure
744  */
745  diguyGraphicsShaderProgram* load_shader_program(const char* shader_name,
746  const char* vertex_shader_filename,
747  const char* pixel_shader_filename);
748 
749  /*l
750  *b Description:
751  **
752  ** This function reloads all previously loaded shader programs, using
753  ** the same source filenames as were used when the shader was
754  ** initially loaded.
755  **
756  ** This function can be used to reload/replace an existing shader
757  ** with the same name, allowing for quick edit and test cycles when
758  ** working on new shaders.
759  */
760  void reload_shader_programs();
761 
762  /*l
763  *b Description:
764  **
765  ** This function looks for the previously loaded shader program with
766  ** the given name.
767  **
768  *b Arguments:
769  **
770  *- shader_name - name of program to find
771  **
772  *b Returns:
773  **
774  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
775  ** on failure
776  */
777  diguyGraphicsShaderProgram* find_shader_program(const char* shader_name);
778 
779  /*l
780  *b Returns:
781  **
782  ** number of loaded shader programs
783  */
784  int get_num_shader_programs();
785 
786  /*l
787  *b Description:
788  **
789  ** This function returns the shader program at the specified index.
790  **
791  *b Arguments:
792  **
793  *- index - index of shader program
794  **
795  *b Returns:
796  **
797  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
798  ** on failure
799  */
800  diguyGraphicsShaderProgram* get_shader_program_at_index(int index);
801 
802  /*l
803  *b Description:
804  **
805  ** This function returns the shader program that's currently active
806  **
807  *b Returns:
808  **
809  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
810  ** on failure
811  */
812  diguyGraphicsShaderProgram* get_current_bound_shader_program();
813 
814  /*l
815  *b Description:
816  **
817  ** This function looks for the previously loaded shader technique with
818  ** the given name.
819  **
820  *b Arguments:
821  **
822  *- shader_technique_name - name of program to find
823  **
824  *b Returns:
825  **
826  ** pointer to object type diguyGraphicsShaderTechnique on success,
827  ** NULL on failure
828  */
829  diguyGraphicsShaderTechnique* find_shader_technique(const char* shader_technique_name);
830 
831  /*l
832  *b Returns:
833  **
834  ** number of loaded shader techniques
835  */
836  int get_num_shader_techniques();
837 
838  /*l
839  *b Returns:
840  **
841  ** a pointer to a diguyGraphicsShaderTechnique on success at the
842  ** specified index, NULL on failure.
843  **
844  *b Arguments:
845  **
846  *- index - index of shader technique
847  */
848  diguyGraphicsShaderTechnique* get_shader_technique_at_index(int index);
849 
850  /*l
851  *b Description:
852  **
853  ** This function sets the max shader quality level for characters in
854  ** the application. See diguyGraphicsShaderProgram.h for the
855  ** diguyGraphicsShaderQualityLevel enum. This quality level, which
856  ** can range from no lighting to normal mapped characters, will be
857  ** used to pick an appropriate shader from a shader technique.
858  */
859  int set_max_character_shader_quality_level(int quality_level);
860  int get_max_character_shader_quality_level();
861 
862  /*l
863  *b Description:
864  **
865  ** This function sets the maximum shader quality level for scene
866  ** objects in the application. See
867  ** diguyApp::set_max_character_shader_quality_level() for more
868  ** information.
869  */
870  int set_max_scene_object_shader_quality_level(int quality_level);
871  int get_max_scene_object_shader_quality_level();
872 
873  /*l
874  *b Returns:
875  **
876  ** the value that was passed in for init.use_sRGB_corrected_textures
877  ** allows end users to procedurally choose gamma correction behavior.
878  */
879  int get_use_sRGB_textures();
880 
881 /*****************************************************************************/
887  /*l
888  *b Description:
889  **
890  ** This function tells DI-Guy to use quaternions for all joint
891  ** angles in motions. It should be called after DI-Guy is
892  ** initialized and before characters are created. By default
893  ** DI-Guy data uses Euler angles.
894  **
895  ** Some motion operations are faster using quaternions, while
896  ** some are not. In general anything that requires blending
897  ** of motions will be faster when using quaternions.
898  **
899  ** This function should not have any negative effect on character
900  ** motion quality.
901  **
902  *b Arguments:
903  **
904  *- enables - pass 1 to use quaternions for motions, 0 to use
905  *- Euler angles
906  **
907  *b Returns:
908  **
909  ** 0 on success, -1 on failure
910  **
911  *b C++ Example:
912  **
913  *e diguy_graphics_initialize();
914  *e diguyApp* the_app = diguy_get_app();
915  *e the_app->set_precompute_quaternions_enabled(1);
916  **
917  */
918  int set_precompute_quaternions_enabled(int enabled);
919 
920  /*l
921  *b Returns:
922  **
923  ** current setting of whether quaternions are enabled;
924  ** see set_precompute_quaternions_enabled()
925  */
926  int get_precompute_quaternions_enabled();
927 
928  /*l
929  *b Description:
930  **
931  ** This function sets how may rendering passes DI-Guy will use
932  ** to draw objects such as characters and scene objects.
933  **
934  ** By default DI-Guy uses two rendering passes. Fully opaque
935  ** objects are drawn in the first pass; semi-transparent objects
936  ** are drawn in the second.
937  **
938  ** If few or no objects have transparency, the number of rendering
939  ** passes can be set to 1, which will increase rendering
940  ** performance.
941  **
942  ** If the number of rendering passes is set to 1, semi-transparent
943  ** objects may incorrectly occlude objects behind them, depending
944  ** on object rendering order.
945  **
946  ** This function can be called at any time.
947  **
948  *b Arguments:
949  **
950  *- num_rendering_passes - how many rendering passes to use;
951  *- default is 2
952  **
953  *b Returns:
954  **
955  ** 0 on success, -1 on failure
956  */
957  int set_num_rendering_passes(int num_rendering_passes);
958 
959  /*l
960  *b Returns:
961  **
962  ** current setting of number of rendering passes;
963  ** see set_num_rendering_passes()
964  */
965  int get_num_rendering_passes();
966 
967  /*l
968  *b Description:
969  **
970  ** Gets current render pass flags. See diguyRenderPassFlags.
971  ** The values are or'd together.
972  */
973  int get_render_pass_flags();
974 
975  /*l
976  *b Description:
977  **
978  ** Sets current render pass flags. See diguyRenderPassFlags.
979  */
980  int set_render_pass_flags(int flags);
981 
982 
983 /*****************************************************************************/
989  /*l
990  *b Description:
991  **
992  ** This function returns the ideal number of threads available on the
993  ** system. This will correspond to the number of available
994  ** processors.
995  **
996  *b Returns:
997  **
998  ** ideal number of threads on the system; -1 on failure to detect
999  */
1000  int get_ideal_num_threads();
1001 
1002  /*l
1003  *b Description:
1004  **
1005  ** This function sets how many threads are available to DI-Guy.
1006  **
1007  *b Arguments:
1008  **
1009  *- num_threads - number of threads available to DI-Guy
1010  **
1011  *b Returns:
1012  **
1013  ** 0 on success, -1 on failure
1014  */
1015  int set_num_threads(int num_threads);
1016 
1017  /*l
1018  *b Returns:
1019  **
1020  ** number of threads available to DI-Guy
1021  */
1022  int get_num_threads();
1023 
1024  /*l
1025  *b Description:
1026  **
1027  ** This function reserves threads for the client application by
1028  ** setting the number of threads available to DI-Guy. DI-Guy will use
1029  ** up to (max_num_threads - reserve_num_threads).
1030  **
1031  *b Arguments:
1032  **
1033  *- reserve_num_threads - how many threads to reserve
1034  **
1035  *b Returns:
1036  **
1037  ** 0 on success, -1 on failure
1038  */
1039  int reserve_num_threads(int num_reserve_threads);
1040 
1041 
1042 /*****************************************************************************/
1048  /*l
1049  *b Description:
1050  **
1051  ** This function changes the current Input Mode of the DI-Guy Scenario
1052  ** application or a DI-Guy Author Host IG.
1053  **
1054  *b Arguments:
1055  **
1056  *a mode - the new base Input Mode of DI-Guy Scenario or DI-Guy Author
1057  **
1058  *b Returns:
1059  **
1060  ** -1 if mode change failed (e.g., tried for AI-related mode but AI
1061  ** not available, 0 on no error
1062  */
1063  int set_base_input_mode(diguyScenarioInputMode mode);
1064 
1065  /*l
1066  *b Returns:
1067  **
1068  ** the current Input Mode of the DI-Guy Scenario application or a
1069  ** DI-Guy Author Host IG.
1070  */
1071  diguyScenarioInputMode get_base_input_mode();
1072 
1073  /*l
1074  *b Description:
1075  **
1076  ** This function returns the 3D world position of the last clicked
1077  ** point in a DI-Guy Scenario 3D view.
1078  **
1079  ** This function is meant to complement the use of callbacks with
1080  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1081  **
1082  *b Arguments:
1083  **
1084  *a x, y, z - position in meters from the origin
1085  **
1086  ** Pass NULL for any values that are not needed.
1087  */
1088  int get_last_clicked_xyz(float* x, float* y, float* z);
1089 
1090  /*l
1091  *b Description:
1092  **
1093  ** This function sets the 3D world position of the last clicked point
1094  ** in a DI-Guy Scenario 3D view.
1095  **
1096  ** This function is meant to complement the use of callbacks with
1097  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1098  **
1099  *b Arguments:
1100  **
1101  *a x, y, z - position in meters from the origin
1102  */
1103  void set_last_clicked_xyz(float x, float y, float z);
1104 
1105  /*l
1106  *b Description:
1107  **
1108  ** This function returns the last character clicked by the mouse in
1109  ** DI-Guy Scenario.
1110  **
1111  ** This function is meant to complement the use of callbacks with
1112  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1113  **
1114  *b Returns:
1115  **
1116  ** pointer of type diguyCharacter; may be NULL if no character has
1117  ** been clicked
1118  */
1119  diguyCharacter* get_last_clicked_character();
1120 
1121  /*l
1122  *b Description:
1123  **
1124  ** This function returns the current screen coordinates x and y
1125  ** position of the mouse.
1126  */
1127  int get_mouse_screen_xy(float* sx, float* sy);
1128 
1129  /*l
1130  *b Description:
1131  **
1132  ** This function returns the current xyz coordinates under the mouse
1133  ** location, this is a fairly speedy test since the octtree is used.
1134  ** Typically this function is used to help build interactive UI tools.
1135  **
1136  *b Arguments:
1137  **
1138  *a x, y, z - resulting position in meters from the origin
1139  */
1140  int get_xyz_under_mouse(float* x, float* y, float* z);
1141 
1142  /*l
1143  *b Description:
1144  **
1145  ** This function sets up the UI to notify a lua object of mouse events
1146  ** via messages while in input mode
1147  ** DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1148  **
1149  ** The following callbacks are generated:
1150  *>
1151  *- - CALLBACK_ID_UI_MOUSE_DOWN
1152  *- - CALLBACK_ID_UI_MOUSE_UP
1153  *- - CALLBACK_ID_UI_RIGHT_MOUSE_DOWN
1154  *- - CALLBACK_ID_UI_RIGHT_MOUSE_UP
1155  *<
1156  ** See luaUIStateMachine:get_user_selected_point() to see an example
1157  ** of usage. Typically this function is used to help build interactive
1158  ** UI tools.
1159  **
1160  *b Arguments:
1161  **
1162  *a object_name - resulting position in meters from the origin
1163  */
1164  void set_lua_object_waiting_for_input(const char* object_name);
1165 
1166  /*l
1167  *b Returns:
1168  **
1169  ** The name of the lua object that's currently waiting for input
1170  ** events. Can return NULL if there's no active object.
1171  */
1172  const char* get_lua_object_waiting_for_input();
1173 
1174 
1175 /*****************************************************************************/
1181  /*l
1182  *b Description:
1183  **
1184  ** This function is equivalent to the function
1185  ** diguy_author_get_author_interface() in diguy_author.h. It is made
1186  ** available here so it is available to scripts.
1187  */
1188  diguyAuthorInterface* get_author_interface();
1189 
1190 
1191 /*****************************************************************************/
1197  /*l
1198  *b Returns:
1199  **
1200  ** This function returns a pointer to a diguyViewPainter object.
1201  ** This object can be used to draw lines, text, and other primitives
1202  ** in the 3D views of DI-Guy Scenario.
1203  */
1204  diguyViewPainter* get_view_painter();
1205 
1206 
1207 /*****************************************************************************/
1213  /*l
1214  *b Description:
1215  **
1216  ** This function sets whether the two specified collision groups
1217  ** should collide against each other.
1218  **
1219  *b Arguments:
1220  **
1221  *a collision_group1 - first collision group
1222  *a collision_group2 - second collision group
1223  *a enable_collisions - pass 1 to have groups collide, 0 to not
1224  */
1225  void set_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1226  diguyPhysicsCollisionGroup collision_group2,
1227  int enable_collisions);
1228 
1229  /*l
1230  *b Description:
1231  **
1232  ** This function returns whether the two specified collision groups
1233  ** should collide against each other.
1234  **
1235  *b Arguments:
1236  **
1237  *a collision_group1 - first collision group
1238  *a collision_group2 - second collision group
1239  **
1240  *b Returns:
1241  **
1242  ** 1 if collision groups collide, 0 if not
1243  */
1244  int get_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1245  diguyPhysicsCollisionGroup collision_group2);
1246 
1247  /*l
1248  *b Description:
1249  **
1250  ** The physics simulation module can have an optional ground plane
1251  ** enabled through which no objects will pass. This function sets
1252  ** whether the ground plane is enabled.
1253  **
1254  *b Arguments:
1255  **
1256  *a enabled - pass 1 to enable ground plane, 0 to disable
1257  */
1258  void set_physics_sim_ground_plane_enabled(int enabled);
1259 
1260  /*l
1261  *b Returns:
1262  **
1263  ** 1 if physics sim ground plane enabled, 0 if not
1264  */
1265  int get_physics_sim_ground_plane_enabled();
1266 
1267  /*l
1268  *b Description:
1269  **
1270  ** The physics simulation module can have an optional ground plane
1271  ** enabled through which no objects will pass. This function sets the
1272  ** height of the ground plane.
1273  **
1274  *b Arguments:
1275  **
1276  *a height - height in meters
1277  */
1278  void set_physics_sim_ground_plane_height(float height);
1279 
1280  /*l
1281  *b Returns:
1282  **
1283  ** height of physics sim ground plane
1284  */
1285  float get_physics_sim_ground_plane_height();
1286 
1287 
1288 /*****************************************************************************/
1297  /*l
1298  *b Returns:
1299  **
1300  ** the library suffix, which is derived from the dll compiling flags, e.g. "_x86_vc9_md"
1301  */
1302  static const char* get_standard_bdi_library_suffix();
1303 
1304  /*l
1305  *b Returns:
1306  **
1307  ** the library suffix, which is derived from the version number, e.g. "_1250"
1308  */
1309  static const char* get_diguy_version_library_suffix();
1310 
1311  /*l
1312  *b Returns:
1313  **
1314  ** the library suffix, which is derived from the compiler type, e.g. "_vc9"
1315  */
1316  static const char* get_compiler_library_suffix();
1317 
1318  /*l
1319  *b Description:
1320  **
1321  ** Loads dynamic library module. The handle returned can be
1322  ** passed into resolve_symbol() or unload_module_library().
1323  **
1324  *b Returns:
1325  **
1326  ** handle as (void *) pointer, NULL if library is not found or failed to load.
1327  **
1328  ** Load status is set to:
1329  **
1330  ** 0 : load successful
1331  ** -1 : library not found
1332  ** -2 : ?
1333  */
1334  static void* load_module_library(const char* module_lib_name,
1335  int include_diguy_standard_library_suffixes = 1,
1336  int* load_status = NULL);
1337 
1338  /*l
1339  *b Description:
1340  **
1341  ** Returns pointer to function provided by already-loaded dynamic library module.
1342  ** Pointer should be cast to one of:
1343  **
1344  ** - diguyModuleFunctionInt
1345  ** - diguyModuleFunctionVoid
1346  ** - diguyModuleFunctionVoidReturnsVoid
1347  **
1348  *b Returns:
1349  **
1350  ** pointer to function, or NULL if function not found.
1351  */
1352  static void* resolve_module_library_symbol(void* module_handle, const char* symbol_name);
1353 
1354  /*l
1355  *b Description:
1356  **
1357  ** Unloads dynamic library module, given handle to it.
1358  **
1359  */
1360  static void unload_module_library(void* module_handle);
1361 
1362  /*l
1363  *b Description:
1364  **
1365  ** Returns 1 if a sound factory is initialized.
1366  */
1367  int get_sound_factory_is_initialized();
1368 
1369 /*****************************************************************************/
1377  /*l
1378  *b Description:
1379  **
1380  ** Sets override values for the specified munition type's DIS impact
1381  ** septet.
1382  **
1383  ** Munition types are defined in the config file munition_types.cfg,
1384  ** located under the DI-Guy installation config directory.
1385  **
1386  *b Arguments:
1387  **
1388  *- munition_type - name of munition type to modify; e.g., "m16"
1389  *- sep1, etc. - new DIS septet values
1390  */
1391  int set_munition_type_DIS_impact_septet(const char* munition_type,
1392  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1393 
1394  /*l
1395  *b Description:
1396  **
1397  ** Similar to set_munition_type_DIS_impact_septet(), but overrides the
1398  ** septet for tracer type.
1399  */
1400  int set_munition_type_DIS_tracer_septet(const char* munition_type,
1401  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1402 
1403  /*l
1404  *b Description:
1405  **
1406  ** Returns the munition type name based on the passed septet values.
1407  **
1408  *b Arguments:
1409  **
1410  *- sep1, etc. - DIS septet values
1411  *- include_last_septet_value - pass 1 to include the last septet
1412  *- value in the search, 0 to not
1413  */
1414  const char* get_munition_type_from_DIS_septet(
1415  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7,
1416  int include_last_septet_value = 1);
1417 
1418 
1419 /****************************************************************************/
1420 /****************************************************************************/
1421 /****************************************************************************/
1425 /****************************************************************************/
1426 /****************************************************************************/
1427 /****************************************************************************/
1428 
1429  /*l
1430  *b Description:
1431  **
1432  ** Causes garbage-collection to unload graphics files that have been
1433  ** previously loaded into memory, but are unused, freeing up memory. There
1434  ** may be a frame hitch if graphics files are to be used again and need to be
1435  ** reloaded.
1436  **
1437  *b Arguments:
1438  **
1439  *- garbage_collect_appearances - setting to 1 will attempt to remove
1440  *- unused character appearance geometry as well as
1441  *- scene objects; default is 1. If 0, only scene object
1442  *- files will be discarded.
1443  */
1444  int unload_unreferenced_graphics_files(int garbage_collect_appearances = 1);
1445 
1446  /*l
1447  *b Description:
1448  **
1449  ** Causes textures that have changes to be reloaded
1450  */
1451  int reload_texture_files();
1452 
1453  /*l
1454  *b Description:
1455  **
1456  ** How many textures in memory before texture unloading starts (defaults to 5000)
1457  */
1458  int set_threshold_to_unload_textures(int number);
1459  int get_threshold_to_unload_textures();
1460 
1461  /*l
1462  *b Description:
1463  **
1464  ** How often to check if inactive textures should be unloaded.
1465  */
1466  int set_texture_unload_frequency(float seconds);
1467  float get_texture_unload_frequency();
1468 
1469  /*l
1470  *b Description:
1471  **
1472  ** Should unused assets be garbage collected after loading a new scenario.
1473  */
1474  int get_unload_unused_after_scenario_load();
1475  int set_unload_unused_after_scenario_load(int val);
1476 
1477  /*l
1478  *b Description:
1479  **
1480  ** Sets whether optimized versions of motion files should be cached to
1481  ** disk when they are loaded.
1482  **
1483  ** This is still experimental. The default is 0, don't enable
1484  ** caching.
1485  **
1486  *b Arguments:
1487  **
1488  *- enabled - pass 1 to enable caching, 0 to disable
1489  */
1490  int set_cache_optimized_motion_files(int enabled = 0);
1491 
1492  /*l
1493  *b Returns:
1494  **
1495  ** 1 if caching of optimized motion files is enabled, 0 if disabled
1496  */
1497  int get_cache_optimized_motion_files();
1498 
1499  /*l
1500  *b Description:
1501  **
1502  ** Prints to the log a report about memory usage and leaks.
1503  **
1504  *b Arguments:
1505  **
1506  *- include_permanent_objects - pass 1 to include permanent objects
1507  *- in reports; 0 is default
1508  *- just_markers - pass 1 to only generate reports for
1509  *- memory use at instants after a marker
1510  *- is dropped
1511  */
1512  int memory_tracker_print_report(int include_permanent_objects = 0, int just_markers = 0);
1513  /*l
1514  *b Description:
1515  **
1516  ** Add a marker for use by memory_tracker_print_report()
1517  */
1518  int memory_tracker_drop_marker();
1519 
1520  /*l
1521  *b Description:
1522  **
1523  ** Provide DI-Guy Scenario with a list of messages that the user can access
1524  ** from the right-click menu. When a message is selected, it is sent over the
1525  ** network to the AIs of remote entities. If the AIs can process the message,
1526  ** they will. Typically used to kill remote entities from a master server.
1527  **
1528  *b Arguments:
1529  **
1530  *- message - a string containing a comma-separated list of messages.
1531  */
1532  void set_reflected_entity_message_list(const char* message);
1533 
1534  /*l
1535  *b Description:
1536  **
1537  ** Returns a string containing a comma-separated list of supported
1538  ** reflected-entity messages, as set by set_reflected_entity_message_list()
1539  */
1540  const char* get_reflected_entity_message_list();
1541 
1542  /*l
1543  *b Description:
1544  **
1545  ** In DI-Guy Scenario pops up a user interface asking the end user to
1546  ** pick a scene object file name.
1547  */
1548  const char* get_scene_object_file_name_from_ui();
1549 
1550  /*l
1551  *b Description:
1552  **
1553  ** Causes DI-Guy to display UI relevant to navmesh generation
1554  */
1555  int show_generate_navmesh_ui();
1556 
1557 
1558 /****************************************************************************/
1559 /****************************************************************************/
1560 /****************************************************************************/
1564 /****************************************************************************/
1565 /****************************************************************************/
1566 /****************************************************************************/
1567 
1568  /*l
1569  *b Returns:
1570  **
1571  ** Newly-created log channel
1572  */
1573  diguyLogChannel* create_log_channel();
1574 
1575  /*l
1576  *b Description:
1577  **
1578  ** Destroys specified log channel
1579  */
1580  void destroy_log_channel(diguyLogChannel*);
1581 
1582  /*l
1583  *b Returns:
1584  **
1585  ** Number of log channels
1586  */
1587  int get_num_log_channels();
1588 
1589  /*l
1590  *b Returns:
1591  **
1592  ** Log channel at index
1593  */
1594  diguyLogChannel* get_log_channel_at_index(int index);
1595 
1596 
1597 /****************************************************************************/
1598 /****************************************************************************/
1599 /****************************************************************************/
1603 /****************************************************************************/
1604 /****************************************************************************/
1605 /****************************************************************************/
1606 
1607  /*l
1608  ** Deprecated as of DI-Guy 12.0.0.
1609  ** Use diguyAuthorVisualRegionPaintbrush::set_painting_subregion()
1610  ** instead.
1611  */
1612  int set_current_painting_subregion(diguySubregionIndex index);
1613 
1614 
1615 
1620 #ifdef CPLUSPLUS_ONLY
1621 
1622  void set_no_blend_test(int flag);
1623 
1624  void set_motion_events_log_enabled(int enabled);
1625 
1626  void dump_motion_events_to_file(const char* filename,
1627  int show_event_id_strings = 0,
1628  int indent = 0);
1629 
1630  bdiScenarioApp* get_scripted_object() {return m_scripted_object;}
1631 
1632 
1633 private:
1634 
1635  /*l
1636  ** A private constructor. Use the DI-Guy function
1637  ** get_app() to obtain a diguyApp object pointer.
1638  */
1639  diguyApp(bdiScenarioApp* scenario);
1640 
1641  /*l
1642  ** A private destructor. Use the DI-Guy function
1643  ** diguy_deinitialize() to delete a diguyApp object pointer.
1644  */
1645  virtual ~diguyApp();
1646 
1647  /*l
1648  ** A pointer to internal data.
1649  */
1650  bdiScenarioApp* m_scripted_object;
1651 
1652  friend class bdiScenarioApp;
1653 
1654 #endif
1655 
1656 };
1657 
1658 #endif /* __diguyApp_H */
1659