This commit is contained in:
Recep Aslantas
2024-03-22 00:18:55 +03:00
parent 41d1a8b9eb
commit 2b78f9ab47
12 changed files with 219 additions and 22 deletions

View File

@@ -55,6 +55,7 @@
CGLM_INLINE vec2s glms_vec2_lerp(vec2s from, vec2s to, float t)
CGLM_INLINE vec2s glms_vec2_make(float * restrict src)
CGLM_INLINE vec2s glms_vec2_reflect(vec2s I, vec2s N)
CGLM_INLINE vec2s glms_vec2_refract(vec2s I, vec2s N, float eta)
*/
#ifndef cglms_vec2s_h
@@ -707,4 +708,23 @@ glms_vec2_(reflect)(vec2s I, vec2s N) {
return dest;
}
/*!
* @brief refraction vector using entering ray, surface normal and refraction index
*
* if the angle between the entering ray I and the surface normal N is too great
* for a given refraction index, the return value is zero
*
* @param[in] I normalized incident vector
* @param[in] N normalized normal vector
* @param[in] eta ratio of indices of refraction
* @param[out] dest refraction result
*/
CGLM_INLINE
vec2s
glms_vec2_(refract)(vec2s I, vec2s N, float eta) {
vec2s dest;
glm_vec2_refract(I.raw, N.raw, eta, dest.raw);
return dest;
}
#endif /* cglms_vec2s_h */