void Frustum::updateViewImpl(void) const
	{
		// ----------------------
		// 更新观察矩阵
		// ----------------------

		// 获取四元数朝向

		if (!mCustomViewMatrix)
		{
			Matrix3 rot;
			const Quaternion& orientation = getOrientationForViewUpdate();
			const Vector3& position = getPositionForViewUpdate();

			mViewMatrix = Math::makeViewMatrix(position, orientation, mReflect ? &mReflectMatrix : 0);
		}

		mRecalcView = false;

		// 标记更新视锥体剪裁平面
		mRecalcFrustumPlanes = true;
		// 标记更新世界空间角
		mRecalcWorldSpaceCorners = true;
		// 标记如果深度斜投影面打开更新视锥体,因为该平面需要在观察空间中
		if (mObliqueDepthProjection)
		{
			mRecalcFrustum = true;
		}
	}
    //-----------------------------------------------------------------------
	void Frustum::updateViewImpl(void) const
	{
		// ----------------------
		// Update the view matrix
		// ----------------------

		// Get orientation from quaternion

		if (!mCustomViewMatrix)
		{
			Matrix3 rot;
			const Quaternion& orientation = getOrientationForViewUpdate();
			const Vector3& position = getPositionForViewUpdate();

			mViewMatrix = Math::makeViewMatrix(position, orientation, mReflect? &mReflectMatrix : 0);
		}

		mRecalcView = false;

		// Signal to update frustum clipping planes
		mRecalcFrustumPlanes = true;
		// Signal to update world space corners
		mRecalcWorldSpaceCorners = true;
		// Signal to update frustum if oblique plane enabled,
		// since plane needs to be in view space
		if (mObliqueDepthProjection)
		{
			mRecalcFrustum = true;
		}
	}
Beispiel #3
0
    //-----------------------------------------------------------------------
	void Frustum::updateViewImpl(void) const
	{
		// ----------------------
		// Update the view matrix
		// ----------------------

		// View matrix is:
		//
		//  [ Lx  Uy  Dz  Tx  ]
		//  [ Lx  Uy  Dz  Ty  ]
		//  [ Lx  Uy  Dz  Tz  ]
		//  [ 0   0   0   1   ]
		//
		// Where T = -(Transposed(Rot) * Pos)

		// This is most efficiently done using 3x3 Matrices

		// Get orientation from quaternion

		if (!mCustomViewMatrix)
		{
			Matrix3 rot;
			const Quaternion& orientation = getOrientationForViewUpdate();
			const Vector3& position = getPositionForViewUpdate();
			orientation.ToRotationMatrix(rot);

			// Make the translation relative to new axes
			Matrix3 rotT = rot.Transpose();
			Vector3 trans = -rotT * position;

			// Make final matrix
			mViewMatrix = Matrix4::IDENTITY;
			mViewMatrix = rotT; // fills upper 3x3
			mViewMatrix[0][3] = trans.x;
			mViewMatrix[1][3] = trans.y;
			mViewMatrix[2][3] = trans.z;

			// Deal with reflections
			if (mReflect)
			{
				mViewMatrix = mViewMatrix * mReflectMatrix;
			}
		}

		mRecalcView = false;

		// Signal to update frustum clipping planes
		mRecalcFrustumPlanes = true;
		// Signal to update world space corners
		mRecalcWorldSpaceCorners = true;
		// Signal to update frustum if oblique plane enabled,
		// since plane needs to be in view space
		if (mObliqueDepthProjection)
		{
			mRecalcFrustum = true;
		}
	}
Beispiel #4
0
	void Frustum::updateViewImpl()const
	{
		if (!mCustomViewMatrix)
		{
			Matrix3 rot;
			const Quaternion& orientation = getOrientationForViewUpdate();
			const Vector3& position = getPositionForViewUpdate();
			mViewMatrix = Math::makeViewMatrix(position, orientation, NULL);
		}
		mRecalcView = FALSE;
	}