#version 300 es // frost patch — a flat quad the fragment stage carves into a mottled disc. it needs two things the // builtin varyings do not carry: the instance CENTER (to measure a radial falloff in world space) // and the instance RADIUS. both ride along as extra varyings layout(location = 0) in vec3 aPos; layout(location = 1) in vec3 aNormal; layout(location = 2) in vec4 aInstRot; layout(location = 3) in vec3 aInstPos; layout(location = 4) in vec3 aInstScale; layout(location = 5) in vec4 aInstColor; layout(location = 6) in vec4 aInstParams; #include "_graphics_uniforms.glsl" out highp vec3 vWorldPos; out highp vec3 vCenter; out vec4 vColor; out float vEmissive; out float vRadius; vec3 quatRotate(vec4 q, vec3 v) { return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); } void main() { vec3 world = quatRotate(aInstRot, aPos * aInstScale) + aInstPos; gl_Position = u_viewProjection * vec4(world, 1.0); vWorldPos = world; vCenter = aInstPos; vColor = aInstColor; vEmissive = aInstParams.x; vRadius = aInstScale.x; }