Click or drag to resize
AB4D logo

BaseCamera Methods

The BaseCamera type exposes the following members.

Methods
 NameDescription
Protected methodArrangeOverride override ArrangeOverride - used to display design time info
(Overrides FrameworkElementArrangeOverride(Size))
Protected methodBaseCreateFrom This method is called from CreateFrom method and actually sets the properties on this camera.
Protected methodBeginCameraUpdate 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.
Public methodBeginInit BeginInit
(Overrides FrameworkElementBeginInit)
Protected methodStatic memberCameraPropertyChanged Called when a property that updates the camera is changed
Protected methodStatic memberCameraTypePropertyPropertyChanged Called when CameraType is changed
Protected methodStatic memberCameraWidthPropertyChanged Called when CameraWidth is changed
Public methodConvertToWpfCamera ConvertToWpfCamera method converts Ab3d.PowerToys camera to a standard WPF camera.
Public methodCreateFrom Creates an Ab3d.Camera from a WPF's Camera.
Public methodCreateMouseRay3D(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.
Public methodStatic memberCreateMouseRay3D(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.
Protected methodCreateNewCamera(BaseCameraCameraTypes) Creates a new Camera for the cameraType.
Protected methodCreateNewCamera(Viewport3D) Creates a new Camera for the viewport3D
Protected methodCreateNewCamera(Viewport3D, BaseCameraCameraTypes) Creates a new Camera for the viewport3D and cameraType.
Public methodStatic memberCreateOrthographicMouseRay3D 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.
Public methodStatic memberCreatePerspectiveMouseRay3D 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.
Protected methodEndCameraUpdate 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.
Public methodEndInit EndInit
(Overrides FrameworkElementEndInit)
Protected methodStatic memberFarPlaneDistancePropertyChanged Called when FarPlaneDistance is changed
Protected methodStatic memberFieldOfViewPropertyChanged Called when FieldOfView is changed
Protected methodForceRefresh Forces a refresh of the camera.
Public methodGetCameraMatrices(Matrix3D, Matrix3D) GetCameraMatrices gets view and projection matrix of the current camera.
Public methodStatic memberGetCameraMatrices(Viewport3D, Matrix3D, Matrix3D) GetCameraMatrices gets view and projection matrix of the camera used by the specified viewport3D.
Public methodStatic memberGetCameraMatrices(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.
Public methodStatic memberGetCameraMatrices(Camera, Double, Matrix3D, Matrix3D) GetCameraMatrices gets view and projection matrix of specified camera and specified viewport's aspect ratio.
Public methodGetCameraMatrixes(Matrix3D, Matrix3D) GetCameraMatrixes gets view and projection matrix of the current camera.
Public methodStatic memberGetCameraMatrixes(Viewport3D, Matrix3D, Matrix3D) GetCameraMatrixes gets view and projection matrix of the camera used by the specified viewport3D.
Public methodStatic memberGetCameraMatrixes(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.
Public methodStatic memberGetCameraMatrixes(Camera, Double, Matrix3D, Matrix3D) GetCameraMatrixes gets view and projection matrix of specified camera and specified viewport's aspect ratio.
Public methodGetCameraPlaneOrientation(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.
Public methodStatic memberGetCameraPlaneOrientation(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.
Public methodGetCameraPosition Gets the position of the camera.
Public methodGetMousePositionOnPlane GetMousePositionOnPlane calculates a position where a ray from mouse position intersects a plane. Returns false if there is no intersection.
Public methodGetScreenSize 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.
Public methodGetTargetViewport3DSceneBounds Returns a Rect3D that represents the bounding box of the 3D scene defined in the TargetViewport3D.
Public methodGetWorldSize 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.
Public methodGetWorldToViewportMatrix 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.
Protected methodGetWPFCameraDirections The method gets lookDirection and upDirection from WPF's camera
Protected methodGetWPFCameraPosition Returns a Position of the WPF camera.
Protected methodInitInfoElement Initializes the info element that is used for design time support
Protected methodStatic memberIsDesignTimeInfoIconShownPropertyChanged Called when IsDesignTimeInfoIconShown is changed
Public methodIsValid 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.
Public methodLine3DTo2D(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.
Public methodLine3DTo2D(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.
Protected methodMeasureOverride override MeasureOverride - used to display design time info
(Overrides FrameworkElementMeasureOverride(Size))
Protected methodStatic memberNearPlaneDistancePropertyChanged Called when NearPlaneDistance is changed
Protected methodOnCameraChanged Called to raise CameraChangedRoutedEvent
Protected methodOnCameraLoaded OnCameraLoaded methods ensures that the CurrentCamera is set
Protected methodOnIsRotatingChanged OnIsRotatingChanged is caled to fire IsRotatingChanged event.
Protected methodOnIsValidChanged OnIsValidChanged is called on IsValidChanged event. The event is subscribed by calling SubscribeToIsValidChanged and unsubscribed by calling UnsubscribeFromIsValidChanged.
Protected methodOnPreviewCameraChanged OnPreviewCameraChanged calls the PreviewCameraChangedEvent routed event.
Protected methodOnRender OnRender
(Overrides UIElementOnRender(DrawingContext))
Protected methodOnRendering Called when Rendering event is subscribed
Protected methodOnTargetViewport3DChanged OnTargetViewport3DChanged is called when the TargetViewport3D is changed
Public methodPoint3DTo2D(Point3D) Converts a Point3D to the Point 2D on the screen.
Public methodPoint3DTo2D(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)
Public methodPoints3DTo2D(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).
Public methodPoints3DTo2D(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).
Public methodRect3DTo2D Converts a Rect3D to the Rect 2D on the screen.
Public methodRefresh Refresh method refreshes the camera.
Protected methodRefreshCurrentCamera Refreshes the CurrentCamera - check if TargetViewport3D is null and tries to find it, also creates a new camera is necessary
Public methodRenderToBitmap(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.
Public methodRenderToBitmap(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.
Public methodRotateCamera Rotates the camera for the specified heading and attitude
Public methodStartRotation(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.
Public methodStartRotation(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.
Public methodStopRotation 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.
Public methodStopRotation(Double, BaseCameraEasingFunctionDelegate) StopRotation slowly stops the animation of the camera with preserving the rotation inertia.
Protected methodSubscribeRenderingEvent Subscribe to Rendering event
Protected methodSubscribeToIsValidChanged SubscribeToIsValidChanged
Protected methodStatic memberTargetViewport3DPropertyChanged Called when a property that updates the camera is changed
Protected methodTryToUpdate Update the Camera if it is already initialized and is not in a batch updated (using BeginInit)
Protected methodUnsubscribeFromIsValidChanged UnsubscribeFromIsValidChanged
Protected methodUnsubscribeRenderingEvent Unsubscribe to Rendering event
Protected methodUpdateCamera Updates the CurrentCamera
Protected methodUpdateCameraLight Updates the camera light if needed
Protected methodUpdateCameraLightData Updates the CameraLight based on the current camera position
Protected methodUpdateWorldToViewportMatrix Updates the worldToViewportMatrix if needed
Public methodUpdateWpfCamera UpdateWpfCamera method updates the specified WPF camera from this Ab3d.PowerToys camera.
Top
See Also