| 1724 | bool G2_NeedsRecalc(CGhoul2Info *ghlInfo,int frameNum); |
| 1725 | |
| 1726 | qboolean G2API_GetBoltMatrix(CGhoul2Info_v &ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, |
| 1727 | const vec3_t position, const int AframeNum, qhandle_t *modelList, const vec3_t scale ) |
| 1728 | { |
| 1729 | G2ERROR(ghoul2.IsValid(),"Invalid ghlInfo"); |
| 1730 | G2ERROR(matrix,"NULL matrix"); |
| 1731 | G2ERROR(modelIndex>=0&&modelIndex<ghoul2.size(),"Invalid ModelIndex"); |
| 1732 | const static mdxaBone_t identityMatrix = |
| 1733 | { |
| 1734 | { |
| 1735 | { 0.0f, -1.0f, 0.0f, 0.0f }, |
| 1736 | { 1.0f, 0.0f, 0.0f, 0.0f }, |
| 1737 | { 0.0f, 0.0f, 1.0f, 0.0f } |
| 1738 | } |
| 1739 | }; |
| 1740 | G2_GenerateWorldMatrix(angles, position); |
| 1741 | if (G2_SetupModelPointers(ghoul2)) |
| 1742 | { |
| 1743 | if (matrix&&modelIndex>=0&&modelIndex<ghoul2.size()) |
| 1744 | { |
| 1745 | int frameNum=G2API_GetTime(AframeNum); |
| 1746 | CGhoul2Info *ghlInfo = &ghoul2[modelIndex]; |
| 1747 | G2ERROR(boltIndex >= 0 && (boltIndex < (int)ghlInfo->mBltlist.size()),va("Invalid Bolt Index (%d:%s)",boltIndex,ghlInfo->mFileName)); |
| 1748 | |
| 1749 | if (boltIndex >= 0 && ghlInfo && (boltIndex < (int)ghlInfo->mBltlist.size()) ) |
| 1750 | { |
| 1751 | mdxaBone_t bolt; |
| 1752 | |
| 1753 | if (G2_NeedsRecalc(ghlInfo,frameNum)) |
| 1754 | { |
| 1755 | G2_ConstructGhoulSkeleton(ghoul2,frameNum,true,scale); |
| 1756 | } |
| 1757 | |
| 1758 | G2_GetBoltMatrixLow(*ghlInfo,boltIndex,scale,bolt); |
| 1759 | // scale the bolt position by the scale factor for this model since at this point its still in model space |
| 1760 | if (scale[0]) |
| 1761 | { |
| 1762 | bolt.matrix[0][3] *= scale[0]; |
| 1763 | } |
| 1764 | if (scale[1]) |
| 1765 | { |
| 1766 | bolt.matrix[1][3] *= scale[1]; |
| 1767 | } |
| 1768 | if (scale[2]) |
| 1769 | { |
| 1770 | bolt.matrix[2][3] *= scale[2]; |
| 1771 | } |
| 1772 | VectorNormalize((float*)&bolt.matrix[0]); |
| 1773 | VectorNormalize((float*)&bolt.matrix[1]); |
| 1774 | VectorNormalize((float*)&bolt.matrix[2]); |
| 1775 | |
| 1776 | Multiply_3x4Matrix(matrix, &worldMatrix, &bolt); |
| 1777 | #if G2API_DEBUG |
| 1778 | for ( int i = 0; i < 3; i++ ) |
| 1779 | { |
| 1780 | for ( int j = 0; j < 4; j++ ) |
| 1781 | { |
| 1782 | assert( !Q_isnan(matrix->matrix[i][j])); |
| 1783 | } |
nothing calls this directly
no test coverage detected