2 #define SRC(...) #__VA_ARGS__ 6 float4x4 modelViewProj;
14 float4 position : SV_POSITION;
15 float2 texcoord : TEXCOORD0;
18 PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0)
22 result.texcoord = texcoord;
26 static const float baseScale = 1.25;
27 static const float density = 0.5;
28 static const float speed = 0.15;
32 return frac(
sin(
dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
35 float dist_func(float2 distv)
37 float dist =
sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
38 dist =
clamp(dist, 0.0, 1.0);
39 return cos(dist * (3.14159265358 * 0.5)) * 0.5;
42 float random_dots(float2 co)
44 float part = 1.0 / 20.0;
48 if (
p > 0.005 * (density * 40.0))
51 float2 dpos = (float2(frac(
p * 2.0) ,
p) + float2(2.0, 2.0)) * 0.25;
53 float2 cellpos = frac(co / part);
54 float2 distv = (cellpos - dpos);
56 return dist_func(distv);
59 float snow(float2 pos,
float time,
float scale)
62 pos.x +=
cos(pos.y * 1.2 +
time * 3.14159 * 2.0 + 1.0 /
scale) / (8.0 /
scale) * 4.0;
64 pos +=
time *
scale * float2(-0.5, 1.0) * 4.0;
65 return random_dots(pos /
scale) * (
scale * 0.5 + 0.5);
69 float4 PSMain(PSInput
input) : SV_TARGET
71 float tim =
global.time * 0.4 * speed;
72 float2 pos =
input.position.xy /
global.OutputSize.xx;
78 a += snow(pos, tim, 1.0);
79 a += snow(pos, tim, 0.7);
80 a += snow(pos, tim, 0.6);
81 a += snow(pos, tim, 0.5);
82 a += snow(pos, tim, 0.4);
83 a += snow(pos, tim, 0.3);
84 a += snow(pos, tim, 0.25);
85 a += snow(pos, tim, 0.125);
86 a =
a * min(pos.y * 4.0, 1.0);
87 return float4(1.0, 1.0, 1.0,
a);
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9939
#define floor(x)
Definition: math.h:25
GLenum GLenum GLenum input
Definition: glext.h:9938
#define sqrt(x)
Definition: math.h:26
#define SRC(...)
Definition: simple_snow_sm4.hlsl.h:2
std::shared_ptr< Ope > dot()
Definition: peglib.h:1603
time_t time(time_t *timer)
GLuint64EXT * result
Definition: glext.h:12211
GLenum clamp
Definition: glext.h:6856
GLfloat GLfloat p
Definition: glext.h:9809
#define sin(x)
Definition: math.h:23
#define cos(x)
Definition: math.h:21
def cd(new_dir)
Definition: build.py:40
Definition: retroarch.h:240
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844