DI-Guy SDK Documentation  13.7.1
diguyApp Class Reference

A Singleton class representing the DI-Guy Application. More...

#include <diguyApp.h>

Public Member Functions

Networking Functions

Unless otherwise specified, all functions callable from:

  • C++
  • Script
diguyExerciseInterfaceget_exercise_interface ()
 Gets a pointer to the exercise interface. More...
 
C++ Only Callback Functions
int add_default_scenario_callback (int callback_id, diguyScenarioCallback *callback, void *callback_params=0, void *callback_user_data=0, int remove_on_scenario_load=1)
 This function sets a default user callback that will be added to all new scenarios. More...
 
int remove_default_scenario_callback (int callback_id, diguyScenarioCallback *callback)
 This function removes a default user callback previously added by add_default_scenario_callback(). More...
 
int remove_default_scenario_callback_with_user_data (int callback_id, void *callback_user_data)
 This function removes a default user callback previously added by add_default_scenario_callback(). More...
 
C++ and Script Callback Functions
int add_default_scenario_callback_script (int callback_id, const char *callback_script, const char *callback_script_type, int remove_on_scenario_load=1)
 This function adds a default scenario callback script. More...
 
int remove_default_scenario_callback_script (int callback_id, const char *callback_script, const char *callback_script_type)
 This function removes a default scenario callback script. More...
 
Event Handler Functions

DI-Guy event handlers are similar to callbacks, but have a name with which they can be referenced.

This name allows DI-Guy Scenario to map event handlers to callback ids using a UI, and allows for these mappings to be saved and restored as part of the scenario.

int register_scenario_event_handler (const char *handler_name, diguyScenarioCallback *callback, void *callback_user_data=0)
 This function is analogous to the diguyScenario::register_character_event_handler() function, but is for scenarios rather than characters. More...
 
int register_scenario_event_handler_from_library (const char *handler_name, const char *library_name, const char *function_name, void *callback_user_data=0)
 This function is analogous to the diguyScenario::register_character_event_handler_from_library() function, but is for scenarios rather than characters. More...
 
int register_scenario_event_handler_script (const char *handler_name, const char *handler_script, const char *handler_script_type=NULL)
 This function is analogous to the diguyScenario::register_character_event_handler_script() function, but is for scenarios rather than characters. More...
 
int has_registered_scenario_event_handler (const char *handler_name)
 This function is analogous to the diguyScenario::has_registered_character_event_handler() function, but is for scenarios rather than characters. More...
 
int unregister_scenario_event_handler (const char *handler_name)
 This function is analogous to the diguyScenario::unregister_character_event_handler() function, but is for scenarios rather than characters. More...
 
int add_draw_pass (const diguyDrawPass *drawPass)
 Adds a draw pass which is used to modified how diguyScenario::draw() functions. More...
 
int remove_all_draw_passes ()
 Removes all draw passes previously registered with diguyApp::add_draw_pass(). More...
 
Plugin Functions

See complete overview at DI-Guy Scenario Plug-in Overview

int load_plugin (const char *plugin_name, int required_by_scenario=0, int unload_on_scenario_close=0, int accepts_mouse_input=1)
 This function adds a new dynamic library plugin to the app. More...
 
int unload_plugin (const char *plugin_name)
 This function unloads a dynamic library plugin from the app that was added using the load_plugin() function. More...
 
void unload_all_plugins ()
 Unloads all plug-ins. More...
 
int get_num_plugins ()
 Returns: This function returns the number of dynamic library plugins currently loaded. More...
 
const char * get_name_of_plugin (int index)
 Returns: the name of a specific plug-in at a specified index. More...
 
Shader Functions
void reset_graphics_state ()
 resets shader programs and texture unit tracking More...
 
diguyUniformBufferUpdaterget_uniform_buffer_updater ()
 Will return a pointer to the abstract wrapper that wraps all shader constants for use with DI-Guy renderering. More...
 
diguyGraphicsShaderProgramload_shader_program (const char *shader_name, const char *vertex_shader_filename, const char *pixel_shader_filename, const char *shader_version)
 This function loads (or reloads) shader source files into a shader program. More...
 
diguyGraphicsShaderProgramcreate_shader_program (const char *shader_name)
 Creates a new shader program which you can then dynamically set the vertex and pixel shader source code on. More...
 
void reload_shader_programs ()
 This function reloads all previously loaded shader programs, using the same source filenames as were used when the shader was initially loaded. More...
 
diguyGraphicsShaderProgramfind_shader_program (const char *shader_name)
 This function looks for the previously loaded shader program with the given name. More...
 
int get_num_shader_programs ()
 Returns: number of loaded shader programs. More...
 
diguyGraphicsShaderProgramget_shader_program_at_index (int index)
 This function returns the shader program at the specified index. More...
 
diguyGraphicsShaderProgramget_current_bound_shader_program ()
 This function returns the shader program that's currently active. More...
 
diguyGraphicsShaderTechniquefind_shader_technique (const char *shader_technique_name)
 This function looks for the previously loaded shader technique with the given name. More...
 
int get_num_shader_techniques ()
 Returns: number of loaded shader techniques. More...
 
diguyGraphicsShaderTechniqueget_shader_technique_at_index (int index)
 Returns: a pointer to a diguyGraphicsShaderTechnique on success at the specified index, NULL on failure. More...
 
int set_max_character_shader_quality_level (int quality_level)
 This function sets the max shader quality level for characters in the application. More...
 
int get_max_character_shader_quality_level ()
 
int set_max_scene_object_shader_quality_level (int quality_level)
 This function sets the maximum shader quality level for scene objects in the application. More...
 
int get_max_scene_object_shader_quality_level ()
 
int get_use_sRGB_textures ()
 Returns: the value that was passed in for init.use_sRGB_corrected_textures allows end users to procedurally choose gamma correction behavior. More...
 
