Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
819 B

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. // derivative of catmull rom spline courtesy of calc
  3. float4 DCatmullRomSpline ( float4 a, float4 b, float4 c, float4 d, float t )
  4. {
  5. return 0.5 *( c - a + t * ( 2 * a - 5 * b + 4 * c - d + t * (3 * b - a - 3 * c + d ) )
  6. + t * ( 2 * a - 5 * b + 4 * c - d + 2 * ( t * ( 3 * b - a - 3 * c + d ) ) ) );
  7. }
  8. float3 DCatmullRomSpline3 ( float3 a, float3 b, float3 c, float3 d, float t )
  9. {
  10. return 0.5 *( c - a + t * ( 2 * a - 5 * b + 4 * c - d + t * (3 * b - a - 3 * c + d ) )
  11. + t * ( 2 * a - 5 * b + 4 * c - d + 2 * ( t * ( 3 * b - a - 3 * c + d ) ) ) );
  12. }
  13. float4 CatmullRomSpline( float4 a, float4 b, float4 c, float4 d, float t )
  14. {
  15. return b + 0.5 * t * ( c - a + t * ( 2 * a - 5 * b + 4 * c - d + t * ( -a + 3 * b -3 * c + d ) ) );
  16. }