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