Render Pass Control Functions
int set_num_rendering_passes (int num_rendering_passes)
 This function sets how may rendering passes DI-Guy will use to draw objects such as characters and scene objects. More...
 
int get_num_rendering_passes ()
 Returns: current setting of number of rendering passes; see set_num_rendering_passes() More...
 
int get_render_pass_flags ()
 Gets current render pass flags. More...
 
int set_render_pass_flags (int flags)
 Sets current render pass flags. More...
 
diguyViewCameraget_current_camera ()
 returns the current camera More...
 
diguyViewCameraget_shooting_camera ()
 returns a scratch camera for shooting tests More...
 
int get_use_materials ()
 
void set_use_materials (int use_materials)
 
int get_use_textures ()
 
void set_use_textures (int use_textures)
 
Performance Functions
void set_delayed_motion_loading (int enabled)
 When loading a character this function tells DI-Guy to wait till a motion is actually needed to load it or load all character's motion at character creation time. More...
 
int get_delayed_motion_loading ()
 Returns: current setting of whether motions will load when 1st used; see set_delayed_motion_loading() More...
 
int set_precompute_quaternions_enabled (int enabled)
 This function tells DI-Guy to use quaternions for all joint angles in motions. More...
 
int get_precompute_quaternions_enabled ()
 Returns: current setting of whether quaternions are enabled; see set_precompute_quaternions_enabled() More...
 
Threading Functions
int get_ideal_num_threads ()
 This function returns the ideal number of threads available on the system. More...
 
int set_num_threads (int num_threads)
 This function sets how many threads are available to DI-Guy. More...
 
int get_num_threads ()
 Returns: number of threads available to DI-Guy. More...
 
void set_use_update_phase_1_multithreading (bool use)
 This defaults to false, DI-Guy will multi-thread character type and appearance updates, can save time on high entity count scenarios but breaks a number of features. More...
 
bool get_use_update_phase_1_multithreading ()
 
void run_background_load_update ()
 helper function to sync asynchronous texture files in retained mode renderers see diguyCharacter::set_texture_load_behavior(), diguyCharacter::get_texture_load_behavior() and diguySceneObject::set_texture_load_behavior(), diguySceneObject::get_texture_load_behavior(); More...
 
int is_background_loader_active ()
 helper function to let you know if asynchronous texture loader is currently using a core More...
 
void set_stream_textures_to_gpu (bool enable)
 should diguy stream textures to the gpu one mip maps at a time, this is implemented in the diguyGeometryTexture code. More...
 
bool get_stream_textures_to_gpu ()
 
User Input Functions
int set_base_input_mode (diguyScenarioInputMode mode)
 This function changes the current Input Mode of the DI-Guy Scenario application or a DI-Guy Author Host IG. More...
 
diguyScenarioInputMode get_base_input_mode ()
 Returns: the current Input Mode of the DI-Guy Scenario application or a DI-Guy Author Host IG. More...
 
int get_last_clicked_xyz (float *x, float *y, float *z)
 This function returns the 3D world position of the last clicked point in a DI-Guy Scenario 3D view. More...
 
void set_last_clicked_xyz (float x, float y, float z)
 This function sets the 3D world position of the last clicked point in a DI-Guy Scenario 3D view. More...
 
diguyCharacterget_last_clicked_character ()
 This function returns the last character clicked by the mouse in DI-Guy Scenario. More...
 
int get_mouse_screen_xy (float *sx, float *sy)
 This function returns the current screen coordinates x and y position of the mouse. More...
 
int get_xyz_under_mouse (float *x, float *y, float *z)
 This function returns the current xyz coordinates under the mouse location, this is a fairly speedy test since the octtree is used. More...
 
void set_lua_object_waiting_for_input (const char *object_name)
 This function sets up the UI to notify a lua object of mouse events via messages while in input mode DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT. More...
 
const char * get_lua_object_waiting_for_input ()
 Returns: The name of the lua object that's currently waiting for input events. More...
 
DI-Guy Author Functions
diguyAuthorInterfaceget_author_interface ()
 This function is equivalent to the function diguy_author_get_author_interface() in diguy_author.h. More...
 
Draw Functions
diguyViewPainterget_view_painter ()
 Returns: This function returns a pointer to a diguyViewPainter object. More...
 
Physics Module Functions
void set_collision_group_detection_flag (diguyPhysicsCollisionGroup collision_group1, diguyPhysicsCollisionGroup collision_group2, int enable_collisions)
 This function sets whether the two specified collision groups should collide against each other. More...
 
int get_collision_group_detection_flag (diguyPhysicsCollisionGroup collision_group1, diguyPhysicsCollisionGroup collision_group2)
 This function returns whether the two specified collision groups should collide against each other. More...
 
void set_physics_sim_ground_plane_enabled (int enabled)
 The physics simulation module can have an optional ground plane enabled through which no objects will pass. More...
 
int get_physics_sim_ground_plane_enabled ()
 Returns: 1 if physics sim ground plane enabled, 0 if not. More...
 
void set_physics_sim_ground_plane_height (float height)
 The physics simulation module can have an optional ground plane enabled through which no objects will pass. More...
 
float get_physics_sim_ground_plane_height ()
 Returns: height of physics sim ground plane. More...
 
Experimental Munition Type Functions

These functions provide access to munition types defined for DI-Guy.

int set_munition_type_DIS_impact_septet (const char *munition_type, int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7)
 Sets override values for the specified munition type's DIS impact septet. More...
 
int set_munition_type_DIS_tracer_septet (const char *munition_type, int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7)
 Similar to set_munition_type_DIS_impact_septet(), but overrides the septet for tracer type. More...
 
const char * get_munition_type_from_DIS_septet (int sep1, int sep2, int sep3, int sep4, int sep5, int sep6, int sep7, int include_last_septet_value=1)
 Returns the munition type name based on the passed septet values. More...
 
Experimental Log Channel Functions
diguyLogChannelcreate_log_channel ()
 Returns: Newly-created log channel. More...
 
void destroy_log_channel (diguyLogChannel *)
 Destroys specified log channel. More...
 
int get_num_log_channels ()
 Returns: Number of log channels. More...
 
diguyLogChannelget_log_channel_at_index (int index)
 Returns: Log channel at index. More...
 
Deprecated Functions
int set_current_painting_subregion (diguySubregionIndex index)
 Deprecated as of DI-Guy 12.0.0. More...
 

Static Public Member Functions

Directory Functions

Unless otherwise specified, all functions callable from:

  • C++
  • Script
static const char * get_diguy_base_dir_path ()
 Returns: the path to the base directory of the DI-Guy installation; this is typically set by the environment variable DIGUY. More...
 
static const char * get_diguy_subdir_path (const char *subdir)
 Returns: the path to a subdirectory of the DI-Guy installation; this is typically derived from the environment variable DIGUY, but is sometimes overridden by other environment variables. More...
 

General Functions

Unless otherwise noted all functions in this class section are callable from:

  • C++
  • Script

In lua static function are callable as diguyApp_function_name or via the this_app global.

static diguyAppget_app ()
 This static function returns a pointer to the DI-Guy application. More...
 
static void install_qt_message_handler ()
 Registers a message handler with Qt so Qt output goes through the diguy logging system. More...
 
int get_num_scenarios ()
 Returns: number of scenarios in the app. More...
 
diguyScenarioget_scenario_at_index (int index)
 Returns: pointer of type diguyScenario; NULL if no scenario at the specified index. More...
 
int get_num_blend_functions ()
 Returns: number of blend functions available. More...
 
const char * get_blend_function_name_at_index (int index)
 Returns: name of blend function at specified index; NULL if no blend function at specified index. More...
 
int is_debug ()
 This function returns whether or not the application is in debug mode. More...
 
int is_api_mode ()
 This function returns whether or not the DI-Guy SDK is being used inside of DI-Guy Scenario or as an embedded C++ library. More...
 
int is_module_enabled (const char *module_name)
 This function returns whether or not the specified module is currently enabled. More...
 
diguyScenarioget_current_scenario ()
 Returns: pointer of type diguyScenario; NULL if no current scenario. More...
 

Library Functions

These functions provide support for loading DI-Guy modules at runtime, without need for linking against module import libraries.

static const char * get_standard_bdi_library_suffix ()
 Returns: the library suffix, which is derived from the dll compiling flags, e.g. More...
 
static const char * get_diguy_version_library_suffix ()
 Returns: the library suffix, which is derived from the version number, e.g. More...
 
static const char * get_compiler_library_suffix ()
 Returns: the library suffix, which is derived from the compiler type, e.g. More...
 
static const char * get_debug_library_suffix ()
 Returns: the debug suffix, "d" or blank. More...
 
static void * load_module_library (const char *module_lib_name, int include_diguy_standard_library_suffixes=1, int *load_status=NULL)
 Loads dynamic library module. More...
 
static diguyVoidFunctionVoid resolve_module_library_symbol (void *module_handle, const char *symbol_name)
 Returns pointer to function provided by already-loaded dynamic library module. More...
 
static void unload_module_library (void *module_handle)
 Unloads dynamic library module, given handle to it. More...
 
int get_sound_factory_is_initialized ()
 Returns 1 if a sound factory is initialized. More...
 

Experimental Functions

static int decompress_lz4_file (const char *source, const char *destination)
 inputs lz4 file, decompresses to source data. Needed for unity texture handling More...
 
static int get_lod_warn_threshold (int lod)
 starts at 1, returns -1 if there isn't a threshold; More...
 
int unload_unreferenced_graphics_files (int garbage_collect_appearances=1)
 Causes garbage-collection to unload graphics files that have been previously loaded into memory, but are unused, freeing up memory. More...
 
int reload_texture_files ()
 Causes textures that have changes to be reloaded. More...
 
int set_threshold_to_unload_textures (int number)
 How many textures in memory before texture unloading starts (defaults to 5000) More...
 
int get_threshold_to_unload_textures ()
 
int set_texture_unload_frequency (float seconds)
 How often to check if inactive textures should be unloaded. More...
 
float get_texture_unload_frequency ()
 
int get_unload_unused_after_scenario_load ()
 Should unused assets be garbage collected after loading a new scenario. More...
 
int set_unload_unused_after_scenario_load (int val)
 
int set_cache_optimized_motion_files (int enabled=0)
 Sets whether optimized versions of motion files should be cached to disk when they are loaded. More...
 
int get_cache_optimized_motion_files ()
 Returns: 1 if caching of optimized motion files is enabled, 0 if disabled. More...
 
int memory_tracker_print_report (int include_permanent_objects=0, int just_markers=0)
 Prints to the log a report about memory usage and leaks. More...
 
int memory_tracker_drop_marker ()
 Add a marker for use by memory_tracker_print_report() More...
 
void set_reflected_entity_message_list (const char *message)
 Provide DI-Guy Scenario with a list of messages that the user can access from the right-click menu. More...
 
const char * get_reflected_entity_message_list ()
 Returns a string containing a comma-separated list of supported reflected-entity messages, as set by set_reflected_entity_message_list() More...
 
const char * get_scene_object_file_name_from_ui ()
 In DI-Guy Scenario pops up a user interface asking the end user to pick a scene object file name. More...
 
int show_generate_navmesh_ui ()
 Causes DI-Guy to display UI relevant to navmesh generation. More...
 
void print_process_memory_info ()
 On Window will print standard memory info to the log.. Occasionally useful for programming examples. More...
 
diguyMotionExporterget_motion_exporter ()
 Only available in the Motion Editor. More...
 
void set_use_scene_object_instancing (int enabled)
 13.2.0 DI-Guy Scenario adds a new fast instancing system that work on xrefs and other repeated geometry. More...
 
void set_enable_concurrency_visualizer_markers (int enabled)
 turns on concurrency visualizer markers ( windows only ) off by default More...
 
void set_enable_tracy_markers (bool enabled, bool start_up_tracy=true)
 turns on tracy markers ( windows only, requires special build of diguy) More...
 
void profiler_mark_end_of_frame ()
 marks end of tracy frame More...
 
void shutdown_profiler ()
 shuts down tracy. More...
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

bdiScenarioAppm_scripted_object
 A pointer to internal data. More...
 
class bdiScenarioApp
 
void set_no_blend_test (int flag)
 
void set_motion_events_log_enabled (int enabled)
 
void dump_motion_events_to_file (const char *filename, int show_event_id_strings=0, int indent=0)
 
bdiScenarioAppget_scripted_object ()
 
 diguyApp (bdiScenarioApp *scenario)
 A private constructor. More...
 
virtual ~diguyApp ()
 A private destructor. More...
 

Detailed Description

A Singleton class representing the DI-Guy Application.

Constructor & Destructor Documentation

diguyApp::diguyApp ( bdiScenarioApp scenario)
private

A private constructor.

Use the DI-Guy function get_app() to obtain a diguyApp object pointer.

virtual diguyApp::~diguyApp ( )
privatevirtual

A private destructor.

Use the DI-Guy function diguy_deinitialize() to delete a diguyApp object pointer.

Member Function Documentation

static diguyApp* diguyApp::get_app ( )
static

This static function returns a pointer to the DI-Guy application.

All functions below can then be called through this pointer.

Returns:

a pointer of type diguyApp

C++ Example:

int diguyApp::get_num_scenarios ( )

Returns: number of scenarios in the app.

diguyScenario* diguyApp::get_scenario_at_index ( int  index)

Returns: pointer of type diguyScenario; NULL if no scenario at the specified index.

Parameters
indexindex of the scenario; indices start at 0
int diguyApp::get_num_blend_functions ( )

Returns: number of blend functions available.

const char* diguyApp::get_blend_function_name_at_index ( int  index)

Returns: name of blend function at specified index; NULL if no blend function at specified index.

Parameters
indexindex of the blend function; indices start at 0
int diguyApp::is_debug ( )

This function returns whether or not the application is in debug mode.

Useful for choosing which versions of shared libraries to load.

Returns:

1 if app is in debug mode; 0 if not

int diguyApp::is_api_mode ( )

This function returns whether or not the DI-Guy SDK is being used inside of DI-Guy Scenario or as an embedded C++ library.

Returns:

1 if being used as a library; 0 if not

int diguyApp::is_module_enabled ( const char *  module_name)

This function returns whether or not the specified module is currently enabled.

Returns:

1 if module is enabled; 0 if not

diguyScenario* diguyApp::get_current_scenario ( )

Returns: pointer of type diguyScenario; NULL if no current scenario.

static void diguyApp::install_qt_message_handler ( )
static

Registers a message handler with Qt so Qt output goes through the diguy logging system.

static const char* diguyApp::get_diguy_base_dir_path ( )
static

Returns: the path to the base directory of the DI-Guy installation; this is typically set by the environment variable DIGUY.

static const char* diguyApp::get_diguy_subdir_path ( const char *  subdir)
static

Returns: the path to a subdirectory of the DI-Guy installation; this is typically derived from the environment variable DIGUY, but is sometimes overridden by other environment variables.

Parameters
subdirname of the subdirectory
diguyExerciseInterface* diguyApp::get_exercise_interface ( )

Gets a pointer to the exercise interface.

If DI-Guy is not on the network, the returned pointer will be NULL.

Returns:

pointer of type diguyExerciseInterface on success, NULL on failure or if not on the network

int diguyApp::add_default_scenario_callback ( int  callback_id,
diguyScenarioCallback callback,
void *  callback_params = 0,
void *  callback_user_data = 0,
int  remove_on_scenario_load = 1 
)

This function sets a default user callback that will be added to all new scenarios.

See diguyScenario::add_callback() for details.

int diguyApp::remove_default_scenario_callback ( int  callback_id,
diguyScenarioCallback callback 
)

This function removes a default user callback previously added by add_default_scenario_callback().

See diguyScenario::remove_callback() for details.

Returns:

0 on success, -1 on failure

int diguyApp::remove_default_scenario_callback_with_user_data ( int  callback_id,
void *  callback_user_data 
)

This function removes a default user callback previously added by add_default_scenario_callback().

See diguyScenario::remove_callback_with_user_data() for details.

int diguyApp::add_default_scenario_callback_script ( int  callback_id,
const char *  callback_script,
const char *  callback_script_type,
int  remove_on_scenario_load = 1 
)

This function adds a default scenario callback script.

The callback script will be added to all new scenarios. See diguyScenario::add_callback_script() for more details.

Returns:

0 on success, -1 on failure

int diguyApp::remove_default_scenario_callback_script ( int  callback_id,
const char *  callback_script,
const char *  callback_script_type 
)

This function removes a default scenario callback script.

See diguyScenario::remove_callback_script() for more details.

Returns:

0 on success, -1 on failure

int diguyApp::register_scenario_event_handler ( const char *  handler_name,
diguyScenarioCallback callback,
void *  callback_user_data = 0 
)

This function is analogous to the diguyScenario::register_character_event_handler() function, but is for scenarios rather than characters.

The registered event handler can be mapped to an event via the DI-Guy Scenario UI, or by the function diguyScenario::map_event_handler_to_callback_id().

It can also be manually invoked by the function call diguyScenario::manually_invoke_event_handler().

Callable From:

  • C++
int diguyApp::register_scenario_event_handler_from_library ( const char *  handler_name,
const char *  library_name,
const char *  function_name,
void *  callback_user_data = 0 
)

This function is analogous to the diguyScenario::register_character_event_handler_from_library() function, but is for scenarios rather than characters.

The registered event handler can be mapped to an event via the DI-Guy Scenario UI, or by the function diguyScenario::map_event_handler_to_callback_id().

It can also be manually invoked by the function call diguyScenario::manually_invoke_event_handler().

int diguyApp::register_scenario_event_handler_script ( const char *  handler_name,
const char *  handler_script,
const char *  handler_script_type = NULL 
)

This function is analogous to the diguyScenario::register_character_event_handler_script() function, but is for scenarios rather than characters.

The registered event handler can be mapped to an event via the DI-Guy Scenario UI, or by the function diguyScenario::map_event_handler_to_callback_id().

It can also be manually invoked by the function call diguyScenario::manually_invoke_event_handler().

int diguyApp::has_registered_scenario_event_handler ( const char *  handler_name)

This function is analogous to the diguyScenario::has_registered_character_event_handler() function, but is for scenarios rather than characters.

int diguyApp::unregister_scenario_event_handler ( const char *  handler_name)

This function is analogous to the diguyScenario::unregister_character_event_handler() function, but is for scenarios rather than characters.

int diguyApp::add_draw_pass ( const diguyDrawPass drawPass)

Adds a draw pass which is used to modified how diguyScenario::draw() functions.

int diguyApp::remove_all_draw_passes ( )

Removes all draw passes previously registered with diguyApp::add_draw_pass().

int diguyApp::load_plugin ( const char *  plugin_name,
int  required_by_scenario = 0,
int  unload_on_scenario_close = 0,
int  accepts_mouse_input = 1 
)

This function adds a new dynamic library plugin to the app.

Plugins work within DI-Guy Scenario as well as the DI-Guy SDK.

Parameters
plugin_namename of the plugin; should be dynamic library name without the extension
required_by_scenarioif set to 1, this plugin is required for proper execution of this scenario; when the scenario is loaded this plugin will be loaded as well if it is not already active; default value is 0
unload_on_scenario_closeif set to 1, this plugin will be unloaded if this scenario is closed or a new scenario is opened; default value is 0
accepts_mouse_inputif set to 1, this plugin will receive mouse events via the mouse plugin functions when the input mode is "Plugin"; default value is 1

Returns:

0 on success, -1 on failure

Windows Specific:

The DLL should be placed in a directory that is in the path, or in the same directory as the DI-Guy Scenario executable.

The DLL version of DI-Guy Scenario or the SDK must be used for plugins to work.

See complete overview at DI-Guy Scenario Plug-in Overview

int diguyApp::unload_plugin ( const char *  plugin_name)

This function unloads a dynamic library plugin from the app that was added using the load_plugin() function.

Parameters
namename of the plugin

Returns:

0 on success, -1 on failure

See complete overview at DI-Guy Scenario Plug-in Overview

void diguyApp::unload_all_plugins ( )

Unloads all plug-ins.

int diguyApp::get_num_plugins ( )

Returns: This function returns the number of dynamic library plugins currently loaded.

See complete overview at DI-Guy Scenario Plug-in Overview

const char* diguyApp::get_name_of_plugin ( int  index)

Returns: the name of a specific plug-in at a specified index.

index - index of the plugin to query

See complete overview at DI-Guy Scenario Plug-in Overview

void diguyApp::reset_graphics_state ( )

resets shader programs and texture unit tracking

diguyUniformBufferUpdater* diguyApp::get_uniform_buffer_updater ( )

Will return a pointer to the abstract wrapper that wraps all shader constants for use with DI-Guy renderering.

In the various Opengl renderers it will return a pointer to a diguyOglUniformBufferUpdater object. Sub The can be set with diguy_graphics_set_uniform_updater() at creation

diguyGraphicsShaderProgram* diguyApp::load_shader_program ( const char *  shader_name,
const char *  vertex_shader_filename,
const char *  pixel_shader_filename,
const char *  shader_version 
)

This function loads (or reloads) shader source files into a shader program.

The shader program can be attached to a character in two ways:

First, a shader may be explicitly added to a character using the diguyCharacter::set_shader_program() function.

Second, a shader may be implicitly added to a character if its appearance specifies an associated shader required to make the appearance look right. Most often this is for appearances that are skinned, requiring a shader to transform the vertices correctly. DI-Guy most often uses the 'diguy_object' shader for this.

If a shader program with the same name has already been loaded, this function will replace it.

DI-Guy Scenario uses GLSL shaders.

shader_name - name by which shader program will be referenced vertex_shader_filename - name of file containing vertex shader source code pixel_shader_filename - name of file containing pixel shader source code

Returns:

pointer to object type diguyGraphicsShaderProgram on success, NULL on failure

diguyGraphicsShaderProgram* diguyApp::create_shader_program ( const char *  shader_name)

Creates a new shader program which you can then dynamically set the vertex and pixel shader source code on.

This is the simplest way to make a shader that uses the DI-Guy OpenGL shared shader library. See sensor fusion plugin for an example of its use.

void diguyApp::reload_shader_programs ( )

This function reloads all previously loaded shader programs, using the same source filenames as were used when the shader was initially loaded.

This function can be used to reload/replace an existing shader with the same name, allowing for quick edit and test cycles when working on new shaders.

diguyGraphicsShaderProgram* diguyApp::find_shader_program ( const char *  shader_name)

This function looks for the previously loaded shader program with the given name.

shader_name - name of program to find

Returns:

pointer to object type diguyGraphicsShaderProgram on success, NULL on failure

int diguyApp::get_num_shader_programs ( )

Returns: number of loaded shader programs.

diguyGraphicsShaderProgram* diguyApp::get_shader_program_at_index ( int  index)

This function returns the shader program at the specified index.

index - index of shader program

Returns:

pointer to object type diguyGraphicsShaderProgram on success, NULL on failure

diguyGraphicsShaderProgram* diguyApp::get_current_bound_shader_program ( )

This function returns the shader program that's currently active.

Returns:

pointer to object type diguyGraphicsShaderProgram on success, NULL on failure

diguyGraphicsShaderTechnique* diguyApp::find_shader_technique ( const char *  shader_technique_name)

This function looks for the previously loaded shader technique with the given name.

shader_technique_name - name of program to find

Returns:

pointer to object type diguyGraphicsShaderTechnique on success, NULL on failure

int diguyApp::get_num_shader_techniques ( )

Returns: number of loaded shader techniques.

diguyGraphicsShaderTechnique* diguyApp::get_shader_technique_at_index ( int  index)

Returns: a pointer to a diguyGraphicsShaderTechnique on success at the specified index, NULL on failure.

index - index of shader technique

int diguyApp::set_max_character_shader_quality_level ( int  quality_level)

This function sets the max shader quality level for characters in the application.

See diguyGraphicsShaderProgram.h for the diguyGraphicsShaderQualityLevel enum. This quality level, which can range from no lighting to normal mapped characters, will be used to pick an appropriate shader from a shader technique.

int diguyApp::get_max_character_shader_quality_level ( )
int diguyApp::set_max_scene_object_shader_quality_level ( int  quality_level)

This function sets the maximum shader quality level for scene objects in the application.

See diguyApp::set_max_character_shader_quality_level() for more information.

int diguyApp::get_max_scene_object_shader_quality_level ( )
int diguyApp::get_use_sRGB_textures ( )

Returns: the value that was passed in for init.use_sRGB_corrected_textures allows end users to procedurally choose gamma correction behavior.

int diguyApp::set_num_rendering_passes ( int  num_rendering_passes)

This function sets how may rendering passes DI-Guy will use to draw objects such as characters and scene objects.

By default DI-Guy uses two rendering passes. Fully opaque objects are drawn in the first pass; semi-transparent objects are drawn in the second.

If few or no objects have transparency, the number of rendering passes can be set to 1, which will increase rendering performance.

If the number of rendering passes is set to 1, semi-transparent objects may incorrectly occlude objects behind them, depending on object rendering order.

This function can be called at any time.

num_rendering_passes - how many rendering passes to use; default is 2

Returns:

0 on success, -1 on failure

int diguyApp::get_num_rendering_passes ( )

Returns: current setting of number of rendering passes; see set_num_rendering_passes()

int diguyApp::get_render_pass_flags ( )

Gets current render pass flags.

See diguyRenderPassFlags. The values are or'd together.

int diguyApp::set_render_pass_flags ( int  flags)

Sets current render pass flags.

See diguyRenderPassFlags.

diguyViewCamera* diguyApp::get_current_camera ( )

returns the current camera

diguyViewCamera* diguyApp::get_shooting_camera ( )

returns a scratch camera for shooting tests

int diguyApp::get_use_materials ( )
void diguyApp::set_use_materials ( int  use_materials)
int diguyApp::get_use_textures ( )
void diguyApp::set_use_textures ( int  use_textures)
void diguyApp::set_delayed_motion_loading ( int  enabled)

When loading a character this function tells DI-Guy to wait till a motion is actually needed to load it or load all character's motion at character creation time.

int diguyApp::get_delayed_motion_loading ( )

Returns: current setting of whether motions will load when 1st used; see set_delayed_motion_loading()

int diguyApp::set_precompute_quaternions_enabled ( int  enabled)

This function tells DI-Guy to use quaternions for all joint angles in motions.

It should be called after DI-Guy is initialized and before characters are created. By default DI-Guy data uses Quaternions.

Some motion operations are faster using quaternions, while some are not. In general anything that requires blending of motions will be faster when using quaternions.

This function should not have any negative effect on character motion quality.

enables - pass 1 to use quaternions for motions, 0 to use Euler angles

Returns:

0 on success, -1 on failure

C++ Example:

int diguyApp::get_precompute_quaternions_enabled ( )

Returns: current setting of whether quaternions are enabled; see set_precompute_quaternions_enabled()

int diguyApp::get_ideal_num_threads ( )

This function returns the ideal number of threads available on the system.

This will correspond to the number of available processors.

Returns:

ideal number of threads on the system; -1 on failure to detect

int diguyApp::set_num_threads ( int  num_threads)

This function sets how many threads are available to DI-Guy.

defaults to -1 which will just use all cores available. 1 or 0 sets single threaded behavior, and other number will indicate a limit to the tbb subsystem on number of cores to use.

num_threads - number of threads available to DI-Guy

Returns:

0 on success, -1 on failure

int diguyApp::get_num_threads ( )

Returns: number of threads available to DI-Guy.

void diguyApp::set_use_update_phase_1_multithreading ( bool  use)

This defaults to false, DI-Guy will multi-thread character type and appearance updates, can save time on high entity count scenarios but breaks a number of features.

Really is limited to SDK based tools and not DI-Guy Scenario

bool diguyApp::get_use_update_phase_1_multithreading ( )
void diguyApp::run_background_load_update ( )
int diguyApp::is_background_loader_active ( )

helper function to let you know if asynchronous texture loader is currently using a core

void diguyApp::set_stream_textures_to_gpu ( bool  enable)

should diguy stream textures to the gpu one mip maps at a time, this is implemented in the diguyGeometryTexture code.

defaults to be on

bool diguyApp::get_stream_textures_to_gpu ( )
int diguyApp::set_base_input_mode ( diguyScenarioInputMode  mode)

This function changes the current Input Mode of the DI-Guy Scenario application or a DI-Guy Author Host IG.

Parameters
modethe new base Input Mode of DI-Guy Scenario or DI-Guy Author

Returns:

