CloudCollectionVS.glsl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifdef INSTANCED
  2. attribute vec2 direction;
  3. #endif
  4. attribute vec4 positionHighAndScaleX;
  5. attribute vec4 positionLowAndScaleY;
  6. attribute vec4 packedAttribute0;
  7. attribute vec4 packedAttribute1;
  8. attribute vec4 color;
  9. varying vec2 v_offset;
  10. varying vec3 v_maximumSize;
  11. varying vec4 v_color;
  12. varying float v_slice;
  13. varying float v_brightness;
  14. void main() {
  15. // Unpack attributes.
  16. vec3 positionHigh = positionHighAndScaleX.xyz;
  17. vec3 positionLow = positionLowAndScaleY.xyz;
  18. vec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);
  19. float show = packedAttribute0.x;
  20. float brightness = packedAttribute0.y;
  21. vec2 coordinates = packedAttribute0.wz;
  22. vec3 maximumSize = packedAttribute1.xyz;
  23. float slice = packedAttribute1.w;
  24. #ifdef INSTANCED
  25. vec2 dir = direction;
  26. #else
  27. vec2 dir = coordinates;
  28. #endif
  29. vec2 offset = dir - vec2(0.5, 0.5);
  30. vec2 scaledOffset = scale * offset;
  31. vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
  32. vec4 positionEC = czm_modelViewRelativeToEye * p;
  33. positionEC.xy += scaledOffset;
  34. positionEC.xyz *= show;
  35. gl_Position = czm_projection * positionEC;
  36. v_offset = offset;
  37. v_maximumSize = maximumSize;
  38. v_color = color;
  39. v_slice = slice;
  40. v_brightness = brightness;
  41. }