clement 5ca3d16a29 Squashed commit of the following:
commit 807aa8c3c6e62c5d033064e3190ae432fb66db03
Merge: 34f74aa 3777d06
Author: Clement <clement@jo85.com>
Date:   Thu Jan 18 12:02:57 2024 +0100

    Merge pull request 'add Atomes Factory' (#10) from feature/AtomesFactory into develop

    Reviewed-on: #10
    Reviewed-by: Clement <clement@jo85.com>

commit 3777d06a0ee942994fdfe90d71fc5056c37346d9
Author: Mathis <mathis.ragot@epitech.eu>
Date:   Thu Jan 18 12:00:00 2024 +0100

    Rename Classname

commit 16bd5bfb6cd51e253e22417ab8196a58e1726849
Merge: da9d57b 34f74aa
Author: Mathis <mathis.ragot@epitech.eu>
Date:   Thu Jan 18 11:46:03 2024 +0100

    Merge remote-tracking branch 'origin/develop' into feature/AtomesFactory

commit da9d57b0bba34dbe24f5e7f744ce60f430832ff4
Author: Mathis <mathis.ragot@epitech.eu>
Date:   Thu Jan 18 11:44:22 2024 +0100

    vue foria config

commit 5346e596c8a0db7684b64920c328abee459926d9
Author: Mathis <mathis.ragot@epitech.eu>
Date:   Thu Jan 18 11:28:02 2024 +0100

    [feature/AtomesFactory] - remove testing file

commit f613217658cf2f1f48ceeeaa3183e515de857213
Author: Mathis <mathis.ragot@epitech.eu>
Date:   Thu Jan 18 10:38:59 2024 +0100

    [feature/AtomesFactory] - Add json for atomes

commit bc2b9e02fdb692d56937bd37cc3d821ffb717424
Author: Mathis <mathis.ragot@epitech.eu>
Date:   Fri Jan 12 15:37:09 2024 +0100

    add Atomes Factory

commit 34f74aa44366c6d5f9e0d647a7837704edbd5fad
Merge: 8b6d07f f181fd9
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 11:50:43 2024 +0100

    Merge pull request 'feature/multi_targets' (#7) from feature/multi_targets into develop

    Reviewed-on: #7
    Reviewed-by: Clement <clement@jo85.com>

commit f181fd993504c811a4546e56f83eb05ed62a625d
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 11:50:10 2024 +0100

    fix du mauvais nom de scene dans le script ChangeScene.cs

commit 1c76868eee12406d6c39fa64da8462e35019a39e
Merge: f1ec062 8b6d07f
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 11:39:02 2024 +0100

    Merge remote-tracking branch 'origin/develop' into feature/multi_targets

commit f1ec062047ba68d48493b25273ba5893f42a890f
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 11:37:29 2024 +0100

    ajout du font fallback

commit 9c23975b204ceb09bd3ccc57b847cf0a8158fb95
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 11:36:49 2024 +0100

    rajouts des fonts text mesh pro

commit aff9df22cfbed9e8b317cafe4269fce891a5bbe5
Merge: a791273 73394e5
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 11:03:32 2024 +0100

    Merge remote-tracking branch 'origin/develop' into feature/multi_targets

commit a7912733e5fed60b9514c778fd9f40661dc66b64
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 10:54:51 2024 +0100

    Ajout dans le canvas d'éléments UI (nom, description....)

commit 0313fe28a1b718152015a401fda32069e94303c0
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Jan 12 09:57:07 2024 +0100

    Suppression du build de la CI

commit 5237a32bb4759c43104e9397cb43b328a99b7c62
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Thu Jan 11 16:18:35 2024 +0100

    ajout de la keystore de debug (user) + changement de la target version d'android

commit afa265dd3141ef3fd96bff685ca655594453a876
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Thu Jan 11 11:26:53 2024 +0100

    Affichage des molécules unitairement et en mode fusion

commit 84136dcc5c3b00603ba8531901418125a832a255
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Dec 22 15:05:47 2023 +0100

    MAJ du fichier d'action build.yaml

commit ce3c95654431f25e22810481f3b10b24f158decd
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Dec 22 15:02:10 2023 +0100

    MAJ du fichier d'action build.yaml

commit 8f105732f7aaa41689894ab388675ae0b79f66f6
Author: Nicolas <nicolas.sansd@gmail.com>
Date:   Fri Dec 22 14:36:52 2023 +0100

    Ajout de la multitarget pour générer un préfab
2024-01-18 14:00:09 +01:00

158 lines
5.2 KiB
HLSL

struct vertex_t {
UNITY_VERTEX_INPUT_INSTANCE_ID
float4 position : POSITION;
float3 normal : NORMAL;
float4 color : COLOR;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
struct pixel_t {
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
float4 position : SV_POSITION;
float4 faceColor : COLOR;
float4 outlineColor : COLOR1;
float4 texcoord0 : TEXCOORD0;
float4 param : TEXCOORD1; // weight, scaleRatio
float2 mask : TEXCOORD2;
#if (UNDERLAY_ON || UNDERLAY_INNER)
float4 texcoord2 : TEXCOORD3;
float4 underlayColor : COLOR2;
#endif
};
float4 SRGBToLinear(float4 rgba) {
return float4(lerp(rgba.rgb / 12.92f, pow((rgba.rgb + 0.055f) / 1.055f, 2.4f), step(0.04045f, rgba.rgb)), rgba.a);
}
pixel_t VertShader(vertex_t input)
{
pixel_t output;
UNITY_INITIALIZE_OUTPUT(pixel_t, output);
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
float bold = step(input.texcoord1.y, 0);
float4 vert = input.position;
vert.x += _VertexOffsetX;
vert.y += _VertexOffsetY;
float4 vPosition = UnityObjectToClipPos(vert);
float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
// Generate UV for the Masking Texture
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
float4 color = input.color;
#if (FORCE_LINEAR && !UNITY_COLORSPACE_GAMMA)
color = SRGBToLinear(input.color);
#endif
float opacity = color.a;
#if (UNDERLAY_ON | UNDERLAY_INNER)
opacity = 1.0;
#endif
float4 faceColor = float4(color.rgb, opacity) * _FaceColor;
faceColor.rgb *= faceColor.a;
float4 outlineColor = _OutlineColor;
outlineColor.a *= opacity;
outlineColor.rgb *= outlineColor.a;
output.position = vPosition;
output.faceColor = faceColor;
output.outlineColor = outlineColor;
output.texcoord0 = float4(input.texcoord0.xy, maskUV.xy);
output.param = float4(0.5 - weight, 1.3333 * _GradientScale * (_Sharpness + 1) / _TextureWidth, _OutlineWidth * _ScaleRatioA * 0.5, 0);
float2 mask = float2(0, 0);
#if UNITY_UI_CLIP_RECT
mask = vert.xy * 2 - clampedRect.xy - clampedRect.zw;
#endif
output.mask = mask;
#if (UNDERLAY_ON || UNDERLAY_INNER)
float4 underlayColor = _UnderlayColor;
underlayColor.rgb *= underlayColor.a;
float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
output.texcoord2 = float4(input.texcoord0 + float2(x, y), input.color.a, 0);
output.underlayColor = underlayColor;
#endif
return output;
}
float4 PixShader(pixel_t input) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(input);
float d = tex2D(_MainTex, input.texcoord0.xy).a;
float2 UV = input.texcoord0.xy;
float scale = rsqrt(abs(ddx(UV.x) * ddy(UV.y) - ddy(UV.x) * ddx(UV.y))) * input.param.y;
#if (UNDERLAY_ON | UNDERLAY_INNER)
float layerScale = scale;
layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale);
float layerBias = input.param.x * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale);
#endif
scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale);
float4 faceColor = input.faceColor * saturate((d - input.param.x) * scale + 0.5);
#ifdef OUTLINE_ON
float4 outlineColor = lerp(input.faceColor, input.outlineColor, sqrt(min(1.0, input.param.z * scale * 2)));
faceColor = lerp(outlineColor, input.faceColor, saturate((d - input.param.x - input.param.z) * scale + 0.5));
faceColor *= saturate((d - input.param.x + input.param.z) * scale + 0.5);
#endif
#if UNDERLAY_ON
d = tex2D(_MainTex, input.texcoord2.xy).a * layerScale;
faceColor += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - layerBias) * (1 - faceColor.a);
#endif
#if UNDERLAY_INNER
float bias = input.param.x * scale - 0.5;
float sd = saturate(d * scale - bias - input.param.z);
d = tex2D(_MainTex, input.texcoord2.xy).a * layerScale;
faceColor += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - layerBias)) * sd * (1 - faceColor.a);
#endif
#ifdef MASKING
float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a);
float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl;
a = saturate(t / _MaskEdgeSoftness);
faceColor.rgb = lerp(_MaskEdgeColor.rgb * faceColor.a, faceColor.rgb, a);
faceColor *= a;
#endif
// Alternative implementation to UnityGet2DClipping with support for softness
#if UNITY_UI_CLIP_RECT
float2 maskZW = 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + (1 / scale));
float2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * maskZW);
faceColor *= m.x * m.y;
#endif
#if (UNDERLAY_ON | UNDERLAY_INNER)
faceColor *= input.texcoord2.z;
#endif
#if UNITY_UI_ALPHACLIP
clip(faceColor.a - 0.001);
#endif
return faceColor;
}