rhdebug.vert 546 B

1234567891011121314151617181920
  1. uniform vec3 extents;
  2. uniform mat4 RHMatrix;
  3. ivec3 resolution = ivec3(32, 16, 32);
  4. out vec3 uvw;
  5. void main(void)
  6. {
  7. // Determine the RH center
  8. float gx = int(gl_VertexID) & (resolution.x - 1);
  9. float gy = int(gl_VertexID >> 5) & (resolution.y - 1);
  10. float gz = int(gl_VertexID >> 9) & (resolution.z - 1);
  11. uvw = vec3(gx, gy, gz) / vec3(resolution);
  12. vec3 WorldPos = (2. * uvw - 1.) * extents;
  13. gl_Position = ProjectionMatrix * ViewMatrix * RHMatrix * vec4(WorldPos, 1.);
  14. gl_PointSize = 500. / gl_Position.w;
  15. }