c_api_world.h - Engine C API Reference

c_api_world.h
  1. #pragma once
  2. #include "c_api_types.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* Defines what should happen if a linked effect becomes orphaned. Should it
  7. be destroyed, stop spawning or be unlinked and continue to spawn. */
  8. struct WorldCApi
  9. {
  10. UnitRef (*spawn_unit) (WorldPtr world_pointer, uint64_t unit_name_id64, const char *optional_debug_unit_name, ConstMatrix4x4Ptr transform);
  11. void (*destroy_unit) (WorldPtr world_pointer, UnitRef unit_ref);
  12. unsigned (*num_units) (ConstWorldPtr world_pointer);
  13. UnitRef (*unit_by_name) (WorldPtr world_pointer, uint64_t unit_name);
  14. UnitRef (*unit_by_id) (WorldPtr world_pointer, uint64_t unit_id);
  15. UnitRef (*unit_by_index) (WorldPtr world_pointer, unsigned index);
  16. unsigned (*num_units_by_resource) (WorldPtr world_pointer, uint64_t resource_name);
  17. unsigned (*units_by_resource)(WorldPtr world_pointer, uint64_t resource_name, unsigned max_unit_count, UnitRef* units);
  18. void (*link_unit) (WorldPtr world_pointer, UnitRef child, unsigned child_node_index, UnitRef parent, unsigned parent_node_index);
  19. void (*unlink_unit) (WorldPtr world_pointer, UnitRef child);
  20. void (*update_unit) (WorldPtr world_pointer, UnitRef unit_ref);
  21. ParticleRef (*create_particles) (WorldPtr world_pointer, uint64_t name_id64, const char *optional_debug_name, ConstMatrix4x4Ptr transform);
  22. void (*destroy_particles) (WorldPtr world_pointer, ParticleRef id);
  23. void (*stop_spawning_particles) (WorldPtr world_pointer, ParticleRef id);
  24. int (*are_particles_playing) (ConstWorldPtr world_pointer, ParticleRef id);
  25. void (*set_particles_collision_filter) (ConstWorldPtr world_pointer, uint32_t collision_filter_name);
  26. void (*move_particles) (WorldPtr world_pointer, ParticleRef id, ConstMatrix4x4Ptr transform);
  27. void (*link_particles) (WorldPtr world_pointer, ParticleRef id, UnitRef unit_ref, unsigned unit_node_index, ConstMatrix4x4Ptr local_pose, enum WorldCApi_OrphanedParticlePolicy orphaned_policy);
  28. unsigned (*find_particles_variable) (ConstWorldPtr world_pointer, uint64_t name_id64, const char *optional_debug_name, unsigned variable_name_id32);
  29. void (*set_particles_variable) (WorldPtr world_pointer, ParticleRef id, unsigned variable, ConstVector3Ptr value);
  30. LevelPtr (*load_level) (WorldPtr world_pointer, uint64_t level_name_id64, const char *optional_debug_level_name, ConstMatrix4x4Ptr transform, uint64_t optional_level_id);
  31. void (*destroy_level) (WorldPtr world_pointer, LevelPtr level_pointer);
  32. unsigned (*num_levels) (ConstWorldPtr world_pointer);
  33. LevelPtr (*level) (WorldPtr world_pointer, unsigned index);
  34. void (*update) (WorldPtr world_pointer, float dt);
  35. void (*update_animations) (WorldPtr world_pointer, float dt, CApiCallbackFunction optional_callback, CallbackData32Ptr callback_data32);
  36. void (*update_scene) (WorldPtr world_pointer, float dt);
  37. float (*delta_time) (ConstWorldPtr world_pointer);
  38. float (*time) (ConstWorldPtr world_pointer);
  39. StoryTellerPtr (*storyteller) (WorldPtr world_pointer);
  40. VectorFieldPtr (*vector_field) (WorldPtr world_pointer, unsigned vector_field_name_id32);
  41. ScatterSystemPtr (*scatter_system) (WorldPtr world_pointer);
  42. ShadingEnvironmentPtr (*create_shading_environment) (WorldPtr world_pointer, uint64_t name_id64, const char *optional_debug_name);
  43. ShadingEnvironmentPtr (*create_default_shading_environment) (WorldPtr world_pointer);
  44. void (*destroy_shading_environment) (WorldPtr world_pointer, ShadingEnvironmentPtr shading_environment_pointer);
  45. void (*set_shading_environment) (WorldPtr world_pointer, ShadingEnvironmentPtr shading_environment, uint64_t name_id64, const char *optional_debug_name);
  46. LineObjectPtr (*create_line_object) (WorldPtr world_pointer, int disable_depth_test);
  47. void (*destroy_line_object) (WorldPtr world_pointer, LineObjectPtr line_object_pointer);
  48. void (*clear_permanent_lines) (WorldPtr world_pointer);
  49. GuiPtr (*create_screen_gui) (WorldPtr world_pointer, ConstVector2Ptr optional_position, ConstVector2Ptr optional_scale, int immediate, int dock_right, int dock_top);
  50. GuiPtr (*create_world_gui) (WorldPtr world_pointer, ConstMatrix4x4Ptr transform, float width, float height, int shadow_caster, int immediate);
  51. void (*destroy_gui) (WorldPtr world_pointer, GuiPtr gui_pointer);
  52. GuiPtr (*get_gui_by_id) (WorldPtr world_pointer, unsigned gui_id);
  53. PhysicsWorldPtr (*physics_world) (WorldPtr world_pointer);
  54. VideoPlayerPtr (*create_video_player) (WorldPtr world_pointer, uint64_t resource_id64, int loop);
  55. void (*destroy_video_player) (WorldPtr world_pointer, VideoPlayerPtr video_player);
  56. ConstMatrix4x4Ptr (*debug_camera_pose) (WorldPtr world_pointer);
  57. /* Begin Development functions */
  58. void (*set_flow_enabled) (WorldPtr world_pointer, int enable);
  59. void (*set_editor_flow_enabled) (WorldPtr world_pointer, int enable);
  60. unsigned (*num_particles)(WorldPtr world_pointer, unsigned* optional_effect_id, unsigned* optional_cloud_index);
  61. void (*advance_particles_time)(WorldPtr world_pointer, unsigned id, float time);
  62. void (*set_frustum_inspector_camera) (WorldPtr world_pointer, CameraPtr camera_pointer);
  63. ReplayPtr (*replay)(WorldPtr world_pointer);
  64. void (*start_playback)(ReplayPtr replay_ptr);
  65. void (*stop_playback)(ReplayPtr replay_ptr);
  66. int (*is_playing_back)(ReplayPtr replay_ptr);
  67. int (*num_frames)(ReplayPtr replay_ptr);
  68. int (*frame)(ReplayPtr replay_ptr);
  69. void (*set_frame)(ReplayPtr replay_ptr, unsigned frame_index);
  70. void (*record_debug_line)(ReplayPtr replay_ptr, ConstVector4Ptr color, ConstVector2Ptr p1, ConstVector2Ptr p2);
  71. void (*record_screen_debug_text)(ReplayPtr replay_ptr, ConstVector4Ptr color, ConstVector2Ptr screen_position, const char* text);
  72. void (*record_world_debug_text)(ReplayPtr replay_ptr, ConstVector4Ptr color, ConstVector3Ptr world_position, const char* text);
  73. void (*set_unit_record_mode)(ReplayPtr replay_ptr, UnitRef unit, enum ReplayRecordMode replay_record_mode);
  74. /* End Development functions */
  75. };
  76. #ifdef __cplusplus
  77. }
  78. #endif