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

Function vm_VectorToMatrix

vecmat/vector.cpp:645–667  ·  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

643// fvec,uvec,rvec - pointers to vectors that determine the matrix.
644// One or two of these must be specified, with the other(s) set to NULL.
645void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) {
646 if (!fvec) { // no forward vector. Use up and/or right vectors.
647 matrix tmatrix;
648
649 if (uvec) { // got up vector. use up and, if specified, right vectors.
650 DoVectorToMatrix(&tmatrix, uvec, NULL, rvec);
651 m->fvec = -tmatrix.uvec;
652 m->uvec = tmatrix.fvec;
653 m->rvec = tmatrix.rvec;
654 return;
655 } else { // no up vector. Use right vector only.
656 ASSERT(rvec);
657 DoVectorToMatrix(&tmatrix, rvec, NULL, NULL);
658 m->fvec = -tmatrix.rvec;
659 m->uvec = tmatrix.uvec;
660 m->rvec = tmatrix.fvec;
661 return;
662 }
663 } else {
664 ASSERT(!(uvec && rvec)); // can only have 1 or 2 vectors specified
665 DoVectorToMatrix(m, fvec, uvec, rvec);
666 }
667}
668
669void vm_SinCos(uint16_t a, float *s, float *c) {
670 if (s)

Callers 15

vm_OrthogonalizeFunction · 0.70
DoPhysLinkedFrameFunction · 0.50
do_physics_simFunction · 0.50
do_walking_simFunction · 0.50
bump_two_objectsFunction · 0.50
check_vector_to_cylinderFunction · 0.50
SetElementViewFunction · 0.50
SetSurfaceViewFunction · 0.50
HObjectPlaceFunction · 0.50
ResetGroundObjectFunction · 0.50

Calls 1

DoVectorToMatrixFunction · 0.70

Tested by

no test coverage detected