Axiom.Core.Frustum._updateView C# (CSharp) Method

_updateView() protected method

protected _updateView ( ) : void
return void
		protected virtual void _updateView()
		{
			// ----------------------
			// 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 ( !_customViewMatrix )
			{
				Quaternion orientation = GetOrientationForViewUpdate();
				Vector3 position = GetPositionForViewUpdate();
				Matrix3 rotation = orientation.ToRotationMatrix();

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

				// Make final matrix
				_viewMatrix = Matrix4.Identity;
				_viewMatrix = rotT; // fills upper 3x3
				_viewMatrix[ 0, 3 ] = trans.x;
				_viewMatrix[ 1, 3 ] = trans.y;
				_viewMatrix[ 2, 3 ] = trans.z;

				// Deal with reflections
				if ( isReflected )
				{
					_viewMatrix = _viewMatrix * _reflectionMatrix;
				}
			}

			_recalculateView = false;

			// Signal to update frustum clipping planes
			_recalculateFrustumPlanes = true;
			// Signal to update world space corners
			_recalculateWorldSpaceCorners = true;
			// Signal to update frustum if oblique plane enabled,
			// since plane needs to be in view space
			if ( useObliqueDepthProjection )
			{
				_recalculateFrustum = true;
			}
		}