DI-Guy SDK Documentation  13.2
diguyApp.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2018 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
6 /*********************************************************************/
13 #pragma once
14 
15 #ifdef SWIG
16 %module diguyApp
17 #else
18 #define CPLUSPLUS_ONLY
19 #endif
20 
21 #ifdef CPLUSPLUS_ONLY
22 
23 typedef int (*diguyModuleFunctionVoid)();
24 typedef void (*diguyVoidFunctionVoid)();
25 
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 
901 /*****************************************************************************/
906  /*l
907  *b Description:
908  **
909  ** This function sets how may rendering passes DI-Guy will use
910  ** to draw objects such as characters and scene objects.
911  **
912  ** By default DI-Guy uses two rendering passes. Fully opaque
913  ** objects are drawn in the first pass; semi-transparent objects
914  ** are drawn in the second.
915  **
916  ** If few or no objects have transparency, the number of rendering
917  ** passes can be set to 1, which will increase rendering
918  ** performance.
919  **
920  ** If the number of rendering passes is set to 1, semi-transparent
921  ** objects may incorrectly occlude objects behind them, depending
922  ** on object rendering order.
923  **
924  ** This function can be called at any time.
925  **
926  *b Arguments:
927  **
928  *- num_rendering_passes - how many rendering passes to use;
929  *- default is 2
930  **
931  *b Returns:
932  **
933  ** 0 on success, -1 on failure
934  */
935  int set_num_rendering_passes(int num_rendering_passes);
936 
937  /*l
938  *b Returns:
939  **
940  ** current setting of number of rendering passes;
941  ** see set_num_rendering_passes()
942  */
943  int get_num_rendering_passes();
944 
945  /*l
946  *b Description:
947  **
948  ** Gets current render pass flags. See diguyRenderPassFlags.
949  ** The values are or'd together.
950  */
951  int get_render_pass_flags();
952 
953  /*l
954  *b Description:
955  **
956  ** Sets current render pass flags. See diguyRenderPassFlags.
957  */
958  int set_render_pass_flags(int flags);
959 
961  diguyViewCamera * get_current_camera();
962 
964  diguyViewCamera * get_shooting_camera();
965 
966  int get_use_materials();
967  void set_use_materials(int use_materials);
968 
969  int get_use_textures();
970  void set_use_textures(int use_textures);
971 
972 
973  /*****************************************************************************/
979  /*l
980  *b Description:
981  ** When loading a character this function tells DI-Guy to wait till a motion
982  ** is actually needed to load it or load all character's motion at character creation
983  ** time.
984  */
985  void set_delayed_motion_loading(int enabled);
986 
987  /*l
988  *b Returns:
989  **
990  ** current setting of whether motions will load when 1st used;
991  ** see set_delayed_motion_loading()
992  */
993  int get_delayed_motion_loading();
994 
995  /*l
996  *b Description:
997  **
998  ** This function tells DI-Guy to use quaternions for all joint
999  ** angles in motions. It should be called after DI-Guy is
1000  ** initialized and before characters are created. By default
1001  ** DI-Guy data uses Quaternions.
1002  **
1003  ** Some motion operations are faster using quaternions, while
1004  ** some are not. In general anything that requires blending
1005  ** of motions will be faster when using quaternions.
1006  **
1007  ** This function should not have any negative effect on character
1008  ** motion quality.
1009  **
1010  *b Arguments:
1011  **
1012  *- enables - pass 1 to use quaternions for motions, 0 to use
1013  *- Euler angles
1014  **
1015  *b Returns:
1016  **
1017  ** 0 on success, -1 on failure
1018  **
1019  *b C++ Example:
1020  **
1021  *e diguy_graphics_initialize();
1022  *e diguyApp* the_app = diguy_get_app();
1023  *e the_app->set_precompute_quaternions_enabled(1);
1024  **
1025  */
1026  int set_precompute_quaternions_enabled(int enabled);
1027 
1028  /*l
1029  *b Returns:
1030  **
1031  ** current setting of whether quaternions are enabled;
1032  ** see set_precompute_quaternions_enabled()
1033  */
1034  int get_precompute_quaternions_enabled();
1035 
1036 /*****************************************************************************/
1042  /*l
1043  *b Description:
1044  **
1045  ** This function returns the ideal number of threads available on the
1046  ** system. This will correspond to the number of available
1047  ** processors.
1048  **
1049  *b Returns:
1050  **
1051  ** ideal number of threads on the system; -1 on failure to detect
1052  */
1053  int get_ideal_num_threads();
1054 
1055  /*l
1056  *b Description:
1057  **
1058  ** This function sets how many threads are available to DI-Guy.
1059  **
1060  *b Arguments:
1061  **
1062  *- num_threads - number of threads available to DI-Guy
1063  **
1064  *b Returns:
1065  **
1066  ** 0 on success, -1 on failure
1067  */
1068  int set_num_threads(int num_threads);
1069 
1070  /*l
1071  *b Returns:
1072  **
1073  ** number of threads available to DI-Guy
1074  */
1075  int get_num_threads();
1076 
1077  /*l
1078  *b Description:
1079  **
1080  ** This function reserves threads for the client application by
1081  ** setting the number of threads available to DI-Guy. DI-Guy will use
1082  ** up to (max_num_threads - reserve_num_threads).
1083  **
1084  *b Arguments:
1085  **
1086  *- reserve_num_threads - how many threads to reserve
1087  **
1088  *b Returns:
1089  **
1090  ** 0 on success, -1 on failure
1091  */
1092  int reserve_num_threads(int num_reserve_threads);
1093 
1096  void set_use_qt_threading_infrastructure(bool use);
1097  int get_use_qt_threading_infrastructure();
1098 
1101  void set_use_intel_threading_infrastructure(bool use);
1102  int get_use_intel_threading_infrastructure();
1103 
1107  void run_background_load_update();
1108 
1110  int is_background_loader_active();
1111 
1112 /*****************************************************************************/
1118  /*l
1119  *b Description:
1120  **
1121  ** This function changes the current Input Mode of the DI-Guy Scenario
1122  ** application or a DI-Guy Author Host IG.
1123  **
1124  *b Arguments:
1125  **
1126  *a mode - the new base Input Mode of DI-Guy Scenario or DI-Guy Author
1127  **
1128  *b Returns:
1129  **
1130  ** -1 if mode change failed (e.g., tried for AI-related mode but AI
1131  ** not available, 0 on no error
1132  */
1133  int set_base_input_mode(diguyScenarioInputMode mode);
1134 
1135  /*l
1136  *b Returns:
1137  **
1138  ** the current Input Mode of the DI-Guy Scenario application or a
1139  ** DI-Guy Author Host IG.
1140  */
1141  diguyScenarioInputMode get_base_input_mode();
1142 
1143  /*l
1144  *b Description:
1145  **
1146  ** This function returns the 3D world position of the last clicked
1147  ** point in a DI-Guy Scenario 3D view.
1148  **
1149  ** This function is meant to complement the use of callbacks with
1150  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1151  **
1152  *b Arguments:
1153  **
1154  *a x, y, z - position in meters from the origin
1155  **
1156  ** Pass NULL for any values that are not needed.
1157  */
1158  int get_last_clicked_xyz(float* x, float* y, float* z);
1159 
1160  /*l
1161  *b Description:
1162  **
1163  ** This function sets the 3D world position of the last clicked point
1164  ** in a DI-Guy Scenario 3D view.
1165  **
1166  ** This function is meant to complement the use of callbacks with
1167  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1168  **
1169  *b Arguments:
1170  **
1171  *a x, y, z - position in meters from the origin
1172  */
1173  void set_last_clicked_xyz(float x, float y, float z);
1174 
1175  /*l
1176  *b Description:
1177  **
1178  ** This function returns the last character clicked by the mouse in
1179  ** DI-Guy Scenario.
1180  **
1181  ** This function is meant to complement the use of callbacks with
1182  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1183  **
1184  *b Returns:
1185  **
1186  ** pointer of type diguyCharacter; may be NULL if no character has
1187  ** been clicked
1188  */
1189  diguyCharacter* get_last_clicked_character();
1190 
1191  /*l
1192  *b Description:
1193  **
1194  ** This function returns the current screen coordinates x and y
1195  ** position of the mouse.
1196  */
1197  int get_mouse_screen_xy(float* sx, float* sy);
1198 
1199  /*l
1200  *b Description:
1201  **
1202  ** This function returns the current xyz coordinates under the mouse
1203  ** location, this is a fairly speedy test since the octtree is used.
1204  ** Typically this function is used to help build interactive UI tools.
1205  **
1206  *b Arguments:
1207  **
1208  *a x, y, z - resulting position in meters from the origin
1209  */
1210  int get_xyz_under_mouse(float* x, float* y, float* z);
1211 
1212  /*l
1213  *b Description:
1214  **
1215  ** This function sets up the UI to notify a lua object of mouse events
1216  ** via messages while in input mode
1217  ** DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1218  **
1219  ** The following callbacks are generated:
1220  *>
1221  *- - CALLBACK_ID_UI_MOUSE_DOWN
1222  *- - CALLBACK_ID_UI_MOUSE_UP
1223  *- - CALLBACK_ID_UI_RIGHT_MOUSE_DOWN
1224  *- - CALLBACK_ID_UI_RIGHT_MOUSE_UP
1225  *<
1226  ** See luaUIStateMachine:get_user_selected_point() to see an example
1227  ** of usage. Typically this function is used to help build interactive
1228  ** UI tools.
1229  **
1230  *b Arguments:
1231  **
1232  *a object_name - resulting position in meters from the origin
1233  */
1234  void set_lua_object_waiting_for_input(const char* object_name);
1235 
1236  /*l
1237  *b Returns:
1238  **
1239  ** The name of the lua object that's currently waiting for input
1240  ** events. Can return NULL if there's no active object.
1241  */
1242  const char* get_lua_object_waiting_for_input();
1243 
1244 
1245 /*****************************************************************************/
1251  /*l
1252  *b Description:
1253  **
1254  ** This function is equivalent to the function
1255  ** diguy_author_get_author_interface() in diguy_author.h. It is made
1256  ** available here so it is available to scripts.
1257  */
1258  diguyAuthorInterface* get_author_interface();
1259 
1260 
1261 /*****************************************************************************/
1267  /*l
1268  *b Returns:
1269  **
1270  ** This function returns a pointer to a diguyViewPainter object.
1271  ** This object can be used to draw lines, text, and other primitives
1272  ** in the 3D views of DI-Guy Scenario.
1273  */
1274  diguyViewPainter* get_view_painter();
1275 
1276 
1277 /*****************************************************************************/
1283  /*l
1284  *b Description:
1285  **
1286  ** This function sets whether the two specified collision groups
1287  ** should collide against each other.
1288  **
1289  *b Arguments:
1290  **
1291  *a collision_group1 - first collision group
1292  *a collision_group2 - second collision group
1293  *a enable_collisions - pass 1 to have groups collide, 0 to not
1294  */
1295  void set_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1296  diguyPhysicsCollisionGroup collision_group2,
1297  int enable_collisions);
1298 
1299  /*l
1300  *b Description:
1301  **
1302  ** This function returns whether the two specified collision groups
1303  ** should collide against each other.
1304  **
1305  *b Arguments:
1306  **
1307  *a collision_group1 - first collision group
1308  *a collision_group2 - second collision group
1309  **
1310  *b Returns:
1311  **
1312  ** 1 if collision groups collide, 0 if not
1313  */
1314  int get_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1315  diguyPhysicsCollisionGroup collision_group2);
1316 
1317  /*l
1318  *b Description:
1319  **
1320  ** The physics simulation module can have an optional ground plane
1321  ** enabled through which no objects will pass. This function sets
1322  ** whether the ground plane is enabled.
1323  **
1324  *b Arguments:
1325  **
1326  *a enabled - pass 1 to enable ground plane, 0 to disable
1327  */
1328  void set_physics_sim_ground_plane_enabled(int enabled);
1329 
1330  /*l
1331  *b Returns:
1332  **
1333  ** 1 if physics sim ground plane enabled, 0 if not
1334  */
1335  int get_physics_sim_ground_plane_enabled();
1336 
1337  /*l
1338  *b Description:
1339  **
1340  ** The physics simulation module can have an optional ground plane
1341  ** enabled through which no objects will pass. This function sets the
1342  ** height of the ground plane.
1343  **
1344  *b Arguments:
1345  **
1346  *a height - height in meters
1347  */
1348  void set_physics_sim_ground_plane_height(float height);
1349 
1350  /*l
1351  *b Returns:
1352  **
1353  ** height of physics sim ground plane
1354  */
1355  float get_physics_sim_ground_plane_height();
1356 
1357 
1358 /*****************************************************************************/
1367  /*l
1368  *b Returns:
1369  **
1370  ** the library suffix, which is derived from the dll compiling flags, e.g. "_x86_vc9_md"
1371  */
1372  static const char* get_standard_bdi_library_suffix();
1373 
1374  /*l
1375  *b Returns:
1376  **
1377  ** the library suffix, which is derived from the version number, e.g. "_1250"
1378  */
1379  static const char* get_diguy_version_library_suffix();
1380 
1381  /*l
1382  *b Returns:
1383  **
1384  ** the library suffix, which is derived from the compiler type, e.g. "_vc9"
1385  */
1386  static const char* get_compiler_library_suffix();
1387 
1388  /*l
1389  *b Description:
1390  **
1391  ** Loads dynamic library module. The handle returned can be
1392  ** passed into resolve_symbol() or unload_module_library().
1393  **
1394  *b Returns:
1395  **
1396  ** handle as (void *) pointer, NULL if library is not found or failed to load.
1397  **
1398  ** Load status is set to:
1399  **
1400  ** 0 : load successful
1401  ** -1 : library not found
1402  ** -2 : ?
1403  */
1404  static void* load_module_library(const char* module_lib_name,
1405  int include_diguy_standard_library_suffixes = 1,
1406  int* load_status = NULL);
1407 
1408  /*l
1409  *b Description:
1410  **
1411  ** Returns pointer to function provided by already-loaded dynamic library module.
1412  ** Pointer should be cast to one of:
1413  **
1414  ** - diguyModuleFunctionInt
1415  ** - diguyModuleFunctionVoid
1416  ** - diguyModuleFunctionVoidReturnsVoid
1417  **
1418  *b Returns:
1419  **
1420  ** pointer to function, or NULL if function not found.
1421  */
1422  static diguyVoidFunctionVoid resolve_module_library_symbol(
1423  void* module_handle, const char* symbol_name );
1424 
1425  /*l
1426  *b Description:
1427  **
1428  ** Unloads dynamic library module, given handle to it.
1429  **
1430  */
1431  static void unload_module_library(void* module_handle);
1432 
1433  /*l
1434  *b Description:
1435  **
1436  ** Returns 1 if a sound factory is initialized.
1437  */
1438  int get_sound_factory_is_initialized();
1439 
1440 /*****************************************************************************/
1448  /*l
1449  *b Description:
1450  **
1451  ** Sets override values for the specified munition type's DIS impact
1452  ** septet.
1453  **
1454  ** Munition types are defined in the config file munition_types.cfg,
1455  ** located under the DI-Guy installation config directory.
1456  **
1457  *b Arguments:
1458  **
1459  *- munition_type - name of munition type to modify; e.g., "m16"
1460  *- sep1, etc. - new DIS septet values
1461  */
1462  int set_munition_type_DIS_impact_septet(const char* munition_type,
1463  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1464 
1465  /*l
1466  *b Description:
1467  **
1468  ** Similar to set_munition_type_DIS_impact_septet(), but overrides the
1469  ** septet for tracer type.
1470  */
1471  int set_munition_type_DIS_tracer_septet(const char* munition_type,
1472  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1473 
1474  /*l
1475  *b Description:
1476  **
1477  ** Returns the munition type name based on the passed septet values.
1478  **
1479  *b Arguments:
1480  **
1481  *- sep1, etc. - DIS septet values
1482  *- need_exact_match - If 1 (true), only return an exact septet match.
1483  *- If 0 (false), a 0 in the munition_types.cfg septet
1484  *- is treated as a wildcard.
1485  *- include_last_septet_value - pass 1 to include the last septet
1486  *- value in the search, 0 to not
1487  */
1488  const char* get_munition_type_from_DIS_septet(
1489  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7,
1490  int include_last_septet_value = 1);
1491 
1492 
1493 /****************************************************************************/
1494 /****************************************************************************/
1495 /****************************************************************************/
1499 /****************************************************************************/
1500 /****************************************************************************/
1501 /****************************************************************************/
1502 
1503  /*l
1504  *b Description:
1505  **
1506  ** Causes garbage-collection to unload graphics files that have been
1507  ** previously loaded into memory, but are unused, freeing up memory. There
1508  ** may be a frame hitch if graphics files are to be used again and need to be
1509  ** reloaded.
1510  **
1511  *b Arguments:
1512  **
1513  *- garbage_collect_appearances - setting to 1 will attempt to remove
1514  *- unused character appearance geometry as well as
1515  *- scene objects; default is 1. If 0, only scene object
1516  *- files will be discarded.
1517  */
1518  int unload_unreferenced_graphics_files(int garbage_collect_appearances = 1);
1519 
1520  /*l
1521  *b Description:
1522  **
1523  ** Causes textures that have changes to be reloaded
1524  */
1525  int reload_texture_files();
1526 
1527  /*l
1528  *b Description:
1529  **
1530  ** How many textures in memory before texture unloading starts (defaults to 5000)
1531  */
1532  int set_threshold_to_unload_textures(int number);
1533  int get_threshold_to_unload_textures();
1534 
1535  /*l
1536  *b Description:
1537  **
1538  ** How often to check if inactive textures should be unloaded.
1539  */
1540  int set_texture_unload_frequency(float seconds);
1541  float get_texture_unload_frequency();
1542 
1543  /*l
1544  *b Description:
1545  **
1546  ** Should unused assets be garbage collected after loading a new scenario.
1547  */
1548  int get_unload_unused_after_scenario_load();
1549  int set_unload_unused_after_scenario_load(int val);
1550 
1551  /*l
1552  *b Description:
1553  **
1554  ** Sets whether optimized versions of motion files should be cached to
1555  ** disk when they are loaded.
1556  **
1557  ** This is still experimental. The default is 0, don't enable
1558  ** caching.
1559  **
1560  *b Arguments:
1561  **
1562  *- enabled - pass 1 to enable caching, 0 to disable
1563  */
1564  int set_cache_optimized_motion_files(int enabled = 0);
1565 
1566  /*l
1567  *b Returns:
1568  **
1569  ** 1 if caching of optimized motion files is enabled, 0 if disabled
1570  */
1571  int get_cache_optimized_motion_files();
1572 
1573  /*l
1574  *b Description:
1575  **
1576  ** Prints to the log a report about memory usage and leaks.
1577  **
1578  *b Arguments:
1579  **
1580  *- include_permanent_objects - pass 1 to include permanent objects
1581  *- in reports; 0 is default
1582  *- just_markers - pass 1 to only generate reports for
1583  *- memory use at instants after a marker
1584  *- is dropped
1585  */
1586  int memory_tracker_print_report(int include_permanent_objects = 0, int just_markers = 0);
1587 
1589  int memory_tracker_drop_marker();
1590 
1591  /*l
1592  *b Description:
1593  **
1594  ** Provide DI-Guy Scenario with a list of messages that the user can access
1595  ** from the right-click menu. When a message is selected, it is sent over the
1596  ** network to the AIs of remote entities. If the AIs can process the message,
1597  ** they will. Typically used to kill remote entities from a master server.
1598  **
1599  *b Arguments:
1600  **
1601  *- message - a string containing a comma-separated list of messages.
1602  */
1603  void set_reflected_entity_message_list(const char* message);
1604 
1605  /*l
1606  *b Description:
1607  **
1608  ** Returns a string containing a comma-separated list of supported
1609  ** reflected-entity messages, as set by set_reflected_entity_message_list()
1610  */
1611  const char* get_reflected_entity_message_list();
1612 
1613  /*l
1614  *b Description:
1615  **
1616  ** In DI-Guy Scenario pops up a user interface asking the end user to
1617  ** pick a scene object file name.
1618  */
1619  const char* get_scene_object_file_name_from_ui();
1620 
1621  /*l
1622  *b Description:
1623  **
1624  ** Causes DI-Guy to display UI relevant to navmesh generation
1625  */
1626  int show_generate_navmesh_ui();
1627 
1629  void print_process_memory_info();
1630 
1632  static int decompress_lz4_file(const char * source, const char * destination);
1633 
1636  diguyMotionExporter* get_motion_exporter();
1637 
1640  void set_use_scene_object_instancing(int enabled);
1641 
1643  void set_enable_concurrency_visualizer_markers(int enabled);
1644 
1645  /****************************************************************************/
1646 /****************************************************************************/
1647 /****************************************************************************/
1651 /****************************************************************************/
1652 /****************************************************************************/
1653 /****************************************************************************/
1654 
1655  /*l
1656  *b Returns:
1657  **
1658  ** Newly-created log channel
1659  */
1660  diguyLogChannel* create_log_channel();
1661 
1662  /*l
1663  *b Description:
1664  **
1665  ** Destroys specified log channel
1666  */
1667  void destroy_log_channel(diguyLogChannel*);
1668 
1669  /*l
1670  *b Returns:
1671  **
1672  ** Number of log channels
1673  */
1674  int get_num_log_channels();
1675 
1676  /*l
1677  *b Returns:
1678  **
1679  ** Log channel at index
1680  */
1681  diguyLogChannel* get_log_channel_at_index(int index);
1682 
1683 
1684 /****************************************************************************/
1685 /****************************************************************************/
1686 /****************************************************************************/
1690 /****************************************************************************/
1691 /****************************************************************************/
1692 /****************************************************************************/
1693 
1694  /*l
1695  ** Deprecated as of DI-Guy 12.0.0.
1696  ** Use diguyAuthorVisualRegionPaintbrush::set_painting_subregion()
1697  ** instead.
1698  */
1699  int set_current_painting_subregion(diguySubregionIndex index);
1700 
1701 
1702 
1707 #ifdef CPLUSPLUS_ONLY
1708 
1709  void set_no_blend_test(int flag);
1710 
1711  void set_motion_events_log_enabled(int enabled);
1712 
1713  void dump_motion_events_to_file(const char* filename,
1714  int show_event_id_strings = 0,
1715  int indent = 0);
1716 
1717  bdiScenarioApp* get_scripted_object() {return m_scripted_object;}
1718 
1719 
1720 private:
1721 
1722  /*l
1723  ** A private constructor. Use the DI-Guy function
1724  ** get_app() to obtain a diguyApp object pointer.
1725  */
1726  diguyApp(bdiScenarioApp* scenario);
1727 
1728  /*l
1729  ** A private destructor. Use the DI-Guy function
1730  ** diguy_deinitialize() to delete a diguyApp object pointer.
1731  */
1732  virtual ~diguyApp();
1733 
1734  /*l
1735  ** A pointer to internal data.
1736  */
1737  bdiScenarioApp* m_scripted_object;
1738 
1739  friend class bdiScenarioApp;
1740 
1741 #endif
1742 
1743 };
int(* diguyModuleFunctionVoid)()
Definition: diguyApp.h:22
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
void(* diguyVoidFunctionVoid)()
Definition: diguyApp.h:23
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:94
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:80
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