DI-Guy SDK Documentation  13.6
diguyApp.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2022 MAK Technologies, Inc.
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 public:
58 
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  /*l
172  *b Description:
173  **
174  ** Registers a message handler with Qt so Qt output goes through the diguy logging system.
175  */
176  static void install_qt_message_handler();
177 
178 /*****************************************************************************/
188  /*l
189  *b Returns:
190  **
191  ** the path to the base directory of the DI-Guy installation;
192  ** this is typically set by the environment variable DIGUY
193  */
194  static const char* get_diguy_base_dir_path();
195 
196  /*l
197  *b Returns:
198  **
199  ** the path to a subdirectory of the DI-Guy installation;
200  ** this is typically derived from the environment variable
201  ** DIGUY, but is sometimes overridden by other environment
202  ** variables
203  **
204  *b Arguments:
205  **
206  *a subdir - name of the subdirectory
207  */
208  static const char* get_diguy_subdir_path( const char* subdir );
209 
210 /*****************************************************************************/
220  /*l
221  *b Description:
222  **
223  ** Gets a pointer to the exercise interface. If DI-Guy is not
224  ** on the network, the returned pointer will be NULL.
225  **
226  *b Returns:
227  **
228  ** pointer of type diguyExerciseInterface on success,
229  ** NULL on failure or if not on the network
230  */
231  diguyExerciseInterface* get_exercise_interface();
232 
233 
234 /*****************************************************************************/
239 #ifdef CPLUSPLUS_ONLY
240 
241  /*l
242  *b Description:
243  **
244  ** This function sets a default user callback that will be added
245  ** to all new scenarios. See diguyScenario::add_callback() for
246  ** details.
247  */
248  int add_default_scenario_callback(int callback_id,
249  diguyScenarioCallback* callback,
250  void* callback_params = 0,
251  void* callback_user_data = 0,
252  int remove_on_scenario_load = 1);
253 
254  /*l
255  *b Description:
256  **
257  ** This function removes a default user callback previously added by
258  ** add_default_scenario_callback(). See
259  ** diguyScenario::remove_callback() for details.
260  **
261  *b Returns:
262  **
263  ** 0 on success, -1 on failure
264  */
265  int remove_default_scenario_callback(int callback_id,
266  diguyScenarioCallback* callback);
267 
268  /*l
269  *b Description:
270  **
271  ** This function removes a default user callback previously added by
272  ** add_default_scenario_callback(). See
273  ** diguyScenario::remove_callback_with_user_data() for details.
274  */
275  int remove_default_scenario_callback_with_user_data(int callback_id,
276  void* callback_user_data);
277 
278 #endif
279 
280 /*****************************************************************************/
284  /*l
285  *b Description:
286  **
287  ** This function adds a default scenario callback script.
288  ** The callback script will be added to all new scenarios.
289  ** See diguyScenario::add_callback_script() for
290  ** more details.
291  **
292  *b Returns:
293  **
294  ** 0 on success, -1 on failure
295  */
296  int add_default_scenario_callback_script(int callback_id,
297  const char* callback_script,
298  const char* callback_script_type,
299  int remove_on_scenario_load = 1);
300 
301  /*l
302  *b Description:
303  **
304  ** This function removes a default scenario callback script.
305  ** See diguyScenario::remove_callback_script() for
306  ** more details.
307  **
308  *b Returns:
309  **
310  ** 0 on success, -1 on failure
311  */
312  int remove_default_scenario_callback_script(int callback_id,
313  const char* callback_script,
314  const char* callback_script_type);
315 
316 
317 /*****************************************************************************/
328 #ifdef CPLUSPLUS_ONLY
329 
330  /*l
331  *b Description:
332  **
333  ** This function is analogous to the
334  ** diguyScenario::register_character_event_handler() function, but
335  ** is for scenarios rather than characters.
336  **
337  ** The registered event handler can be mapped to an event via the
338  ** DI-Guy Scenario UI, or by the function
339  ** diguyScenario::map_event_handler_to_callback_id().
340  **
341  ** It can also be manually invoked by the function call
342  ** diguyScenario::manually_invoke_event_handler().
343  **
344  *b Callable From:
345  **
346  *- - C++
347  */
348  int register_scenario_event_handler(const char* handler_name,
349  diguyScenarioCallback* callback,
350  void* callback_user_data = 0);
351 
352 #endif
353 
354  /*l
355  *b Description:
356  **
357  ** This function is analogous to the
358  ** diguyScenario::register_character_event_handler_from_library()
359  ** function, but is for scenarios rather than characters.
360  **
361  ** The registered event handler can be mapped to an event via the
362  ** DI-Guy Scenario UI, or by the function
363  ** diguyScenario::map_event_handler_to_callback_id().
364  **
365  ** It can also be manually invoked by the function call
366  ** diguyScenario::manually_invoke_event_handler().
367  */
368  int register_scenario_event_handler_from_library(const char* handler_name,
369  const char* library_name,
370  const char* function_name,
371  void* callback_user_data = 0);
372 
373  /*l
374  *b Description:
375  **
376  ** This function is analogous to the
377  ** diguyScenario::register_character_event_handler_script()
378  ** function, but is for scenarios rather than characters.
379  **
380  ** The registered event handler can be mapped to an event via the
381  ** DI-Guy Scenario UI, or by the function
382  ** diguyScenario::map_event_handler_to_callback_id().
383  **
384  ** It can also be manually invoked by the function call
385  ** diguyScenario::manually_invoke_event_handler().
386  */
387  int register_scenario_event_handler_script(const char* handler_name,
388  const char* handler_script,
389  const char* handler_script_type = NULL);
390 
391  /*l
392  *b Description:
393  **
394  ** This function is analogous to the
395  ** diguyScenario::has_registered_character_event_handler()
396  ** function, but is for scenarios rather than characters.
397  */
398  int has_registered_scenario_event_handler(const char* handler_name);
399 
400  /*l
401  *b Description:
402  **
403  ** This function is analogous to the
404  ** diguyScenario::unregister_character_event_handler()
405  ** function, but is for scenarios rather than characters.
406  */
407  int unregister_scenario_event_handler(const char* handler_name);
408 
409 #ifdef CPLUSPLUS_ONLY
410 
411  /*l
412  *b Description:
413  **
414  ** Adds a draw pass which is used to modified how
415  ** diguyScenario::draw() functions.
416  */
417 
418  int add_draw_pass(const diguyDrawPass* drawPass);
419 
420  /*l
421  *b Description:
422  **
423  ** Removes all draw passes previously registered with
424  ** diguyApp::add_draw_pass().
425  */
426  int remove_all_draw_passes();
427 
428 #endif
429 
430 /*****************************************************************************/
625  /*l
626  *b Description:
627  **
628  ** This function adds a new dynamic library plugin to the app.
629  ** Plugins work within DI-Guy Scenario as well as the DI-Guy SDK.
630  **
631  *b Arguments:
632  **
633  *a plugin_name - name of the plugin; should be dynamic
634  *a library name without the extension
635  *a required_by_scenario - if set to 1, this plugin is required
636  *a for proper execution of this scenario;
637  *a when the scenario is loaded this plugin
638  *a will be loaded as well if it is not
639  *a already active; default value is 0
640  *a unload_on_scenario_close - if set to 1, this plugin will be
641  *a unloaded if this scenario is closed
642  *a or a new scenario is opened; default
643  *a value is 0
644  *a accepts_mouse_input - if set to 1, this plugin will receive
645  *a mouse events via the mouse plugin
646  *a functions when the input mode is
647  *a "Plugin"; default value is 1
648  **
649  *b Returns:
650  **
651  ** 0 on success, -1 on failure
652  **
653  *i Windows Specific:
654  **
655  ** The DLL should be placed in a directory that is in the path, or in
656  ** the same directory as the DI-Guy Scenario executable.
657  **
658  ** The DLL version of DI-Guy Scenario or the SDK must be used for
659  ** plugins to work.
660  **
661  ** See complete overview at \ref diguyScenarioPluginOverview
662  */
663  int load_plugin(const char* plugin_name,
664  int required_by_scenario = 0,
665  int unload_on_scenario_close = 0,
666  int accepts_mouse_input = 1);
667 
668  /*l
669  *b Description:
670  **
671  ** This function unloads a dynamic library plugin from the app
672  ** that was added using the load_plugin() function.
673  **
674  *b Arguments:
675  **
676  *a name - name of the plugin
677  **
678  *b Returns:
679  **
680  ** 0 on success, -1 on failure
681  **
682  ** See complete overview at \ref diguyScenarioPluginOverview
683  */
684  int unload_plugin(const char* plugin_name);
685 
686  /*l
687  *b Description:
688  **
689  ** Unloads all plug-ins.
690  */
691  void unload_all_plugins();
692 
693  /*l
694  *b Returns:
695  **
696  ** This function returns the number of dynamic library plugins
697  ** currently loaded.
698  **
699  ** See complete overview at \ref diguyScenarioPluginOverview
700  */
701  int get_num_plugins();
702 
703  /*l
704  *b Returns:
705  **
706  ** the name of a specific plug-in at a specified index
707  **
708  *b Arguments:
709  **
710  *- index - index of the plugin to query
711  **
712  ** See complete overview at \ref diguyScenarioPluginOverview
713  */
714  const char* get_name_of_plugin(int index);
715 
716 
717 /*****************************************************************************/
722  void reset_graphics_state();
724 
728  diguyUniformBufferUpdater * get_uniform_buffer_updater();
729 
730  /*l
731  *b Description:
732  **
733  ** This function loads (or reloads) shader source files into a shader
734  ** program. The shader program can be attached to a character in two
735  ** ways:
736  **
737  ** First, a shader may be explicitly added to a character using the
738  ** diguyCharacter::set_shader_program() function.
739  **
740  ** Second, a shader may be implicitly added to a character if its
741  ** appearance specifies an associated shader required to make the
742  ** appearance look right. Most often this is for appearances that
743  ** are skinned, requiring a shader to transform the vertices
744  ** correctly. DI-Guy most often uses the 'diguy_object' shader for
745  ** this.
746  **
747  ** If a shader program with the same name has already been loaded,
748  ** this function will replace it.
749  **
750  ** DI-Guy Scenario uses GLSL shaders.
751  **
752  *b Arguments:
753  **
754  *- shader_name - name by which shader program will be
755  *- referenced
756  *- vertex_shader_filename - name of file containing vertex shader
757  *- source code
758  *- pixel_shader_filename - name of file containing pixel shader
759  *- source code
760  **
761  *b Returns:
762  **
763  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
764  ** on failure
765  */
766  diguyGraphicsShaderProgram* load_shader_program(const char* shader_name,
767  const char* vertex_shader_filename,
768  const char* pixel_shader_filename,
769  const char* shader_version);
770 
774  diguyGraphicsShaderProgram * create_shader_program(const char* shader_name);
775 
776  /*l
777  *b Description:
778  **
779  ** This function reloads all previously loaded shader programs, using
780  ** the same source filenames as were used when the shader was
781  ** initially loaded.
782  **
783  ** This function can be used to reload/replace an existing shader
784  ** with the same name, allowing for quick edit and test cycles when
785  ** working on new shaders.
786  */
787  void reload_shader_programs();
788 
789  /*l
790  *b Description:
791  **
792  ** This function looks for the previously loaded shader program with
793  ** the given name.
794  **
795  *b Arguments:
796  **
797  *- shader_name - name of program to find
798  **
799  *b Returns:
800  **
801  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
802  ** on failure
803  */
804  diguyGraphicsShaderProgram* find_shader_program(const char* shader_name);
805 
806  /*l
807  *b Returns:
808  **
809  ** number of loaded shader programs
810  */
811  int get_num_shader_programs();
812 
813  /*l
814  *b Description:
815  **
816  ** This function returns the shader program at the specified index.
817  **
818  *b Arguments:
819  **
820  *- index - index of shader program
821  **
822  *b Returns:
823  **
824  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
825  ** on failure
826  */
827  diguyGraphicsShaderProgram* get_shader_program_at_index(int index);
828 
829  /*l
830  *b Description:
831  **
832  ** This function returns the shader program that's currently active
833  **
834  *b Returns:
835  **
836  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
837  ** on failure
838  */
839  diguyGraphicsShaderProgram* get_current_bound_shader_program();
840 
841  /*l
842  *b Description:
843  **
844  ** This function looks for the previously loaded shader technique with
845  ** the given name.
846  **
847  *b Arguments:
848  **
849  *- shader_technique_name - name of program to find
850  **
851  *b Returns:
852  **
853  ** pointer to object type diguyGraphicsShaderTechnique on success,
854  ** NULL on failure
855  */
856  diguyGraphicsShaderTechnique* find_shader_technique(const char* shader_technique_name);
857 
858  /*l
859  *b Returns:
860  **
861  ** number of loaded shader techniques
862  */
863  int get_num_shader_techniques();
864 
865  /*l
866  *b Returns:
867  **
868  ** a pointer to a diguyGraphicsShaderTechnique on success at the
869  ** specified index, NULL on failure.
870  **
871  *b Arguments:
872  **
873  *- index - index of shader technique
874  */
875  diguyGraphicsShaderTechnique* get_shader_technique_at_index(int index);
876 
877  /*l
878  *b Description:
879  **
880  ** This function sets the max shader quality level for characters in
881  ** the application. See diguyGraphicsShaderProgram.h for the
882  ** diguyGraphicsShaderQualityLevel enum. This quality level, which
883  ** can range from no lighting to normal mapped characters, will be
884  ** used to pick an appropriate shader from a shader technique.
885  */
886  int set_max_character_shader_quality_level(int quality_level);
887  int get_max_character_shader_quality_level();
888 
889  /*l
890  *b Description:
891  **
892  ** This function sets the maximum shader quality level for scene
893  ** objects in the application. See
894  ** diguyApp::set_max_character_shader_quality_level() for more
895  ** information.
896  */
897  int set_max_scene_object_shader_quality_level(int quality_level);
898  int get_max_scene_object_shader_quality_level();
899 
900  /*l
901  *b Returns:
902  **
903  ** the value that was passed in for init.use_sRGB_corrected_textures
904  ** allows end users to procedurally choose gamma correction behavior.
905  */
906  int get_use_sRGB_textures();
907 
908 
909 /*****************************************************************************/
914  /*l
915  *b Description:
916  **
917  ** This function sets how may rendering passes DI-Guy will use
918  ** to draw objects such as characters and scene objects.
919  **
920  ** By default DI-Guy uses two rendering passes. Fully opaque
921  ** objects are drawn in the first pass; semi-transparent objects
922  ** are drawn in the second.
923  **
924  ** If few or no objects have transparency, the number of rendering
925  ** passes can be set to 1, which will increase rendering
926  ** performance.
927  **
928  ** If the number of rendering passes is set to 1, semi-transparent
929  ** objects may incorrectly occlude objects behind them, depending
930  ** on object rendering order.
931  **
932  ** This function can be called at any time.
933  **
934  *b Arguments:
935  **
936  *- num_rendering_passes - how many rendering passes to use;
937  *- default is 2
938  **
939  *b Returns:
940  **
941  ** 0 on success, -1 on failure
942  */
943  int set_num_rendering_passes(int num_rendering_passes);
944 
945  /*l
946  *b Returns:
947  **
948  ** current setting of number of rendering passes;
949  ** see set_num_rendering_passes()
950  */
951  int get_num_rendering_passes();
952 
953  /*l
954  *b Description:
955  **
956  ** Gets current render pass flags. See diguyRenderPassFlags.
957  ** The values are or'd together.
958  */
959  int get_render_pass_flags();
960 
961  /*l
962  *b Description:
963  **
964  ** Sets current render pass flags. See diguyRenderPassFlags.
965  */
966  int set_render_pass_flags(int flags);
967 
969  diguyViewCamera * get_current_camera();
970 
972  diguyViewCamera * get_shooting_camera();
973 
974  int get_use_materials();
975  void set_use_materials(int use_materials);
976 
977  int get_use_textures();
978  void set_use_textures(int use_textures);
979 
980 
981  /*****************************************************************************/
987  /*l
988  *b Description:
989  ** When loading a character this function tells DI-Guy to wait till a motion
990  ** is actually needed to load it or load all character's motion at character creation
991  ** time.
992  */
993  void set_delayed_motion_loading(int enabled);
994 
995  /*l
996  *b Returns:
997  **
998  ** current setting of whether motions will load when 1st used;
999  ** see set_delayed_motion_loading()
1000  */
1001  int get_delayed_motion_loading();
1002 
1003  /*l
1004  *b Description:
1005  **
1006  ** This function tells DI-Guy to use quaternions for all joint
1007  ** angles in motions. It should be called after DI-Guy is
1008  ** initialized and before characters are created. By default
1009  ** DI-Guy data uses Quaternions.
1010  **
1011  ** Some motion operations are faster using quaternions, while
1012  ** some are not. In general anything that requires blending
1013  ** of motions will be faster when using quaternions.
1014  **
1015  ** This function should not have any negative effect on character
1016  ** motion quality.
1017  **
1018  *b Arguments:
1019  **
1020  *- enables - pass 1 to use quaternions for motions, 0 to use
1021  *- Euler angles
1022  **
1023  *b Returns:
1024  **
1025  ** 0 on success, -1 on failure
1026  **
1027  *b C++ Example:
1028  **
1029  *e diguy_graphics_initialize();
1030  *e diguyApp* the_app = diguy_get_app();
1031  *e the_app->set_precompute_quaternions_enabled(1);
1032  **
1033  */
1034  int set_precompute_quaternions_enabled(int enabled);
1035 
1036  /*l
1037  *b Returns:
1038  **
1039  ** current setting of whether quaternions are enabled;
1040  ** see set_precompute_quaternions_enabled()
1041  */
1042  int get_precompute_quaternions_enabled();
1043 
1044 /*****************************************************************************/
1050  /*l
1051  *b Description:
1052  **
1053  ** This function returns the ideal number of threads available on the
1054  ** system. This will correspond to the number of available
1055  ** processors.
1056  **
1057  *b Returns:
1058  **
1059  ** ideal number of threads on the system; -1 on failure to detect
1060  */
1061  int get_ideal_num_threads();
1062 
1063  /*l
1064  *b Description:
1065  **
1066  ** This function sets how many threads are available to DI-Guy. defaults to -1
1067  ** which will just use all cores available. 1 or 0 sets single threaded behavior,
1068  ** and other number will indicate a limit to the tbb subsystem on number of cores to use.
1069  **
1070  *b Arguments:
1071  **
1072  *- num_threads - number of threads available to DI-Guy
1073  **
1074  *b Returns:
1075  **
1076  ** 0 on success, -1 on failure
1077  */
1078  int set_num_threads(int num_threads);
1079 
1080  /*l
1081  *b Returns:
1082  **
1083  ** number of threads available to DI-Guy
1084  */
1085  int get_num_threads();
1086 
1087 
1091  void set_use_update_phase_1_multithreading(bool use);
1092  bool get_use_update_phase_1_multithreading();
1093 
1097  void run_background_load_update();
1098 
1100  int is_background_loader_active();
1101 
1104  void set_stream_textures_to_gpu(bool enable);
1105  bool get_stream_textures_to_gpu();
1106 
1107 /*****************************************************************************/
1113  /*l
1114  *b Description:
1115  **
1116  ** This function changes the current Input Mode of the DI-Guy Scenario
1117  ** application or a DI-Guy Author Host IG.
1118  **
1119  *b Arguments:
1120  **
1121  *a mode - the new base Input Mode of DI-Guy Scenario or DI-Guy Author
1122  **
1123  *b Returns:
1124  **
1125  ** -1 if mode change failed (e.g., tried for AI-related mode but AI
1126  ** not available, 0 on no error
1127  */
1128  int set_base_input_mode(diguyScenarioInputMode mode);
1129 
1130  /*l
1131  *b Returns:
1132  **
1133  ** the current Input Mode of the DI-Guy Scenario application or a
1134  ** DI-Guy Author Host IG.
1135  */
1136  diguyScenarioInputMode get_base_input_mode();
1137 
1138  /*l
1139  *b Description:
1140  **
1141  ** This function returns the 3D world position of the last clicked
1142  ** point in a DI-Guy Scenario 3D view.
1143  **
1144  ** This function is meant to complement the use of callbacks with
1145  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1146  **
1147  *b Arguments:
1148  **
1149  *a x, y, z - position in meters from the origin
1150  **
1151  ** Pass NULL for any values that are not needed.
1152  */
1153  int get_last_clicked_xyz(float* x, float* y, float* z);
1154 
1155  /*l
1156  *b Description:
1157  **
1158  ** This function sets the 3D world position of the last clicked point
1159  ** in a DI-Guy Scenario 3D view.
1160  **
1161  ** This function is meant to complement the use of callbacks with
1162  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1163  **
1164  *b Arguments:
1165  **
1166  *a x, y, z - position in meters from the origin
1167  */
1168  void set_last_clicked_xyz(float x, float y, float z);
1169 
1170  /*l
1171  *b Description:
1172  **
1173  ** This function returns the last character clicked by the mouse in
1174  ** DI-Guy Scenario.
1175  **
1176  ** This function is meant to complement the use of callbacks with
1177  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1178  **
1179  *b Returns:
1180  **
1181  ** pointer of type diguyCharacter; may be NULL if no character has
1182  ** been clicked
1183  */
1184  diguyCharacter* get_last_clicked_character();
1185 
1186  /*l
1187  *b Description:
1188  **
1189  ** This function returns the current screen coordinates x and y
1190  ** position of the mouse.
1191  */
1192  int get_mouse_screen_xy(float* sx, float* sy);
1193 
1194  /*l
1195  *b Description:
1196  **
1197  ** This function returns the current xyz coordinates under the mouse
1198  ** location, this is a fairly speedy test since the octtree is used.
1199  ** Typically this function is used to help build interactive UI tools.
1200  **
1201  *b Arguments:
1202  **
1203  *a x, y, z - resulting position in meters from the origin
1204  */
1205  int get_xyz_under_mouse(float* x, float* y, float* z);
1206 
1207  /*l
1208  *b Description:
1209  **
1210  ** This function sets up the UI to notify a lua object of mouse events
1211  ** via messages while in input mode
1212  ** DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1213  **
1214  ** The following callbacks are generated:
1215  *>
1216  *- - CALLBACK_ID_UI_MOUSE_DOWN
1217  *- - CALLBACK_ID_UI_MOUSE_UP
1218  *- - CALLBACK_ID_UI_RIGHT_MOUSE_DOWN
1219  *- - CALLBACK_ID_UI_RIGHT_MOUSE_UP
1220  *<
1221  ** See luaUIStateMachine:get_user_selected_point() to see an example
1222  ** of usage. Typically this function is used to help build interactive
1223  ** UI tools.
1224  **
1225  *b Arguments:
1226  **
1227  *a object_name - resulting position in meters from the origin
1228  */
1229  void set_lua_object_waiting_for_input(const char* object_name);
1230 
1231  /*l
1232  *b Returns:
1233  **
1234  ** The name of the lua object that's currently waiting for input
1235  ** events. Can return NULL if there's no active object.
1236  */
1237  const char* get_lua_object_waiting_for_input();
1238 
1239 
1240 /*****************************************************************************/
1246  /*l
1247  *b Description:
1248  **
1249  ** This function is equivalent to the function
1250  ** diguy_author_get_author_interface() in diguy_author.h. It is made
1251  ** available here so it is available to scripts.
1252  */
1253  diguyAuthorInterface* get_author_interface();
1254 
1255 
1256 /*****************************************************************************/
1262  /*l
1263  *b Returns:
1264  **
1265  ** This function returns a pointer to a diguyViewPainter object.
1266  ** This object can be used to draw lines, text, and other primitives
1267  ** in the 3D views of DI-Guy Scenario.
1268  */
1269  diguyViewPainter* get_view_painter();
1270 
1271 
1272 /*****************************************************************************/
1278  /*l
1279  *b Description:
1280  **
1281  ** This function sets whether the two specified collision groups
1282  ** should collide against each other.
1283  **
1284  *b Arguments:
1285  **
1286  *a collision_group1 - first collision group
1287  *a collision_group2 - second collision group
1288  *a enable_collisions - pass 1 to have groups collide, 0 to not
1289  */
1290  void set_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1291  diguyPhysicsCollisionGroup collision_group2,
1292  int enable_collisions);
1293 
1294  /*l
1295  *b Description:
1296  **
1297  ** This function returns whether the two specified collision groups
1298  ** should collide against each other.
1299  **
1300  *b Arguments:
1301  **
1302  *a collision_group1 - first collision group
1303  *a collision_group2 - second collision group
1304  **
1305  *b Returns:
1306  **
1307  ** 1 if collision groups collide, 0 if not
1308  */
1309  int get_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1310  diguyPhysicsCollisionGroup collision_group2);
1311 
1312  /*l
1313  *b Description:
1314  **
1315  ** The physics simulation module can have an optional ground plane
1316  ** enabled through which no objects will pass. This function sets
1317  ** whether the ground plane is enabled.
1318  **
1319  *b Arguments:
1320  **
1321  *a enabled - pass 1 to enable ground plane, 0 to disable
1322  */
1323  void set_physics_sim_ground_plane_enabled(int enabled);
1324 
1325  /*l
1326  *b Returns:
1327  **
1328  ** 1 if physics sim ground plane enabled, 0 if not
1329  */
1330  int get_physics_sim_ground_plane_enabled();
1331 
1332  /*l
1333  *b Description:
1334  **
1335  ** The physics simulation module can have an optional ground plane
1336  ** enabled through which no objects will pass. This function sets the
1337  ** height of the ground plane.
1338  **
1339  *b Arguments:
1340  **
1341  *a height - height in meters
1342  */
1343  void set_physics_sim_ground_plane_height(float height);
1344 
1345  /*l
1346  *b Returns:
1347  **
1348  ** height of physics sim ground plane
1349  */
1350  float get_physics_sim_ground_plane_height();
1351 
1352 
1353 /*****************************************************************************/
1362  /*l
1363  *b Returns:
1364  **
1365  ** the library suffix, which is derived from the dll compiling flags, e.g. "_x64_vc14"
1366  */
1367  static const char* get_standard_bdi_library_suffix();
1368 
1369  /*l
1370  *b Returns:
1371  **
1372  ** the library suffix, which is derived from the version number, e.g. "_1250"
1373  */
1374  static const char* get_diguy_version_library_suffix();
1375 
1376  /*l
1377  *b Returns:
1378  **
1379  ** the library suffix, which is derived from the compiler type, e.g. "_vc9"
1380  */
1381  static const char* get_compiler_library_suffix();
1382 
1383  /*l
1384  *b Returns:
1385  **
1386  ** the debug suffix, "d" or blank
1387  */
1388  static const char* get_debug_library_suffix();
1389 
1390  /*l
1391  *b Description:
1392  **
1393  ** Loads dynamic library module. The handle returned can be
1394  ** passed into resolve_symbol() or unload_module_library().
1395  **
1396  *b Returns:
1397  **
1398  ** handle as (void *) pointer, NULL if library is not found or failed to load.
1399  **
1400  ** Load status is set to:
1401  **
1402  ** 0 : load successful
1403  ** -1 : library not found
1404  ** -2 : ?
1405  */
1406  static void* load_module_library(const char* module_lib_name,
1407  int include_diguy_standard_library_suffixes = 1,
1408  int* load_status = NULL);
1409 
1410  /*l
1411  *b Description:
1412  **
1413  ** Returns pointer to function provided by already-loaded dynamic library module.
1414  ** Pointer should be cast to one of:
1415  **
1416  ** - diguyModuleFunctionInt
1417  ** - diguyModuleFunctionVoid
1418  ** - diguyModuleFunctionVoidReturnsVoid
1419  **
1420  *b Returns:
1421  **
1422  ** pointer to function, or NULL if function not found.
1423  */
1424  static diguyVoidFunctionVoid resolve_module_library_symbol(
1425  void* module_handle, const char* symbol_name );
1426 
1427  /*l
1428  *b Description:
1429  **
1430  ** Unloads dynamic library module, given handle to it.
1431  **
1432  */
1433  static void unload_module_library(void* module_handle);
1434 
1435  /*l
1436  *b Description:
1437  **
1438  ** Returns 1 if a sound factory is initialized.
1439  */
1440  int get_sound_factory_is_initialized();
1441 
1442 /*****************************************************************************/
1450  /*l
1451  *b Description:
1452  **
1453  ** Sets override values for the specified munition type's DIS impact
1454  ** septet.
1455  **
1456  ** Munition types are defined in the config file munition_types.cfg,
1457  ** located under the DI-Guy installation config directory.
1458  **
1459  *b Arguments:
1460  **
1461  *- munition_type - name of munition type to modify; e.g., "m16"
1462  *- sep1, etc. - new DIS septet values
1463  */
1464  int set_munition_type_DIS_impact_septet(const char* munition_type,
1465  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1466 
1467  /*l
1468  *b Description:
1469  **
1470  ** Similar to set_munition_type_DIS_impact_septet(), but overrides the
1471  ** septet for tracer type.
1472  */
1473  int set_munition_type_DIS_tracer_septet(const char* munition_type,
1474  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1475 
1476  /*l
1477  *b Description:
1478  **
1479  ** Returns the munition type name based on the passed septet values.
1480  **
1481  *b Arguments:
1482  **
1483  *- sep1, etc. - DIS septet values
1484  *- need_exact_match - If 1 (true), only return an exact septet match.
1485  *- If 0 (false), a 0 in the munition_types.cfg septet
1486  *- is treated as a wildcard.
1487  *- include_last_septet_value - pass 1 to include the last septet
1488  *- value in the search, 0 to not
1489  */
1490  const char* get_munition_type_from_DIS_septet(
1491  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7,
1492  int include_last_septet_value = 1);
1493 
1494 
1495 /****************************************************************************/
1496 /****************************************************************************/
1497 /****************************************************************************/
1501 /****************************************************************************/
1502 /****************************************************************************/
1503 /****************************************************************************/
1504 
1505  /*l
1506  *b Description:
1507  **
1508  ** Causes garbage-collection to unload graphics files that have been
1509  ** previously loaded into memory, but are unused, freeing up memory. There
1510  ** may be a frame hitch if graphics files are to be used again and need to be
1511  ** reloaded.
1512  **
1513  *b Arguments:
1514  **
1515  *- garbage_collect_appearances - setting to 1 will attempt to remove
1516  *- unused character appearance geometry as well as
1517  *- scene objects; default is 1. If 0, only scene object
1518  *- files will be discarded.
1519  */
1520  int unload_unreferenced_graphics_files(int garbage_collect_appearances = 1);
1521 
1522  /*l
1523  *b Description:
1524  **
1525  ** Causes textures that have changes to be reloaded
1526  */
1527  int reload_texture_files();
1528 
1529  /*l
1530  *b Description:
1531  **
1532  ** How many textures in memory before texture unloading starts (defaults to 5000)
1533  */
1534  int set_threshold_to_unload_textures(int number);
1535  int get_threshold_to_unload_textures();
1536 
1537  /*l
1538  *b Description:
1539  **
1540  ** How often to check if inactive textures should be unloaded.
1541  */
1542  int set_texture_unload_frequency(float seconds);
1543  float get_texture_unload_frequency();
1544 
1545  /*l
1546  *b Description:
1547  **
1548  ** Should unused assets be garbage collected after loading a new scenario.
1549  */
1550  int get_unload_unused_after_scenario_load();
1551  int set_unload_unused_after_scenario_load(int val);
1552 
1553  /*l
1554  *b Description:
1555  **
1556  ** Sets whether optimized versions of motion files should be cached to
1557  ** disk when they are loaded.
1558  **
1559  ** This is still experimental. The default is 0, don't enable
1560  ** caching.
1561  **
1562  *b Arguments:
1563  **
1564  *- enabled - pass 1 to enable caching, 0 to disable
1565  */
1566  int set_cache_optimized_motion_files(int enabled = 0);
1567 
1568  /*l
1569  *b Returns:
1570  **
1571  ** 1 if caching of optimized motion files is enabled, 0 if disabled
1572  */
1573  int get_cache_optimized_motion_files();
1574 
1575  /*l
1576  *b Description:
1577  **
1578  ** Prints to the log a report about memory usage and leaks.
1579  **
1580  *b Arguments:
1581  **
1582  *- include_permanent_objects - pass 1 to include permanent objects
1583  *- in reports; 0 is default
1584  *- just_markers - pass 1 to only generate reports for
1585  *- memory use at instants after a marker
1586  *- is dropped
1587  */
1588  int memory_tracker_print_report(int include_permanent_objects = 0, int just_markers = 0);
1589 
1591  int memory_tracker_drop_marker();
1592 
1593  /*l
1594  *b Description:
1595  **
1596  ** Provide DI-Guy Scenario with a list of messages that the user can access
1597  ** from the right-click menu. When a message is selected, it is sent over the
1598  ** network to the AIs of remote entities. If the AIs can process the message,
1599  ** they will. Typically used to kill remote entities from a master server.
1600  **
1601  *b Arguments:
1602  **
1603  *- message - a string containing a comma-separated list of messages.
1604  */
1605  void set_reflected_entity_message_list(const char* message);
1606 
1607  /*l
1608  *b Description:
1609  **
1610  ** Returns a string containing a comma-separated list of supported
1611  ** reflected-entity messages, as set by set_reflected_entity_message_list()
1612  */
1613  const char* get_reflected_entity_message_list();
1614 
1615  /*l
1616  *b Description:
1617  **
1618  ** In DI-Guy Scenario pops up a user interface asking the end user to
1619  ** pick a scene object file name.
1620  */
1621  const char* get_scene_object_file_name_from_ui();
1622 
1623  /*l
1624  *b Description:
1625  **
1626  ** Causes DI-Guy to display UI relevant to navmesh generation
1627  */
1628  int show_generate_navmesh_ui();
1629 
1631  void print_process_memory_info();
1632 
1634  static int decompress_lz4_file(const char * source, const char * destination);
1635 
1638  diguyMotionExporter* get_motion_exporter();
1639 
1642  void set_use_scene_object_instancing(int enabled);
1643 
1645  void set_enable_concurrency_visualizer_markers(int enabled);
1646 
1648  void set_enable_tracy_markers(bool enabled, bool start_up_tracy = true);
1650  void profiler_mark_end_of_frame();
1652  void shutdown_profiler();
1653 
1655  static int get_lod_warn_threshold(int lod);
1656 
1657  /****************************************************************************/
1658 /****************************************************************************/
1659 /****************************************************************************/
1663 /****************************************************************************/
1664 /****************************************************************************/
1665 /****************************************************************************/
1666 
1667  /*l
1668  *b Returns:
1669  **
1670  ** Newly-created log channel
1671  */
1672  diguyLogChannel* create_log_channel();
1673 
1674  /*l
1675  *b Description:
1676  **
1677  ** Destroys specified log channel
1678  */
1679  void destroy_log_channel(diguyLogChannel*);
1680 
1681  /*l
1682  *b Returns:
1683  **
1684  ** Number of log channels
1685  */
1686  int get_num_log_channels();
1687 
1688  /*l
1689  *b Returns:
1690  **
1691  ** Log channel at index
1692  */
1693  diguyLogChannel* get_log_channel_at_index(int index);
1694 
1695 
1696 /****************************************************************************/
1697 /****************************************************************************/
1698 /****************************************************************************/
1702 /****************************************************************************/
1703 /****************************************************************************/
1704 /****************************************************************************/
1705 
1706  /*l
1707  ** Deprecated as of DI-Guy 12.0.0.
1708  ** Use diguyAuthorVisualRegionPaintbrush::set_painting_subregion()
1709  ** instead.
1710  */
1711  int set_current_painting_subregion(diguySubregionIndex index);
1712 
1713 
1714 
1719 #ifdef CPLUSPLUS_ONLY
1720 
1721  void set_no_blend_test(int flag);
1722 
1723  void set_motion_events_log_enabled(int enabled);
1724 
1725  void dump_motion_events_to_file(const char* filename,
1726  int show_event_id_strings = 0,
1727  int indent = 0);
1728 
1729  bdiScenarioApp* get_scripted_object() {return m_scripted_object;}
1730 
1731 
1732 private:
1733 
1734  /*l
1735  ** A private constructor. Use the DI-Guy function
1736  ** get_app() to obtain a diguyApp object pointer.
1737  */
1738  diguyApp(bdiScenarioApp* scenario);
1739 
1740  /*l
1741  ** A private destructor. Use the DI-Guy function
1742  ** diguy_deinitialize() to delete a diguyApp object pointer.
1743  */
1744  virtual ~diguyApp();
1745 
1746  /*l
1747  ** A pointer to internal data.
1748  */
1749  bdiScenarioApp* m_scripted_object;
1750 
1751  friend class bdiScenarioApp;
1752 
1753 #endif
1754 
1755 };
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:157
!
Definition: diguyAuthorInterface.h:57
void(* diguyVoidFunctionVoid)()
Definition: diguyApp.h:23
diguySubregionIndex
DI-Guy subregions.
Definition: diguy_constants.h:1519
The diguyViewPainter class acts as a helper for drawing various graphics primitives in DI-Guy Scenari...
Definition: diguyViewPainter.h:36
Definition: diguyLogChannel.h:34
Definition: diguyLoadManager.h:41
This struct is populated by the user and passed into diguyApp::add_draw_pass(diguyDrawPass drawPass)...
Definition: diguyGraphicsShaderTechnique.h:49
Represents the scenario currently being portrayed.
Definition: diguyScenario.h:99
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:82
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
A Singleton class representing the DI-Guy Application.
Definition: diguyApp.h:53
The diguyVariable class allows you to add per character named parameters. This can be handy for track...
Definition: diguyVariable.h:46
diguyPhysicsCollisionGroup
This enumeration lists the collision groups that a DI-Guy physics sim object can be in...
Definition: diguy_constants.h:1769
This class implements shader lod system for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderTechnique.h:154
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:94
Represents a scriptable api wrapping the DIS/HLA network connection.
Definition: diguyExerciseInterface.h:42
static diguyScenario * scenario
Definition: simple_playback_ogl.cpp:57
diguyScenarioInputMode
This enumeration lists the input modes available in DI-Guy Scenario views (3D windows) and for DI-Guy...
Definition: diguy_constants.h:842