/// <summary> /// Compute the transpose of this PerspectiveProjectionMatrix. /// </summary> /// <returns> /// A <see cref="PerspectiveProjectionMatrix"/> which hold the transpose of this PerspectiveProjectionMatrix. /// </returns> public new PerspectiveProjectionMatrix Transpose() { PerspectiveProjectionMatrix transpose = new PerspectiveProjectionMatrix(); // Transpose matrix for (uint c = 0; c < 4; c++) { for (uint r = 0; r < 4; r++) { transpose[r, c] = this[c, r]; } } return(transpose); }
/// <summary> /// PerspectiveProjectionMatrix copy constructor. /// </summary> /// <param name="m"> /// A <see cref="PerspectiveProjectionMatrix"/> to be copied. /// </param> public PerspectiveProjectionMatrix(PerspectiveProjectionMatrix m) : base(m) { }
/// <summary> /// Compute the transpose of this PerspectiveProjectionMatrix. /// </summary> /// <returns> /// A <see cref="PerspectiveProjectionMatrix"/> which hold the transpose of this PerspectiveProjectionMatrix. /// </returns> public new PerspectiveProjectionMatrix Transpose() { PerspectiveProjectionMatrix transpose = new PerspectiveProjectionMatrix(); // Transpose matrix for (uint c = 0; c < 4; c++) for (uint r = 0; r < 4; r++) transpose[r, c] = this[c, r]; return (transpose); }
private void SampleGraphicsControl_Render(object sender, GraphicsControlEventArgs e) { GraphicsContext ctx = e.Context; GraphicsSurface framebuffer = e.Framebuffer; if (_AnimationBegin == DateTime.MinValue) _AnimationBegin = DateTime.UtcNow; PerspectiveProjectionMatrix matrixProjection = new PerspectiveProjectionMatrix(); Matrix4x4 matrixView; // Set projection matrixProjection.SetPerspective(60.0f, (float)ClientSize.Width / (float)ClientSize.Height, 1.0f, 1000.0f); // Set view ModelMatrix matrixViewModel = new ModelMatrix(); matrixViewModel.RotateX(_ViewElevation); matrixViewModel.RotateY(_ViewAzimuth); matrixViewModel.Translate(0.0f, 0.0f, _ViewDistance); matrixView = matrixViewModel.GetInverseMatrix(); _NewtonProgram.Bind(ctx); _NewtonProgram.SetUniform(ctx, "hal_ModelViewProjection", matrixProjection * matrixView); _NewtonProgram.SetUniform(ctx, "hal_FrameTimeInterval", (float)(DateTime.UtcNow - _AnimationBegin).TotalSeconds); _NewtonVertexArray.Draw(ctx, _NewtonProgram); SwapNewtonVertexArrays(); // Issue another rendering SampleGraphicsControl.Invalidate(); }