Add profiling with Remotery

This commit is contained in:
David 2021-08-24 20:55:39 +02:00
commit 6331a2bf79
50 changed files with 16864 additions and 11 deletions

View file

@ -136,12 +136,14 @@ inline vec3 operator/(vec3 v, double t)
// Straightforward dot product
inline double dot(const vec3 &u, const vec3 &v)
{
return u.x*v.x + u.y*v.y + u.z*v.z;
}
// Cross product between two vectors
inline vec3 cross(const vec3 &u, const vec3 &v)
{
return vec3(u.y * v.z - u.z * v.y,
u.z * v.x - u.x * v.z,
u.x * v.y - u.y * v.x);
@ -150,12 +152,13 @@ inline vec3 cross(const vec3 &u, const vec3 &v)
// Normalize vector so its length = 1
inline vec3 normalize(const vec3 v)
{
return v / v.length();
}
// Returns a vec3 of random components between [-1,1) that is inside a unit sphere
vec3 random_in_unit_sphere()
{
{
// Iterate until we find a vector with length < 1
while (true)
{
@ -173,7 +176,7 @@ vec3 random_unit_vector()
}
vec3 random_in_hemisphere(const vec3& normal)
{
{
vec3 in_unit_sphere = random_in_unit_sphere();
if (dot(in_unit_sphere, normal) > 0.0)