Skip to content

Instantly share code, notes, and snippets.

@antoinefortin
Created December 13, 2021 06:22
Show Gist options
  • Save antoinefortin/0e4a2d95ad83c30ea849b40db0809111 to your computer and use it in GitHub Desktop.
Save antoinefortin/0e4a2d95ad83c30ea849b40db0809111 to your computer and use it in GitHub Desktop.
public Matrix4x4 GetScaleTransform(
ref Vector4 inVert,
float xScale,
float yScale,
float zScale
)
{
Matrix4x4 sm = new Matrix4x4();
// r0
sm.m00 = xScale;
sm.m01 = 0;
sm.m02 = 0;
sm.m03 = 0;
//r1
sm.m10 = 0;
sm.m11 = yScale;
sm.m12 = 0;
sm.m13 = 0;
//r2
sm.m20 = 0;
sm.m21 = 0;
sm.m22 = zScale;
sm.m23 = 0;
//r3
sm.m30 = 0;
sm.m31 = 0;
sm.m32 = 0;
sm.m33 = 1;
//inVert *= sm;
return sm;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment