MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / vm_VectorToMatrix

Function vm_VectorToMatrix

scripts/osiris_vector.h:687–709  ·  view source on GitHub ↗

Compute a matrix from one or two vectors. At least one and at most two vectors must/can be specified. Parameters: m - filled in with the orienation matrix fvec,uvec,rvec - pointers to vectors that determine the matrix. One or two of these must be specified, with the other(s) set to NULL.

Source from the content-addressed store, hash-verified

685// fvec,uvec,rvec - pointers to vectors that determine the matrix.
686// One or two of these must be specified, with the other(s) set to NULL.
687void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) {
688 if (!fvec) { // no forward vector. Use up and/or right vectors.
689 matrix tmatrix;
690
691 if (uvec) { // got up vector. use up and, if specified, right vectors.
692 DoVectorToMatrix(&tmatrix, uvec, NULL, rvec);
693 m->fvec = -tmatrix.uvec;
694 m->uvec = tmatrix.fvec;
695 m->rvec = tmatrix.rvec;
696 return;
697 } else { // no up vector. Use right vector only.
698 // ASSERT(rvec);
699 DoVectorToMatrix(&tmatrix, rvec, NULL, NULL);
700 m->fvec = -tmatrix.rvec;
701 m->uvec = tmatrix.uvec;
702 m->rvec = tmatrix.fvec;
703 return;
704 }
705 } else {
706 // ASSERT(! (uvec && rvec)); //can only have 1 or 2 vectors specified
707 DoVectorToMatrix(m, fvec, uvec, rvec);
708 }
709}
710
711void vm_SinCos(uint16_t a, float *s, float *c) {
712 if (s)

Callers 4

FindHomeMethod · 0.70
CallEventMethod · 0.70
vm_OrthogonalizeFunction · 0.70
OnDestroyMethod · 0.70

Calls 1

DoVectorToMatrixFunction · 0.70

Tested by

no test coverage detected