From acd7c17ef77adbc305bb0ce29427bcc836848d77 Mon Sep 17 00:00:00 2001 From: SpectrumQT <19625504+SpectrumQT@users.noreply.github.com> Date: Sun, 21 Apr 2024 01:21:50 +0700 Subject: [PATCH] Dropped usage of include directive as it fails for multiple users --- TileGUI/Shaders/instance_model.hlsl | 12 -- TileGUI/Shaders/instance_writer.hlsl | 14 +- TileGUI/Shaders/tile_draw_service.hlsl | 54 +++++- TileGUI/Shaders/tile_features_service.hlsl | 54 +++++- TileGUI/Shaders/tile_group_writer.hlsl | 177 ++++++++++++++++- TileGUI/Shaders/tile_model.hlsl | 214 --------------------- TileGUI/Shaders/tile_position_service.hlsl | 41 +++- TileGUI/Shaders/tile_reader.hlsl | 54 +++++- TileGUI/Shaders/tile_writer.hlsl | 214 ++++++++++++++++++++- 9 files changed, 591 insertions(+), 243 deletions(-) delete mode 100644 TileGUI/Shaders/instance_model.hlsl delete mode 100644 TileGUI/Shaders/tile_model.hlsl diff --git a/TileGUI/Shaders/instance_model.hlsl b/TileGUI/Shaders/instance_model.hlsl deleted file mode 100644 index 2b2a30b..0000000 --- a/TileGUI/Shaders/instance_model.hlsl +++ /dev/null @@ -1,12 +0,0 @@ - -struct Instance { - float max_tiles_count; - float max_layers_count; - float2 unused1; - - float drag_tile_id; - float2 drag_pos; - float1 unused2; - - float4 unused3; -}; diff --git a/TileGUI/Shaders/instance_writer.hlsl b/TileGUI/Shaders/instance_writer.hlsl index be77bd8..f799167 100644 --- a/TileGUI/Shaders/instance_writer.hlsl +++ b/TileGUI/Shaders/instance_writer.hlsl @@ -1,7 +1,5 @@ // Updates client's instance storage with given ini variables -#include "instance_model.hlsl" - Texture1D IniParams : register(t120); // #define WindowWidth IniParams[0].x @@ -14,6 +12,18 @@ Texture1D IniParams : register(t120); #define DragTileId IniParams[15].x +struct Instance { + float max_tiles_count; + float max_layers_count; + float2 unused1; + + float drag_tile_id; + float2 drag_pos; + float1 unused2; + + float4 unused3; +}; + RWStructuredBuffer InstanceContainerRW : register(u0); #define CurrentInstance InstanceContainerRW[0] diff --git a/TileGUI/Shaders/tile_draw_service.hlsl b/TileGUI/Shaders/tile_draw_service.hlsl index 22a2e50..9e9a351 100644 --- a/TileGUI/Shaders/tile_draw_service.hlsl +++ b/TileGUI/Shaders/tile_draw_service.hlsl @@ -1,8 +1,5 @@ // Draws all tiles on screen -#include "instance_model.hlsl" -#include "tile_model.hlsl" - struct vs2gs { uint vertex_id : TEXCOORD0; }; @@ -25,9 +22,60 @@ void main(uint vertex_id : SV_VertexID, out vs2gs output) #ifdef GEOMETRY_SHADER +struct Instance { + float max_tiles_count; + float max_layers_count; + float2 unused1; + + float drag_tile_id; + float2 drag_pos; + float1 unused2; + + float4 unused3; +}; + StructuredBuffer InstanceContainer : register(t121); #define CurrentInstance InstanceContainer[0] +struct Tile { + // Base config + float sys_state_id; + float layer_id; + float parent_tile_id; + float template_id; + // Features config + float show; + float select; + float clamp; + float track_mouse; + // Advanced features config + float loop_start; + float loop_method; + float hover_overlay_tile_id; + float select_overlay_tile_id; + // Display config + float2 size; + float texture_id; + float tex_arr_id; + // Texture config + float4 tex_uv; + // Texture config 2 + float opacity; + float saturation; + float2 reserved_1; + // Layout config + float2 offset; + float2 anchor; + // Current state + float loop_stage; + float is_hovered_over; + float2 reserved_2; + // Absolute coords of current position + float4 abs_pos; + // Relative coords of current position + float4 rel_pos; +}; + StructuredBuffer Tiles : register(t122); // Here we devide MaxTilesCount (128, 256, 512 or 1024) by the number of geometry shader instances (32) diff --git a/TileGUI/Shaders/tile_features_service.hlsl b/TileGUI/Shaders/tile_features_service.hlsl index 4e1fb0c..ce1fe5c 100644 --- a/TileGUI/Shaders/tile_features_service.hlsl +++ b/TileGUI/Shaders/tile_features_service.hlsl @@ -1,9 +1,6 @@ // Handles special (re)actions for all tiles, like hover over, overlays, dragging and so on // Simplifies and accelerates common GUI logic that would require tons of STORE calls otherwise -#include "instance_model.hlsl" -#include "tile_model.hlsl" - Texture1D IniParams : register(t120); #define WindowWidth IniParams[0].x @@ -13,9 +10,60 @@ Texture1D IniParams : register(t120); #define RootParentCoords float4(0, 0, IniParams[0].x, IniParams[0].y) +struct Instance { + float max_tiles_count; + float max_layers_count; + float2 unused1; + + float drag_tile_id; + float2 drag_pos; + float1 unused2; + + float4 unused3; +}; + RWStructuredBuffer InstanceContainerRW : register(u0); #define Instance InstanceContainerRW[0] +struct Tile { + // Base config + float sys_state_id; + float layer_id; + float parent_tile_id; + float template_id; + // Features config + float show; + float select; + float clamp; + float track_mouse; + // Advanced features config + float loop_start; + float loop_method; + float hover_overlay_tile_id; + float select_overlay_tile_id; + // Display config + float2 size; + float texture_id; + float tex_arr_id; + // Texture config + float4 tex_uv; + // Texture config 2 + float opacity; + float saturation; + float2 reserved_1; + // Layout config + float2 offset; + float2 anchor; + // Current state + float loop_stage; + float is_hovered_over; + float2 reserved_2; + // Absolute coords of current position + float4 abs_pos; + // Relative coords of current position + float4 rel_pos; +}; + RWStructuredBuffer TilesRW : register(u1); //RWBuffer DebugRW : register(u7); diff --git a/TileGUI/Shaders/tile_group_writer.hlsl b/TileGUI/Shaders/tile_group_writer.hlsl index 318f2c8..5cfea39 100644 --- a/TileGUI/Shaders/tile_group_writer.hlsl +++ b/TileGUI/Shaders/tile_group_writer.hlsl @@ -1,7 +1,5 @@ // Streamlines multiple tiles declaration and property updates both for initialization and runtime -#include "tile_model.hlsl" - Texture1D IniParams : register(t120); #define RequestType (IniParams[0].x != 100000 ? IniParams[0].x : -1) @@ -22,10 +20,185 @@ Texture1D IniParams : register(t120); #define AnchorX (IniParams[4].x != 100000 ? IniParams[4].x : 0) #define AnchorY (IniParams[4].y != 100000 ? IniParams[4].y : 0) +struct Tile { + // Base config + float sys_state_id; + float layer_id; + float parent_tile_id; + float template_id; + // Features config + float show; + float select; + float clamp; + float track_mouse; + // Advanced features config + float loop_start; + float loop_method; + float hover_overlay_tile_id; + float select_overlay_tile_id; + // Display config + float2 size; + float texture_id; + float tex_arr_id; + // Texture config + float4 tex_uv; + // Texture config 2 + float opacity; + float saturation; + float2 reserved_1; + // Layout config + float2 offset; + float2 anchor; + // Current state + float loop_stage; + float is_hovered_over; + float2 reserved_2; + // Absolute coords of current position + float4 abs_pos; + // Relative coords of current position + float4 rel_pos; +}; + RWStructuredBuffer TileTemplateDataRW : register(u0); RWStructuredBuffer TilesRW : register(u1); //RWBuffer DebugRW : register(u7); +void InitializeTile(inout Tile tile) +{ + // Base config + tile.sys_state_id = 1; + tile.layer_id = 0; + tile.parent_tile_id = -1; + tile.template_id = -1; + // Features config + tile.show = 1; + tile.select = 0; + tile.clamp = 1; + tile.track_mouse = 1; + // Advanced features config + tile.loop_start = -1; + tile.loop_method = -1; + tile.hover_overlay_tile_id = -1; + tile.select_overlay_tile_id = -1; + // Display config + tile.size = 0; + tile.texture_id = -1; + tile.tex_arr_id = 0; + // Texture config + tile.tex_uv = float4(0, 0, 1, 1); + // Texture config 2 + tile.opacity = 1; + tile.saturation = 1; + tile.reserved_1 = 0; + // Layout config + tile.offset = 0; + tile.anchor = 0; + // Current state + tile.loop_stage = 0; + tile.is_hovered_over = 0; + tile.reserved_2 = 0; + // Absolute coords of current position + tile.abs_pos = 0; + // Relative coords of current position + tile.rel_pos = 0; +} + +void LoadDataUpdate(Tile tile_data, inout Tile tile) +{ + // Base config + if (tile_data.sys_state_id != 100000) { + tile.sys_state_id = tile_data.sys_state_id; + } + if (tile_data.layer_id != 100000) { + tile.layer_id = tile_data.layer_id; + } + if (tile_data.parent_tile_id != 100000) { + tile.parent_tile_id = tile_data.parent_tile_id; + } + if (tile_data.template_id != 100000) { + tile.template_id = tile_data.template_id; + } + // Features config + if (tile_data.show != 100000) { + tile.show = tile_data.show; + } + if (tile_data.select != 100000) { + tile.select = tile_data.select; + } + if (tile_data.clamp != 100000) { + tile.clamp = tile_data.clamp; + } + if (tile_data.track_mouse != 100000) { + tile.track_mouse = tile_data.track_mouse; + } + // Advanced features config + if (tile_data.loop_start != 100000) { + tile.loop_start = tile_data.loop_start; + } + if (tile_data.loop_method != 100000) { + tile.loop_method = tile_data.loop_method; + } + if (tile_data.hover_overlay_tile_id != 100000) { + tile.hover_overlay_tile_id = tile_data.hover_overlay_tile_id; + } + if (tile_data.select_overlay_tile_id != 100000) { + tile.select_overlay_tile_id = tile_data.select_overlay_tile_id; + } + // Display config + if (tile_data.size.x != 100000) { + tile.size.x = tile_data.size.x; + } + if (tile_data.size.y != 100000) { + tile.size.y = tile_data.size.y; + } + if (tile_data.texture_id != 100000) { + tile.texture_id = tile_data.texture_id; + } + if (tile_data.tex_arr_id != 100000) { + tile.tex_arr_id = tile_data.tex_arr_id; + } + // Texture config + if (tile_data.tex_uv.x != 100000) { + tile.tex_uv.x = tile_data.tex_uv.x; + } + if (tile_data.tex_uv.y != 100000) { + tile.tex_uv.y = tile_data.tex_uv.y; + } + if (tile_data.tex_uv.z != 100000) { + tile.tex_uv.z = tile_data.tex_uv.z; + } + if (tile_data.tex_uv.w != 100000) { + tile.tex_uv.w = tile_data.tex_uv.w; + } + // Texture config 2 + if (tile_data.opacity != 100000) { + tile.opacity = tile_data.opacity; + } + if (tile_data.saturation != 100000) { + tile.saturation = tile_data.saturation; + } + // Layout config + if (tile_data.offset.x != 100000) { + tile.offset.x = tile_data.offset.x; + } + if (tile_data.offset.y != 100000) { + tile.offset.y = tile_data.offset.y; + } + if (tile_data.anchor.x != 100000) { + tile.anchor.x = tile_data.anchor.x; + } + if (tile_data.anchor.y != 100000) { + tile.anchor.y = tile_data.anchor.y; + } + // Current state + if (tile_data.loop_stage != 100000) { + tile.loop_stage = tile_data.loop_stage; + } + // if (tile_data.is_hovered_over != 100000) { + // tile.is_hovered_over = tile_data.is_hovered_over; + // } + // tile_data.not_used_2 = 0; +} void ApplyTemplate(int tile_id) { diff --git a/TileGUI/Shaders/tile_model.hlsl b/TileGUI/Shaders/tile_model.hlsl deleted file mode 100644 index 61ee64d..0000000 --- a/TileGUI/Shaders/tile_model.hlsl +++ /dev/null @@ -1,214 +0,0 @@ - -struct Tile { - // Base config - float sys_state_id; - float layer_id; - float parent_tile_id; - float template_id; - // Features config - float show; - float select; - float clamp; - float track_mouse; - // Advanced features config - float loop_start; - float loop_method; - float hover_overlay_tile_id; - float select_overlay_tile_id; - // Display config - float2 size; - float texture_id; - float tex_arr_id; - // Texture config - float4 tex_uv; - // Texture config 2 - float opacity; - float saturation; - float2 reserved_1; - // Layout config - float2 offset; - float2 anchor; - // Current state - float loop_stage; - float is_hovered_over; - float2 reserved_2; - // Absolute coords of current position - float4 abs_pos; - // Relative coords of current position - float4 rel_pos; -}; - -void InitializeTile(inout Tile tile) -{ - // Base config - tile.sys_state_id = 1; - tile.layer_id = 0; - tile.parent_tile_id = -1; - tile.template_id = -1; - // Features config - tile.show = 1; - tile.select = 0; - tile.clamp = 1; - tile.track_mouse = 1; - // Advanced features config - tile.loop_start = -1; - tile.loop_method = -1; - tile.hover_overlay_tile_id = -1; - tile.select_overlay_tile_id = -1; - // Display config - tile.size = 0; - tile.texture_id = -1; - tile.tex_arr_id = 0; - // Texture config - tile.tex_uv = float4(0, 0, 1, 1); - // Texture config 2 - tile.opacity = 1; - tile.saturation = 1; - tile.reserved_1 = 0; - // Layout config - tile.offset = 0; - tile.anchor = 0; - // Current state - tile.loop_stage = 0; - tile.is_hovered_over = 0; - tile.reserved_2 = 0; - // Absolute coords of current position - tile.abs_pos = 0; - // Relative coords of current position - tile.rel_pos = 0; -} - -void InitializeTemplate(inout Tile tile) -{ - // Base config - tile.sys_state_id = 100000; - tile.layer_id = 100000; - tile.parent_tile_id = 100000; - tile.template_id = 100000; - // Features config - tile.show = 100000; - tile.select = 100000; - tile.clamp = 100000; - tile.track_mouse = 100000; - // Advanced features config - tile.loop_start = 100000; - tile.loop_method = 100000; - tile.hover_overlay_tile_id = 100000; - tile.select_overlay_tile_id = 100000; - // Display config - tile.size = 100000; - tile.texture_id = 100000; - tile.tex_arr_id = 100000; - // Texture config - tile.tex_uv = 100000; - // Texture config 2 - tile.opacity = 100000; - tile.saturation = 100000; - tile.reserved_1 = 100000; - // Layout config - tile.offset = 100000; - tile.anchor = 100000; - // Current state - tile.loop_stage = 100000; - tile.is_hovered_over = 100000; - tile.reserved_2 = 100000; -} - -void LoadDataUpdate(Tile tile_data, inout Tile tile) -{ - // Base config - if (tile_data.sys_state_id != 100000) { - tile.sys_state_id = tile_data.sys_state_id; - } - if (tile_data.layer_id != 100000) { - tile.layer_id = tile_data.layer_id; - } - if (tile_data.parent_tile_id != 100000) { - tile.parent_tile_id = tile_data.parent_tile_id; - } - if (tile_data.template_id != 100000) { - tile.template_id = tile_data.template_id; - } - // Features config - if (tile_data.show != 100000) { - tile.show = tile_data.show; - } - if (tile_data.select != 100000) { - tile.select = tile_data.select; - } - if (tile_data.clamp != 100000) { - tile.clamp = tile_data.clamp; - } - if (tile_data.track_mouse != 100000) { - tile.track_mouse = tile_data.track_mouse; - } - // Advanced features config - if (tile_data.loop_start != 100000) { - tile.loop_start = tile_data.loop_start; - } - if (tile_data.loop_method != 100000) { - tile.loop_method = tile_data.loop_method; - } - if (tile_data.hover_overlay_tile_id != 100000) { - tile.hover_overlay_tile_id = tile_data.hover_overlay_tile_id; - } - if (tile_data.select_overlay_tile_id != 100000) { - tile.select_overlay_tile_id = tile_data.select_overlay_tile_id; - } - // Display config - if (tile_data.size.x != 100000) { - tile.size.x = tile_data.size.x; - } - if (tile_data.size.y != 100000) { - tile.size.y = tile_data.size.y; - } - if (tile_data.texture_id != 100000) { - tile.texture_id = tile_data.texture_id; - } - if (tile_data.tex_arr_id != 100000) { - tile.tex_arr_id = tile_data.tex_arr_id; - } - // Texture config - if (tile_data.tex_uv.x != 100000) { - tile.tex_uv.x = tile_data.tex_uv.x; - } - if (tile_data.tex_uv.y != 100000) { - tile.tex_uv.y = tile_data.tex_uv.y; - } - if (tile_data.tex_uv.z != 100000) { - tile.tex_uv.z = tile_data.tex_uv.z; - } - if (tile_data.tex_uv.w != 100000) { - tile.tex_uv.w = tile_data.tex_uv.w; - } - // Texture config 2 - if (tile_data.opacity != 100000) { - tile.opacity = tile_data.opacity; - } - if (tile_data.saturation != 100000) { - tile.saturation = tile_data.saturation; - } - // Layout config - if (tile_data.offset.x != 100000) { - tile.offset.x = tile_data.offset.x; - } - if (tile_data.offset.y != 100000) { - tile.offset.y = tile_data.offset.y; - } - if (tile_data.anchor.x != 100000) { - tile.anchor.x = tile_data.anchor.x; - } - if (tile_data.anchor.y != 100000) { - tile.anchor.y = tile_data.anchor.y; - } - // Current state - if (tile_data.loop_stage != 100000) { - tile.loop_stage = tile_data.loop_stage; - } - // if (tile_data.is_hovered_over != 100000) { - // tile.is_hovered_over = tile_data.is_hovered_over; - // } - // tile_data.not_used_2 = 0; -} - - diff --git a/TileGUI/Shaders/tile_position_service.hlsl b/TileGUI/Shaders/tile_position_service.hlsl index 829c595..f84cd52 100644 --- a/TileGUI/Shaders/tile_position_service.hlsl +++ b/TileGUI/Shaders/tile_position_service.hlsl @@ -1,7 +1,5 @@ // Updates positions of all tiles based on sizes, offsets, anchors and parents -#include "tile_model.hlsl" - Texture1D IniParams : register(t120); #define WindowWidth IniParams[0].x @@ -11,6 +9,45 @@ Texture1D IniParams : register(t120); #define RootParentCoords float4(0, 0, IniParams[0].x, IniParams[0].y) +struct Tile { + // Base config + float sys_state_id; + float layer_id; + float parent_tile_id; + float template_id; + // Features config + float show; + float select; + float clamp; + float track_mouse; + // Advanced features config + float loop_start; + float loop_method; + float hover_overlay_tile_id; + float select_overlay_tile_id; + // Display config + float2 size; + float texture_id; + float tex_arr_id; + // Texture config + float4 tex_uv; + // Texture config 2 + float opacity; + float saturation; + float2 reserved_1; + // Layout config + float2 offset; + float2 anchor; + // Current state + float loop_stage; + float is_hovered_over; + float2 reserved_2; + // Absolute coords of current position + float4 abs_pos; + // Relative coords of current position + float4 rel_pos; +}; + RWStructuredBuffer TilesRW : register(u1); //RWBuffer DebugRW : register(u7); diff --git a/TileGUI/Shaders/tile_reader.hlsl b/TileGUI/Shaders/tile_reader.hlsl index e44a7a6..adaa874 100644 --- a/TileGUI/Shaders/tile_reader.hlsl +++ b/TileGUI/Shaders/tile_reader.hlsl @@ -1,16 +1,64 @@ -#include "instance_model.hlsl" -#include "tile_model.hlsl" - Texture1D IniParams : register(t120); #define RequestType IniParams[1].x #define TileId IniParams[1].y #define VarId IniParams[1].z +struct Instance { + float max_tiles_count; + float max_layers_count; + float2 unused1; + + float drag_tile_id; + float2 drag_pos; + float1 unused2; + + float4 unused3; +}; + StructuredBuffer InstanceContainer : register(t121); #define Instance InstanceContainer[0] +struct Tile { + // Base config + float sys_state_id; + float layer_id; + float parent_tile_id; + float template_id; + // Features config + float show; + float select; + float clamp; + float track_mouse; + // Advanced features config + float loop_start; + float loop_method; + float hover_overlay_tile_id; + float select_overlay_tile_id; + // Display config + float2 size; + float texture_id; + float tex_arr_id; + // Texture config + float4 tex_uv; + // Texture config 2 + float opacity; + float saturation; + float2 reserved_1; + // Layout config + float2 offset; + float2 anchor; + // Current state + float loop_stage; + float is_hovered_over; + float2 reserved_2; + // Absolute coords of current position + float4 abs_pos; + // Relative coords of current position + float4 rel_pos; +}; + StructuredBuffer Tiles : register(t122); RWBuffer OutputRW : register(u0); //RWBuffer DebugRW : register(u7); diff --git a/TileGUI/Shaders/tile_writer.hlsl b/TileGUI/Shaders/tile_writer.hlsl index dfcf725..69ce622 100644 --- a/TileGUI/Shaders/tile_writer.hlsl +++ b/TileGUI/Shaders/tile_writer.hlsl @@ -1,7 +1,5 @@ // Updates client's tile storage with given ini variables -#include "tile_model.hlsl" - Texture1D IniParams : register(t120); #define TileType IniParams[1].x @@ -39,10 +37,222 @@ Texture1D IniParams : register(t120); // Current state #define LoopStage IniParams[9].x +struct Tile { + // Base config + float sys_state_id; + float layer_id; + float parent_tile_id; + float template_id; + // Features config + float show; + float select; + float clamp; + float track_mouse; + // Advanced features config + float loop_start; + float loop_method; + float hover_overlay_tile_id; + float select_overlay_tile_id; + // Display config + float2 size; + float texture_id; + float tex_arr_id; + // Texture config + float4 tex_uv; + // Texture config 2 + float opacity; + float saturation; + float2 reserved_1; + // Layout config + float2 offset; + float2 anchor; + // Current state + float loop_stage; + float is_hovered_over; + float2 reserved_2; + // Absolute coords of current position + float4 abs_pos; + // Relative coords of current position + float4 rel_pos; +}; + RWStructuredBuffer TileTemplateDataRW : register(u0); RWStructuredBuffer TilesRW : register(u1); // RWBuffer DebugRW : register(u7); +void InitializeTile(inout Tile tile) +{ + // Base config + tile.sys_state_id = 1; + tile.layer_id = 0; + tile.parent_tile_id = -1; + tile.template_id = -1; + // Features config + tile.show = 1; + tile.select = 0; + tile.clamp = 1; + tile.track_mouse = 1; + // Advanced features config + tile.loop_start = -1; + tile.loop_method = -1; + tile.hover_overlay_tile_id = -1; + tile.select_overlay_tile_id = -1; + // Display config + tile.size = 0; + tile.texture_id = -1; + tile.tex_arr_id = 0; + // Texture config + tile.tex_uv = float4(0, 0, 1, 1); + // Texture config 2 + tile.opacity = 1; + tile.saturation = 1; + tile.reserved_1 = 0; + // Layout config + tile.offset = 0; + tile.anchor = 0; + // Current state + tile.loop_stage = 0; + tile.is_hovered_over = 0; + tile.reserved_2 = 0; + // Absolute coords of current position + tile.abs_pos = 0; + // Relative coords of current position + tile.rel_pos = 0; +} + +void InitializeTemplate(inout Tile tile) +{ + // Base config + tile.sys_state_id = 100000; + tile.layer_id = 100000; + tile.parent_tile_id = 100000; + tile.template_id = 100000; + // Features config + tile.show = 100000; + tile.select = 100000; + tile.clamp = 100000; + tile.track_mouse = 100000; + // Advanced features config + tile.loop_start = 100000; + tile.loop_method = 100000; + tile.hover_overlay_tile_id = 100000; + tile.select_overlay_tile_id = 100000; + // Display config + tile.size = 100000; + tile.texture_id = 100000; + tile.tex_arr_id = 100000; + // Texture config + tile.tex_uv = 100000; + // Texture config 2 + tile.opacity = 100000; + tile.saturation = 100000; + tile.reserved_1 = 100000; + // Layout config + tile.offset = 100000; + tile.anchor = 100000; + // Current state + tile.loop_stage = 100000; + tile.is_hovered_over = 100000; + tile.reserved_2 = 100000; +} + +void LoadDataUpdate(Tile tile_data, inout Tile tile) +{ + // Base config + if (tile_data.sys_state_id != 100000) { + tile.sys_state_id = tile_data.sys_state_id; + } + if (tile_data.layer_id != 100000) { + tile.layer_id = tile_data.layer_id; + } + if (tile_data.parent_tile_id != 100000) { + tile.parent_tile_id = tile_data.parent_tile_id; + } + if (tile_data.template_id != 100000) { + tile.template_id = tile_data.template_id; + } + // Features config + if (tile_data.show != 100000) { + tile.show = tile_data.show; + } + if (tile_data.select != 100000) { + tile.select = tile_data.select; + } + if (tile_data.clamp != 100000) { + tile.clamp = tile_data.clamp; + } + if (tile_data.track_mouse != 100000) { + tile.track_mouse = tile_data.track_mouse; + } + // Advanced features config + if (tile_data.loop_start != 100000) { + tile.loop_start = tile_data.loop_start; + } + if (tile_data.loop_method != 100000) { + tile.loop_method = tile_data.loop_method; + } + if (tile_data.hover_overlay_tile_id != 100000) { + tile.hover_overlay_tile_id = tile_data.hover_overlay_tile_id; + } + if (tile_data.select_overlay_tile_id != 100000) { + tile.select_overlay_tile_id = tile_data.select_overlay_tile_id; + } + // Display config + if (tile_data.size.x != 100000) { + tile.size.x = tile_data.size.x; + } + if (tile_data.size.y != 100000) { + tile.size.y = tile_data.size.y; + } + if (tile_data.texture_id != 100000) { + tile.texture_id = tile_data.texture_id; + } + if (tile_data.tex_arr_id != 100000) { + tile.tex_arr_id = tile_data.tex_arr_id; + } + // Texture config + if (tile_data.tex_uv.x != 100000) { + tile.tex_uv.x = tile_data.tex_uv.x; + } + if (tile_data.tex_uv.y != 100000) { + tile.tex_uv.y = tile_data.tex_uv.y; + } + if (tile_data.tex_uv.z != 100000) { + tile.tex_uv.z = tile_data.tex_uv.z; + } + if (tile_data.tex_uv.w != 100000) { + tile.tex_uv.w = tile_data.tex_uv.w; + } + // Texture config 2 + if (tile_data.opacity != 100000) { + tile.opacity = tile_data.opacity; + } + if (tile_data.saturation != 100000) { + tile.saturation = tile_data.saturation; + } + // Layout config + if (tile_data.offset.x != 100000) { + tile.offset.x = tile_data.offset.x; + } + if (tile_data.offset.y != 100000) { + tile.offset.y = tile_data.offset.y; + } + if (tile_data.anchor.x != 100000) { + tile.anchor.x = tile_data.anchor.x; + } + if (tile_data.anchor.y != 100000) { + tile.anchor.y = tile_data.anchor.y; + } + // Current state + if (tile_data.loop_stage != 100000) { + tile.loop_stage = tile_data.loop_stage; + } + // if (tile_data.is_hovered_over != 100000) { + // tile.is_hovered_over = tile_data.is_hovered_over; + // } + // tile_data.not_used_2 = 0; +} + Tile GetDataFromIni() { Tile tile_data;