Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if COMPILING_VS
- uniform TransformBlock {
- mat4 Projection;
- mat4 View;
- } Transform;
- uniform MaterialBlock {
- vec4 Color;
- } Material;
- out Vertex {
- vec2 Position;
- vec2 TexCoord;
- vec4 Color;
- } Out;
- void main()
- {
- Out.Position = gl_Vertex.xy;
- Out.TexCoord = gl_MultiTexCoord0.st;
- Out.Color = Material.Color;
- gl_Position = Transform.Projection * Transform.View * gl_Vertex;
- }
- #elif COMPILING_FS
- in Vertex {
- vec2 Position;
- vec2 TexCoord;
- vec4 Color;
- } In;
- /*
- uniform unsigned int LightCount;
- uniform Lights {
- vec2 Pos;
- vec2 Dir;
- vec2 Threshold;
- vec3 Color;
- } Light[];
- */
- void main()
- {
- vec2 LightPos = vec2(0, 350);
- vec2 LightDir = vec2(0, -1);
- float Threshold1 = cos(3.1415 * 0.20);
- float Threshold2 = cos(3.1415 * 0.21);
- vec3 LightColor = vec3(1.0, 0.2, 0.8);
- float Attenuation = 0.2;
- vec2 L = In.Position - LightPos;
- float SqrDistance = dot(L, L);
- vec2 LightVec = normalize(L);
- float CosPhi = dot(LightDir, LightVec);
- float Brightness = smoothstep(Threshold2, Threshold1, CosPhi) / (1 + SqrDistance/75000);
- vec3 Color = (Attenuation + (1 - Attenuation) * Brightness * LightColor) * In.Color.rgb;
- gl_FragColor = vec4(Color, In.Color.a);
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement