instance at specified point with specified orientation if matrix==NULL, don't modify matrix. This will be like doing an offset
| 228 | // instance at specified point with specified orientation |
| 229 | // if matrix==NULL, don't modify matrix. This will be like doing an offset |
| 230 | void newstyle_StartInstanceMatrix(vector *pos, matrix *orient) { |
| 231 | vector tempv, temp0, temp1; |
| 232 | matrix tempm, tempm2; |
| 233 | |
| 234 | ASSERT(instance_depth < MAX_INSTANCE_DEPTH); |
| 235 | |
| 236 | instance_stack[instance_depth].m = View_matrix; |
| 237 | instance_stack[instance_depth].p = View_position; |
| 238 | instance_stack[instance_depth].p0 = *fvi_query_ptr->p0; |
| 239 | instance_stack[instance_depth].p1 = *fvi_query_ptr->p1; |
| 240 | if (fvi_do_orient) { |
| 241 | instance_stack[instance_depth].fvec = fvi_move_fvec; |
| 242 | instance_stack[instance_depth].uvec = fvi_move_uvec; |
| 243 | } |
| 244 | instance_depth++; |
| 245 | |
| 246 | // step 1: subtract object position from view position |
| 247 | |
| 248 | tempv = View_position - *pos; |
| 249 | temp0 = *fvi_query_ptr->p0 - *pos; |
| 250 | temp1 = *fvi_query_ptr->p1 - *pos; |
| 251 | |
| 252 | if (orient) { |
| 253 | // step 2: rotate view vector through object matrix |
| 254 | |
| 255 | View_position = tempv * *orient; |
| 256 | *fvi_query_ptr->p0 = temp0 * *orient; |
| 257 | *fvi_query_ptr->p1 = temp1 * *orient; |
| 258 | |
| 259 | if (fvi_do_orient) { |
| 260 | fvi_move_fvec = fvi_move_fvec * *orient; |
| 261 | fvi_move_uvec = fvi_move_uvec * *orient; |
| 262 | } |
| 263 | |
| 264 | // step 3: rotate object matrix through view_matrix (vm = ob * vm) |
| 265 | |
| 266 | tempm2 = ~*orient; |
| 267 | |
| 268 | tempm = tempm2 * View_matrix; |
| 269 | |
| 270 | View_matrix = tempm; |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | // instance at specified point with specified orientation |
| 275 | // if angles==NULL, don't modify matrix. This will be like doing an offset |
no outgoing calls
no test coverage detected