pointSpritePS.h 951 B

123456789101112131415161718192021222324252627282930313233
  1. //this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
  2. static const char* pointSpriteFragmentShader= \
  3. "#version 330\n"
  4. "precision highp float;\n"
  5. "in Fragment\n"
  6. "{\n"
  7. " vec4 color;\n"
  8. "} fragment;\n"
  9. "in vec3 ambient;\n"
  10. "out vec4 color;\n"
  11. "void main_textured(void)\n"
  12. "{\n"
  13. " color = fragment.color;//texture2D(Diffuse,vert.texcoord);//fragment.color;\n"
  14. "}\n"
  15. "void main(void)\n"
  16. "{\n"
  17. " vec3 N;\n"
  18. " N.xy = gl_PointCoord.st*vec2(2.0, -2.0) + vec2(-1.0, 1.0);\n"
  19. " float mag = dot(N.xy, N.xy);\n"
  20. " if (mag > 1.0) discard; \n"
  21. " vec4 texel = fragment.color;//vec4(1,0,0,1);//fragment.color*texture(Diffuse,vert.texcoord);//fragment.color;\n"
  22. " vec3 ct;\n"
  23. " float at,af;\n"
  24. " af = 1.0;\n"
  25. " \n"
  26. " ct = texel.rgb;\n"
  27. " at = texel.a;\n"
  28. " \n"
  29. " vec3 lightDir= vec3(1,0,0);\n"
  30. " float diffuse = max(0.0, dot(lightDir, N));\n"
  31. " color = vec4(ct * diffuse, at * af); \n"
  32. "}\n"
  33. ;