Transpose() public méthode

Swap the rows of the matrix with the columns.
public Transpose ( ) : Matrix4
Résultat Matrix4
		/// <summary>
		///    Sends a multiple value constant floating-point parameter to the program.
		/// </summary>
		/// <remarks>
		///     This method is made virtual to allow GpuProgramManagers, or even individual
		///     GpuProgram implementations to supply their own implementation if need be.
		///     An example would be where a Matrix needs to be transposed to row-major format
		///     before passing to the hardware.
		/// </remarks>
		/// <param name="index">Index of the contant register.</param>
		/// <param name="val">Structure containing 3 packed float values.</param>
		public void SetConstant( int index, Matrix4 val )
		{
			Matrix4 mat;

			// transpose the matrix if need be
			if ( transposeMatrices )
			{
				mat = val.Transpose();
			}
			else
			{
				mat = val;
			}

			SetConstant( index++, mat.m00, mat.m01, mat.m02, mat.m03 );
			SetConstant( index++, mat.m10, mat.m11, mat.m12, mat.m13 );
			SetConstant( index++, mat.m20, mat.m21, mat.m22, mat.m23 );
			SetConstant( index, mat.m30, mat.m31, mat.m32, mat.m33 );
		}
		public void WriteRawConstant( int physicalIndex, Matrix4 m, int elementCount )
		{
			var arr = new float[16];
			// remember, raw content access uses raw float count rather than float4
			if ( TransposeMatrices )
			{
				var t = m.Transpose();
				t.MakeFloatArray( arr );
				_writeRawConstants( physicalIndex, arr, elementCount > 16 ? 16 : elementCount );
			}
			else
			{
				m.MakeFloatArray( arr );
				_writeRawConstants( physicalIndex, arr, elementCount > 16 ? 16 : elementCount );
			}
		}
		/// <summary>
		/// Sets the texture matrix for the specified stage.  Used to apply rotations, translations,
		/// and scaling to textures.
		/// </summary>
		public override void SetTextureMatrix(int stage, Matrix4 xform)
		{
			if (texStageDesc[stage].autoTexCoordType == TexCoordCalcMethod.ProjectiveTexture)
			{
				//seems like we have to apply a specific transform when we have the frustum
				//and a projective texture
				//from directx rendersystem

				// Derive camera space to projector space transform
				// To do this, we need to undo the camera view matrix, then 
				// apply the projector view & projection matrices

				//Matrix4 newMat = _viewMatrix.Inverse();
				//texStageDesc[ stage ].frustum.ViewMatrix = texStageDesc[ stage ].frustum.ViewMatrix.Transpose();
				//texStageDesc[stage].frustum.ProjectionMatrix = texStageDesc[stage].frustum.ProjectionMatrix.Transpose();
				//newMat = texStageDesc[ stage ].frustum.ViewMatrix * newMat;
				//newMat = texStageDesc[ stage ].frustum.ProjectionMatrix * newMat;
				//newMat = Matrix4.ClipSpace2DToImageSpace * newMat;
				//xform = xform * newMat;
			}
#if AXIOM_FF_EMULATION
			_ffProgramParameters.SetTextureMatrix( stage, xform.Transpose() );
#endif
		}
		public void SetConstant( int index, Matrix4 mat )
		{
			var a = new float[16];

			// set as 4x 4-element floats
			if ( TransposeMatrices )
			{
				mat.Transpose().MakeFloatArray( a );
			}
			else
			{
				mat.MakeFloatArray( a );
			}

			SetConstant( index, a, 4 );
		}
		private void MakeGLMatrix( ref Matrix4 matrix, float[] floats )
		{
			var mat = matrix.Transpose();
			mat.MakeFloatArray( floats );
		}