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

Function G2API_GiveMeVectorFromMatrix

codemp/rd-dedicated/G2_API.cpp:2156–2196  ·  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

2154
2155// given a boltmatrix, return in vec a normalised vector for the axis requested in flags
2156void G2API_GiveMeVectorFromMatrix(mdxaBone_t *boltMatrix, Eorientations flags, vec3_t vec)
2157{
2158 switch (flags)
2159 {
2160 case ORIGIN:
2161 vec[0] = boltMatrix->matrix[0][3];
2162 vec[1] = boltMatrix->matrix[1][3];
2163 vec[2] = boltMatrix->matrix[2][3];
2164 break;
2165 case POSITIVE_Y:
2166 vec[0] = boltMatrix->matrix[0][1];
2167 vec[1] = boltMatrix->matrix[1][1];
2168 vec[2] = boltMatrix->matrix[2][1];
2169 break;
2170 case POSITIVE_X:
2171 vec[0] = boltMatrix->matrix[0][0];
2172 vec[1] = boltMatrix->matrix[1][0];
2173 vec[2] = boltMatrix->matrix[2][0];
2174 break;
2175 case POSITIVE_Z:
2176 vec[0] = boltMatrix->matrix[0][2];
2177 vec[1] = boltMatrix->matrix[1][2];
2178 vec[2] = boltMatrix->matrix[2][2];
2179 break;
2180 case NEGATIVE_Y:
2181 vec[0] = -boltMatrix->matrix[0][1];
2182 vec[1] = -boltMatrix->matrix[1][1];
2183 vec[2] = -boltMatrix->matrix[2][1];
2184 break;
2185 case NEGATIVE_X:
2186 vec[0] = -boltMatrix->matrix[0][0];
2187 vec[1] = -boltMatrix->matrix[1][0];
2188 vec[2] = -boltMatrix->matrix[2][0];
2189 break;
2190 case NEGATIVE_Z:
2191 vec[0] = -boltMatrix->matrix[0][2];
2192 vec[1] = -boltMatrix->matrix[1][2];
2193 vec[2] = -boltMatrix->matrix[2][2];
2194 break;
2195 }
2196}
2197
2198
2199int G2API_CopyGhoul2Instance(CGhoul2Info_v &g2From, CGhoul2Info_v &g2To, int modelIndex)

Calls

no outgoing calls

Tested by

no test coverage detected