moved vector math helpers to Utils.cpp/h

This commit is contained in:
ZappoMan 2013-04-10 09:39:43 -07:00
parent fc122f23d2
commit 597f35db3d
3 changed files with 27 additions and 20 deletions

View file

@ -140,3 +140,26 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl
glPopMatrix();
}
// XXXBHG - These handy operators should probably go somewhere else, I'm surprised they don't
// already exist somewhere in OpenGL. Maybe someone can point me to them if they do exist!
glm::vec3 operator* (float lhs, const glm::vec3& rhs)
{
glm::vec3 result = rhs;
result.x *= lhs;
result.y *= lhs;
result.z *= lhs;
return result;
}
// XXXBHG - These handy operators should probably go somewhere else, I'm surprised they don't
// already exist somewhere in OpenGL. Maybe someone can point me to them if they do exist!
glm::vec3 operator* (const glm::vec3& lhs, float rhs)
{
glm::vec3 result = lhs;
result.x *= rhs;
result.y *= rhs;
result.z *= rhs;
return result;
}

View file

@ -48,4 +48,8 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl
double diffclock(timeval *clock1,timeval *clock2);
glm::vec3 operator* (float lhs, const glm::vec3& rhs);
glm::vec3 operator* (const glm::vec3& lhs, float rhs);
#endif

View file

@ -511,26 +511,6 @@ void simulateHead(float frametime)
}
}
// These handy operators should probably go somewhere else, I'm surprised they don't
// already exist somewhere in OpenGL. Maybe someone can point me to them if they do exist!
glm::vec3 operator* (float lhs, const glm::vec3& rhs)
{
glm::vec3 result = rhs;
result.x *= lhs;
result.y *= lhs;
result.z *= lhs;
return result;
}
glm::vec3 operator* (const glm::vec3& lhs, float rhs)
{
glm::vec3 result = lhs;
result.x *= rhs;
result.y *= rhs;
result.z *= rhs;
return result;
}
// XXXBHG - this code is not yet working. This is here to help Jeffery debug getAvatarHeadLookatDirection()
// The code will draw a yellow line from the avatar's position to the origin,
// It also attempts to draw a cyan line from the avatar to 2 meters in front of the avatar in the direction