72 if (rotation.axis.x == 1.0f) {
73 float angle_cos =
cos(rotation.angle);
74 float angle_sin =
sin(rotation.angle);
75 for (
int c = 0; c < 3; c++) {
76 result[0][c] = mat[0][c];
77 result[1][c] = angle_cos * mat[1][c] + angle_sin * mat[2][c];
78 result[2][c] = -angle_sin * mat[1][c] + angle_cos * mat[2][c];
81 else if (rotation.axis.y == 1.0f) {
82 float angle_cos =
cos(rotation.angle);
83 float angle_sin =
sin(rotation.angle);
84 for (
int c = 0; c < 3; c++) {
85 result[0][c] = angle_cos * mat[0][c] - angle_sin * mat[2][c];
86 result[1][c] = mat[1][c];
87 result[2][c] = angle_sin * mat[0][c] + angle_cos * mat[2][c];
90 else if (rotation.axis.z == 1.0f) {
91 float angle_cos =
cos(rotation.angle);
92 float angle_sin =
sin(rotation.angle);
93 for (
int c = 0; c < 3; c++) {
94 result[0][c] = angle_cos * mat[0][c] + angle_sin * mat[1][c];
95 result[1][c] = -angle_sin * mat[0][c] + angle_cos * mat[1][c];
96 result[2][c] = mat[2][c];
112 if (rotation.y == 0.0f && rotation.z == 0.0f) {
115 else if (rotation.x == 0.0f && rotation.z == 0.0f) {
118 else if (rotation.x == 0.0f && rotation.y == 0.0f) {
125 return rotate(mat, axis_angle);
133 float4x4 result = to_float4x4(
rotate(to_float3x3(mat), rotation));
134 result[0][3] = mat[0][3];
135 result[1][3] = mat[1][3];
136 result[2][3] = mat[2][3];
137 result[3][0] = mat[3][0];
138 result[3][1] = mat[3][1];
139 result[3][2] = mat[3][2];
140 result[3][3] = mat[3][3];
149 float4x4 result = to_float4x4(
rotate(to_float3x3(mat), rotation));
150 result[0][3] = mat[0][3];
151 result[1][3] = mat[1][3];
152 result[2][3] = mat[2][3];
153 result[3][0] = mat[3][0];
154 result[3][1] = mat[3][1];
155 result[3][2] = mat[3][2];
156 result[3][3] = mat[3][3];