mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
Provide emulation for vector / float and quaternion / float.
The VM doesn't have such instructions, so emulate them via vector * (1 / float) and quaternion * (1 / float).
This commit is contained in:
parent
dc55034708
commit
732d6a1520
1 changed files with 6 additions and 0 deletions
|
@ -324,6 +324,9 @@ do_op_vector (int op, expr_t *e, expr_t *e1, expr_t *e2)
|
|||
e->e.expr.type = &type_float;
|
||||
} else if (op == '*' && get_type (e2) == &type_vector) {
|
||||
e->e.expr.type = &type_float;
|
||||
} else if (op == '/' && !is_constant (e1)) {
|
||||
e2 = fold_constants (binary_expr ('/', new_float_expr (1), e2));
|
||||
e = fold_constants (binary_expr ('*', e1, e2));
|
||||
} else {
|
||||
e->e.expr.type = &type_vector;
|
||||
}
|
||||
|
@ -553,6 +556,9 @@ do_op_quaternion (int op, expr_t *e, expr_t *e1, expr_t *e2)
|
|||
e->e.expr.type = &type_integer;
|
||||
else
|
||||
e->e.expr.type = &type_float;
|
||||
} else if (op == '/' && !is_constant (e1)) {
|
||||
e2 = fold_constants (binary_expr ('/', new_float_expr (1), e2));
|
||||
e = fold_constants (binary_expr ('*', e1, e2));
|
||||
} else {
|
||||
e->e.expr.type = &type_quaternion;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue