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