void LLCamera::calculateWorldFrustumPlanes() { F32 d; LLVector3 center = mOrigin - mXAxis*mNearPlane; mWorldPlanePos = center; for (int p=0; p<4; p++) { LLVector3 pnorm = LLVector3(mLocalPlanes[p]); LLVector3 norm = rotateToAbsolute(pnorm); norm.normVec(); d = -(center * norm); mWorldPlanes[p] = LLPlane(norm, d); } // horizontal planes, perpindicular to (0,0,1); LLVector3 zaxis(0, 0, 1.0f); F32 yaw = getYaw(); { LLVector3 tnorm = LLVector3(mLocalPlanes[PLANE_LEFT]); tnorm.rotVec(yaw, zaxis); d = -(mOrigin * tnorm); mHorizPlanes[HORIZ_PLANE_LEFT] = LLPlane(tnorm, d); } { LLVector3 tnorm = LLVector3(mLocalPlanes[PLANE_RIGHT]); tnorm.rotVec(yaw, zaxis); d = -(mOrigin * tnorm); mHorizPlanes[HORIZ_PLANE_RIGHT] = LLPlane(tnorm, d); } }
LLVector4 LLCoordFrame::transformToAbsolute(const LLVector4 &local_vector) const { LLVector4 absolute_vector; absolute_vector = rotateToAbsolute(local_vector); absolute_vector.mV[VX] += mOrigin.mV[VX]; absolute_vector.mV[VY] += mOrigin.mV[VY]; absolute_vector.mV[VZ] += mOrigin.mV[VZ]; return absolute_vector; }
LLVector3 LLCoordFrame::transformToAbsolute(const LLVector3 &local_vector) const { return (rotateToAbsolute(local_vector) + mOrigin); }