diff options
Diffstat (limited to 'shaders/include/math.h')
| -rw-r--r-- | shaders/include/math.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shaders/include/math.h b/shaders/include/math.h index cc4e2f4..c95b065 100644 --- a/shaders/include/math.h +++ b/shaders/include/math.h @@ -43,3 +43,11 @@ vec3 rotate_point(vec4 q, vec3 v) { const vec3 q_axis = q.xyz;
return 2.0f * dot(q_axis, v) * q_axis + (q.w * q.w - dot(q_axis, q_axis)) * v + 2.0f * q.w * cross(q_axis, v);
}
+
+vec3 interpolate_attribute(vec3 values[3], vec3 weights) {
+ return values[0] * weights.x + values[1] * weights.y + values[2] * weights.z;
+}
+
+vec2 interpolate_attribute(vec2 values[3], vec3 weights) {
+ return values[0] * weights.x + values[1] * weights.y + values[2] * weights.z;
+}
|
