pointAlongRay.glsl 594 B

12345678910111213141516171819
  1. /**
  2. * Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.
  3. *
  4. * @name czm_pointAlongRay
  5. * @glslFunction
  6. *
  7. * @param {czm_ray} ray The ray to compute the point along.
  8. * @param {float} time The time along the ray.
  9. *
  10. * @returns {vec3} The point along the ray at the given time.
  11. *
  12. * @example
  13. * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction
  14. * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)
  15. */
  16. vec3 czm_pointAlongRay(czm_ray ray, float time)
  17. {
  18. return ray.origin + (time * ray.direction);
  19. }