diff --git a/engine_plugins/render_plugin/render_plugin_sample/helpers.svg b/engine_plugins/render_plugin/render_plugin_sample/helpers.svg index 3bfcecf..24a81e2 100644 --- a/engine_plugins/render_plugin/render_plugin_sample/helpers.svg +++ b/engine_plugins/render_plugin/render_plugin_sample/helpers.svg @@ -1,35 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_application.h b/stingray_sdk/engine_plugin_api/c_api/c_api_application.h index 9e2d914..6556e4a 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_application.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_application.h @@ -17,7 +17,6 @@ struct ApplicationCApi const char* (*build) (); const char* (*platform) (); - const char* (*source_platform) (); const char* (*build_identifier) (); const char* (*sysinfo) (); ConstConfigRootPtr (*settings_root) (); @@ -38,4 +37,3 @@ struct ApplicationCApi #ifdef __cplusplus } #endif - diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_camera.h b/stingray_sdk/engine_plugin_api/c_api/c_api_camera.h index 87fa9f9..643afce 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_camera.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_camera.h @@ -55,6 +55,8 @@ struct CameraCApi enum CameraMode (*mode)(ConstCameraPtr); void (*set_mode)(CameraPtr, enum CameraMode); + + void (*set_local)(CameraPtr, ConstMatrix4x4Ptr m, unsigned); }; #ifdef __cplusplus diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_entity.h b/stingray_sdk/engine_plugin_api/c_api/c_api_entity.h index 293b1a2..461a385 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_entity.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_entity.h @@ -2,6 +2,7 @@ #include "c_api_types.h" #include "entity_components/c_api_data_component.h" +#include "entity_components/c_api_render_data_component.h" #include "entity_components/c_api_debug_name_component.h" #include "entity_components/c_api_tag_component.h" #include "entity_components/c_api_animation_state_machine_component.h" @@ -21,7 +22,7 @@ struct EntityManagerApi void (*destroy) (EntityRef); int (*is_alive) (EntityRef); void (*set_debug_name) (EntityRef, const char*); - EntityRef (*spawn) (WorldPtr, uint64_t entity_name, ConstMatrix4x4Ptr transform); + EntityRef (*spawn) (WorldPtr, uint64_t entity_name_id64, const char *optional_debug_entity_name, ConstMatrix4x4Ptr transform); }; struct EntityCApi diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_line_object.h b/stingray_sdk/engine_plugin_api/c_api/c_api_line_object.h index b5eddd2..d2d212d 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_line_object.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_line_object.h @@ -21,7 +21,7 @@ struct LineObjectCApi void (*add_axes) (LineObjectPtr, ConstMatrix4x4Ptr pose, float length); /* Not available in Release builds. If camera_direction is supplied, back-facing triangles will get culled. */ - void (*add_unit_meshes) (LineObjectPtr, uint64_t unit_id64, ConstVector4Ptr color, ConstMatrix4x4Ptr pose, ConstVector3Ptr optional_camera_direction); + void (*add_unit_meshes) (LineObjectPtr, uint64_t unit_resource_name_id64, const char *optional_debug_unit_resource_name, ConstVector4Ptr color, ConstMatrix4x4Ptr pose, ConstVector3Ptr optional_camera_direction); }; #ifdef __cplusplus diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_material.h b/stingray_sdk/engine_plugin_api/c_api/c_api_material.h index bd4ffb1..e84af90 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_material.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_material.h @@ -16,7 +16,7 @@ struct MaterialCApi unsigned (*material_id) (ConstMaterialPtr); void (*set_shader_pass_flag) (MaterialPtr, unsigned flag_name_id32, int enabled); - void (*set_texture) (MaterialPtr, unsigned slot_name_id32, uint64_t texture_resource); + void (*set_texture) (MaterialPtr, unsigned slot_name_id32, uint64_t texture_resource_name_id64, const char *optional_debug_texture_resource_name); void (*set_resource) (MaterialPtr, unsigned slot_name_id32, ConstRenderResourcePtr); void (*set_matrix4x4) (MaterialPtr, unsigned variable_name_id32, ConstMatrix4x4Ptr); }; diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_types.h b/stingray_sdk/engine_plugin_api/c_api/c_api_types.h index c2a54ca..4bbf3ec 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_types.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_types.h @@ -54,6 +54,7 @@ extern "C" { typedef void* AnimationStateMachineComponentPtr; typedef void* DebugNameComponentPtr; typedef void* DataComponentPtr; + typedef void* RenderDataComponentPtr; typedef void* TagComponentPtr; typedef void* ComponentPtr; typedef CApiPhysicsWorld* PhysicsWorldPtr; @@ -130,6 +131,11 @@ extern "C" { unsigned num_states; }; + struct AnimationLayerSeeds { + unsigned seeds[32]; + unsigned num_seeds; + }; + struct AnimationLayerInfo { float length; double t; diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_unit.h b/stingray_sdk/engine_plugin_api/c_api/c_api_unit.h index 2080c48..b7a1957 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_unit.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_unit.h @@ -57,7 +57,7 @@ struct UnitCApi void* (*flow_variable) (UnitRef, unsigned variable_name_id32); void (*set_flow_variable) (UnitRef, unsigned variable_name_id32, void* value); - uint64_t (*set_material) (UnitRef, unsigned slot_name_id32, uint64_t material_resource); + uint64_t (*set_material) (UnitRef, unsigned slot_name_id32, uint64_t material_resource_name_id64, const char *optional_debug_material_resource_name); uint64_t (*set_material_to_none) (UnitRef, unsigned slot_name_id32); unsigned (*num_meshes) (UnitRef); @@ -80,14 +80,14 @@ struct UnitCApi void (*animation_set_constraint_target_position) (UnitRef, unsigned index, ConstVector3Ptr); void (*animation_set_constraint_target_rotation) (UnitRef, unsigned index, ConstQuaternionPtr); - unsigned (*crossfade_animation) (UnitRef, uint64_t animation_name, unsigned layer, float blend_time, int should_loop, enum AnimationBlendType); + unsigned (*crossfade_animation) (UnitRef, uint64_t animation_name_id64, const char *optional_debug_animation_name, unsigned layer, float blend_time, int should_loop, enum AnimationBlendType); unsigned (*is_crossfading_animation) (UnitRef); void (*crossfade_animation_set_time) (UnitRef, unsigned id, float time, int should_cap_to_range); void (*crossfade_animation_set_speed) (UnitRef, unsigned id, float speed); void (*disable_state_machine) (UnitRef); void (*enable_state_machine) (UnitRef); - void (*set_state_machine) (UnitRef, uint64_t state_machine_name); + void (*set_state_machine) (UnitRef, uint64_t machine_name_id64, const char *optional_debug_machine_name); int (*has_state_machine) (UnitRef); int (*has_event) (UnitRef, unsigned event_name_id32); @@ -101,6 +101,9 @@ struct UnitCApi void (*animation_set_state) (UnitRef, struct AnimationStates*); struct AnimationStates (*animation_get_state) (UnitRef); + void(*animation_set_seeds) (UnitRef, struct AnimationLayerSeeds*); + struct AnimationLayerSeeds(*animation_get_seeds) (UnitRef); + struct AnimationLayerInfo (*animation_layer_info) (UnitRef, unsigned index); void (*set_merge_options) (UnitRef, float max_start_time, float max_drift, float clock_fidelity); diff --git a/stingray_sdk/engine_plugin_api/c_api/c_api_world.h b/stingray_sdk/engine_plugin_api/c_api/c_api_world.h index 1ebe194..f0d6073 100644 --- a/stingray_sdk/engine_plugin_api/c_api/c_api_world.h +++ b/stingray_sdk/engine_plugin_api/c_api/c_api_world.h @@ -17,7 +17,7 @@ enum WorldCApi_OrphanedParticlePolicy struct WorldCApi { - UnitRef (*spawn_unit) (WorldPtr world_pointer, uint64_t unit_name, ConstMatrix4x4Ptr transform); + UnitRef (*spawn_unit) (WorldPtr world_pointer, uint64_t unit_name_id64, const char *optional_debug_unit_name, ConstMatrix4x4Ptr transform); void (*destroy_unit) (WorldPtr world_pointer, UnitRef unit_ref); unsigned (*num_units) (ConstWorldPtr world_pointer); @@ -30,7 +30,7 @@ struct WorldCApi void (*link_unit) (WorldPtr world_pointer, UnitRef child, unsigned child_node_index, UnitRef parent, unsigned parent_node_index); void (*unlink_unit) (WorldPtr world_pointer, UnitRef child); void (*update_unit) (WorldPtr world_pointer, UnitRef unit_ref); - ParticleRef (*create_particles) (WorldPtr world_pointer, uint64_t effect_name, ConstMatrix4x4Ptr transform); + ParticleRef (*create_particles) (WorldPtr world_pointer, uint64_t name_id64, const char *optional_debug_name, ConstMatrix4x4Ptr transform); void (*destroy_particles) (WorldPtr world_pointer, ParticleRef id); void (*stop_spawning_particles) (WorldPtr world_pointer, ParticleRef id); int (*are_particles_playing) (ConstWorldPtr world_pointer, ParticleRef id); @@ -39,10 +39,10 @@ struct WorldCApi void (*move_particles) (WorldPtr world_pointer, ParticleRef id, ConstMatrix4x4Ptr transform); void (*link_particles) (WorldPtr world_pointer, ParticleRef id, UnitRef unit_ref, unsigned unit_node_index, ConstMatrix4x4Ptr local_pose, enum WorldCApi_OrphanedParticlePolicy orphaned_policy); - unsigned (*find_particles_variable) (ConstWorldPtr world_pointer, uint64_t effect_name, unsigned variable_name_id32); + unsigned (*find_particles_variable) (ConstWorldPtr world_pointer, uint64_t name_id64, const char *optional_debug_name, unsigned variable_name_id32); void (*set_particles_variable) (WorldPtr world_pointer, ParticleRef id, unsigned variable, ConstVector3Ptr value); - LevelPtr (*load_level) (WorldPtr world_pointer, uint64_t level_name_id64, ConstMatrix4x4Ptr transform, uint64_t optional_level_id); + LevelPtr (*load_level) (WorldPtr world_pointer, uint64_t level_name_id64, const char *optional_debug_level_name, ConstMatrix4x4Ptr transform, uint64_t optional_level_id); void (*destroy_level) (WorldPtr world_pointer, LevelPtr level_pointer); unsigned (*num_levels) (ConstWorldPtr world_pointer); LevelPtr (*level) (WorldPtr world_pointer, unsigned index); @@ -58,10 +58,10 @@ struct WorldCApi VectorFieldPtr (*vector_field) (WorldPtr world_pointer, unsigned vector_field_name_id32); ScatterSystemPtr (*scatter_system) (WorldPtr world_pointer); - ShadingEnvironmentPtr (*create_shading_environment) (WorldPtr world_pointer, uint64_t name_id64); + ShadingEnvironmentPtr (*create_shading_environment) (WorldPtr world_pointer, uint64_t name_id64, const char *optional_debug_name); ShadingEnvironmentPtr (*create_default_shading_environment) (WorldPtr world_pointer); void (*destroy_shading_environment) (WorldPtr world_pointer, ShadingEnvironmentPtr shading_environment_pointer); - void (*set_shading_environment) (WorldPtr world_pointer, ShadingEnvironmentPtr shading_environment, uint64_t name_id64); + void (*set_shading_environment) (WorldPtr world_pointer, ShadingEnvironmentPtr shading_environment, uint64_t name_id64, const char *optional_debug_name); LineObjectPtr (*create_line_object) (WorldPtr world_pointer, int disable_depth_test); void (*destroy_line_object) (WorldPtr world_pointer, LineObjectPtr line_object_pointer); diff --git a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_blender_component.h b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_blender_component.h index bcffa0e..8d5864c 100644 --- a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_blender_component.h +++ b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_blender_component.h @@ -18,7 +18,7 @@ struct AnimationBlenderComponentCApi void (*set_property) (AnimationBlenderComponentPtr, EntityRef, struct EntityPropertyParameter*, unsigned num_args, ...); struct EntityPropertyValue (*get_property) (DataComponentPtr, EntityRef, unsigned num_args, ...); - unsigned (*crossfade) (AnimationBlenderComponentPtr, EntityRef, uint64_t animation_name, unsigned layer, float blend_time, int should_loop, enum AnimationBlendType anim_blend_type); + unsigned (*crossfade) (AnimationBlenderComponentPtr, EntityRef, uint64_t animation_name_id64, const char *optional_debug_animation_name, unsigned layer, float blend_time, int should_loop, enum AnimationBlendType anim_blend_type); void (*set_time) (AnimationBlenderComponentPtr, EntityRef, unsigned id, float time, int should_cap_to_range); void (*set_speed) (AnimationBlenderComponentPtr, EntityRef, unsigned id, float speed); int (*is_crossfading) (AnimationBlenderComponentPtr, EntityRef); diff --git a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_state_machine_component.h b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_state_machine_component.h index 4a063d6..f4bdc4c 100644 --- a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_state_machine_component.h +++ b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_animation_state_machine_component.h @@ -19,7 +19,7 @@ struct AnimationStateMachineComponentCApi struct EntityPropertyValue (*get_property) (DataComponentPtr, EntityRef, unsigned num_args, ...); int (*has_event) (AnimationStateMachineComponentPtr, EntityRef, unsigned event_name_id32); - void (*trigger_event) (AnimationStateMachineComponentPtr, EntityRef, unsigned event_name_id32); + void (*trigger_event) (AnimationStateMachineComponentPtr, EntityRef, unsigned event_name_id32, const char *opt_event_plain_name); unsigned (*find_variable) (AnimationStateMachineComponentPtr, EntityRef, unsigned variable_name_id32); float (*get_variable) (AnimationStateMachineComponentPtr, EntityRef, unsigned index); void (*set_variable) (AnimationStateMachineComponentPtr, EntityRef, unsigned index, float value); diff --git a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_mesh_component.h b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_mesh_component.h index 4e6634d..801ad20 100644 --- a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_mesh_component.h +++ b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_mesh_component.h @@ -10,16 +10,16 @@ struct MeshComponentCApi { MeshComponentPtr (*component) (WorldPtr); - InstanceId (*create) (MeshComponentPtr, EntityRef); - void (*destroy) (MeshComponentPtr, EntityRef, InstanceId); - unsigned (*instances) (MeshComponentPtr, EntityRef, InstanceId *buffer, unsigned buffer_size); + InstanceId (*create) (MeshComponentPtr comp, EntityRef e_ref); + void (*destroy) (MeshComponentPtr comp, EntityRef e_ref, InstanceId); + unsigned (*instances) (MeshComponentPtr comp, EntityRef e_ref, InstanceId *buffer, unsigned buffer_size); /* All property keys should be in the format of const char* */ - void (*set_property) (MeshComponentPtr, EntityRef, InstanceId, struct EntityPropertyParameter*, unsigned num_args, ...); + void (*set_property) (MeshComponentPtr comp, EntityRef e_ref, InstanceId, struct EntityPropertyParameter*, unsigned num_args, ...); struct EntityPropertyValue (*get_property) (DataComponentPtr, EntityRef, InstanceId, unsigned num_args, ...); - InstanceId (*create_with_mesh) (MeshComponentPtr, EntityRef, uint64_t scene_resource_id64, unsigned mesh_name_id32); - void (*set_material) (MeshComponentPtr, EntityRef, InstanceId, unsigned key_id32, uint64_t material_resource_id64, unsigned material_id32); + InstanceId (*create_with_mesh) (MeshComponentPtr comp, EntityRef e_ref, uint64_t scene_resource_id64, const char *optional_debug_scene_resource_name, unsigned mesh_name_id32, const char *optional_debug_mesh_name); + void (*set_material) (MeshComponentPtr comp, EntityRef e_ref, InstanceId id, unsigned key_id32, uint64_t material_resource_id64, const char *optional_debug_material_resource_name, unsigned material_id32, const char *optional_debug_material_name); }; #ifdef __cplusplus diff --git a/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_render_data_component.h b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_render_data_component.h new file mode 100644 index 0000000..e8efad9 --- /dev/null +++ b/stingray_sdk/engine_plugin_api/c_api/entity_components/c_api_render_data_component.h @@ -0,0 +1,24 @@ +#pragma once + +#include "../c_api_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct RenderDataComponentCApi +{ + RenderDataComponentPtr (*component) (WorldPtr world); + + InstanceId (*create) (RenderDataComponentPtr, EntityRef); + void (*destroy) (RenderDataComponentPtr, EntityRef, InstanceId); + unsigned (*instances) (RenderDataComponentPtr, EntityRef, InstanceId *buffer, unsigned buffer_size); + + /* All property keys should be in the format of const char* */ + void (*set_property) (RenderDataComponentPtr, EntityRef, InstanceId, struct EntityPropertyParameter*, unsigned num_args, ...); + struct EntityPropertyValue (*get_property) (RenderDataComponentPtr, EntityRef, InstanceId, unsigned num_args, ...); +}; + +#ifdef __cplusplus +} +#endif diff --git a/stingray_sdk/engine_plugin_api/plugin_api.h b/stingray_sdk/engine_plugin_api/plugin_api.h index 04de75b..487d074 100644 --- a/stingray_sdk/engine_plugin_api/plugin_api.h +++ b/stingray_sdk/engine_plugin_api/plugin_api.h @@ -86,8 +86,7 @@ enum PluginApiID { SCENE_DATABASE_API_ID = 35, STREAM_CAPTURE_API = 36, FLOW_NODES_API_ID = 37, - CAMERA_API_ID = 38, - RENDER_CAMERA_API_ID = 39 + CAMERA_API_ID = 38 }; /* ---------------------------------------------------------------------- @@ -558,6 +557,8 @@ struct DataCompileParametersApi /* Includes (type,name) in packages for the compiled file. */ void (*include_in_package)(struct DataCompileParameters *input, const char *type, const char *name); + void (*glob_include_in_package)(struct DataCompileParameters *input, const char *prefix, const char *suffix, const char *type); + /* Returns true if the path exists. */ int (*exists)(struct DataCompileParameters *input, const char *path); }; @@ -1007,7 +1008,8 @@ struct ApplicationApi void (*hook_console_receiver)(const char *type, struct AP_ReceiverUserDataWrapper *user_wrapper); void (*unhook_console_receiver)(const char *type); - void (*console_send_message)(int client_id, const char *type, const char *data, uint32_t data_length); + int (*current_client_id)(); + void (*console_send_with_binary_data)(const char *text, uint32_t text_len, const char *data, uint32_t data_len, uint8_t sync, int client_id); }; /* ---------------------------------------------------------------------- @@ -1094,6 +1096,8 @@ struct WorldApi void (*register_post_animation_callback)(CApiWorld * world, PostAnimationCallback function); /* unregister a post FK animation callback */ void (*unregister_post_animation_callback)(CApiWorld * world, PostAnimationCallback function); + /* it is the responsibility of the plugin to free memory returned by find_units_by_resource_name */ + CApiUnit ** (*find_units_by_resource_name)(CApiWorld *world, uint64_t resource_name, struct AllocatorObject *allocator, unsigned *count); }; /* ---------------------------------------------------------------------- @@ -1628,8 +1632,6 @@ struct CameraApi { struct SceneGraph * (*scene_graph)(CApiCamera *camera); - uint32_t (*render_handle)(CApiCamera *camera); - float (*near_range)(CApiCamera *camera); void (*set_near_range)(CApiCamera *, float near_range); @@ -1647,15 +1649,8 @@ struct CameraApi uint8_t (*mode)(CApiCamera *camera); void (*set_mode)(CApiCamera *camera, uint8_t mode); -}; -/* ---------------------------------------------------------------------- -RenderCameraApi ----------------------------------------------------------------------- */ -struct RenderCameraApi -{ - void (*set_world)(uint32_t render_handle, CApiWorld *world, ConstMatrix4x4Ptr w, unsigned i); - void (*set_view)(uint32_t render_handle, CApiWorld *world, ConstMatrix4x4Ptr v, unsigned i); + void (*set_local)(CApiCamera *camera, ConstMatrix4x4Ptr offset, unsigned i); }; #ifdef __cplusplus diff --git a/stingray_sdk/plugin_foundation/random.h b/stingray_sdk/plugin_foundation/random.h index 15a4d82..9f5f63b 100644 --- a/stingray_sdk/plugin_foundation/random.h +++ b/stingray_sdk/plugin_foundation/random.h @@ -19,12 +19,12 @@ class Random static const unsigned A = 1664525 , B = 1013904223; __forceinline Random() : _state(0) {} - __forceinline Random(unsigned long s) : _state(unsigned(s)) {} - __forceinline unsigned long seed() const {return _state;} - __forceinline void set_seed(unsigned long s) {_state = unsigned(s);} + __forceinline Random(unsigned s) : _state(s) {} + __forceinline unsigned seed() const {return _state;} + __forceinline void set_seed(unsigned s) {_state = s;} __forceinline void next() {_state = A * _state + B;} - __forceinline unsigned long rand_u32() {next(); return _state;} + __forceinline unsigned rand_u32() {next(); return _state;} __forceinline double rand_double() {return double(rand_u32()) * (0.5 / 0x80000000);} __forceinline float rand_float() {return float(rand_u32()) * (0.5f / 0x80000000);}