instance at specified point with specified orientation
| 33 | |
| 34 | // instance at specified point with specified orientation |
| 35 | void g3_StartInstanceMatrix(vector *pos, matrix *orient) { |
| 36 | ASSERT(orient != NULL); |
| 37 | ASSERT(sInstanceDepth < MAX_INSTANCE_DEPTH); |
| 38 | |
| 39 | sInstanceStack[sInstanceDepth].m_viewMatrix = View_matrix; |
| 40 | sInstanceStack[sInstanceDepth].m_viewPosition = View_position; |
| 41 | sInstanceStack[sInstanceDepth].m_unscaledMatrix = Unscaled_matrix; |
| 42 | memcpy(sInstanceStack[sInstanceDepth].m_modelView, gTransformModelView, sizeof(gTransformModelView)); |
| 43 | ++sInstanceDepth; |
| 44 | |
| 45 | // step 1: subtract object position from view position |
| 46 | vector tempv = View_position - *pos; |
| 47 | |
| 48 | // step 2: rotate view vector through object matrix |
| 49 | View_position = tempv * *orient; |
| 50 | |
| 51 | // step 3: rotate object matrix through view_matrix (vm = ob * vm) |
| 52 | matrix tempm, tempm2 = ~*orient; |
| 53 | |
| 54 | tempm = tempm2 * View_matrix; |
| 55 | View_matrix = tempm; |
| 56 | |
| 57 | tempm = tempm2 * Unscaled_matrix; |
| 58 | Unscaled_matrix = tempm; |
| 59 | |
| 60 | // transform the model/view matrix |
| 61 | g3_GetModelViewMatrix(&View_position, &Unscaled_matrix, (float *)gTransformModelView); |
| 62 | g3_UpdateFullTransform(); |
| 63 | } |
| 64 | |
| 65 | // instance at specified point with specified orientation |
| 66 | void g3_StartInstanceAngles(vector *pos, angvec *angles) { |
no test coverage detected