28 return {
A[0] * xyz[0],
39 result[3] =
vec4(xyz, 1.0f);
50 A[0] * xyz[0] +
A[1] * xyz[1] +
A[2] * xyz[2] +
A[3]};
60 float s = sinf(angle);
61 float c = cosf(angle);
62 vec3 temp = (1.0f - c) * axis;
64 return {
vec4(axis[0] * temp[0] + c,
65 axis[1] * temp[0] + s * axis[2],
66 axis[2] * temp[0] - s * axis[1],
68 vec4(axis[0] * temp[1] - s * axis[2],
69 axis[1] * temp[1] + c,
70 axis[2] * temp[1] + s * axis[0],
72 vec4(axis[0] * temp[2] + s * axis[1],
73 axis[1] * temp[2] - s * axis[0],
74 axis[2] * temp[2] + c,
95 float s = sinf(angle);
96 float c = cosf(angle);
97 return {
vec4(1.0f, 0.0f, 0.0f, 0.0f),
98 vec4(0.0f, c , s , 0.0f),
99 vec4(0.0f, -s , c , 0.0f),
100 vec4(0.0f, 0.0f, 0.0f, 1.0f)};
107 float s = sinf(angle);
108 float c = cosf(angle);
120 float s = sinf(angle);
121 float c = cosf(angle);
122 return {
vec4( c , 0.0f, -s , 0.0f),
123 vec4(0.0f, 1.0f, 0.0f, 0.0f),
124 vec4( s , 0.0f, c , 0.0f),
125 vec4(0.0f, 0.0f, 0.0f, 1.0f)};
132 float s = sinf(angle);
133 float c = cosf(angle);
134 return {
A[0] * c -
A[2] * s,
145 float s = sinf(angle);
146 float c = cosf(angle);
147 return {
vec4( c , s , 0.0f, 0.0f),
148 vec4(-s , c , 0.0f, 0.0f),
149 vec4(0.0f, 0.0f, 1.0f, 0.0f),
150 vec4(0.0f, 0.0f, 0.0f, 1.0f)};
157 float s = sinf(angle);
158 float c = cosf(angle);
159 return {
A[0] * c +
A[1] * s,
170 float left,
float right,
171 float bottom,
float top,
172 float nearVal,
float farVal)
174 return {
vec4(-2.0f / (left - right), 0.0f, 0.0f, 0.0f),
175 vec4( 0.0f, -2.0f / (bottom - top), 0.0f, 0.0f),
176 vec4( 0.0f, 0.0f, 2.0f / (nearVal - farVal), 0.0f),
177 vec4((left + right ) / (left - right ),
178 (bottom + top ) / (bottom - top ),
179 (nearVal + farVal) / (nearVal - farVal),
186 float left,
float right,
187 float bottom,
float top,
188 float nearVal,
float farVal)
190 return {
vec4((2.0f * nearVal) / (right - left), 0.0f, 0.0f, 0.0f),
191 vec4(0.0f, (2.0f * nearVal) / (top - bottom), 0.0f, 0.0f),
192 vec4((right + left ) / (right - left ),
193 (top + bottom) / (top - bottom),
194 (nearVal + farVal) / (nearVal - farVal),
198 (2.0f * farVal * nearVal) / (nearVal - farVal),
mat4 rotateZ(float angle)
mat4 rotate(float angle, const vec3 &axis)
mat4 rotateY(float angle)
mat4 rotateX(float angle)
constexpr mat4 ortho(float left, float right, float bottom, float top, float nearVal, float farVal)
matMxN< 4, 4, float > mat4
constexpr mat4 frustum(float left, float right, float bottom, float top, float nearVal, float farVal)
constexpr mat4 translate(const vec3 &xyz)
constexpr mat4 scale(const vec3 &xyz)
std::array< const EDStorage, 4 > A