Add vec = quat * vec to the progs engine.

This commit is contained in:
Bill Currie 2012-04-26 10:29:21 +09:00
parent 0a22a98b60
commit 1a0ccf6a92
3 changed files with 9 additions and 1 deletions

View file

@ -270,6 +270,7 @@ typedef enum {
OP_MUL_Q,
OP_MUL_QF,
OP_MUL_FQ,
OP_MUL_QV,
OP_CONJ_Q,
OP_NOT_Q,
OP_EQ_Q,
@ -362,7 +363,7 @@ typedef struct pr_va_list_s {
|(((0x##b) & 0xfff) << 12) \
|(((0x##c) & 0xfff) << 0) )
#define PROG_ID_VERSION 6
#define PROG_VERSION PROG_VERSION_ENCODE(0,fff,008)
#define PROG_VERSION PROG_VERSION_ENCODE(0,fff,009)
typedef struct dprograms_s {
pr_uint_t version;

View file

@ -431,6 +431,9 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
case OP_MUL_Q:
QuatMult (OPA.quat_var, OPB.quat_var, OPC.quat_var);
break;
case OP_MUL_QV:
QuatMultVec (OPA.quat_var, OPB.vector_var, OPC.vector_var);
break;
case OP_MUL_FQ:
QuatScale (OPB.quat_var, OPA.float_var, OPC.quat_var);
break;

View file

@ -128,6 +128,10 @@ VISIBLE opcode_t pr_opcodes[] = {
ev_quat, ev_float, ev_quat,
PROG_VERSION,
},
{"*", "mul.qv", OP_MUL_QV, false,
ev_quat, ev_vector, ev_vector,
PROG_VERSION,
},
{"~", "conj.q", OP_CONJ_Q, false,
ev_quat, ev_invalid, ev_quat,