point_vertex.glsl 660 B

123456789101112131415161718192021222324252627282930
  1. #include <attributes>
  2. // Model uniforms
  3. uniform mat4 MVP;
  4. // Material uniforms
  5. #include <material>
  6. // Outputs for fragment shader
  7. out vec3 Color;
  8. flat out mat2 Rotation;
  9. void main() {
  10. // Rotation matrix for fragment shader
  11. float rotSin = sin(MatPointRotationZ);
  12. float rotCos = cos(MatPointRotationZ);
  13. Rotation = mat2(rotCos, rotSin, - rotSin, rotCos);
  14. // Sets the vertex position
  15. vec4 pos = MVP * vec4(VertexPosition, 1.0);
  16. gl_Position = pos;
  17. // Sets the size of the rasterized point decreasing with distance
  18. gl_PointSize = (1.0 - pos.z / pos.w) * MatPointSize;
  19. // Outputs color
  20. Color = MatEmissiveColor;
  21. }