-1 if mode change failed (e.g., tried for AI-related mode but AI not available, 0 on no error

diguyScenarioInputMode diguyApp::get_base_input_mode ( )

Returns: the current Input Mode of the DI-Guy Scenario application or a DI-Guy Author Host IG.

int diguyApp::get_last_clicked_xyz ( float *  x,
float *  y,
float *  z 
)

This function returns the 3D world position of the last clicked point in a DI-Guy Scenario 3D view.

This function is meant to complement the use of callbacks with callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.

Parameters
x,y,zposition in meters from the origin

Pass NULL for any values that are not needed.

void diguyApp::set_last_clicked_xyz ( float  x,
float  y,
float  z 
)

This function sets the 3D world position of the last clicked point in a DI-Guy Scenario 3D view.

This function is meant to complement the use of callbacks with callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.

Parameters
x,y,zposition in meters from the origin
diguyCharacter* diguyApp::get_last_clicked_character ( )

This function returns the last character clicked by the mouse in DI-Guy Scenario.

This function is meant to complement the use of callbacks with callback id DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.

Returns:

pointer of type diguyCharacter; may be NULL if no character has been clicked

int diguyApp::get_mouse_screen_xy ( float *  sx,
float *  sy 
)

This function returns the current screen coordinates x and y position of the mouse.

int diguyApp::get_xyz_under_mouse ( float *  x,
float *  y,
float *  z 
)

This function returns the current xyz coordinates under the mouse location, this is a fairly speedy test since the octtree is used.

Typically this function is used to help build interactive UI tools.

Parameters
x,y,zresulting position in meters from the origin
void diguyApp::set_lua_object_waiting_for_input ( const char *  object_name)

This function sets up the UI to notify a lua object of mouse events via messages while in input mode DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT.

The following callbacks are generated:

  • CALLBACK_ID_UI_MOUSE_DOWN
  • CALLBACK_ID_UI_MOUSE_UP
  • CALLBACK_ID_UI_RIGHT_MOUSE_DOWN
  • CALLBACK_ID_UI_RIGHT_MOUSE_UP

See luaUIStateMachine:get_user_selected_point() to see an example of usage. Typically this function is used to help build interactive UI tools.

Parameters
object_nameresulting position in meters from the origin
const char* diguyApp::get_lua_object_waiting_for_input ( )

Returns: The name of the lua object that's currently waiting for input events.

Can return NULL if there's no active object.

diguyAuthorInterface* diguyApp::get_author_interface ( )

This function is equivalent to the function diguy_author_get_author_interface() in diguy_author.h.

It is made available here so it is available to scripts.

diguyViewPainter* diguyApp::get_view_painter ( )

Returns: This function returns a pointer to a diguyViewPainter object.

This object can be used to draw lines, text, and other primitives in the 3D views of DI-Guy Scenario.

void diguyApp::set_collision_group_detection_flag ( diguyPhysicsCollisionGroup  collision_group1,
diguyPhysicsCollisionGroup  collision_group2,
int  enable_collisions 
)

This function sets whether the two specified collision groups should collide against each other.

Parameters
collision_group1first collision group
collision_group2second collision group
enable_collisionspass 1 to have groups collide, 0 to not
int diguyApp::get_collision_group_detection_flag ( diguyPhysicsCollisionGroup  collision_group1,
diguyPhysicsCollisionGroup  collision_group2 
)

This function returns whether the two specified collision groups should collide against each other.

Parameters
collision_group1first collision group
collision_group2second collision group

Returns:

1 if collision groups collide, 0 if not

void diguyApp::set_physics_sim_ground_plane_enabled ( int  enabled)

The physics simulation module can have an optional ground plane enabled through which no objects will pass.

This function sets whether the ground plane is enabled.

Parameters
enabledpass 1 to enable ground plane, 0 to disable
int diguyApp::get_physics_sim_ground_plane_enabled ( )

Returns: 1 if physics sim ground plane enabled, 0 if not.

void diguyApp::set_physics_sim_ground_plane_height ( float  height)

The physics simulation module can have an optional ground plane enabled through which no objects will pass.

This function sets the height of the ground plane.

Parameters
heightheight in meters
float diguyApp::get_physics_sim_ground_plane_height ( )

Returns: height of physics sim ground plane.

static const char* diguyApp::get_standard_bdi_library_suffix ( )
static

Returns: the library suffix, which is derived from the dll compiling flags, e.g.

"_x64_vc14"

static const char* diguyApp::get_diguy_version_library_suffix ( )
static

Returns: the library suffix, which is derived from the version number, e.g.

"_1250"

static const char* diguyApp::get_compiler_library_suffix ( )
static

Returns: the library suffix, which is derived from the compiler type, e.g.

"_vc9"

static const char* diguyApp::get_debug_library_suffix ( )
static

Returns: the debug suffix, "d" or blank.

static void* diguyApp::load_module_library ( const char *  module_lib_name,
int  include_diguy_standard_library_suffixes = 1,
int *  load_status = NULL 
)
static

Loads dynamic library module.

The handle returned can be passed into resolve_symbol() or unload_module_library().

Returns:

handle as (void *) pointer, NULL if library is not found or failed to load.

Load status is set to:

0 : load successful -1 : library not found -2 : ?

static diguyVoidFunctionVoid diguyApp::resolve_module_library_symbol ( void *  module_handle,
const char *  symbol_name 
)
static

Returns pointer to function provided by already-loaded dynamic library module.

Pointer should be cast to one of:

  • diguyModuleFunctionInt
  • diguyModuleFunctionVoid
  • diguyModuleFunctionVoidReturnsVoid

Returns:

pointer to function, or NULL if function not found.

static void diguyApp::unload_module_library ( void *  module_handle)
static

Unloads dynamic library module, given handle to it.

int diguyApp::get_sound_factory_is_initialized ( )

Returns 1 if a sound factory is initialized.

int diguyApp::set_munition_type_DIS_impact_septet ( const char *  munition_type,
int  sep1,
int  sep2,
int  sep3,
int  sep4,
int  sep5,
int  sep6,
int  sep7 
)

Sets override values for the specified munition type's DIS impact septet.

Munition types are defined in the config file munition_types.cfg, located under the DI-Guy installation config directory.

munition_type - name of munition type to modify; e.g., "m16" sep1, etc. - new DIS septet values

int diguyApp::set_munition_type_DIS_tracer_septet ( const char *  munition_type,
int  sep1,
int  sep2,
int  sep3,
int  sep4,
int  sep5,
int  sep6,
int  sep7 
)

Similar to set_munition_type_DIS_impact_septet(), but overrides the septet for tracer type.

const char* diguyApp::get_munition_type_from_DIS_septet ( int  sep1,
int  sep2,
int  sep3,
int  sep4,
int  sep5,
int  sep6,
int  sep7,
int  include_last_septet_value = 1 
)

Returns the munition type name based on the passed septet values.

sep1, etc. - DIS septet values need_exact_match - If 1 (true), only return an exact septet match. If 0 (false), a 0 in the munition_types.cfg septet is treated as a wildcard. include_last_septet_value - pass 1 to include the last septet value in the search, 0 to not

int diguyApp::unload_unreferenced_graphics_files ( int  garbage_collect_appearances = 1)

Causes garbage-collection to unload graphics files that have been previously loaded into memory, but are unused, freeing up memory.

There may be a frame hitch if graphics files are to be used again and need to be reloaded.

garbage_collect_appearances - setting to 1 will attempt to remove unused character appearance geometry as well as scene objects; default is 1. If 0, only scene object files will be discarded.

int diguyApp::reload_texture_files ( )

Causes textures that have changes to be reloaded.

int diguyApp::set_threshold_to_unload_textures ( int  number)

How many textures in memory before texture unloading starts (defaults to 5000)

int diguyApp::get_threshold_to_unload_textures ( )
int diguyApp::set_texture_unload_frequency ( float  seconds)

How often to check if inactive textures should be unloaded.

float diguyApp::get_texture_unload_frequency ( )
int diguyApp::get_unload_unused_after_scenario_load ( )

Should unused assets be garbage collected after loading a new scenario.

int diguyApp::set_unload_unused_after_scenario_load ( int  val)
int diguyApp::set_cache_optimized_motion_files ( int  enabled = 0)

Sets whether optimized versions of motion files should be cached to disk when they are loaded.

This is still experimental. The default is 0, don't enable caching.

enabled - pass 1 to enable caching, 0 to disable

int diguyApp::get_cache_optimized_motion_files ( )

Returns: 1 if caching of optimized motion files is enabled, 0 if disabled.

int diguyApp::memory_tracker_print_report ( int  include_permanent_objects = 0,
int  just_markers = 0 
)

Prints to the log a report about memory usage and leaks.

include_permanent_objects - pass 1 to include permanent objects in reports; 0 is default just_markers - pass 1 to only generate reports for memory use at instants after a marker is dropped

int diguyApp::memory_tracker_drop_marker ( )

Add a marker for use by memory_tracker_print_report()

void diguyApp::set_reflected_entity_message_list ( const char *  message)

Provide DI-Guy Scenario with a list of messages that the user can access from the right-click menu.

When a message is selected, it is sent over the network to the AIs of remote entities. If the AIs can process the message, they will. Typically used to kill remote entities from a master server.

message - a string containing a comma-separated list of messages.

const char* diguyApp::get_reflected_entity_message_list ( )

Returns a string containing a comma-separated list of supported reflected-entity messages, as set by set_reflected_entity_message_list()

const char* diguyApp::get_scene_object_file_name_from_ui ( )

In DI-Guy Scenario pops up a user interface asking the end user to pick a scene object file name.

int diguyApp::show_generate_navmesh_ui ( )

Causes DI-Guy to display UI relevant to navmesh generation.

void diguyApp::print_process_memory_info ( )

On Window will print standard memory info to the log.. Occasionally useful for programming examples.

static int diguyApp::decompress_lz4_file ( const char *  source,
const char *  destination 
)
static

inputs lz4 file, decompresses to source data. Needed for unity texture handling

diguyMotionExporter* diguyApp::get_motion_exporter ( )

Only available in the Motion Editor.

A class that allows end users to write a simple script for exporting a number of motions from the motion editor time-line.

void diguyApp::set_use_scene_object_instancing ( int  enabled)

13.2.0 DI-Guy Scenario adds a new fast instancing system that work on xrefs and other repeated geometry.

this function allows disabling it in case it causes problems.

void diguyApp::set_enable_concurrency_visualizer_markers ( int  enabled)

turns on concurrency visualizer markers ( windows only ) off by default

void diguyApp::set_enable_tracy_markers ( bool  enabled,
bool  start_up_tracy = true 
)

turns on tracy markers ( windows only, requires special build of diguy)

void diguyApp::profiler_mark_end_of_frame ( )

marks end of tracy frame

void diguyApp::shutdown_profiler ( )

shuts down tracy.

static int diguyApp::get_lod_warn_threshold ( int  lod)
static

starts at 1, returns -1 if there isn't a threshold;

diguyLogChannel* diguyApp::create_log_channel ( )

Returns: Newly-created log channel.

void diguyApp::destroy_log_channel ( diguyLogChannel )

Destroys specified log channel.

int diguyApp::get_num_log_channels ( )

Returns: Number of log channels.

diguyLogChannel* diguyApp::get_log_channel_at_index ( int  index)

Returns: Log channel at index.

int diguyApp::set_current_painting_subregion ( diguySubregionIndex  index)

Deprecated as of DI-Guy 12.0.0.

Use diguyAuthorVisualRegionPaintbrush::set_painting_subregion() instead.

void diguyApp::set_no_blend_test ( int  flag)
void diguyApp::set_motion_events_log_enabled ( int  enabled)
void diguyApp::dump_motion_events_to_file ( const char *  filename,
int  show_event_id_strings = 0,
int  indent = 0 
)
bdiScenarioApp* diguyApp::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiScenarioApp
friend

Member Data Documentation

bdiScenarioApp* diguyApp::m_scripted_object
private

A pointer to internal data.


The documentation for this class was generated from the following file: