I’m stuck with the function Refract of the Raytracing in a weekend but I have no idea what I’m doing wrong. This is the function that is giving me problems.
inline Vec3 Vec3::Refract(const Vec3& uv, const Vec3& n, double etai_over_etat) {
double cos_theta = std::min(Vec3::DotProduct(uv * -1, n), 1.0);
Vec3 r_out_perp = etai_over_etat * (uv + (cos_theta * n));
Vec3 r_out_parallel = -std::sqrt(std::fabs(1.0 - r_out_perp.Normalized())) * n;
return r_out_perp + r_out_parallel;
}
This is the error I get
error C2677: '*' binario: no se encontró un operador global que adopte el tipo 'const Vec3' (o bien no existe una conversión aceptable)
which translates to
'*' binary: could not find global operator that adopts the type 'const Vec3' (or there doesnt exist an acceptable conversion)
In my math library this is hoy I define the operator
Vec3 operator*(double value) const;
And this is the function
inline Vec3 Vec3::operator*(double value) const {
return Vec3(x * value, y * value, z * value);
}
Can someone help me understand what I’m doing wrong? I can’t understand what I’m missing.
4