MCPcopy Create free account
hub / github.com/JACoders/OpenJK / G2API_GiveMeVectorFromMatrix

Function G2API_GiveMeVectorFromMatrix

code/rd-vanilla/G2_API.cpp:1967–2007  ·  view source on GitHub ↗

given a boltmatrix, return in vec a normalised vector for the axis requested in flags

Source from the content-addressed store, hash-verified

1965
1966// given a boltmatrix, return in vec a normalised vector for the axis requested in flags
1967void G2API_GiveMeVectorFromMatrix(mdxaBone_t &boltMatrix, Eorientations flags, vec3_t &vec)
1968{
1969 switch (flags)
1970 {
1971 case ORIGIN:
1972 vec[0] = boltMatrix.matrix[0][3];
1973 vec[1] = boltMatrix.matrix[1][3];
1974 vec[2] = boltMatrix.matrix[2][3];
1975 break;
1976 case POSITIVE_Y:
1977 vec[0] = boltMatrix.matrix[0][1];
1978 vec[1] = boltMatrix.matrix[1][1];
1979 vec[2] = boltMatrix.matrix[2][1];
1980 break;
1981 case POSITIVE_X:
1982 vec[0] = boltMatrix.matrix[0][0];
1983 vec[1] = boltMatrix.matrix[1][0];
1984 vec[2] = boltMatrix.matrix[2][0];
1985 break;
1986 case POSITIVE_Z:
1987 vec[0] = boltMatrix.matrix[0][2];
1988 vec[1] = boltMatrix.matrix[1][2];
1989 vec[2] = boltMatrix.matrix[2][2];
1990 break;
1991 case NEGATIVE_Y:
1992 vec[0] = -boltMatrix.matrix[0][1];
1993 vec[1] = -boltMatrix.matrix[1][1];
1994 vec[2] = -boltMatrix.matrix[2][1];
1995 break;
1996 case NEGATIVE_X:
1997 vec[0] = -boltMatrix.matrix[0][0];
1998 vec[1] = -boltMatrix.matrix[1][0];
1999 vec[2] = -boltMatrix.matrix[2][0];
2000 break;
2001 case NEGATIVE_Z:
2002 vec[0] = -boltMatrix.matrix[0][2];
2003 vec[1] = -boltMatrix.matrix[1][2];
2004 vec[2] = -boltMatrix.matrix[2][2];
2005 break;
2006 }
2007}
2008
2009// copy a model from one ghoul2 instance to another, and reset the root surface on the new model if need be
2010// NOTE if modelIndex = -1 then copy all the models

Calls

no outgoing calls

Tested by

no test coverage detected