Added setUniform method to KRMat4, KRVector2, and KRVector3
--HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40130
This commit is contained in:
@@ -351,3 +351,8 @@ KRMat4 KRMat4::Transpose(const KRMat4 &m)
|
|||||||
matTranspose.transpose();
|
matTranspose.transpose();
|
||||||
return matTranspose;
|
return matTranspose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KRMat4::setUniform(GLint location) const
|
||||||
|
{
|
||||||
|
if(location != -1) GLDEBUG(glUniformMatrix4fv(location, 1, GL_FALSE, m_mat));
|
||||||
|
}
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ public:
|
|||||||
static KRVector3 DotWDiv(const KRMat4 &m, const KRVector3 &v);
|
static KRVector3 DotWDiv(const KRMat4 &m, const KRVector3 &v);
|
||||||
|
|
||||||
static KRMat4 LookAt(const KRVector3 &cameraPos, const KRVector3 &lookAtPos, const KRVector3 &upDirection);
|
static KRMat4 LookAt(const KRVector3 &cameraPos, const KRVector3 &lookAtPos, const KRVector3 &upDirection);
|
||||||
|
|
||||||
|
void setUniform(GLint location) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KRMAT4_I
|
#endif // KRMAT4_I
|
||||||
@@ -164,3 +164,7 @@ float KRVector2::Dot(const KRVector2 &v1, const KRVector2 &v2) {
|
|||||||
return v1.x * v2.x + v1.y * v2.y;
|
return v1.x * v2.x + v1.y * v2.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KRVector2::setUniform(GLint location) const
|
||||||
|
{
|
||||||
|
if(location != -1) GLDEBUG(glUniform2f(location, x, y));
|
||||||
|
}
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ public:
|
|||||||
static KRVector2 Zero();
|
static KRVector2 Zero();
|
||||||
static KRVector2 One();
|
static KRVector2 One();
|
||||||
|
|
||||||
|
void setUniform(GLint location) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -293,5 +293,5 @@ bool KRVector3::operator <(const KRVector3& b) const
|
|||||||
|
|
||||||
void KRVector3::setUniform(GLint location) const
|
void KRVector3::setUniform(GLint location) const
|
||||||
{
|
{
|
||||||
GLDEBUG(glUniform3f(location, x, y, z));
|
if(location != -1) GLDEBUG(glUniform3f(location, x, y, z));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user