Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Media3D / ProjectionCamera.cs / 1 / ProjectionCamera.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // //--------------------------------------------------------------------------- using System; namespace System.Windows.Media.Media3D { ////// The ProjectionCamera is an abstract base class from cameras /// constructed from well-understand parameers such as Position, /// LookAtPoint, and Up. /// public abstract partial class ProjectionCamera : Camera { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- ////// Prevent 3rd parties from extending this abstract base class. /// internal ProjectionCamera() { } //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- //------------------------------------------------------ // // Public Properties // //------------------------------------------------------ //----------------------------------------------------- // // Public Events // //------------------------------------------------------ //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods internal override Matrix3D GetViewMatrix() { Point3D position = Position; Vector3D lookDirection = LookDirection; Vector3D upDirection = UpDirection; return CreateViewMatrix(Transform, ref position, ref lookDirection, ref upDirection); } // Transfrom that moves the world to a camera coordinate system // where the camera is at the origin looking down the negative z // axis and y is up. // // NOTE: We consider camera.Transform to be part of the view matrix. // internal static Matrix3D CreateViewMatrix(Transform3D transform, ref Point3D position, ref Vector3D lookDirection, ref Vector3D upDirection) { Vector3D zaxis = -lookDirection; zaxis.Normalize(); Vector3D xaxis = Vector3D.CrossProduct(upDirection, zaxis); xaxis.Normalize(); Vector3D yaxis = Vector3D.CrossProduct(zaxis, xaxis); Vector3D positionVec = (Vector3D) position; double cx = -Vector3D.DotProduct(xaxis, positionVec); double cy = -Vector3D.DotProduct(yaxis, positionVec); double cz = -Vector3D.DotProduct(zaxis, positionVec); Matrix3D viewMatrix = new Matrix3D( xaxis.X, yaxis.X, zaxis.X, 0, xaxis.Y, yaxis.Y, zaxis.Y, 0, xaxis.Z, yaxis.Z, zaxis.Z, 0, cx, cy, cz, 1); PrependInverseTransform(transform, ref viewMatrix); return viewMatrix; } #endregion Internal Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // //--------------------------------------------------------------------------- using System; namespace System.Windows.Media.Media3D { ////// The ProjectionCamera is an abstract base class from cameras /// constructed from well-understand parameers such as Position, /// LookAtPoint, and Up. /// public abstract partial class ProjectionCamera : Camera { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- ////// Prevent 3rd parties from extending this abstract base class. /// internal ProjectionCamera() { } //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- //------------------------------------------------------ // // Public Properties // //------------------------------------------------------ //----------------------------------------------------- // // Public Events // //------------------------------------------------------ //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods internal override Matrix3D GetViewMatrix() { Point3D position = Position; Vector3D lookDirection = LookDirection; Vector3D upDirection = UpDirection; return CreateViewMatrix(Transform, ref position, ref lookDirection, ref upDirection); } // Transfrom that moves the world to a camera coordinate system // where the camera is at the origin looking down the negative z // axis and y is up. // // NOTE: We consider camera.Transform to be part of the view matrix. // internal static Matrix3D CreateViewMatrix(Transform3D transform, ref Point3D position, ref Vector3D lookDirection, ref Vector3D upDirection) { Vector3D zaxis = -lookDirection; zaxis.Normalize(); Vector3D xaxis = Vector3D.CrossProduct(upDirection, zaxis); xaxis.Normalize(); Vector3D yaxis = Vector3D.CrossProduct(zaxis, xaxis); Vector3D positionVec = (Vector3D) position; double cx = -Vector3D.DotProduct(xaxis, positionVec); double cy = -Vector3D.DotProduct(yaxis, positionVec); double cz = -Vector3D.DotProduct(zaxis, positionVec); Matrix3D viewMatrix = new Matrix3D( xaxis.X, yaxis.X, zaxis.X, 0, xaxis.Y, yaxis.Y, zaxis.Y, 0, xaxis.Z, yaxis.Z, zaxis.Z, 0, cx, cy, cz, 1); PrependInverseTransform(transform, ref viewMatrix); return viewMatrix; } #endregion Internal Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextServicesDisplayAttribute.cs
- SoapExtension.cs
- DbProviderServices.cs
- RemoteWebConfigurationHost.cs
- SqlDataSourceDesigner.cs
- IconConverter.cs
- InitializationEventAttribute.cs
- ConfigXmlComment.cs
- ObjectViewQueryResultData.cs
- RsaKeyIdentifierClause.cs
- FormattedTextSymbols.cs
- SubpageParaClient.cs
- ResourcesBuildProvider.cs
- ExtenderControl.cs
- EventMappingSettings.cs
- XsltConvert.cs
- NetCodeGroup.cs
- TransformerConfigurationWizardBase.cs
- Int16Storage.cs
- SessionEndingEventArgs.cs
- XmlSchemaDocumentation.cs
- Control.cs
- VisualTreeUtils.cs
- RuntimeCompatibilityAttribute.cs
- TemporaryBitmapFile.cs
- _emptywebproxy.cs
- DataGridViewComboBoxCell.cs
- MultipartContentParser.cs
- RelationshipManager.cs
- SessionChannels.cs
- LingerOption.cs
- QilXmlReader.cs
- UpnEndpointIdentity.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- SchemaObjectWriter.cs
- columnmapkeybuilder.cs
- Transform.cs
- ToolStripHighContrastRenderer.cs
- NavigationProgressEventArgs.cs
- SerializerProvider.cs
- RegexTree.cs
- TemplateContent.cs
- DynamicHyperLink.cs
- SafeSerializationManager.cs
- ParameterSubsegment.cs
- ItemsChangedEventArgs.cs
- XmlAnyElementAttribute.cs
- ReaderWriterLock.cs
- SmiEventSink_Default.cs
- SessionStateContainer.cs
- ColorTransform.cs
- GPPOINT.cs
- MatrixTransform3D.cs
- remotingproxy.cs
- ListMarkerLine.cs
- JsonByteArrayDataContract.cs
- OpenTypeLayoutCache.cs
- HttpConfigurationSystem.cs
- OneOfScalarConst.cs
- CodeCatchClause.cs
- PropertyGeneratedEventArgs.cs
- QueryStringParameter.cs
- SerializationInfo.cs
- Parser.cs
- ImageClickEventArgs.cs
- UidManager.cs
- FontUnitConverter.cs
- TripleDES.cs
- SQLBinary.cs
- ApplicationId.cs
- MenuCommandService.cs
- InternalResources.cs
- WebBrowser.cs
- PermissionRequestEvidence.cs
- InitializerFacet.cs
- Context.cs
- HttpFileCollection.cs
- SqlCommand.cs
- TrustManagerPromptUI.cs
- ToolStripLabel.cs
- CancelEventArgs.cs
- Icon.cs
- CachedBitmap.cs
- MetafileHeaderWmf.cs
- ToolStripDropTargetManager.cs
- FixedSOMTableRow.cs
- BehaviorEditorPart.cs
- PropertyEmitter.cs
- HighlightVisual.cs
- ViewCellSlot.cs
- TypePropertyEditor.cs
- ProgressBar.cs
- EdmScalarPropertyAttribute.cs
- MarkupExtensionParser.cs
- SqlHelper.cs
- TableNameAttribute.cs
- updatecommandorderer.cs
- CallbackValidator.cs
- PingReply.cs
- ContentFileHelper.cs