added in poor grid
This commit is contained in:
parent
c1b96fc14e
commit
2242adc568
12 changed files with 154 additions and 26 deletions
|
@ -19,6 +19,7 @@ public:
|
|||
void Use();
|
||||
|
||||
void SetUniform(const std::string& name, const glm::mat4& value);
|
||||
void SetUniform(const std::string& name, const glm::vec4& value);
|
||||
|
||||
private:
|
||||
unsigned int id;
|
||||
|
|
|
@ -8,16 +8,17 @@ class Transformable
|
|||
public:
|
||||
Transformable();
|
||||
|
||||
const glm::vec3& GetPosition();
|
||||
const glm::vec3& GetPosition() const;
|
||||
void SetPosition(const glm::vec3& pos);
|
||||
void Move(const glm::vec3& direction);
|
||||
|
||||
const glm::vec3 GetRotation();
|
||||
const glm::vec3 GetRotation() const;
|
||||
const glm::quat& GetQuaternion() const;
|
||||
void SetRotation(const glm::vec3& axis, float angle);
|
||||
void SetRotation(const glm::vec3& eulerAngles);
|
||||
void Rotate(const glm::vec3& axis, float angle);
|
||||
|
||||
const glm::vec3& GetScale();
|
||||
const glm::vec3& GetScale() const;
|
||||
void SetScale(const glm::vec3& scale);
|
||||
void Scale(const glm::vec3& factor);
|
||||
|
||||
|
|
|
@ -85,4 +85,13 @@ void AbstractShader::SetUniform(const std::string& name, const glm::mat4& value)
|
|||
return;
|
||||
|
||||
glUniformMatrix4fv(location, 1, GL_FALSE, glm::value_ptr(value));
|
||||
}
|
||||
|
||||
void AbstractShader::SetUniform(const std::string& name, const glm::vec4& value)
|
||||
{
|
||||
GLint location = glGetUniformLocation(id, name.c_str());
|
||||
if (location == -1)
|
||||
return;
|
||||
|
||||
glUniform4fv(location, 1, glm::value_ptr(value));
|
||||
}
|
|
@ -6,7 +6,7 @@ Transformable::Transformable() :
|
|||
CalculateTransformationMatrix();
|
||||
}
|
||||
|
||||
const glm::vec3& Transformable::GetPosition()
|
||||
const glm::vec3& Transformable::GetPosition() const
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
@ -23,11 +23,16 @@ void Transformable::Move(const glm::vec3& direction)
|
|||
CalculateTransformationMatrix();
|
||||
}
|
||||
|
||||
const glm::vec3 Transformable::GetRotation()
|
||||
const glm::vec3 Transformable::GetRotation() const
|
||||
{
|
||||
return glm::eulerAngles(orientation);
|
||||
}
|
||||
|
||||
const glm::quat& Transformable::GetQuaternion() const
|
||||
{
|
||||
return orientation;
|
||||
}
|
||||
|
||||
void Transformable::SetRotation(const glm::vec3& axis, float angle)
|
||||
{
|
||||
orientation = glm::quat(glm::radians(angle), axis);
|
||||
|
@ -46,7 +51,7 @@ void Transformable::Rotate(const glm::vec3& axis, float angle)
|
|||
CalculateTransformationMatrix();
|
||||
}
|
||||
|
||||
const glm::vec3& Transformable::GetScale()
|
||||
const glm::vec3& Transformable::GetScale() const
|
||||
{
|
||||
return scale;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue