Base |
public abstract class BaseCamera : FrameworkElement, ICompositionRenderingSubscriber
The BaseCamera type exposes the following members.
Name | Description | |
---|---|---|
AnimationController | Gets an AnimationController that is used to animate this camera. When this AnimationController is used to animate the camera, it is possible to control if MouseCameraController can stop the animation when user starts camera rotation or movement by mouse or touch. This is controller with the IsCameraAnimationStoppedOnUserAction property (by default set to true to stop the animation on user action). | |
CameraLight | Gets or sets a Light that is used as a Camera Light. The default value is White DirectionalLight. | |
CameraType | Gets or sets a type of camera. The default camera type value is PerspectiveCamera. The camera type can be also OrthographicCamera. | |
CameraWidth | Gets or sets the width of the camera's viewing box. The property is used when the camera type is set to OrthographicCamera. | |
CurrentCamera | Gets the WPF's ProjectionCamera that is controlled by this Camera. | |
FarPlaneDistance | Gets or sets a value that specifies the distance from the camera of the camera's far clip plane. This is a dependency property. | |
FieldOfView | Gets or sets a value that represents the camera's horizontal field of view in degrees. The property is used when the camera type is set to PerspectiveCamera. Default value is 45 degrees. | |
IsAutoViewport3DFindingEnabled | Gets or sets a Boolean which specifies that if the TargetViewport3D property is not manually set the first Viewport3D is automatically find from the current UserControl, Page or Window. Default value is true. | |
IsDesignTime | Gets a Boolean that specifies if design time is used. | |
IsDesignTimeInfoIconShown | Gets or sets a Boolean that specifies if Camera info icon is visible in design time. Default value is true. | |
IsRotating | Gets or sets a boolean that specifies if the camera is currently being animated. | |
LookDirection | Gets a Vector3D which defines the look direction of the camera. | |
NearPlaneDistance | Gets or sets a value that specifies the distance from the camera of the camera's near clip plane. This is a dependency property. | |
Offset | Gets or sets a Vector3D that specifies an offset of the camera's position. | |
ShowCameraLight | Gets or sets a ShowCameraLightType that specifies when the Cameras light is shown. The default value is ShowCameraLightType.Auto. | |
TargetViewport3D | Gets or sets a Viewport3D whose Camera is controlled by this Ab3d.Camera. | |
TargetViewport3DName | Gets or sets a name of the Viewport3D whose Camera is controlled by this Ab3d.Camera. | |
UpDirection | Gets a Vector3D that represents the upward direction in the scene projection. |
Name | Description | |
---|---|---|
ArrangeOverride |
override ArrangeOverride - used to display design time info
(Overrides FrameworkElementArrangeOverride(Size)) | |
BaseCreateFrom | This method is called from CreateFrom method and actually sets the properties on this camera. | |
BeginCameraUpdate | BeginCameraUpdate method must be called in each UpdateCamera method, to ensure that the CameraChanged event is fired after all the UpdateCamera methods in all child cameras are called. | |
BeginInit |
BeginInit
(Overrides FrameworkElementBeginInit) | |
CameraPropertyChanged | Called when a property that updates the camera is changed | |
CameraTypePropertyPropertyChanged | Called when CameraType is changed | |
CameraWidthPropertyChanged | Called when CameraWidth is changed | |
ConvertToWpfCamera | ConvertToWpfCamera method converts Ab3d.PowerToys camera to a standard WPF camera. | |
CreateFrom | Creates an Ab3d.Camera from a WPF's Camera. | |
CreateMouseRay3D(Point, Point3D, Vector3D) | CreateMouseRay3D calculates the 3D ray that goes from the mouse position into the 3D scene. The ray goes from rayOrigin in the rayDirection. If the ray cannot be calculated this method returns false. | |
CreateMouseRay3D(Point, Size, Matrix3D, Matrix3D, Point3D, Vector3D) | Obsolete. CreateMouseRay3D calculates a normalized 3D ray that goes from the mouse position into the 3D scene. The ray goes from rayOrigin in the rayDirection. If the ray cannot be calculated this method returns false. | |
CreateNewCamera(BaseCameraCameraTypes) | Creates a new Camera for the cameraType. | |
CreateNewCamera(Viewport3D) | Creates a new Camera for the viewport3D | |
CreateNewCamera(Viewport3D, BaseCameraCameraTypes) | Creates a new Camera for the viewport3D and cameraType. | |
CreateOrthographicMouseRay3D | CreateOrthographicMouseRay3D is used for orthographic camera and calculates a normalized 3D ray that goes from the mouse position into the 3D scene for an Orthographic camera. The ray goes from rayOrigin in the rayDirection. If the ray cannot be calculated this method returns false. For perspective camera use CreatePerspectiveMouseRay3D(Point, Size, Matrix3D, Matrix3D, Point3D, Vector3D) or use non-static CreateMouseRay3D(Point, Point3D, Vector3D) method. | |
CreatePerspectiveMouseRay3D | CreatePerspectiveMouseRay3D is used for perspective camera and calculates a normalized 3D ray that goes from the mouse position into the 3D scene. The ray goes from rayOrigin in the rayDirection. If the ray cannot be calculated this method returns false. For orthographic camera use CreateOrthographicMouseRay3D(Point, Size, Point3D, Vector3D, Vector3D, Double, Double, Point3D, Vector3D) or use non-static CreateMouseRay3D(Point, Point3D, Vector3D) method. | |
EndCameraUpdate | EndCameraUpdate method must be called in each UpdateCamera method, to ensure that the CameraChanged event is fired after all the UpdateCamera methods in all child cameras are called. | |
EndInit |
EndInit
(Overrides FrameworkElementEndInit) | |
FarPlaneDistancePropertyChanged | Called when FarPlaneDistance is changed | |
FieldOfViewPropertyChanged | Called when FieldOfView is changed | |
ForceRefresh | Forces a refresh of the camera. | |
GetCameraMatrices(Matrix3D, Matrix3D) | GetCameraMatrices gets view and projection matrix of the current camera. | |
GetCameraMatrices(Viewport3D, Matrix3D, Matrix3D) | GetCameraMatrices gets view and projection matrix of the camera used by the specified viewport3D. | |
GetCameraMatrices(BaseCamera, Double, Matrix3D, Matrix3D) | GetCameraMatrices gets view and projection matrix of specified Ab3d.PowerToys camera and specified viewport's aspect ratio. The method sets matrices even if TargetViewport3D is not assigned to the camera. | |
GetCameraMatrices(Camera, Double, Matrix3D, Matrix3D) | GetCameraMatrices gets view and projection matrix of specified camera and specified viewport's aspect ratio. | |
GetCameraMatrixes(Matrix3D, Matrix3D) | GetCameraMatrixes gets view and projection matrix of the current camera. | |
GetCameraMatrixes(Viewport3D, Matrix3D, Matrix3D) | GetCameraMatrixes gets view and projection matrix of the camera used by the specified viewport3D. | |
GetCameraMatrixes(BaseCamera, Double, Matrix3D, Matrix3D) | GetCameraMatrixes gets view and projection matrix of specified Ab3d.PowerToys camera and specified viewport's aspect ratio. The method sets matrixes even if TargetViewport3D is not assigned to the camera. | |
GetCameraMatrixes(Camera, Double, Matrix3D, Matrix3D) | GetCameraMatrixes gets view and projection matrix of specified camera and specified viewport's aspect ratio. | |
GetCameraPlaneOrientation(Vector3D, Vector3D, Vector3D) | GetCameraPlaneOrientation gets plane's width and height vectors that can be used to orient the plane 3D model so that it is aligned with the camera view. | |
GetCameraPlaneOrientation(ProjectionCamera, Vector3D, Vector3D, Vector3D) | GetCameraPlaneOrientation sets plane width and height vectors that can be used to orient the plane 3D model so that it is aligned with the camera view. | |
GetCameraPosition | Gets the position of the camera. | |
GetMousePositionOnPlane | GetMousePositionOnPlane calculates a position where a ray from mouse position intersects a plane. Returns false if there is no intersection. | |
GetScreenSize | GetScreenSize calculates a size on screen (in same units as size of Viewport3D.Width - without DPI scale) of a Size in 3D space (worldSize) that is at distanceFromCamera and shown with this camera and in TargetViewport3D. | |
GetTargetViewport3DSceneBounds | Returns a Rect3D that represents the bounding box of the 3D scene defined in the TargetViewport3D. | |
GetWorldSize | GetWorldSize calculates a size in 3D world coordinates from a size provided in 2D screen coordinates. The calculation is based on the this camera and the screen size of TargetViewport3D. | |
GetWorldToViewportMatrix | Gets Matrix3D that can be used to convert 3D coordinates to 2D viewport (screen) coordinates. If the method returns true, than the worldToViewportMatrix was set; if false is returned than the matrix cannot be calculated. | |
GetWPFCameraDirections | The method gets lookDirection and upDirection from WPF's camera | |
GetWPFCameraPosition | Returns a Position of the WPF camera. | |
InitInfoElement | Initializes the info element that is used for design time support | |
IsDesignTimeInfoIconShownPropertyChanged | Called when IsDesignTimeInfoIconShown is changed | |
IsValid | Gets a Boolean that specifies if the camera is valid (has TargetViewport3D that has a valid size; has valid values for all properties). When camera is valid the Point3DTo2D(Point3D) returns correct value; when the camera is not valid, the Point3DTo2D method cannot calculate the 2D screen position. | |
Line3DTo2D(Point3D, Point3D, Point, Point) | Converts a 3D line that is defined by startPositionWorld and endPositionWorld to a line on the screen that is defined by startPositionScreen and endPositionScreen. This method correctly handles the case when the 3D line crosses the camera near plane (goes behind the camera). In this case the line needs to be cropped at the camera near plane. | |
Line3DTo2D(Point3D, Point3D, Size, Point, Point) | Converts a 3D line that is defined by startPositionWorld and endPositionWorld to a line on the screen that is defined by startPositionScreen and endPositionScreen. The method takes a custom Viewport3D size and does not require that this Camera class is connected to real Viewport3D. This method correctly handles the case when the 3D line crosses the camera near plane (goes behind the camera). In this case the line needs to be cropped at the camera near plane. | |
MeasureOverride |
override MeasureOverride - used to display design time info
(Overrides FrameworkElementMeasureOverride(Size)) | |
NearPlaneDistancePropertyChanged | Called when NearPlaneDistance is changed | |
OnCameraChanged | Called to raise CameraChangedRoutedEvent | |
OnCameraLoaded | OnCameraLoaded methods ensures that the CurrentCamera is set | |
OnIsRotatingChanged | OnIsRotatingChanged is caled to fire IsRotatingChanged event. | |
OnIsValidChanged | OnIsValidChanged is called on IsValidChanged event. The event is subscribed by calling SubscribeToIsValidChanged and unsubscribed by calling UnsubscribeFromIsValidChanged. | |
OnPreviewCameraChanged | OnPreviewCameraChanged calls the PreviewCameraChangedEvent routed event. | |
OnRender |
OnRender
(Overrides UIElementOnRender(DrawingContext)) | |
OnRendering | Called when Rendering event is subscribed | |
OnTargetViewport3DChanged | OnTargetViewport3DChanged is called when the TargetViewport3D is changed | |
Point3DTo2D(Point3D) | Converts a Point3D to the Point 2D on the screen. | |
Point3DTo2D(Point3D, Size) | Converts a Point3D to the Point 2D on the screen with custom Viewport3D size (no need that this Camera class is connected to real Viewport3D) | |
Points3DTo2D(IListPoint3D, Point, Transform3D, Boolean) | Points3DTo2D calculates 2D screen positions from the specified 3D positions. Calculated screen positions are stored into the specified points2D array (its size must be at least the size of the 3D positions). | |
Points3DTo2D(Point3D, Point, Transform3D, Boolean) | Points3DTo2D calculates 2D screen positions from the specified 3D positions. Calculated screen positions are stored into the specified points2D array (its size must be at least the size of the 3D positions). | |
Rect3DTo2D | Converts a Rect3D to the Rect 2D on the screen. | |
Refresh | Refresh method refreshes the camera. | |
RefreshCurrentCamera | Refreshes the CurrentCamera - check if TargetViewport3D is null and tries to find it, also creates a new camera is necessary | |
RenderToBitmap(Brush, Int32) | Renders TargetViewport3D to bitmap with specified backgroundBrush and dpi. The size of the created bitmap is the same as the size of the TargetViewport3D. | |
RenderToBitmap(Int32, Int32, Int32, Brush, Int32) | Renders TargetViewport3D to bitmap. It is possible to specify custom bitmap width and height (when customWidth and customHeight are bigger than 0). When antialiasingLevel is bigger than 1, the bitmap is rendered into bigger image and than scaled down to create an antialiasing effect. | |
RotateCamera | Rotates the camera for the specified heading and attitude | |
StartRotation(Double, Double) | StartRotation method immediately starts Heading and Attitude animation for this camera. To slowly start the camera rotation and than accelerating the rotation, use the StartRotation(Double, Double, Double, BaseCameraEasingFunctionDelegate) method. | |
StartRotation(Double, Double, Double, BaseCameraEasingFunctionDelegate) | StartRotation method slowly starts the camera rotation (changing Heading and Attitude) and than accelerates the rotation. To immediately start rotation for this camera, use the StartRotation(Double, Double) method. | |
StopRotation | StopRotation immediately stops the animation of the camera. To slowly stop the camera rotation with preserving the camera's inertia, use the StopRotation(Double, BaseCameraEasingFunctionDelegate) method. | |
StopRotation(Double, BaseCameraEasingFunctionDelegate) | StopRotation slowly stops the animation of the camera with preserving the rotation inertia. | |
SubscribeRenderingEvent | Subscribe to Rendering event | |
SubscribeToIsValidChanged | SubscribeToIsValidChanged | |
TargetViewport3DPropertyChanged | Called when a property that updates the camera is changed | |
TryToUpdate | Update the Camera if it is already initialized and is not in a batch updated (using BeginInit) | |
UnsubscribeFromIsValidChanged | UnsubscribeFromIsValidChanged | |
UnsubscribeRenderingEvent | Unsubscribe to Rendering event | |
UpdateCamera | Updates the CurrentCamera | |
UpdateCameraLight | Updates the camera light if needed | |
UpdateCameraLightData | Updates the CameraLight based on the current camera position | |
UpdateWorldToViewportMatrix | Updates the worldToViewportMatrix if needed | |
UpdateWpfCamera | UpdateWpfCamera method updates the specified WPF camera from this Ab3d.PowerToys camera. |
Name | Description | |
---|---|---|
CameraChanged | Notify that the current camera has changed | |
IsRotatingChanged | IsRotatingChanged event is fired when the IsRotating is changed. | |
IsValidChanged | Notify that camera has become valid (for example after the size of the TargetViewport3D is set) or invalid. To get the new state of the camera, call the IsValid(Boolean) method. | |
PreviewCameraChanged | Notify that the current camera is about to change - user can set Handled property to true to prevent the change. |
Name | Description | |
---|---|---|
CameraChangedEvent | CameraChangedChangedEvent | |
CameraLightProperty | CameraLightProperty | |
CameraTypeProperty | CameraTypeProperty | |
CameraWidthProperty | FieldOfViewProperty | |
FarPlaneDistanceProperty | FarPlaneDistanceProperty | |
FieldOfViewProperty | FieldOfViewProperty | |
infoElement | info element that is displayed in design time | |
IsAutoViewport3DFindingEnabledProperty | IsAutoViewport3DFindingEnabledProperty | |
IsDesignTimeInfoIconShownProperty | IsDesignTimeInfoIconShownProperty | |
isDirty | if true the camera needs to be recalculated | |
isInitializing | if true the camera is being initialized | |
isWorldToViewportMatrixDirty | if true the worldToViewportMatrix needs to be recalculated. Used for Point3DTo2D and Rect3DTo2D. | |
isworldToViewportMatrixValid | if false the WorldToViewportMatrix cannot be calculated (is not invertible, etc.) Used for Point3DTo2D and Rect3DTo2D. | |
NearPlaneDistanceProperty | NearPlaneDistanceProperty | |
OffsetProperty | OffsetProperty | |
PreviewCameraChangedEvent | PreviewCameraChangedEvent | |
ShowCameraLightProperty | ShowCameraLightProperty | |
TargetViewport3DNameProperty | TargetViewport3DNameProperty | |
TargetViewport3DProperty | TargetViewport3DProperty | |
worldToViewportMatrix | WordlsToViewport matrix. Used for Point3DTo2D and Rect3DTo2D. |