Skip to content

Instantly share code, notes, and snippets.

@shibbo
Created July 26, 2017 04:01
Show Gist options
  • Save shibbo/e8e0cc75f4ea61a4a0d45e5bbf06af3d to your computer and use it in GitHub Desktop.
Save shibbo/e8e0cc75f4ea61a4a0d45e5bbf06af3d to your computer and use it in GitHub Desktop.
#include "helper.h"
Helper::Helper(Vector3 scale, Vector3 rot, Vector3 trans)
{
this->scale = scale;
this->rot = rot;
this->trans = trans;
}
QMatrix4x4 Helper::SRTToMatrix()
{
QMatrix4x4 ret = QMatrix4x4.Identity;
QMatrix4x4 mscale = QMatrix4x4.scale(scale.x, scale.y, scale.z);
QMatrix4x4 mrot = QMatrix4x4.rotate(rot.x, rot.y, rot.z);
QMatrix4x4 mtrans = QMatrix4x4.translate(trans.x, trans.y, trans.z);
ret *= mscale;
ret *= mrot;
ret *= mtrans;
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment