Pass parameters by const reference rather than by value
This commit is contained in:
@@ -52,7 +52,7 @@ double MyDistance(const myVec3& v1, const myVec3& v2)
|
||||
}
|
||||
|
||||
// Angle between two normalized vectors, in radians
|
||||
double AngleBetween(myVec3 v1, myVec3 v2)
|
||||
double AngleBetween(const myVec3& v1, const myVec3& v2)
|
||||
{
|
||||
double angle = MyDot(v1, v2);
|
||||
// Prevent issues due to numerical precision
|
||||
|
@@ -56,7 +56,7 @@ myVec3 MyCross(const myVec3& v1, const myVec3& v2);
|
||||
double MyDistance(const myVec3& v1, const myVec3& v2);
|
||||
|
||||
// Angle between two normalized vectors, in radians
|
||||
double AngleBetween(myVec3 v1, myVec3 v2);
|
||||
double AngleBetween(const myVec3& v1, const myVec3& v2);
|
||||
|
||||
// Matrix 4x4 by 4x1 multiplication
|
||||
myVec4 MyMatMul4x1(const double *m1, const myVec4& v);
|
||||
|
@@ -305,14 +305,14 @@ void myOGLShaders::AddCode(const GLchar* shaString, GLenum shaType)
|
||||
m_shaCode.push_back(sv);
|
||||
}
|
||||
|
||||
void myOGLShaders::AddAttrib(std::string name)
|
||||
void myOGLShaders::AddAttrib(const std::string& name)
|
||||
{
|
||||
shaVars sv = {0, name}; //We will set the location later
|
||||
m_shaAttrib.push_back(sv);
|
||||
// We don't check the max number of attribute locations (usually 16)
|
||||
}
|
||||
|
||||
void myOGLShaders::AddUnif(std::string name)
|
||||
void myOGLShaders::AddUnif(const std::string& name)
|
||||
{
|
||||
shaVars sv = {0, name};
|
||||
m_shaUnif.push_back(sv);
|
||||
@@ -333,7 +333,7 @@ void myOGLShaders::SetAttribLocations()
|
||||
}
|
||||
}
|
||||
|
||||
GLuint myOGLShaders::GetAttribLoc(std::string name)
|
||||
GLuint myOGLShaders::GetAttribLoc(const std::string& name)
|
||||
{
|
||||
for (shaVars_v::iterator it = m_shaAttrib.begin(); it != m_shaAttrib.end(); ++it)
|
||||
{
|
||||
@@ -362,7 +362,7 @@ bool myOGLShaders::AskUnifLocations()
|
||||
return true;
|
||||
}
|
||||
|
||||
GLuint myOGLShaders::GetUnifLoc(std::string name)
|
||||
GLuint myOGLShaders::GetUnifLoc(const std::string& name)
|
||||
{
|
||||
for (shaVars_v::iterator it = m_shaUnif.begin(); it != m_shaUnif.end(); ++it)
|
||||
{
|
||||
|
@@ -109,10 +109,10 @@ public:
|
||||
void CleanUp();
|
||||
|
||||
void AddCode(const GLchar* shaString, GLenum shaType);
|
||||
void AddAttrib(std::string name);
|
||||
void AddUnif(std::string name);
|
||||
GLuint GetAttribLoc(std::string name);
|
||||
GLuint GetUnifLoc(std::string name);
|
||||
void AddAttrib(const std::string& name);
|
||||
void AddUnif(const std::string& name);
|
||||
GLuint GetAttribLoc(const std::string& name);
|
||||
GLuint GetUnifLoc(const std::string& name);
|
||||
// Disable generic vertex attribute array
|
||||
void DisableGenericVAA();
|
||||
|
||||
|
Reference in New Issue
Block a user