summaryrefslogtreecommitdiff
path: root/themes/src/shaders/snowflake_vert.cpp
blob: 199009d667b53241cd8a42cc001dfc539824e30e (plain)
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
#include "snowflake_vert.h"

const char* shader_snowflake_vert = "// Instanced snowflake vertex shader \n"
"attribute vec2 position;        // Base quad vertex position \n"
"attribute vec2 instancePos;     // Per-instance: snowflake center position \n"
"attribute float instanceRot;    // Per-instance: rotation angle \n"
"attribute float instanceScale;  // Per-instance: size scale \n"
"attribute float instanceSeed;   // Per-instance: random seed for variation \n"
" \n"
"uniform mat4 projection; \n"
"uniform mat4 model; \n"
" \n"
"varying lowp vec2 vUV;           // UV coordinates for fragment shader \n"
"varying lowp float vSeed;        // Pass seed to fragment shader \n"
"varying lowp float vScale;       // Pass scale to fragment shader \n"
" \n"
"void main() { \n"
"    // Rotate and scale the base quad \n"
"    float c = cos(instanceRot); \n"
"    float s = sin(instanceRot); \n"
"    mat2 rotation = mat2(c, s, -s, c); \n"
" \n"
"    vec2 rotatedPos = rotation * (position * instanceScale); \n"
"    vec2 worldPos = instancePos + rotatedPos; \n"
" \n"
"    gl_Position = projection * model * vec4(worldPos, 0.0, 1.0); \n"
" \n"
"    // Pass UV in range [-1, 1] for procedural generation \n"
"    vUV = position; \n"
"    vSeed = instanceSeed; \n"
"    vScale = instanceScale; \n"
"} \n"
" \n";