| 1 | STRINGIFY( | 
|---|
| 2 |  | 
|---|
| 3 | $genType cos($genType y); | 
|---|
| 4 | $genHType cos($genHType y); | 
|---|
| 5 | float dot($genType x, $genType y); | 
|---|
| 6 | float2x2 inverse(float2x2 m); | 
|---|
| 7 | float3x3 inverse(float3x3 m); | 
|---|
| 8 | float4x4 inverse(float4x4 m); | 
|---|
| 9 | $genType sin($genType x); | 
|---|
| 10 | $genHType sin($genHType x); | 
|---|
| 11 | $genType sqrt($genType x); | 
|---|
| 12 | $genHType sqrt($genHType x); | 
|---|
| 13 | $genType tan($genType x); | 
|---|
| 14 | $genHType tan($genHType x); | 
|---|
| 15 |  | 
|---|
| 16 | float  degrees(float  rad) { return rad * 57.2957795; } | 
|---|
| 17 | float2 degrees(float2 rad) { return rad * 57.2957795; } | 
|---|
| 18 | float3 degrees(float3 rad) { return rad * 57.2957795; } | 
|---|
| 19 | float4 degrees(float4 rad) { return rad * 57.2957795; } | 
|---|
| 20 |  | 
|---|
| 21 | float  radians(float  deg) { return deg * 0.0174532925; } | 
|---|
| 22 | float2 radians(float2 deg) { return deg * 0.0174532925; } | 
|---|
| 23 | float3 radians(float3 deg) { return deg * 0.0174532925; } | 
|---|
| 24 | float4 radians(float4 deg) { return deg * 0.0174532925; } | 
|---|
| 25 |  | 
|---|
| 26 | float length(float2 v) { return sqrt(dot(v, v)); } | 
|---|
| 27 | float length(float3 v) { return sqrt(dot(v, v)); } | 
|---|
| 28 | float length(float4 v) { return sqrt(dot(v, v)); } | 
|---|
| 29 |  | 
|---|
| 30 | float distance(float2 a, float2 b) { return length(a - b); } | 
|---|
| 31 | float distance(float3 a, float3 b) { return length(a - b); } | 
|---|
| 32 | float distance(float4 a, float4 b) { return length(a - b); } | 
|---|
| 33 |  | 
|---|
| 34 | float2 normalize(float2 v) { return v / length(v); } | 
|---|
| 35 | float3 normalize(float3 v) { return v / length(v); } | 
|---|
| 36 | float4 normalize(float4 v) { return v / length(v); } | 
|---|
| 37 |  | 
|---|
| 38 | float  mix(float  x, float  y, float t) { return x * (1 - t) + y * t; } | 
|---|
| 39 | float2 mix(float2 x, float2 y, float t) { return x * (1 - t) + y * t; } | 
|---|
| 40 | float3 mix(float3 x, float3 y, float t) { return x * (1 - t) + y * t; } | 
|---|
| 41 | float4 mix(float4 x, float4 y, float t) { return x * (1 - t) + y * t; } | 
|---|
| 42 |  | 
|---|
| 43 | float2 mix(float2 x, float2 y, float2 t) { return x * (1 - t) + y * t; } | 
|---|
| 44 | float3 mix(float3 x, float3 y, float3 t) { return x * (1 - t) + y * t; } | 
|---|
| 45 | float4 mix(float4 x, float4 y, float4 t) { return x * (1 - t) + y * t; } | 
|---|
| 46 |  | 
|---|
| 47 | float3 cross(float3 a, float3 b) { | 
|---|
| 48 | return float3(a.y * b.z - a.z * b.y, | 
|---|
| 49 | a.z * b.x - a.x * b.z, | 
|---|
| 50 | a.x * b.y - a.y * b.x); | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | ) | 
|---|
| 54 |  | 
|---|