The Library is where code samples, building blocks of scripts will be shared.
matrixworld: item,time // m { // call before matrixtransformworld() vnRight = item.getRight(time); // Right m[1][1] = vnRight.x; m[1][2] = vnRight.y; m[1][3] = vnRight.z; m[1][4] = 0.0; vnUp = item.getUp(time); // Up m[2][1] = vnUp.x; m[2][2] = vnUp.y; m[2][3] = vnUp.z; m[2][4] = 0.0; vnForward = item.getForward(time); // Forward m[3][1] = vnForward.x; m[3][2] = vnForward.y; m[3][3] = vnForward.z; m[3][4] = 0.0; vWorldPosition = item.getWorldPosition(time); // World Position m[4][1] = vWorldPosition.x; m[4][2] = vWorldPosition.y; m[4][3] = vWorldPosition.z; m[4][4] = 1.0; return(m); } matrixinverseworld: item,time // m { // call before matrixtransformlocal() vnRight = item.getRight(time); // Right m[1][1] = vnRight.x; m[1][2] = vnRight.y; m[1][3] = vnRight.z; m[1][4] = 0.0; vnUp = item.getUp(time); // Up m[2][1] = vnUp.x; m[2][2] = vnUp.y; m[2][3] = vnUp.z; m[2][4] = 0.0; vnForward = item.getForward(time); // Forward m[3][1] = vnForward.x; m[3][2] = vnForward.y; m[3][3] = vnForward.z; m[3][4] = 0.0; vWorldPosition = item.getWorldPosition(time); // World Position m[4][1] = -vWorldPosition.x; m[4][2] = -vWorldPosition.y; m[4][3] = -vWorldPosition.z; m[4][4] = 1.0; return(m); } matrixtransformworld: v,m // v { // call after matrixworld() _v = <0.0,0.0,0.0>; _v.x = m[1][1] * v.x + m[2][1] * v.y + m[3][1] * v.z + m[4][1]; _v.y = m[1][2] * v.x + m[2][2] * v.y + m[3][2] * v.z + m[4][2]; _v.z = m[1][3] * v.x + m[2][3] * v.y + m[3][3] * v.z + m[4][3]; return(_v); } matrixtransformlocal: v,m // v { // call after matrixinverseworld() _v = <0.0,0.0,0.0>; v.x += m[4][1]; v.y += m[4][2]; v.z += m[4][3]; _v.x = m[1][1] * v.x + m[2][1] * v.y + m[3][1] * v.z; _v.y = m[1][2] * v.x + m[2][2] * v.y + m[3][2] * v.z; _v.z = m[1][3] * v.x + m[2][3] * v.y + m[3][3] * v.z; return(_v); }
No comments:
Post a Comment