### find_path Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initiates a pathfinding operation from a start to an end point with specified settings. ```APIDOC ## find_path ### Description Starts finding a path from a given start point to an end point, using the provided pathfinding settings. ### Signature ```c io_handle16_t (*find_path)(io_vec3_t start, io_vec3_t end, const io_pathfinding_path_settings_t* settings); ``` ### Parameters * **start** (io_vec3_t) - The starting 3D position for the path. * **end** (io_vec3_t) - The ending 3D position for the path. * **settings** (const io_pathfinding_path_settings_t*) - Pointer to settings that configure the pathfinding process. ### Returns * **io_handle16_t** - A handle to the pathfinding operation. ``` -------------------------------- ### io_flipbook_animation_i Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides functions to control flip book animations, allowing playback to be started and stopped. ```APIDOC ## io_flipbook_animation_i ### Description Provides functions to control flip book animations, allowing playback to be started and stopped. ### Methods - **play**(io_ref_t flipbook_animation) - Starts playing the provided flip book animation. - **stop**(io_ref_t flipbook_animation) - Stops playing the provided flip book animation. ``` -------------------------------- ### Compile Open-Source Plugins with CMake Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/plugins/working_with_plugins.md Build the IOLITE open-source plugins using CMake. Ensure you have a C++ compiler and CMake installed. Run these commands in the plugin source directory. ```bash $ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release $ cmake --build build --config Release ``` -------------------------------- ### io_settings_i Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides functions to get and set various types of settings within the iolite system. ```APIDOC ## io_settings_i ### Description Provides access to the settings subsystem, allowing users to manage boolean, unsigned integer, float, and string settings. ### Methods #### Set Boolean Setting - **set_bool** (const char* name, io_bool_t value) - Sets the given boolean setting. #### Get Boolean Setting - **get_bool** (const char* name) - Returns: io_bool_t - Gets the given boolean setting. #### Set Unsigned Integer Setting - **set_uint** (const char* name, io_uint32_t value) - Sets the given unsigned integer setting. #### Get Unsigned Integer Setting - **get_uint** (const char* name) - Returns: io_uint32_t - Gets the given unsigned integer setting. #### Set Float Setting - **set_float** (const char* name, io_float32_t value) - Sets the given float setting. #### Get Float Setting - **get_float** (const char* name) - Returns: io_float32_t - Gets the given float setting. #### Set String Setting - **set_string** (const char* name, const char* value) - Sets the given string setting. #### Get String Setting - **get_string** (const char* name) - Returns: const char* - Gets the given string setting. ``` -------------------------------- ### Script Activation Callback Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/plugins/lua.md Called once when a script becomes active, typically during world load or entity spawn. Use for initial setup and resource allocation. ```lua function OnActivate(entity) end ``` -------------------------------- ### Get First Selected Entity Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves a reference to the first entity currently selected in the editor. ```c io_ref_t (*get_first_selected_entity)(); ``` -------------------------------- ### Initialize Pathfinding Settings Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes a 'io_pathfinding_path_settings_t' structure with default values for pathfinding parameters. Use this function to set up pathfinding configurations. ```c inline void io_pathfinding_init_path_settings(io_pathfinding_path_settings_t* settings) { settings->find_walkable_cell_range = 8u; settings->capsule_radius = 0.2f; settings->capsule_half_height = 0.4f; settings->step_height = 0.2f; settings->cell_size = 0.2f; settings->num_max_steps = 128u; settings->group_mask = 1u; // Shapes only by default } ``` -------------------------------- ### Get Component for Entity Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the component attached to the given entity, if any. ```c io_ref_t (*get_component_for_entity)(io_handle16_t manager, io_ref_t entity); ``` -------------------------------- ### Palette Resource Interface Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Defines functions for accessing and modifying palette resources, including setting and getting colors and material parameters. ```c struct io_resource_palette_i { // Base interface functions. io_resource_base_i base; // Sets the color for the given palette index of the given palette. void (*set_color)(io_ref_t palette, io_uint8_t palette_index, io_vec4_t color); // Gets the color for the given palette index of the given palette. io_vec4_t (*get_color)(io_ref_t palette, io_uint8_t palette_index); // Material parameters: // x: Roughness [0, 1] // y: Metalmask [0, 1] // z: Hardness [0, 255] // w: Emissive [0, FLT_MAX] // Sets the material parameters for the given palette index of the given // palette. void (*set_material_parameters)(io_ref_t palette, io_uint8_t palette_index, io_vec4_t parameters); // Gets the material parameters for the given palette index of the given // palette. io_vec4_t (*get_material_parameters)(io_ref_t palette, io_uint8_t palette_index); }; ``` -------------------------------- ### Configure Plugins with plugins.json Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/plugins/working_with_plugins.md Define which plugins to load and their filenames using this JSON structure. The `load_on_startup` option can be set to `false` to manually load plugins. ```json [ { "name": "my_plugin", "filename": "MyPlugin" }, { "name": "another_plugin", "//": "..." } ] ``` -------------------------------- ### Get Entity for Component Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the entity to which the given component is attached. ```c io_ref_t (*get_entity)(io_handle16_t manager, io_ref_t component); ``` -------------------------------- ### Event Handling Callback Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/plugins/lua.md Called when events are available. This example shows how to iterate and handle 'Contact' events, accessing contact position, impulse, and entities. ```lua function OnEvent(entity, events) -- Iterate over all the available events for i = 1, #events do local e = events[i] -- Handle contact events if e.type == "Contact" then -- Provides the position of the contact -- "e.data.pos", the resulting impulse "e.data.impulse", -- and the interacting entities "e.data.entity0" -- and "e.data.entity1" end end ``` -------------------------------- ### Add C++ Sample Plugin Library with ImGui Dependencies Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_c_api/sample_plugins/CMakeLists.txt Defines a shared library for the C++ sample plugin, including ImGui source files. ```cmake add_library(IoliteSamplePluginCPP SHARED sample_plugin.cpp dependencies/imgui/imgui.cpp dependencies/imgui/imgui_widgets.cpp dependencies/imgui/imgui_tables.cpp dependencies/imgui/imgui_draw.cpp ) ``` -------------------------------- ### Get Entity Memory Pointer for Custom Component Manager Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets a pointer to the memory for entities, which is updated if the internal memory changes. ```c io_ref_t** (*get_entity_memory_ptr)(io_handle16_t manager); ``` -------------------------------- ### Include Directories and Definitions Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_c_api/sample_plugins/CMakeLists.txt Adds include directories for dependencies and defines a preprocessor macro. ```cmake include_directories(../ dependencies/imgui dependencies/glm/glm dependencies/) add_definitions("-D_CRT_SECURE_NO_WARNINGS") ``` -------------------------------- ### Get Property Memory for Custom Component Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the linear memory for a property of a custom component. Do not cache the returned pointer as it may change. ```c void* (*get_property_memory)(io_handle16_t manager, const char* name); ``` -------------------------------- ### Get Entity Memory for Custom Component Manager Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the linear memory for entities of active components. Do not cache the returned pointer as it may change. ```c io_ref_t* (*get_entity_memory)(io_handle16_t manager); ``` -------------------------------- ### io_pathfinding_init_path_settings Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes the pathfinding settings structure with default values. This function sets parameters such as walkable cell range, capsule dimensions, step height, cell size, maximum steps, and group mask. ```APIDOC ## io_pathfinding_init_path_settings ### Description Initializes the `io_pathfinding_path_settings_t` structure with default values. This function sets parameters such as walkable cell range, capsule dimensions, step height, cell size, maximum steps, and group mask. ### Function Signature ```c void io_pathfinding_init_path_settings(io_pathfinding_path_settings_t* settings) ``` ### Parameters * **settings** (`io_pathfinding_path_settings_t*`) - A pointer to the pathfinding settings structure to be initialized. ``` -------------------------------- ### Get Property Memory Pointer for Custom Component Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets a pointer to the memory for a property, which is updated if the internal memory changes. Caching is safe only after all properties are registered. ```c void** (*get_property_memory_ptr)(io_handle16_t manager, const char* name); ``` -------------------------------- ### Minimal C/C++ Plugin Sample Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md This is a basic template for a C/C++ plugin. It includes essential functions like get_api_version, load_plugin, and unload_plugin. Implement these to integrate your plugin with Iolite. ```c // MIT License // // Copyright (c) 2023 Missing Deadlines (Benjamin Wrensch) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. //----------------------------------------------------------------------------// // Minimal C/C++ plugin sample //----------------------------------------------------------------------------// /* #include "iolite_api.h" const struct io_api_manager_i* io_api_manager = 0; IO_API_EXPORT io_uint32_t IO_API_CALL get_api_version() { // Inform IOLITE which version of the API you are using return IO_API_VERSION; } IO_API_EXPORT io_int32_t IO_API_CALL load_plugin(const void* api_manager) { // Ensure we can keep accessing the API manager after loading the plugin io_api_manager = (const struct io_api_manager_i*)api_manager; // Do something with the API manager, set up your plugin, etc. return 0; // Return a value < 0 to indicate that the loading of your plugin // has failed (dependency not available, etc.) } IO_API_EXPORT void IO_API_CALL unload_plugin() { // Clean up here } */ ``` -------------------------------- ### Voxel Shape - Get Voxel Data Pointer Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets a direct pointer to the underlying voxel data array. This is efficient for bulk operations. Data is laid out as idx = x + y * dim.x + z * dim.x * dim.y. ```c io_uint8_t* (*get_voxel_data)(io_ref_t shape); ``` -------------------------------- ### Initialize Animation Description Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes an 'io_animation_system_animation_desc_t' structure with default values for animation playback. The 'animation_name' must be set by the user. ```c inline void io_animation_system_init_animation_desc( io_animation_system_animation_desc_t* desc) { desc->animation_name = ""; // Has to be set by the user desc->play_speed = 1.0f; desc->blend_weight = 1.0f; desc->blend_in_out_duration = 0.0f; desc->priority = 0.0f; desc->delay = 0.0f; desc->looping = IO_FALSE; desc->restore_when_finished = IO_FALSE; } ``` -------------------------------- ### io_variant_get_name Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a name. ```APIDOC ## io_variant_get_name ### Description Gets the value of the variant as a name. ### Function Signature `io_name_t io_variant_get_name(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the name value from. ### Returns Returns the name value of the variant, or a name with hash 0 if the variant type is not a name. ``` -------------------------------- ### Configure Build Options Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_c_api/sample_plugins/CMakeLists.txt Enables export of compile commands and sets the C standard to C90. ```cmake set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_C_STANDARD 90) ``` -------------------------------- ### Configure Runtime Output Directories for Plugins Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_plugins/CMakeLists.txt Sets runtime output directories and names for all plugin executables. ```cmake foreach(EXECUTABLE ${PLUGINS}) set_target_properties(${EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_NAME ${EXECUTABLE} RUNTIME_OUTPUT_NAME_RELEASE ${EXECUTABLE} RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${EXECUTABLE} RUNTIME_OUTPUT_NAME_DEBUG ${EXECUTABLE} LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} LIBRARY_OUTPUT_NAME ${EXECUTABLE} ) endforeach() ``` -------------------------------- ### io_variant_get_bool Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a boolean value. ```APIDOC ## io_variant_get_bool ### Description Gets the value of the variant as a boolean value. ### Function Signature `io_bool_t io_variant_get_bool(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the boolean value from. ### Returns Returns the boolean value of the variant, or IO_FALSE if the variant type is not a boolean. ``` -------------------------------- ### Basic Lua Script for Logging Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/plugins/lua.md This script logs messages when it is loaded and when a component becomes active. It demonstrates the use of Log.load() and Log.log_info(). ```lua Log.load() -- Logs each time the script gets (re-)loaded Log.log_info("Hello world! Script loaded!") function OnActivate(entity) -- Logs once the component becomes active Log.log_info("Hello world! Component active!") end ``` -------------------------------- ### io_variant_get_uint Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as an unsigned integer. ```APIDOC ## io_variant_get_uint ### Description Gets the value of the variant as an unsigned integer. ### Function Signature `io_uint32_t io_variant_get_uint(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the unsigned integer value from. ### Returns Returns the unsigned integer value of the variant, or 0u if the variant type is not an unsigned integer. ``` -------------------------------- ### io_variant_get_int Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a signed integer. ```APIDOC ## io_variant_get_int ### Description Gets the value of the variant as a signed integer. ### Function Signature `io_int32_t io_variant_get_int(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the signed integer value from. ### Returns Returns the signed integer value of the variant, or 0 if the variant type is not an integer. ``` -------------------------------- ### Anchor Presets for UI Elements Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides predefined anchor points for positioning UI elements. ```c // Various presets for anchors //----------------------------------------------------------------------------// enum io_ui_anchor_preset_ { io_ui_anchor_preset_full_rect, // A full rectangle io_ui_anchor_preset_top_left, // Anchor at top left io_ui_anchor_preset_top_right, // Anchor at top right io_ui_anchor_preset_bottom_right, // Anchor at bottom right io_ui_anchor_preset_bottom_left, // Anchor at bottom left io_ui_anchor_preset_center_left, // Anchor at the left center io_ui_anchor_preset_center_top, // Anchor at the top center io_ui_anchor_preset_center_right, // Anchor at the right center io_ui_anchor_preset_center_bottom, // Anchor at the bottom center io_ui_anchor_preset_center, // Anchor at the center io_ui_anchor_preset_num }; typedef io_uint32_t io_ui_anchor_preset; ``` -------------------------------- ### io_variant_get_uint64 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a 64-bit unsigned integer. ```APIDOC ## io_variant_get_uint64 ### Description Gets the value of the variant as a 64-bit unsigned integer. ### Function Signature `io_uint64_t io_variant_get_uint64(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the 64-bit unsigned integer value from. ### Returns Returns the 64-bit unsigned integer value of the variant, or 0ull if the variant type is not a 64-bit unsigned integer. ``` -------------------------------- ### Convert UI Texture to DDS with Pre-multiplied Alpha Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/engine/importing_assets.md Use this command to convert a PNG texture to the BC7 DDS format with pre-multiplied alpha enabled, suitable for IOLITE's UI system. Ensure DirectXTex is installed and accessible. ```console texconv.exe -pmalpha -f BC7_UNORM_SRGB my_texture.png ``` -------------------------------- ### io_component_light_i Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides access to light components. ```APIDOC ## io_component_light_i ### Description Provides access to light components. ``` -------------------------------- ### io_variant_get_uint16 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a 16-bit unsigned integer. ```APIDOC ## io_variant_get_uint16 ### Description Gets the value of the variant as a 16-bit unsigned integer. ### Function Signature `io_uint16_t io_variant_get_uint16(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the 16-bit unsigned integer value from. ### Returns Returns the 16-bit unsigned integer value of the variant, or 0u if the variant type is not a 16-bit unsigned integer. ``` -------------------------------- ### io_variant_get_uint8 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a 8-bit unsigned integer. ```APIDOC ## io_variant_get_uint8 ### Description Gets the value of the variant as a 8-bit unsigned integer. ### Function Signature `io_uint8_t io_variant_get_uint8(io_variant_t variant)` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the 8-bit unsigned integer value from. ### Returns Returns the 8-bit unsigned integer value of the variant, or 0u if the variant type is not a 8-bit unsigned integer. ``` -------------------------------- ### Prefab and Camera Control Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Functions for spawning prefabs and managing active cameras. ```APIDOC ## spawn_prefab ### Description Spawns the prefab with the given name. ### Parameters - name (const char*) - The name of the prefab to spawn. ### Returns - io_ref_t - A reference to the spawned prefab. ``` ```APIDOC ## get_active_camera ### Description Retrieves the currently active camera. ### Returns - io_ref_t - A reference to the active camera. ``` ```APIDOC ## activate_camera ### Description Activates the given camera. ### Parameters - camera (io_ref_t) - The camera to activate. ``` -------------------------------- ### Play and Blend Animations with Lua Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/engine/subsystems/animation_system.md This script demonstrates how to load and use the animation system in Lua. It plays a base animation, layers a second animation on top, and dynamically blends the layered animation using a sine wave. Animations are stopped when the component is deactivated. ```lua Node.load() Math.load() AnimationSystem.load() function OnActivate(entity) -- The time passed since this script was activated Time = 0.0 -- Retrieve the node of the entity this script is attached to local n = Node.get_component_for_entity(entity) -- Prepare the description for the animation we want to play local desc = AnimationSystem.AnimationDesc() -- The name of the animation to play desc.animation_name = "anination_a" -- Loop the animation until we stop it manually desc.looping = true -- Play the animation on the root node node of the hierarchy -- we've retrieved earlier AnimInstanceA = AnimationSystem.play_animation(n, desc) -- Prepare an animation to layer on top of the base animation desc.animation_name = "animation_b" desc.looping = true -- Player the animation at twice the speed desc.play_speed = 2.0 -- Blend it out initially, so we can blend it in manually later on desc.blend_weight = 0.0 -- Play the second animation AnimInstanceB = AnimationSystem.play_animation(n, desc) end function OnTick(entity) -- Advance time Time = Time + delta_t -- As an example, blend the layered animation in and out AnimationSystem.set_blend_weight(AnimInstanceB, Math.sin(Time) * 0.5 + 0.5) end function OnDeactivate(entity) AnimationSystem.stop_animation(AnimInstanceA) AnimationSystem.stop_animation(AnimInstanceB) -- Alternatively, stop all animations on the root node -- local n = Node.get_component_for_entity(entity) -- AnimationSystem.stop_animations(n) end ``` -------------------------------- ### Get String from Name Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves the original string representation from an internalized name. ```c const char* (*name_get_string)(io_name_t name); ``` -------------------------------- ### Initialize Custom Component Manager Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes the manager and makes it available under the given type name. This should be called once after all properties have been registered. ```c void (*init_manager)(io_handle16_t manager, const char* type); ``` -------------------------------- ### Node Bounds Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Functions to get the bounding box of a node in both local and world space. ```APIDOC ## get_local_bounds ### Description Gets the bounds of the node in local space, represented as an axis-aligned bounding box. ### Method `io_aabb_t get_local_bounds(io_ref_t node)` ### Parameters - **node** (io_ref_t) - The node to query. ### Returns An `io_aabb_t` representing the local bounds of the node. ## get_world_bounds ### Description Gets the bounds of the node in world space, represented as an axis-aligned bounding box. ### Method `io_aabb_t get_world_bounds(io_ref_t node)` ### Parameters - **node** (io_ref_t) - The node to query. ### Returns An `io_aabb_t` representing the world bounds of the node. ``` -------------------------------- ### io_low_level_imgui_i Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides direct access to the internal low-level Dear ImGui data structures. ```APIDOC ## io_low_level_imgui_i ### Description Provides direct access to the internal low-level Dear ImGui data structures. Use this in conjunction with `ImGui::SetCurrentContext()` and `ImGui::SetAllocatorFunctions()` in your plugin. ### Methods #### get_imgui_context Returns the pointer to the global `ImGui::ImGuiContext` instance. - **Returns**: void* - Pointer to the `ImGui::ImGuiContext` instance. #### get_imgui_allocator_functions Returns the pointers to the global `ImGuiMemAllocFunc` and `ImGuiMemFreeFunc` functions. - **alloc_func** (void**) - Pointer to the memory allocation function. - **free_func** (void**) - Pointer to the memory free function. ``` -------------------------------- ### Configure Target Properties for Executables Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_c_api/sample_plugins/CMakeLists.txt Sets runtime and library output directories, as well as runtime names for various plugin executables. ```cmake foreach(EXECUTABLE IoliteSamplePluginC IoliteSamplePluginCPP IoliteMinimalPlugin IoliteSamplePluginVulkan) set_target_properties(${EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} RUNTIME_OUTPUT_NAME ${EXECUTABLE} RUNTIME_OUTPUT_NAME_RELEASE ${EXECUTABLE} RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${EXECUTABLE} RUNTIME_OUTPUT_NAME_DEBUG ${EXECUTABLE} LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${OUTPUT_DIR} LIBRARY_OUTPUT_NAME ${EXECUTABLE} ) endforeach() ``` -------------------------------- ### World Management Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Functions for interacting with the game world, including getting its name and loading/saving it. ```APIDOC ## get_world_name ### Description Gets the name of the currently loaded world. ### Returns - const char* - The name of the current world. ``` ```APIDOC ## load_world ### Description Loads the world with the given name. ### Parameters - name (const char*) - The name of the world to load. ``` ```APIDOC ## save_world ### Description Saves the current world under the given name. ### Parameters - name (const char*) - The name to save the current world under. ``` -------------------------------- ### Voxel Shape - Get Dimensions Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves the dimensions (width, height, depth) of the voxel shape. ```c io_u16vec3_t (*get_dim)(io_ref_t shape); ``` -------------------------------- ### User Editor Interface Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Extend the editor by implementing this interface. Use `on_build_plugin_menu` to add menu items, and `on_activate`, `on_deactivate`, `on_tick` for editor lifecycle and frame updates. ```c struct io_user_editor_i { // Called when building the "Plugin" menu in the editor's menu bar. Extend the // menu here using ImGui::MenuItem() etc. void (*on_build_plugin_menu)(); // Called once when the editor becomes active. void (*on_activate)(); // Called once when the editor becomes inactive. void (*on_deactivate)(); // Called every frame when the editor is active. void (*on_tick)(io_float32_t delta_t); }; ``` -------------------------------- ### Get Component Property Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves the value of a specific property from a component. The value is returned as an `io_variant_t`. ```c io_variant_t (*get_property)(io_ref_t component, const char* name); ``` -------------------------------- ### Minimal Plugin Structure in C/C++ Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/plugins/creating_plugins.md Provides the three essential functions required for a plugin: get_api_version, load_plugin, and unload_plugin. Ensure the API manager is accessible after loading. ```cpp #include "iolite_api.h" const struct io_api_manager_i* io_api_manager = 0; IO_API_EXPORT io_uint32_t IO_API_CALL get_api_version() { // Inform IOLITE which version of the API you are using return IO_API_VERSION; } IO_API_EXPORT io_int32_t IO_API_CALL load_plugin(const void* api_manager) { // Ensure we can keep accessing the API manager after loading the plugin io_api_manager = (const struct io_api_manager_i*)api_manager; // Do something with the API manager, set up your plugin, etc. return 0; // Return a value < 0 to indicate that the loading of your plugin // has failed (depedency not available, etc.) } IO_API_EXPORT void IO_API_CALL unload_plugin() { // Clean up here } ``` -------------------------------- ### Define ImGui Sources for Voxel Editing Plugin Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_plugins/CMakeLists.txt Lists the source files for ImGui, which will be used by the Voxel Editing Plugin. ```cmake set(IMGUI_SOURCES ../iolite_c_api/sample_plugins/dependencies/imgui/imgui.cpp ../iolite_c_api/sample_plugins/dependencies/imgui/imgui_widgets.cpp ../iolite_c_api/sample_plugins/dependencies/imgui/imgui_tables.cpp ../iolite_c_api/sample_plugins/dependencies/imgui/imgui_draw.cpp ) ``` -------------------------------- ### Get Number of Active Components Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Returns the number of active components managed by the given manager. ```c io_size_t (*get_num_active_components)(io_handle16_t manager); ``` -------------------------------- ### Make Index from Ref Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Converts a component reference to its corresponding index. ```c io_ref_index_t (*make_index)(io_handle16_t manager, io_ref_t component); ``` -------------------------------- ### Get First Selected Node Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves a reference to the first node currently selected in the editor. ```c io_ref_t (*get_first_selected_node)(); ``` -------------------------------- ### Add Shared Libraries for Sample Plugins Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_c_api/sample_plugins/CMakeLists.txt Defines shared libraries for different Iolite sample plugins (C, Vulkan, and C++). ```cmake add_library(IoliteSamplePluginC SHARED sample_plugin.c) add_library(IoliteSamplePluginVulkan SHARED sample_plugin_vulkan.c) ``` -------------------------------- ### Enqueue and Kick Task Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Adds a task to the scheduler's queue and initiates its execution. Tasks are processed asynchronously. ```c void (*scheduler_enqueue_task)(io_scheduler_task_t* task); ``` -------------------------------- ### io_component_camera_controller_i Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides access to camera controller components for setting and getting target nodes and Euler angles. ```APIDOC ## io_component_camera_controller_i ### Description Provides access to camera controller components for setting and getting target nodes and Euler angles. ### Methods - **set_target_node**(io_ref_t controller, io_ref_t node) - Sets the node to target for the given controller. - **set_target_euler_angles**(io_ref_t controller, io_vec3_t euler_angles) - Sets the Euler angles to target for the given controller. - **get_target_euler_angles**(io_ref_t controller) - Gets the Euler angles to target for the given controller. ``` -------------------------------- ### User Debug View Interface Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Implement this interface to provide custom debug views using Dear ImGui. The `on_build_debug_view` function is called to populate the view. ```c struct io_user_debug_view_i { // Called when the debug view should be filled using Dear ImGui calls. Called // in the context of the current debug view window. void (*on_build_debug_view)(io_float32_t delta_t); }; ``` -------------------------------- ### Voxel Shape - Get Voxel Palette Index Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves the palette index of a voxel at the given coordinate. ```c io_uint8_t (*get)(io_ref_t shape, io_u8vec3_t coord); ``` -------------------------------- ### Low-Level ImGui Interface Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Offers direct access to internal low-level Dear ImGui data structures. Use in conjunction with ImGui::SetCurrentContext() and ImGui::SetAllocatorFunctions(). ```c struct io_low_level_imgui_i { // Returns the ptr to the global "ImGui::ImGuiContext" instance void* (*get_imgui_context)(); // Returns the ptrs to the global "ImGuiMemAllocFunc" and "ImGuiMemFreeFunc" // functions void (*get_imgui_allocator_functions)(void** alloc_func, void** free_func); }; ``` -------------------------------- ### io_variant_get_uvec2 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a uvec2. If the variant's type is not uvec2, it returns a zero-initialized uvec2. ```APIDOC ## io_variant_get_uvec2 ### Description Gets the value of the variant as a uvec2. Returns a zero-initialized uvec2 if the variant type does not match. ### Function Signature ```c io_uvec2_t io_variant_get_uvec2(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the uvec2 value from. ### Returns * **io_uvec2_t** - The uvec2 value if the variant type matches, otherwise a zero-initialized uvec2. ``` -------------------------------- ### Pathfinding Path Settings Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Structure defining parameters for the pathfinding system. Includes settings for search range, agent dimensions, step height, cell size, maximum steps, and group masks. ```c typedef struct { io_uint32_t find_walkable_cell_range; io_float32_t capsule_radius; io_float32_t capsule_half_height; io_float32_t step_height; io_float32_t cell_size; io_uint32_t num_max_steps; io_uint32_t group_mask; } io_pathfinding_path_settings_t; ``` -------------------------------- ### io_variant_get_ivec4 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as an ivec4. If the variant's type is not ivec4, it returns a zero-initialized ivec4. ```APIDOC ## io_variant_get_ivec4 ### Description Gets the value of the variant as an ivec4. Returns a zero-initialized ivec4 if the variant type does not match. ### Function Signature ```c io_ivec4_t io_variant_get_ivec4(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the ivec4 value from. ### Returns * **io_ivec4_t** - The ivec4 value if the variant type matches, otherwise a zero-initialized ivec4. ``` -------------------------------- ### Initialize Fixed Step Accumulator Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes a fixed-step accumulator with a given update frequency. This function should be called once when creating a new accumulator. ```c inline void io_init_fixed_step_accumulator(io_fixed_step_accumulator_t* accumulator, io_float32_t update_frequency_in_hz) { accumulator->update_frequency_in_hz = update_frequency_in_hz; accumulator->delta_t = 1.0f / accumulator->update_frequency_in_hz; accumulator->accumulator = 0.0f; accumulator->interpolator = 0.0f; } ``` -------------------------------- ### Define OIDN Denoiser Plugin Library (Windows) Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_plugins/CMakeLists.txt Defines the IoliteDenoiserOIDNPlugin as a SHARED library for Windows, linking against OIDN and TBB libraries. ```cmake if(WIN32) # OIDN denoiser plugin add_library(IoliteDenoiserOIDNPlugin SHARED denoiser_oidn_plugin/denoiser_oidn_plugin.cpp ) list(APPEND PLUGINS IoliteDenoiserOIDNPlugin) find_library(_OIDN_LIB NAMES OpenImageDenoise PATHS "dependencies/oidn/lib") list(APPEND OIDN_LIBS ${_OIDN_LIB}) find_library(_OIDN_LIB_TBB NAMES tbb PATHS "dependencies/oidn/lib") list(APPEND OIDN_LIBS ${_OIDN_LIB_TBB}) target_link_libraries(IoliteDenoiserOIDNPlugin ${OIDN_LIBS}) endif() ``` -------------------------------- ### io_variant_get_ivec3 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as an ivec3. If the variant's type is not ivec3, it returns a zero-initialized ivec3. ```APIDOC ## io_variant_get_ivec3 ### Description Gets the value of the variant as an ivec3. Returns a zero-initialized ivec3 if the variant type does not match. ### Function Signature ```c io_ivec3_t io_variant_get_ivec3(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the ivec3 value from. ### Returns * **io_ivec3_t** - The ivec3 value if the variant type matches, otherwise a zero-initialized ivec3. ``` -------------------------------- ### IOLITE Package Generator Usage Source: https://github.com/klopppo/iolitelegacy/blob/legacy/python_scripts/README.md Command-line usage for generating an IOLITE Package File (IOPKG) from a data source directory. Requires specifying the output file path and the data source directory. ```python usage: IOLITE Package Generator [-h] -o OUTPUT data_source_path Generates an IOLITE Package File (IOPKG) from the provided data source directory. positional arguments: data_source_path The data source directory to create the package for. options: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT The filepath of the package file to create. Example: 'base.iopkg'. ``` -------------------------------- ### io_variant_get_ivec2 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as an ivec2. If the variant's type is not ivec2, it returns a zero-initialized ivec2. ```APIDOC ## io_variant_get_ivec2 ### Description Gets the value of the variant as an ivec2. Returns a zero-initialized ivec2 if the variant type does not match. ### Function Signature ```c io_ivec2_t io_variant_get_ivec2(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the ivec2 value from. ### Returns * **io_ivec2_t** - The ivec2 value if the variant type matches, otherwise a zero-initialized ivec2. ``` -------------------------------- ### io_variant_get_quat Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a quaternion. If the variant's type is not quat, it returns a zero-initialized quaternion. ```APIDOC ## io_variant_get_quat ### Description Gets the value of the variant as a quaternion. Returns a zero-initialized quaternion if the variant type does not match. ### Function Signature ```c io_quat_t io_variant_get_quat(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the quaternion value from. ### Returns * **io_quat_t** - The quaternion value if the variant type matches, otherwise a zero-initialized quaternion. ``` -------------------------------- ### Convert iolite Quat to User Quat (W First) Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Provides an inline function to convert iolite's io_quat_t to a user-defined quaternion type, assuming the user type stores w, x, y, z. Requires IO_USER_QUAT_TYPE to be defined. ```c #ifndef IO_USER_QUAT_TYPE_W_LAST //----------------------------------------------------------------------------// inline IO_USER_QUAT_TYPE io_cvt(io_quat_t v) { return {v.w, v.x, v.y, v.z}; } //----------------------------------------------------------------------------// #endif // IO_USER_QUAT_TYPE_W_LAST ``` -------------------------------- ### io_init_fixed_step_accumulator Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes a fixed-time step accumulator. This function should be called once when creating a new accumulator to set the update frequency and initialize internal time variables. ```APIDOC ## io_init_fixed_step_accumulator ### Description Initializes the provided accumulator. Call this function once when creating a new accumulator. ### Signature ```c void io_init_fixed_step_accumulator(io_fixed_step_accumulator_t* accumulator, io_float32_t update_frequency_in_hz) ``` ### Parameters - **accumulator** (*io_fixed_step_accumulator_t*): Pointer to the fixed-time step accumulator structure to initialize. - **update_frequency_in_hz** (*io_float32_t*): The fixed update frequency in Hz (steps per second). ``` -------------------------------- ### io_variant_get_vec4 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a vec4. If the variant's type is not vec4, it returns a zero-initialized vec4. ```APIDOC ## io_variant_get_vec4 ### Description Gets the value of the variant as a vec4. Returns a zero-initialized vec4 if the variant type does not match. ### Function Signature ```c io_vec4_t io_variant_get_vec4(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the vec4 value from. ### Returns * **io_vec4_t** - The vec4 value if the variant type matches, otherwise a zero-initialized vec4. ``` -------------------------------- ### io_variant_get_vec3 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a vec3. If the variant's type is not vec3, it returns a zero-initialized vec3. ```APIDOC ## io_variant_get_vec3 ### Description Gets the value of the variant as a vec3. Returns a zero-initialized vec3 if the variant type does not match. ### Function Signature ```c io_vec3_t io_variant_get_vec3(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the vec3 value from. ### Returns * **io_vec3_t** - The vec3 value if the variant type matches, otherwise a zero-initialized vec3. ``` -------------------------------- ### io_variant_get_vec2 Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Gets the value of the variant as a vec2. If the variant's type is not vec2, it returns a zero-initialized vec2. ```APIDOC ## io_variant_get_vec2 ### Description Gets the value of the variant as a vec2. Returns a zero-initialized vec2 if the variant type does not match. ### Function Signature ```c io_vec2_t io_variant_get_vec2(io_variant_t variant) ``` ### Parameters * **variant** (io_variant_t) - The variant to retrieve the vec2 value from. ### Returns * **io_vec2_t** - The vec2 value if the variant type matches, otherwise a zero-initialized vec2. ``` -------------------------------- ### Create Component Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Initializes and attaches a new component of a specific type to a parent entity. This is the primary method for adding functionality to entities. ```c io_ref_t (*create)(io_ref_t parent_entity); ``` -------------------------------- ### Input System Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Functions for querying input states from keyboards, axes, and mouse. ```APIDOC ## get_key_state ### Description Gets the state of the given key. ### Parameters - key (io_input_key) - The key to check. - player_id (io_uint8_t) - The ID of the player. ### Returns - io_input_key_state - The state of the key. ``` ```APIDOC ## get_axis_state ### Description Gets the state of the given axis. ### Parameters - axis (io_input_axis) - The axis to check. - player_id (io_uint8_t) - The ID of the player. ### Returns - io_float32_t - The state of the axis. ``` ```APIDOC ## get_mouse_pos ### Description Gets the mouse position in pixels. ### Returns - io_vec2_t - The mouse position. ``` ```APIDOC ## get_mouse_pos_viewport ### Description Gets the position of the mouse in the viewport. ### Returns - io_vec2_t - The mouse position in the viewport. ``` -------------------------------- ### Get Type ID of Custom Component Manager Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Returns the type ID for a given custom component manager. ```c io_ref_type_id_t (*get_type_id)(io_handle16_t manager); ``` -------------------------------- ### Get boolean from iolite variant Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Retrieves the value of a variant as a boolean. Returns IO_FALSE if the variant type is not io_variant_type_bool. ```c inline io_bool_t io_variant_get_bool(io_variant_t variant) { if (variant.type.hash != io_variant_type_bool) return IO_FALSE; return *(io_bool_t*)variant.data; } ``` -------------------------------- ### io_component_base_i Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Base interface for all resources, providing fundamental operations like creation, destruction, and property management. ```APIDOC ## io_component_base_i ### Description Base interface for all resources, providing fundamental operations like creation, destruction, and property management. Not all functions are provided by all resources. ### Methods - **get_type_id**() - Returns the type ID for this type of resource. - **create**(const char* name) - Creates a new resource with the given name. - **destroy**(io_ref_t resource) - Destroys the given resource. - **commit_changes**(io_ref_t resource) - Commits any changes and reloads the internals of the resource. - **find_first_resource_with_name**(const char* name) - Finds the first resource with the given name. - **find_resource_with_uuid**(io_uuid_t uuid) - Finds the first resource with the given UUID. - **get_num_active_resources**() - Returns the number of active resources. - **make_ref**(io_ref_index_t resource_index) - Returns a ref for the given linear resource index. - **make_index**(io_ref_t resource) - Returns the linear resource index for the given ref. - **get_name**(io_ref_t resource) - Returns the name of the resource. - **get_uuid**(io_ref_t resource) - Returns the UUID of the resource. - **get_name_memory**() - Returns the linear memory containing all the names for all active resources. - **is_alive**(io_ref_t resource) - Returns true if the given resource is alive. - **set_property**(io_ref_t resource, const char* name, io_variant_t value) - Sets the property of the given resource to the provided value. - **get_property**(io_ref_t resource, const char* name) - Gets the property of the given resource as a variant. - **get_property_memory**(const char* name) - Gets the linear memory for the property with the given name. Don't cache the returned pointer! The property memory will change when the manager runs over its current capacity. - **get_property_memory_ptr**(const char* name) - Gets a pointer to a pointer pointing to the linear memory for the property with the given name. The referenced pointer is updated if the internal memory changes. It's only safe to cache the returned pointer when all properties have been registered. ``` -------------------------------- ### Create Custom Component Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Creates a new custom component and attaches it to the provided parent entity. ```c io_ref_t (*create_custom_component)(io_handle16_t manager, io_ref_t parent_entity); ``` -------------------------------- ### Get Invalid 64-bit Handle Source: https://github.com/klopppo/iolitelegacy/blob/legacy/iolite_docs/api/c.md Returns an invalid io_handle64_t. An invalid handle has its internal value set to -1. ```c // Returns an invalid 64-bit handle. //----------------------------------------------------------------------------// inline io_handle64_t io_handle64_invalid() { io_handle64_t handle; handle.internal = (io_uint64_t)-1; return handle; } ```