FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
tdesktop/Telegram/shaders/thanos_init.comp at dev · feiyunwill/tdesktop · GitHub
feiyunwill
/
tdesktop
Public
forked from
telegramdesktop/tdesktop
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
tdesktop
/
Telegram
/
shaders
/
thanos_init.comp
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (38 loc) · 1.08 KB
Breadcrumbs
tdesktop
/
Telegram
/
shaders
/
thanos_init.comp
Copy path
File metadata and controls
48 lines (38 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#version 450
layout(local_size_x = 64) in;
layout(rgba32f, binding = 0) uniform image2D particleStateImage;
layout(rgba32f, binding = 2) uniform image2D particleVelocityImage;
layout(std140, binding = 1) uniform Params {
uint particleCountX;
uint particleCountY;
uint seed;
uint _pad;
};
uint hash(uint x) {
x ^= x >> 16u;
x *= 0x45d9f3bu;
x ^= x >> 16u;
x *= 0x45d9f3bu;
x ^= x >> 16u;
return x;
}
float hashFloat(uint x) {
return float(hash(x)) / float(0xFFFFFFFFu);
}
void main() {
uint gid = gl_GlobalInvocationID.x;
uint count = particleCountX * particleCountY;
if (gid >= count) {
return;
}
uint s = gid * 3u + seed;
float direction = hashFloat(s) * (3.14159265 * 2.0);
float speed = (0.1 + hashFloat(s + 1u) * 0.1) * 320.0;
vec2 velocity = vec2(cos(direction) * speed, sin(direction) * speed);
float lifetime = 1.5 + hashFloat(s + 2u) * 1.5;
ivec2 coord = ivec2(
int(gid % particleCountX),
int(gid / particleCountX));
imageStore(particleStateImage, coord, vec4(0.0, 0.0, lifetime, 0.0));
imageStore(particleVelocityImage, coord, vec4(velocity, 0.0, 0.0));
}
Back
|
FazBrowse Home
|
New Git URL