1 |
var mT; |
2 |
function d3d_transform_add_rotation_axis(argument0, argument1, argument2, argument3) //gml_Script_d3d_transform_add_rotation_axis |
3 |
{ |
4 |
var c = dcos((-argument3)) |
5 |
var s = dsin((-argument3)) |
6 |
var omc = 1 - c |
7 |
var xx = argument0 |
8 |
var yy = argument1 |
9 |
var zz = argument2 |
10 |
var length2 = sqr(xx) + sqr(yy) + sqr(zz) |
11 |
var length = sqrt(length2) |
12 |
xx /= length |
13 |
yy /= length |
14 |
zz /= length |
15 |
mT[0] = omc * xx * xx + c |
16 |
mT[1] = omc * xx * yy + s * zz |
17 |
mT[2] = omc * xx * zz - s * yy |
18 |
mT[3] = 0 |
19 |
mT[4] = omc * xx * yy - s * zz |
20 |
mT[5] = omc * yy * yy + c |
21 |
mT[6] = omc * yy * zz + s * xx |
22 |
mT[7] = 0 |
23 |
mT[8] = omc * xx * zz + s * yy |
24 |
mT[9] = omc * yy * zz - s * xx |
25 |
mT[10] = omc * zz * zz + c |
26 |
mT[11] = 0 |
27 |
mT[12] = 0 |
28 |
mT[13] = 0 |
29 |
mT[14] = 0 |
30 |
mT[15] = 1 |
31 |
var m = matrix_get(2) |
32 |
var mR = matrix_multiply(m, mT) |
33 |
matrix_set(2, mR) |
34 |
} |