Quaternion structure and math ops
This commit is contained in:
parent
802f77ab19
commit
540f778047
11 changed files with 243 additions and 24 deletions
|
|
@ -1887,7 +1887,22 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
ASSERTF(B+3); ASSERTKF(C+3);
|
||||
fcp = &konstf[C];
|
||||
goto Do_EQV4;
|
||||
|
||||
OP(MULQV3_RR):
|
||||
ASSERTF(a + 2); ASSERTF(B + 3); ASSERTF(C + 2);
|
||||
{
|
||||
const DQuaternion& q = reinterpret_cast<DQuaternion&>(reg.f[B]);
|
||||
const DVector3& v = reinterpret_cast<DVector3&>(reg.f[C]);
|
||||
reinterpret_cast<DVector3&>(reg.f[A]) = q * v;
|
||||
}
|
||||
NEXTOP;
|
||||
OP(MULQQ_RR):
|
||||
ASSERTF(a + 3); ASSERTF(B + 3); ASSERTF(C + 3);
|
||||
{
|
||||
const DQuaternion& q1 = reinterpret_cast<DQuaternion&>(reg.f[B]);
|
||||
const DQuaternion& q2 = reinterpret_cast<DQuaternion&>(reg.f[C]);
|
||||
reinterpret_cast<DQuaternion&>(reg.f[A]) = q1 * q2;
|
||||
}
|
||||
NEXTOP;
|
||||
OP(ADDA_RR):
|
||||
ASSERTA(a); ASSERTA(B); ASSERTD(C);
|
||||
c = reg.d[C];
|
||||
|
|
|
|||
|
|
@ -278,6 +278,10 @@ xx(LENV4, lenv4, RFRV, NOP, 0, 0) // fA = vB.Length
|
|||
xx(EQV4_R, beqv4, CVRR, NOP, 0, 0) // if ((vB == vkC) != A) then pc++ (inexact if A & 33)
|
||||
xx(EQV4_K, beqv4, CVRK, NOP, 0, 0) // this will never be used.
|
||||
|
||||
// Quaternion math
|
||||
xx(MULQQ_RR, mulqq, RVRVRV, NOP, 0, 0) // qA = qB * qC
|
||||
xx(MULQV3_RR, mulqv3, RVRVRV, NOP, 0, 0) // qA = qB * vC
|
||||
|
||||
// Pointer math.
|
||||
xx(ADDA_RR, add, RPRPRI, NOP, 0, 0) // pA = pB + dkC
|
||||
xx(ADDA_RK, add, RPRPKI, ADDA_RR,4, REGT_INT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue