diff --git a/Assets/Materials/UIMat_Slider_Textured.shmat b/Assets/Materials/UIMat_Slider_Textured.shmat new file mode 100644 index 00000000..cb09a99e --- /dev/null +++ b/Assets/Materials/UIMat_Slider_Textured.shmat @@ -0,0 +1,9 @@ +- VertexShader: 46580970 + FragmentShader: 43211183 + SubPass: UI + Properties: + data.color: {x: 1, y: 1, z: 1, w: 1} + data.textureIndex: 51995224 + data.alpha: 1 + data.beta: {x: 1, y: 1, z: 1} + data.sliderThreshold: 1 \ No newline at end of file diff --git a/Assets/Materials/UIMat_Slider_Textured.shmat.shmeta b/Assets/Materials/UIMat_Slider_Textured.shmat.shmeta new file mode 100644 index 00000000..99aec372 --- /dev/null +++ b/Assets/Materials/UIMat_Slider_Textured.shmat.shmeta @@ -0,0 +1,3 @@ +Name: UIMat_Slider_Textured +ID: 127128823 +Type: 7 diff --git a/Assets/Shaders/UI_Slider_FS.glsl b/Assets/Shaders/UI_Slider_FS.glsl index 48e301cc..b39f18dd 100644 --- a/Assets/Shaders/UI_Slider_FS.glsl +++ b/Assets/Shaders/UI_Slider_FS.glsl @@ -42,16 +42,16 @@ layout(location = 1) out uint outEntityID; void main() { //fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv); - if (fragColor.a < 0.01f) - { - discard; - } + if (In.uv.x > MatProp.data[In2.materialIndex].sliderThreshold) fragColor = MatProp.data[In2.materialIndex].sliderBarColor; else fragColor = (1.0f - In.uv.x) * MatProp.data[In2.materialIndex].sliderStartColor + In.uv.x * MatProp.data[In2.materialIndex].sliderEndColor; //fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv); - + if (fragColor.a < 0.01f) + { + discard; + } fragColor.a = MatProp.data[In2.materialIndex].alpha; diff --git a/Assets/Shaders/UI_Slider_FS.shshaderb b/Assets/Shaders/UI_Slider_FS.shshaderb index 3d340d37..0dcfb62d 100644 Binary files a/Assets/Shaders/UI_Slider_FS.shshaderb and b/Assets/Shaders/UI_Slider_FS.shshaderb differ diff --git a/Assets/Shaders/UI_Slider_Textured_FS.glsl b/Assets/Shaders/UI_Slider_Textured_FS.glsl new file mode 100644 index 00000000..9f7945ce --- /dev/null +++ b/Assets/Shaders/UI_Slider_Textured_FS.glsl @@ -0,0 +1,62 @@ +#version 450 +#extension GL_ARB_separate_shader_objects : enable +#extension GL_ARB_shading_language_420pack : enable +#extension GL_EXT_nonuniform_qualifier : require + +struct MatPropData +{ + int textureIndex; + float alpha; + float sliderThreshold; + vec4 sliderStartColor; + vec4 sliderEndColor; + vec4 sliderBarColor; +}; + +layout(location = 0) in struct +{ + vec4 vertPos; // location 0 + vec2 uv; // location = 1 + vec4 normal; // location = 2 + +} In; + +// material stuff +layout(location = 3) flat in struct +{ + int materialIndex; + uint eid; + uint lightLayerIndex; + +} In2; + +layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global) +layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials +{ + MatPropData data[]; +} MatProp; + +layout(location = 0) out vec4 fragColor; +layout(location = 1) out uint outEntityID; + +void main() +{ + //fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv); + + if (In.uv.x > MatProp.data[In2.materialIndex].sliderThreshold) + fragColor = MatProp.data[In2.materialIndex].sliderBarColor; + else + //fragColor = (1.0f - In.uv.x) * MatProp.data[In2.materialIndex].sliderStartColor + In.uv.x * MatProp.data[In2.materialIndex].sliderEndColor; + fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv); + + + if (fragColor.a < 0.01f) + { + discard; + } + + fragColor.a = MatProp.data[In2.materialIndex].alpha; + + // fragColor.a = 1.0f; + outEntityID = In2.eid; +} \ No newline at end of file diff --git a/Assets/Shaders/UI_Slider_Textured_FS.shshaderb b/Assets/Shaders/UI_Slider_Textured_FS.shshaderb new file mode 100644 index 00000000..db7f7c70 Binary files /dev/null and b/Assets/Shaders/UI_Slider_Textured_FS.shshaderb differ diff --git a/Assets/Shaders/UI_Slider_Textured_FS.shshaderb.shmeta b/Assets/Shaders/UI_Slider_Textured_FS.shshaderb.shmeta new file mode 100644 index 00000000..57e0093e --- /dev/null +++ b/Assets/Shaders/UI_Slider_Textured_FS.shshaderb.shmeta @@ -0,0 +1,3 @@ +Name: UI_Slider_Textured_FS +ID: 43211183 +Type: 2