DXView Class |
public abstract class DXView : FrameworkElement, IDisposableDXResource, IDXResource, IDisposable
The DXView type exposes the following members.
Name | Description | |
---|---|---|
DXView | Constructor | |
DXView(DXDevice) | Constructor | |
DXView(DXScene) | Constructor | |
DXView(DXView, Boolean) | Constructor of a child DXView that will render DXScene defined in the masterDXView. |
Name | Description | |
---|---|---|
BackgroundColor | Gets or sets a background color for DXView (this color is used to clear the DirectX back buffer). Default color is Transparent. | |
ChildDXViews | When this DXView is a master DXView (some other DXView objects were created by passing this DXView in a constructor), then the method returns a list of child DXView objects. Otherwise null is returned. | |
D3DHost | Gets D3DHost control (set only when DirectXOverlay PresentationType is used) | |
Disposables | Disposables can be used to simply add IDisposable objects to a list that is automatically disposed when this object is disposed. | |
DpiScaleX | Gets or sets a double that represents a DPI scale factor in X direction: 1 means 96 DPI, 1.5 means 144 DPI, etc. (double.NaN is default value and means system default DPI setting - on loaded the double.NaN value is replaced by the system default DPI value). | |
DpiScaleY | Gets or sets a double that represents a DPI scale factor in Y direction: 1 means 96 DPI, 1.5 means 144 DPI, etc. (double.NaN is default value and means system default DPI setting - on loaded the double.NaN value is replaced by the system default DPI value). | |
DXFinalPixelSize | Gets size of shown rendering area in pixels (DXRenderSize is multiplied by DpiScale). In case of super-sampling this value is smaller than DXRenderPixelSize. | |
DXImage | Gets used DXImage control (set only when DirectXImage PresentationType is used) | |
DXRenderPixelSize | Gets size in pixels of back buffer that is used to render the 3D scene (DXRenderSize is multiplied by DpiScale and with SupersamplingFactor). To get size of shown rendering area in pixels (this size multiplied by dpi scale) see DXFinalPixelSize. | |
DXRenderSize | Gets size of shown rendering area in WPF units. To get size of shown rendering area in pixels (this size multiplied by dpi scale) see DXFinalPixelSize. To get size of back buffer that is used by rendering (this size multiplied by dpi scale and super-sampling factor, see the DXRenderPixelSize | |
DXScene | Gets used DXScene that contains the WPF scene converted into DXSceneNode objects | |
GraphicsProfiles | Gets or sets an array of GraphicsProfile objects that specify graphics settings that are supported by this DXView. | |
Id | Gets a unique id of this component | |
IsAutomaticallyUpdatingDXScene | Gets or sets a Boolean that specifies if DXView is calling DXScene's Update (checking for changed in all SceneNodes) on every WPF's rendering event. When IsAutomaticallyUpdatingDXScene is set to false, this can improve performance but you need to manually call Update method after each change of the objects. Default value is true. | |
IsDisposed | Gets a Boolean that specifies if this resource has been disposed. | |
IsSceneInitialized | Gets a Boolean that specifies if the DXView has been initialized by InitializeScene method where DXScene was initialized with the UsedGraphicsProfile (also creates DXScene, DXDevice and other related objects). | |
IsTransparencySortingEnabled | Gets or sets a Boolean that specifies if sorting transparent objects by their distance to the camera is enabled. This property sets the DXScene.IsTransparencySortingEnabled property. Default value is false. See remarks for more info. | |
IsWaitingInBackgroundUntilRendered | Gets or sets a Boolean value that is used only when PresentationType is set to DirectXImage. In DirectXImage presentation type the DXEngine needs to wait until graphics card finish rendering the scene. Then the engine can inform (invalidate) the WPF's D3DImage that the shared texture is prepared. When IsWaitingInBackgroundUntilRendered property is true (by default) then the CompleteRenderingStep is not waiting on the main thread. Instead the waiting is done on the background thread and when it is completed then the invalidation is done on the main thread. When IsWaitingInBackgroundUntilRendered is false, then the waiting is done on the main thread. | |
MasterDXView | When MasterDXView is set, then this DXView is a child DXView and renders the 3D scene defined in the masterDXView.DXScene. | |
PresentationType | Gets or sets an enum that specifies how the 3D scene is presented to the WPF rendering engine. Default value is DirectXImage. | |
UsedGraphicsProfile | Gets a GraphicsProfile that is used by DXView. |
Name | Description | |
---|---|---|
BeginInit |
BeginInit begins initializing the DXView. The DXView will not render the scene until the EndInit is calls. This allows to make multiple changes without rendering the scene after each change.
(Overrides FrameworkElementBeginInit) | |
Collect3DObjectNames | Collect3DObjectNames gets names of all internal fields in parentObject that contains internal fields defined in XAML (for example Window or UserControl) that are derived from Visual3D, Model3D or DXSceneViewChild and stores them in Dictionary of object as key and object name as value. | |
CreateObjectNames | CreateObjectNames uses reflection on parentObject (Window or UserControl) to get the names of internal fields that are created from XAML. This method calls Collect3DObjectNames method. | |
Dispose | Dispose | |
DumpRenderingSteps | Writes string that contains details about all RenderingSteps in the DXScene that is used to render this DXView to the console (when the application is debugged in Visual Studio the string is written to Output window). When using child DXViews, then their RenderingSteps are written too. | |
EndInit |
EndInit needs to be called after BeginInit was called for the changes to take effect.
(Overrides FrameworkElementEndInit) | |
GetDpiScale | Returns the dpiScaleX and dpiScaleY of the specified WPF visual (can be window or any other WPF control). | |
GetDXAttributeCollection | Gets the value of the DXAttributeCollectionProperty from the specified element | |
GetRenderingStepsDumpString | Returns string that contains details about all RenderingSteps in the DXScene that is used to render this DXView. When using child DXViews, then their RenderingSteps are shown too. | |
GetSceneNodeForWpfObject | GetSceneNodeForWpfObject returns the SceneNode in DXScene that was created to represent the wpfObject. The method returns null if SceneNode is not found. | |
InitializeScene | Initialize the DXScene or WPF 3D. This method is usually called in DXView Loaded event but it can be called manually before Loaded event to create the DXScene, DXDevice and other related objects. | |
LogUserMessage | LogUserLabel can be used to add custom user message to DXEngine log file. This method work only with debug DXEngine build and with enabled logging. It added the "USER MESSAGE: " prefix to log entry. | |
Refresh | Forces update and rendering of the scene | |
RenderScene(Boolean) | RenderScene rendered the scene. If forceUpdate is false (by default) then the scene is rendered only if there are any changes in the scene nodes. | |
RenderScene(Boolean, Boolean) | RenderScene rendered the scene. If forceRender is false then the scene is rendered only if there are any changes in the scene nodes. If forceUpdate is true then the RenderingQueues are always regenerated (otherwise RenderingQueues are regenerated only when this is required because of the changes). | |
RenderToBitmap | RenderToBitmap renders the 3D scene to bitmap. The size of the bitmap is the same as the current size of this DXView.DXRenderPixelSize. See also other overrides of RenderToBitmap method: RenderToBitmap(Int32, Int32, Int32, Int32, Boolean), RenderToBitmap(Int32, Int32, Int32, Double, Double), RenderToBitmap(Int32, Int32, Int32, Int32, Double, Double, Boolean), RenderToBitmap(WriteableBitmap, Int32, Int32), RenderToBitmap(DXViewRenderedBitmapReadyDelegate, Int32, Int32, Int32, Int32, Double, Double, Boolean). | |
RenderToBitmap(WriteableBitmap, Int32, Int32) | RenderToBitmap renders the 3D scene the specified WriteableBitmap. See also other overrides of RenderToBitmap method: RenderToBitmap, RenderToBitmap(Int32, Int32, Int32, Int32, Boolean), RenderToBitmap(Int32, Int32, Int32, Double, Double), RenderToBitmap(Int32, Int32, Int32, Int32, Double, Double, Boolean), RenderToBitmap(DXViewRenderedBitmapReadyDelegate, Int32, Int32, Int32, Int32, Double, Double, Boolean). | |
RenderToBitmap(Int32, Int32, Int32, Double, Double) | RenderToBitmap renders the 3D scene to bitmap with specified width, height, multi-sampling and super-sampling count and DPI. See also other overrides of RenderToBitmap method: RenderToBitmap, RenderToBitmap(Int32, Int32, Int32, Int32, Boolean), RenderToBitmap(Int32, Int32, Int32, Int32, Double, Double, Boolean), RenderToBitmap(WriteableBitmap, Int32, Int32), RenderToBitmap(DXViewRenderedBitmapReadyDelegate, Int32, Int32, Int32, Int32, Double, Double, Boolean). | |
RenderToBitmap(Int32, Int32, Int32, Int32, Boolean) | RenderToBitmap renders the 3D scene to bitmap with specified width, height, multi-sampling count and DPI. See also other overrides of RenderToBitmap method: RenderToBitmap, RenderToBitmap(Int32, Int32, Int32, Double, Double), RenderToBitmap(Int32, Int32, Int32, Int32, Double, Double, Boolean), RenderToBitmap(WriteableBitmap, Int32, Int32), RenderToBitmap(DXViewRenderedBitmapReadyDelegate, Int32, Int32, Int32, Int32, Double, Double, Boolean). | |
RenderToBitmap(Int32, Int32, Int32, Int32, Double, Double, Boolean) | RenderToBitmap renders the 3D scene to bitmap with specified width, height, multi-sampling and super-sampling count and DPI. See also other overrides of RenderToBitmap method: RenderToBitmap, RenderToBitmap(Int32, Int32, Int32, Int32, Boolean), RenderToBitmap(Int32, Int32, Int32, Double, Double), RenderToBitmap(WriteableBitmap, Int32, Int32). | |
RenderToBitmap(DXViewRenderedBitmapReadyDelegate, Int32, Int32, Int32, Int32, Double, Double, Boolean) | RenderToBitmap renders the 3D scene and then calls the specified renderedBitmapReadyCallback where user can copy rendered bitmap from the mapped GPU mapped memory to main memory. See remarks for a code sample for a OnRenderedBitmapReady method. See also other overrides of RenderToBitmap method: RenderToBitmap, RenderToBitmap(Int32, Int32, Int32, Int32, Boolean), RenderToBitmap(Int32, Int32, Int32, Double, Double), RenderToBitmap(Int32, Int32, Int32, Int32, Double, Double, Boolean). | |
SetDXAttributeCollection | Sets the DXAttributeCollectionProperty to the specified element | |
SetObjectNames(DictionaryObject, String) | SetObjectNames sets a dictionary with object as key and name as value that can be used to name the created SceneNodes. This method must be called before the RootNode is created. | |
SetObjectNames(DictionaryString, Object) | SetObjectNames sets a dictionary with object as key and name as value that can be used to name the created SceneNodes. This method must be called before the RootNode is created. | |
Update | Update method checks all child SceneNodes and checks if any changes has been created and if rendering is required. |
Name | Description | |
---|---|---|
DefaultSystemAdapterChanged | DefaultSystemAdapterChanged event is triggered when the default system adapter (the primary system GPU) is changed. This means that it is not longer possible to share a DXEngine's texture with WPF. DXEngine will need to switch to WritableBitmap that is much slower than shared texture because the rendered scene needs to be copied from GPU memory to to CPU memory. In this case it is recommended to save the current scene, dispose the DXViewportView and create a new DXViewportView that will use the new graphics card. | |
Disposing | Occurs when when Dispose is called. | |
DXRenderSizeChanged | Called when the size of the rendering area is changed. Also called after the back buffers are initialized for the first time. | |
DXSceneDeviceCreated | Called when the DXScene and DirectX 11 device have been created and when UsedGraphicsProfile was set, but before it is fully initialized (DXImage, D3DHOst, DirectX buffers and views are not created yet). This method can be used to change some properties the created DXScene object that is set to the DXScene property. Once all the DirectX objects has been initialized (all the buffers and views are created), the DXSceneInitialized event is triggered. Note that when DXScene is not created because a WPF 3D rendering is used, then the Wpf3DRenderingInitialized event is called. | |
DXSceneInitialized | Called after the DXScene has been fully initialized - the device, buffers and views are created. In Wpf3D mode the event is triggered after the Wpf3D has been initialized. To be notified after the DXScene, DirectX device and UsedGraphicsProfile would be set and before the DirectX buffers and views are created, use the DXSceneDeviceCreated event. | |
GraphicsProfileRejected | GraphicsProfileRejected event is fired when a GraphicsProfile is rejected. | |
SceneRendered | Called after the scene has been rendered (with WPF 3D rendering this is called from CompositionTarget.Rendering event handler. | |
SceneUpdating | Called when the scene is being updated and before it is rendered. | |
Wpf3DRenderingInitialized | Wpf3DRenderingInitialized event is called when WPF 3D rendering graphics profile is initialized. This rendering profile can be selected because user selected this profile (Wpf3D was the only profile in the GraphicsProfiles collection) or because no DirectX 11 rendering can be initialized (usually because of the problems with the drivers or some other problems). When a DirectX 11 rendering is initialized, then the DXSceneDeviceCreated event is called. |
Name | Description | |
---|---|---|
BackgroundColorProperty | BackgroundColorProperty | |
DefaultGraphicsProfiles | Gets an array of GraphicsProfile that are used by default. | |
DXAttributeCollectionProperty | DXAttributeCollectionProperty is a DependencyProperty that is used to add DXEngine's attributes to WPF objects. | |
RootDXSceneViewNodeName | Gets the name of the Root node name |
Name | Description | |
---|---|---|
DXAttributeCollection | DXAttributeCollectionProperty is a DependencyProperty that is used to add DXEngine's attributes to WPF objects. |