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