MCPcopy Create free account
hub / github.com/assimp/assimp / GetCameraMatrix

Method GetCameraMatrix

include/assimp/camera.h:196–225  ·  view source on GitHub ↗

@brief Get a *right-handed* camera matrix from me * @param out Camera matrix to be filled */

Source from the content-addressed store, hash-verified

194 * @param out Camera matrix to be filled
195 */
196 void GetCameraMatrix(aiMatrix4x4 &out) const {
197 /** todo: test ... should work, but i'm not absolutely sure */
198
199 /** We don't know whether these vectors are already normalized ...*/
200 aiVector3D zaxis = mLookAt;
201 zaxis.Normalize();
202 aiVector3D yaxis = mUp;
203 yaxis.Normalize();
204 aiVector3D xaxis = mUp ^ mLookAt;
205 xaxis.Normalize();
206
207 out.a4 = -(xaxis * mPosition);
208 out.b4 = -(yaxis * mPosition);
209 out.c4 = -(zaxis * mPosition);
210
211 out.a1 = xaxis.x;
212 out.a2 = xaxis.y;
213 out.a3 = xaxis.z;
214
215 out.b1 = yaxis.x;
216 out.b2 = yaxis.y;
217 out.b3 = yaxis.z;
218
219 out.c1 = zaxis.x;
220 out.c2 = zaxis.y;
221 out.c3 = zaxis.z;
222
223 out.d1 = out.d2 = out.d3 = 0.f;
224 out.d4 = 1.f;
225 }
226
227#endif
228};

Callers 1

WriteNodeMethod · 0.80

Calls 1

NormalizeMethod · 0.45

Tested by

no test coverage detected