DI-Guy SDK Documentation  13.5
diguyApp.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2020 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 
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  void reset_graphics_state();
719 
723  diguyUniformBufferUpdater * get_uniform_buffer_updater();
724 
725  /*l
726  *b Description:
727  **
728  ** This function loads (or reloads) shader source files into a shader
729  ** program. The shader program can be attached to a character in two
730  ** ways:
731  **
732  ** First, a shader may be explicitly added to a character using the
733  ** diguyCharacter::set_shader_program() function.
734  **
735  ** Second, a shader may be implicitly added to a character if its
736  ** appearance specifies an associated shader required to make the
737  ** appearance look right. Most often this is for appearances that
738  ** are skinned, requiring a shader to transform the vertices
739  ** correctly. DI-Guy most often uses the 'diguy_object' shader for
740  ** this.
741  **
742  ** If a shader program with the same name has already been loaded,
743  ** this function will replace it.
744  **
745  ** DI-Guy Scenario uses GLSL shaders.
746  **
747  *b Arguments:
748  **
749  *- shader_name - name by which shader program will be
750  *- referenced
751  *- vertex_shader_filename - name of file containing vertex shader
752  *- source code
753  *- pixel_shader_filename - name of file containing pixel shader
754  *- source code
755  **
756  *b Returns:
757  **
758  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
759  ** on failure
760  */
761  diguyGraphicsShaderProgram* load_shader_program(const char* shader_name,
762  const char* vertex_shader_filename,
763  const char* pixel_shader_filename,
764  const char* shader_version);
765 
769  diguyGraphicsShaderProgram * create_shader_program(const char* shader_name);
770 
771  /*l
772  *b Description:
773  **
774  ** This function reloads all previously loaded shader programs, using
775  ** the same source filenames as were used when the shader was
776  ** initially loaded.
777  **
778  ** This function can be used to reload/replace an existing shader
779  ** with the same name, allowing for quick edit and test cycles when
780  ** working on new shaders.
781  */
782  void reload_shader_programs();
783 
784  /*l
785  *b Description:
786  **
787  ** This function looks for the previously loaded shader program with
788  ** the given name.
789  **
790  *b Arguments:
791  **
792  *- shader_name - name of program to find
793  **
794  *b Returns:
795  **
796  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
797  ** on failure
798  */
799  diguyGraphicsShaderProgram* find_shader_program(const char* shader_name);
800 
801  /*l
802  *b Returns:
803  **
804  ** number of loaded shader programs
805  */
806  int get_num_shader_programs();
807 
808  /*l
809  *b Description:
810  **
811  ** This function returns the shader program at the specified index.
812  **
813  *b Arguments:
814  **
815  *- index - index of shader program
816  **
817  *b Returns:
818  **
819  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
820  ** on failure
821  */
822  diguyGraphicsShaderProgram* get_shader_program_at_index(int index);
823 
824  /*l
825  *b Description:
826  **
827  ** This function returns the shader program that's currently active
828  **
829  *b Returns:
830  **
831  ** pointer to object type diguyGraphicsShaderProgram on success, NULL
832  ** on failure
833  */
834  diguyGraphicsShaderProgram* get_current_bound_shader_program();
835 
836  /*l
837  *b Description:
838  **
839  ** This function looks for the previously loaded shader technique with
840  ** the given name.
841  **
842  *b Arguments:
843  **
844  *- shader_technique_name - name of program to find
845  **
846  *b Returns:
847  **
848  ** pointer to object type diguyGraphicsShaderTechnique on success,
849  ** NULL on failure
850  */
851  diguyGraphicsShaderTechnique* find_shader_technique(const char* shader_technique_name);
852 
853  /*l
854  *b Returns:
855  **
856  ** number of loaded shader techniques
857  */
858  int get_num_shader_techniques();
859 
860  /*l
861  *b Returns:
862  **
863  ** a pointer to a diguyGraphicsShaderTechnique on success at the
864  ** specified index, NULL on failure.
865  **
866  *b Arguments:
867  **
868  *- index - index of shader technique
869  */
870  diguyGraphicsShaderTechnique* get_shader_technique_at_index(int index);
871 
872  /*l
873  *b Description:
874  **
875  ** This function sets the max shader quality level for characters in
876  ** the application. See diguyGraphicsShaderProgram.h for the
877  ** diguyGraphicsShaderQualityLevel enum. This quality level, which
878  ** can range from no lighting to normal mapped characters, will be
879  ** used to pick an appropriate shader from a shader technique.
880  */
881  int set_max_character_shader_quality_level(int quality_level);
882  int get_max_character_shader_quality_level();
883 
884  /*l
885  *b Description:
886  **
887  ** This function sets the maximum shader quality level for scene
888  ** objects in the application. See
889  ** diguyApp::set_max_character_shader_quality_level() for more
890  ** information.
891  */
892  int set_max_scene_object_shader_quality_level(int quality_level);
893  int get_max_scene_object_shader_quality_level();
894 
895  /*l
896  *b Returns:
897  **
898  ** the value that was passed in for init.use_sRGB_corrected_textures
899  ** allows end users to procedurally choose gamma correction behavior.
900  */
901  int get_use_sRGB_textures();
902 
903 
904 /*****************************************************************************/
909  /*l
910  *b Description:
911  **
912  ** This function sets how may rendering passes DI-Guy will use
913  ** to draw objects such as characters and scene objects.
914  **
915  ** By default DI-Guy uses two rendering passes. Fully opaque
916  ** objects are drawn in the first pass; semi-transparent objects
917  ** are drawn in the second.
918  **
919  ** If few or no objects have transparency, the number of rendering
920  ** passes can be set to 1, which will increase rendering
921  ** performance.
922  **
923  ** If the number of rendering passes is set to 1, semi-transparent
924  ** objects may incorrectly occlude objects behind them, depending
925  ** on object rendering order.
926  **
927  ** This function can be called at any time.
928  **
929  *b Arguments:
930  **
931  *- num_rendering_passes - how many rendering passes to use;
932  *- default is 2
933  **
934  *b Returns:
935  **
936  ** 0 on success, -1 on failure
937  */
938  int set_num_rendering_passes(int num_rendering_passes);
939 
940  /*l
941  *b Returns:
942  **
943  ** current setting of number of rendering passes;
944  ** see set_num_rendering_passes()
945  */
946  int get_num_rendering_passes();
947 
948  /*l
949  *b Description:
950  **
951  ** Gets current render pass flags. See diguyRenderPassFlags.
952  ** The values are or'd together.
953  */
954  int get_render_pass_flags();
955 
956  /*l
957  *b Description:
958  **
959  ** Sets current render pass flags. See diguyRenderPassFlags.
960  */
961  int set_render_pass_flags(int flags);
962 
964  diguyViewCamera * get_current_camera();
965 
967  diguyViewCamera * get_shooting_camera();
968 
969  int get_use_materials();
970  void set_use_materials(int use_materials);
971 
972  int get_use_textures();
973  void set_use_textures(int use_textures);
974 
975 
976  /*****************************************************************************/
982  /*l
983  *b Description:
984  ** When loading a character this function tells DI-Guy to wait till a motion
985  ** is actually needed to load it or load all character's motion at character creation
986  ** time.
987  */
988  void set_delayed_motion_loading(int enabled);
989 
990  /*l
991  *b Returns:
992  **
993  ** current setting of whether motions will load when 1st used;
994  ** see set_delayed_motion_loading()
995  */
996  int get_delayed_motion_loading();
997 
998  /*l
999  *b Description:
1000  **
1001  ** This function tells DI-Guy to use quaternions for all joint
1002  ** angles in motions. It should be called after DI-Guy is
1003  ** initialized and before characters are created. By default
1004  ** DI-Guy data uses Quaternions.
1005  **
1006  ** Some motion operations are faster using quaternions, while
1007  ** some are not. In general anything that requires blending
1008  ** of motions will be faster when using quaternions.
1009  **
1010  ** This function should not have any negative effect on character
1011  ** motion quality.
1012  **
1013  *b Arguments:
1014  **
1015  *- enables - pass 1 to use quaternions for motions, 0 to use
1016  *- Euler angles
1017  **
1018  *b Returns:
1019  **
1020  ** 0 on success, -1 on failure
1021  **
1022  *b C++ Example:
1023  **
1024  *e diguy_graphics_initialize();
1025  *e diguyApp* the_app = diguy_get_app();
1026  *e the_app->set_precompute_quaternions_enabled(1);
1027  **
1028  */
1029  int set_precompute_quaternions_enabled(int enabled);
1030 
1031  /*l
1032  *b Returns:
1033  **
1034  ** current setting of whether quaternions are enabled;
1035  ** see set_precompute_quaternions_enabled()
1036  */
1037  int get_precompute_quaternions_enabled();
1038 
1039 /*****************************************************************************/
1045  /*l
1046  *b Description:
1047  **
1048  ** This function returns the ideal number of threads available on the
1049  ** system. This will correspond to the number of available
1050  ** processors.
1051  **
1052  *b Returns:
1053  **
1054  ** ideal number of threads on the system; -1 on failure to detect
1055  */
1056  int get_ideal_num_threads();
1057 
1058  /*l
1059  *b Description:
1060  **
1061  ** This function sets how many threads are available to DI-Guy. defaults to -1
1062  ** which will just use all cores available. 1 or 0 sets single threaded behavior,
1063  ** and other number will indicate a limit to the tbb subsystem on number of cores to use.
1064  **
1065  *b Arguments:
1066  **
1067  *- num_threads - number of threads available to DI-Guy
1068  **
1069  *b Returns:
1070  **
1071  ** 0 on success, -1 on failure
1072  */
1073  int set_num_threads(int num_threads);
1074 
1075  /*l
1076  *b Returns:
1077  **
1078  ** number of threads available to DI-Guy
1079  */
1080  int get_num_threads();
1081 
1082 
1086  void set_use_update_phase_1_multithreading(bool use);
1087  bool get_use_update_phase_1_multithreading();
1088 
1092  void run_background_load_update();
1093 
1095  int is_background_loader_active();
1096 
1099  void set_stream_textures_to_gpu(bool enable);
1100  bool get_stream_textures_to_gpu();
1101 
1102 /*****************************************************************************/
1108  /*l
1109  *b Description:
1110  **
1111  ** This function changes the current Input Mode of the DI-Guy Scenario
1112  ** application or a DI-Guy Author Host IG.
1113  **
1114  *b Arguments:
1115  **
1116  *a mode - the new base Input Mode of DI-Guy Scenario or DI-Guy Author
1117  **
1118  *b Returns:
1119  **
1120  ** -1 if mode change failed (e.g., tried for AI-related mode but AI
1121  ** not available, 0 on no error
1122  */
1123  int set_base_input_mode(diguyScenarioInputMode mode);
1124 
1125  /*l
1126  *b Returns:
1127  **
1128  ** the current Input Mode of the DI-Guy Scenario application or a
1129  ** DI-Guy Author Host IG.
1130  */
1131  diguyScenarioInputMode get_base_input_mode();
1132 
1133  /*l
1134  *b Description:
1135  **
1136  ** This function returns the 3D world position of the last clicked
1137  ** point in a DI-Guy Scenario 3D view.
1138  **
1139  ** This function is meant to complement the use of callbacks with
1140  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1141  **
1142  *b Arguments:
1143  **
1144  *a x, y, z - position in meters from the origin
1145  **
1146  ** Pass NULL for any values that are not needed.
1147  */
1148  int get_last_clicked_xyz(float* x, float* y, float* z);
1149 
1150  /*l
1151  *b Description:
1152  **
1153  ** This function sets the 3D world position of the last clicked point
1154  ** in a DI-Guy Scenario 3D view.
1155  **
1156  ** This function is meant to complement the use of callbacks with
1157  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1158  **
1159  *b Arguments:
1160  **
1161  *a x, y, z - position in meters from the origin
1162  */
1163  void set_last_clicked_xyz(float x, float y, float z);
1164 
1165  /*l
1166  *b Description:
1167  **
1168  ** This function returns the last character clicked by the mouse in
1169  ** DI-Guy Scenario.
1170  **
1171  ** This function is meant to complement the use of callbacks with
1172  ** callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1173  **
1174  *b Returns:
1175  **
1176  ** pointer of type diguyCharacter; may be NULL if no character has
1177  ** been clicked
1178  */
1179  diguyCharacter* get_last_clicked_character();
1180 
1181  /*l
1182  *b Description:
1183  **
1184  ** This function returns the current screen coordinates x and y
1185  ** position of the mouse.
1186  */
1187  int get_mouse_screen_xy(float* sx, float* sy);
1188 
1189  /*l
1190  *b Description:
1191  **
1192  ** This function returns the current xyz coordinates under the mouse
1193  ** location, this is a fairly speedy test since the octtree is used.
1194  ** Typically this function is used to help build interactive UI tools.
1195  **
1196  *b Arguments:
1197  **
1198  *a x, y, z - resulting position in meters from the origin
1199  */
1200  int get_xyz_under_mouse(float* x, float* y, float* z);
1201 
1202  /*l
1203  *b Description:
1204  **
1205  ** This function sets up the UI to notify a lua object of mouse events
1206  ** via messages while in input mode
1207  ** DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.
1208  **
1209  ** The following callbacks are generated:
1210  *>
1211  *- - CALLBACK_ID_UI_MOUSE_DOWN
1212  *- - CALLBACK_ID_UI_MOUSE_UP
1213  *- - CALLBACK_ID_UI_RIGHT_MOUSE_DOWN
1214  *- - CALLBACK_ID_UI_RIGHT_MOUSE_UP
1215  *<
1216  ** See luaUIStateMachine:get_user_selected_point() to see an example
1217  ** of usage. Typically this function is used to help build interactive
1218  ** UI tools.
1219  **
1220  *b Arguments:
1221  **
1222  *a object_name - resulting position in meters from the origin
1223  */
1224  void set_lua_object_waiting_for_input(const char* object_name);
1225 
1226  /*l
1227  *b Returns:
1228  **
1229  ** The name of the lua object that's currently waiting for input
1230  ** events. Can return NULL if there's no active object.
1231  */
1232  const char* get_lua_object_waiting_for_input();
1233 
1234 
1235 /*****************************************************************************/
1241  /*l
1242  *b Description:
1243  **
1244  ** This function is equivalent to the function
1245  ** diguy_author_get_author_interface() in diguy_author.h. It is made
1246  ** available here so it is available to scripts.
1247  */
1248  diguyAuthorInterface* get_author_interface();
1249 
1250 
1251 /*****************************************************************************/
1257  /*l
1258  *b Returns:
1259  **
1260  ** This function returns a pointer to a diguyViewPainter object.
1261  ** This object can be used to draw lines, text, and other primitives
1262  ** in the 3D views of DI-Guy Scenario.
1263  */
1264  diguyViewPainter* get_view_painter();
1265 
1266 
1267 /*****************************************************************************/
1273  /*l
1274  *b Description:
1275  **
1276  ** This function sets 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  *a enable_collisions - pass 1 to have groups collide, 0 to not
1284  */
1285  void set_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1286  diguyPhysicsCollisionGroup collision_group2,
1287  int enable_collisions);
1288 
1289  /*l
1290  *b Description:
1291  **
1292  ** This function returns whether the two specified collision groups
1293  ** should collide against each other.
1294  **
1295  *b Arguments:
1296  **
1297  *a collision_group1 - first collision group
1298  *a collision_group2 - second collision group
1299  **
1300  *b Returns:
1301  **
1302  ** 1 if collision groups collide, 0 if not
1303  */
1304  int get_collision_group_detection_flag(diguyPhysicsCollisionGroup collision_group1,
1305  diguyPhysicsCollisionGroup collision_group2);
1306 
1307  /*l
1308  *b Description:
1309  **
1310  ** The physics simulation module can have an optional ground plane
1311  ** enabled through which no objects will pass. This function sets
1312  ** whether the ground plane is enabled.
1313  **
1314  *b Arguments:
1315  **
1316  *a enabled - pass 1 to enable ground plane, 0 to disable
1317  */
1318  void set_physics_sim_ground_plane_enabled(int enabled);
1319 
1320  /*l
1321  *b Returns:
1322  **
1323  ** 1 if physics sim ground plane enabled, 0 if not
1324  */
1325  int get_physics_sim_ground_plane_enabled();
1326 
1327  /*l
1328  *b Description:
1329  **
1330  ** The physics simulation module can have an optional ground plane
1331  ** enabled through which no objects will pass. This function sets the
1332  ** height of the ground plane.
1333  **
1334  *b Arguments:
1335  **
1336  *a height - height in meters
1337  */
1338  void set_physics_sim_ground_plane_height(float height);
1339 
1340  /*l
1341  *b Returns:
1342  **
1343  ** height of physics sim ground plane
1344  */
1345  float get_physics_sim_ground_plane_height();
1346 
1347 
1348 /*****************************************************************************/
1357  /*l
1358  *b Returns:
1359  **
1360  ** the library suffix, which is derived from the dll compiling flags, e.g. "_x64_vc14"
1361  */
1362  static const char* get_standard_bdi_library_suffix();
1363 
1364  /*l
1365  *b Returns:
1366  **
1367  ** the library suffix, which is derived from the version number, e.g. "_1250"
1368  */
1369  static const char* get_diguy_version_library_suffix();
1370 
1371  /*l
1372  *b Returns:
1373  **
1374  ** the library suffix, which is derived from the compiler type, e.g. "_vc9"
1375  */
1376  static const char* get_compiler_library_suffix();
1377 
1378  /*l
1379  *b Returns:
1380  **
1381  ** the debug suffix, "d" or blank
1382  */
1383  static const char* get_debug_library_suffix();
1384 
1385  /*l
1386  *b Description:
1387  **
1388  ** Loads dynamic library module. The handle returned can be
1389  ** passed into resolve_symbol() or unload_module_library().
1390  **
1391  *b Returns:
1392  **
1393  ** handle as (void *) pointer, NULL if library is not found or failed to load.
1394  **
1395  ** Load status is set to:
1396  **
1397  ** 0 : load successful
1398  ** -1 : library not found
1399  ** -2 : ?
1400  */
1401  static void* load_module_library(const char* module_lib_name,
1402  int include_diguy_standard_library_suffixes = 1,
1403  int* load_status = NULL);
1404 
1405  /*l
1406  *b Description:
1407  **
1408  ** Returns pointer to function provided by already-loaded dynamic library module.
1409  ** Pointer should be cast to one of:
1410  **
1411  ** - diguyModuleFunctionInt
1412  ** - diguyModuleFunctionVoid
1413  ** - diguyModuleFunctionVoidReturnsVoid
1414  **
1415  *b Returns:
1416  **
1417  ** pointer to function, or NULL if function not found.
1418  */
1419  static diguyVoidFunctionVoid resolve_module_library_symbol(
1420  void* module_handle, const char* symbol_name );
1421 
1422  /*l
1423  *b Description:
1424  **
1425  ** Unloads dynamic library module, given handle to it.
1426  **
1427  */
1428  static void unload_module_library(void* module_handle);
1429 
1430  /*l
1431  *b Description:
1432  **
1433  ** Returns 1 if a sound factory is initialized.
1434  */
1435  int get_sound_factory_is_initialized();
1436 
1437 /*****************************************************************************/
1445  /*l
1446  *b Description:
1447  **
1448  ** Sets override values for the specified munition type's DIS impact
1449  ** septet.
1450  **
1451  ** Munition types are defined in the config file munition_types.cfg,
1452  ** located under the DI-Guy installation config directory.
1453  **
1454  *b Arguments:
1455  **
1456  *- munition_type - name of munition type to modify; e.g., "m16"
1457  *- sep1, etc. - new DIS septet values
1458  */
1459  int set_munition_type_DIS_impact_septet(const char* munition_type,
1460  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1461 
1462  /*l
1463  *b Description:
1464  **
1465  ** Similar to set_munition_type_DIS_impact_septet(), but overrides the
1466  ** septet for tracer type.
1467  */
1468  int set_munition_type_DIS_tracer_septet(const char* munition_type,
1469  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7);
1470 
1471  /*l
1472  *b Description:
1473  **
1474  ** Returns the munition type name based on the passed septet values.
1475  **
1476  *b Arguments:
1477  **
1478  *- sep1, etc. - DIS septet values
1479  *- need_exact_match - If 1 (true), only return an exact septet match.
1480  *- If 0 (false), a 0 in the munition_types.cfg septet
1481  *- is treated as a wildcard.
1482  *- include_last_septet_value - pass 1 to include the last septet
1483  *- value in the search, 0 to not
1484  */
1485  const char* get_munition_type_from_DIS_septet(
1486  int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7,
1487  int include_last_septet_value = 1);
1488 
1489 
1490 /****************************************************************************/
1491 /****************************************************************************/
1492 /****************************************************************************/
1496 /****************************************************************************/
1497 /****************************************************************************/
1498 /****************************************************************************/
1499 
1500  /*l
1501  *b Description:
1502  **
1503  ** Causes garbage-collection to unload graphics files that have been
1504  ** previously loaded into memory, but are unused, freeing up memory. There
1505  ** may be a frame hitch if graphics files are to be used again and need to be
1506  ** reloaded.
1507  **
1508  *b Arguments:
1509  **
1510  *- garbage_collect_appearances - setting to 1 will attempt to remove
1511  *- unused character appearance geometry as well as
1512  *- scene objects; default is 1. If 0, only scene object
1513  *- files will be discarded.
1514  */
1515  int unload_unreferenced_graphics_files(int garbage_collect_appearances = 1);
1516 
1517  /*l
1518  *b Description:
1519  **
1520  ** Causes textures that have changes to be reloaded
1521  */
1522  int reload_texture_files();
1523 
1524  /*l
1525  *b Description:
1526  **
1527  ** How many textures in memory before texture unloading starts (defaults to 5000)
1528  */
1529  int set_threshold_to_unload_textures(int number);
1530  int get_threshold_to_unload_textures();
1531 
1532  /*l
1533  *b Description:
1534  **
1535  ** How often to check if inactive textures should be unloaded.
1536  */
1537  int set_texture_unload_frequency(float seconds);
1538  float get_texture_unload_frequency();
1539 
1540  /*l
1541  *b Description:
1542  **
1543  ** Should unused assets be garbage collected after loading a new scenario.
1544  */
1545  int get_unload_unused_after_scenario_load();
1546  int set_unload_unused_after_scenario_load(int val);
1547 
1548  /*l
1549  *b Description:
1550  **
1551  ** Sets whether optimized versions of motion files should be cached to
1552  ** disk when they are loaded.
1553  **
1554  ** This is still experimental. The default is 0, don't enable
1555  ** caching.
1556  **
1557  *b Arguments:
1558  **
1559  *- enabled - pass 1 to enable caching, 0 to disable
1560  */
1561  int set_cache_optimized_motion_files(int enabled = 0);
1562 
1563  /*l
1564  *b Returns:
1565  **
1566  ** 1 if caching of optimized motion files is enabled, 0 if disabled
1567  */
1568  int get_cache_optimized_motion_files();
1569 
1570  /*l
1571  *b Description:
1572  **
1573  ** Prints to the log a report about memory usage and leaks.
1574  **
1575  *b Arguments:
1576  **
1577  *- include_permanent_objects - pass 1 to include permanent objects
1578  *- in reports; 0 is default
1579  *- just_markers - pass 1 to only generate reports for
1580  *- memory use at instants after a marker
1581  *- is dropped
1582  */
1583  int memory_tracker_print_report(int include_permanent_objects = 0, int just_markers = 0);
1584 
1586  int memory_tracker_drop_marker();
1587 
1588  /*l
1589  *b Description:
1590  **
1591  ** Provide DI-Guy Scenario with a list of messages that the user can access
1592  ** from the right-click menu. When a message is selected, it is sent over the
1593  ** network to the AIs of remote entities. If the AIs can process the message,
1594  ** they will. Typically used to kill remote entities from a master server.
1595  **
1596  *b Arguments:
1597  **
1598  *- message - a string containing a comma-separated list of messages.
1599  */
1600  void set_reflected_entity_message_list(const char* message);
1601 
1602  /*l
1603  *b Description:
1604  **
1605  ** Returns a string containing a comma-separated list of supported
1606  ** reflected-entity messages, as set by set_reflected_entity_message_list()
1607  */
1608  const char* get_reflected_entity_message_list();
1609 
1610  /*l
1611  *b Description:
1612  **
1613  ** In DI-Guy Scenario pops up a user interface asking the end user to
1614  ** pick a scene object file name.
1615  */
1616  const char* get_scene_object_file_name_from_ui();
1617 
1618  /*l
1619  *b Description:
1620  **
1621  ** Causes DI-Guy to display UI relevant to navmesh generation
1622  */
1623  int show_generate_navmesh_ui();
1624 
1626  void print_process_memory_info();
1627 
1629  static int decompress_lz4_file(const char * source, const char * destination);
1630 
1633  diguyMotionExporter* get_motion_exporter();
1634 
1637  void set_use_scene_object_instancing(int enabled);
1638 
1640  void set_enable_concurrency_visualizer_markers(int enabled);
1641 
1643  void set_enable_tracy_markers(int enabled);
1645  void profiler_mark_end_of_frame();
1646 
1648  static int get_lod_warn_threshold(int lod);
1649 
1650  /****************************************************************************/
1651 /****************************************************************************/
1652 /****************************************************************************/
1656 /****************************************************************************/
1657 /****************************************************************************/
1658 /****************************************************************************/
1659 
1660  /*l
1661  *b Returns:
1662  **
1663  ** Newly-created log channel
1664  */
1665  diguyLogChannel* create_log_channel();
1666 
1667  /*l
1668  *b Description:
1669  **
1670  ** Destroys specified log channel
1671  */
1672  void destroy_log_channel(diguyLogChannel*);
1673 
1674  /*l
1675  *b Returns:
1676  **
1677  ** Number of log channels
1678  */
1679  int get_num_log_channels();
1680 
1681  /*l
1682  *b Returns:
1683  **
1684  ** Log channel at index
1685  */
1686  diguyLogChannel* get_log_channel_at_index(int index);
1687 
1688 
1689 /****************************************************************************/
1690 /****************************************************************************/
1691 /****************************************************************************/
1695 /****************************************************************************/
1696 /****************************************************************************/
1697 /****************************************************************************/
1698 
1699  /*l
1700  ** Deprecated as of DI-Guy 12.0.0.
1701  ** Use diguyAuthorVisualRegionPaintbrush::set_painting_subregion()
1702  ** instead.
1703  */
1704  int set_current_painting_subregion(diguySubregionIndex index);
1705 
1706 
1707 
1712 #ifdef CPLUSPLUS_ONLY
1713 
1714  void set_no_blend_test(int flag);
1715 
1716  void set_motion_events_log_enabled(int enabled);
1717 
1718  void dump_motion_events_to_file(const char* filename,
1719  int show_event_id_strings = 0,
1720  int indent = 0);
1721 
1722  bdiScenarioApp* get_scripted_object() {return m_scripted_object;}
1723 
1724 
1725 private:
1726 
1727  /*l
1728  ** A private constructor. Use the DI-Guy function
1729  ** get_app() to obtain a diguyApp object pointer.
1730  */
1731  diguyApp(bdiScenarioApp* scenario);
1732 
1733  /*l
1734  ** A private destructor. Use the DI-Guy function
1735  ** diguy_deinitialize() to delete a diguyApp object pointer.
1736  */
1737  virtual ~diguyApp();
1738 
1739  /*l
1740  ** A pointer to internal data.
1741  */
1742  bdiScenarioApp* m_scripted_object;
1743 
1744  friend class bdiScenarioApp;
1745 
1746 #endif
1747 
1748 };
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
Link against: libdiguy
Definition: diguyAuthorInterface.h:58
void(* diguyVoidFunctionVoid)()
Definition: diguyApp.h:23
diguySubregionIndex
DI-Guy subregions.
Definition: diguy_constants.h:1469
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:100
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:1719
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:792