DXScene Class |
public class DXScene : DisposableDXResource
The DXScene type exposes the following members.
Name | Description | |
---|---|---|
DXScene(DXDevice, String) | Constructor | |
DXScene(DXScene, Boolean, String) | Creates a child DXScene that will render the objects defined in the masterDXScene to the back buffer and with camera defined in this DXScene. |
Name | Description | |
---|---|---|
BackBuffer | Gets the BackBuffer as Texture2D | |
BackBufferDescription | Gets the Description of the BackBuffer | |
BackBufferRenderTargetView | Gets the RenderTargetView of the BackBuffer | |
BackBufferShaderResourceView | ShaderResourceView that is created from BackBuffer. Created when DXScene is initialized with CreateBackBufferShaderResourceView property set to true and when swap chain is not used. The created ShaderResourceView can be used in another DXScene so that the renderer 3D scene can be used as a texture. This works only when both DXScenes are created by the same DXDevice. | |
BackgroundColor | Gets or sets a Color4 that represents a background color for the scene. The color values must be alpha premultiplied - each red, green and blue value must be multiplied with alpha value (for example a fully transparent value is (0, 0, 0, 0) and not (0, 255, 255, 255) as in WPF. | |
BackgroundRenderingQueue | Gets a RenderingQueue that is rendered first. Objects in this queue are not sorted and are rendered in the same order as they are added to the queue. | |
BackgroundThreadsManager | Gets or sets a BackgroundThreadsManager that is used instead of BackgroundThreadsManager defined in DXDevice. | |
BackgroundWaitingUntilRenderedThresholdTimeMs | Time in milliseconds that is used to enable background waiting until rendered. When DXViewportView.IsWaitingInBackgroundUntilRendered is true and after waiting for rendered in the last two frames is bigger then this time, then waiting is actually enabled (this prevents using background thread for simple scenes). Default value is 3 milliseconds. | |
BuffersInitialized | Gets a Boolean that specifis if SwapChain and buffers are created. This property can be false when DXScene is initialized with zero width and height. | |
Camera | Gets or sets an ICamera that is used to show the scene. | |
ComplexGeometryRenderingQueue | Gets a RenderingQueue that contains opaque and very complex 3D objects that are expected to take a lot of GPU time to render and should therefore start rendering as soon as possible. Usually this queue contains instanced objects, big point cloud objects or standard objects with many triangles. Objects in this queue are not sorted and are rendered in the main thread (no multi-threading rendering) and in the same order as they are added to the queue. | |
CreateBackBufferShaderResourceView | When true and when swap chain is not used, then a BackBufferShaderResourceView is created from BackBuffer. Default value is false. | |
DefaultCompleteRenderingStep | Gets a default CompleteRenderingStep. | |
DefaultInitializeRenderingStep | Gets a default InitializeRenderingStep. | |
DefaultPreparePostProcessingRenderingStep | Gets a default PreparePostProcessingRenderingStep. This rendering step is defined in the DefaultRenderPostProcessingRenderingStepsGroup. | |
DefaultPrepareRenderTargetsRenderingStep | Gets a default PrepareRenderTargetsRenderingStep. | |
DefaultRenderObjectsRenderingStep | Gets a default RenderObjectsRenderingStep. | |
DefaultRenderPostProcessingRenderingStep | Gets a default RenderPostProcessingRenderingStep. This rendering step is defined in the DefaultRenderPostProcessingRenderingStepsGroup. | |
DefaultRenderPostProcessingRenderingStepsGroup | Gets a default RenderingStepsGroup that groups PreparePostProcessing and RenderPostProcessing rendering steps. | |
DefaultRenderSpritesRenderingStep | Gets a default RenderSpritesRenderingStep. This step is added to the RenderingSteps before the DefaultCompleteRenderingStep after the first SpriteBatch is created. The step is removed when the last SpriteBatch is removed from DXScene. | |
DefaultResolveBackBufferRenderingStep | Gets a default ResolveBackBufferRenderingStep. | |
DepthStencilBufferFormat | Gets or sets a depth stencil buffer format that is used in rendering the scene. Default value is D32_Float (32 bit depth buffer, no stencil buffer). If this value is changed, a new depth stencil buffer will be created in the next call to PrepareRenderTargetsRenderingStep. | |
DepthStencilView | Gets the DepthStencilView | |
Device | Gets a DirectX device that is used by this DXScene. | |
DpiScaleX | Gets or sets a float that represents a DPI scale factor in X direction: 1 means 96 DPI, 1.5 means 144 DPI, etc. This value is used in line and pixel rendering and scales the line thickness or size of pixels. | |
DpiScaleY | Gets or sets a float that represents a DPI scale factor in Y direction: 1 means 96 DPI, 1.5 means 144 DPI, etc. This value is used in line and pixel rendering and scales the line thickness or size of pixels. | |
DXDevice | Gets a DXDevice that was used to initialize this DXScene. | |
DXHitTestOptions | DXHitTestOptions specifies hit testing parameters that are used with DXScene's hit testing. | |
ExecutePixelShaderPerSample | Obsolete. ExecutePixelShaderPerSample is obsolete. Use SupersamplingCount instead. | |
ForegroundRenderingQueue | Gets a RenderingQueue that is rendered after standard GeometryRenderingQueue but before TransparentRenderingQueue. Objects in this queue are not sorted and are rendered in the same order as they are added to the queue. | |
FrameNumber | Gets an integer that represents the last rendered frame number (increased after each rendered frame) | |
GeometryRenderingQueue | Obsolete. OBSOLETE: GeometryRenderingQueue is obsolete because it was slit into ComplexGeometryRenderingQueue, LineGeometryRenderingQueue, OtherGeometryRenderingQueue and StandardGeometryRenderingQueue. Please add your objects to any of those RenderingQueues. For Backwards compatibility the GeometryRenderingQueue is assigned to the OtherGeometryRenderingQueue. | |
HardwareAccelerate3DLineCaps | Gets or sets a Boolean that specifies if line caps (arrow, box, diamond, etc.) are hardware accelerated and generated on the graphics card. Default value is true. When false, then lines with caps will be generated on the CPU by Ab3d.PowerToys library. | |
HardwareAccelerate3DLines | Gets or sets a boolean that specifies if rendering 3D lines is hardware accelerated by DXEngine. | |
Height | Gets an integer that represents a height of the Viewport | |
IsAutomaticallyUpdatingBeforeEachRender | Gets or sets a Boolean that specifies if Update method is automatically called before each rendering of the scene (if it was not yet manually called). Default value is true. | |
IsCachingCommandLists | Gets or sets a Boolean that specifies if Ab3d.DXEngine records all DirectX commands into DirectX CommandLists and reuses the command lists on next frame if only camera and light properties have changed. See remarks for more info. Default value is false. | |
IsCurrentlyWaitingUntilRendered | Gets a Boolean that specifies if the background thread is currently waiting to complete rendering (this can be used for DirectXImage PresentationType where the DXEngine needs to notify WPF when the 3D scene is rendered; this is enabled by default - the DXViewportView.IsWaitingInBackgroundUntilRendered is set to true). When this property is true, then a new render pass should not begin (by default the InitializeRenderingStep is waiting on the main thread until the rendering is completed). | |
IsEnabled | Gets or sets if this DXScene is enabled and is rendering the scene. | |
IsInitialized | Gets a Boolean that is set to true when this DXScene is initialized - DXDevice are created and also required objects and collections are created: RenderingContext, RenderingQueues, PostProcessing. Also the SwapChain is created when the DXScene in initialized with InitializeSwapChain method (though the size of SwapChain buffers might not be final yet). Note that when IsInitialized is set to true, the DirectX buffers are initialized only when the size of viewport is already known. To see if buffers are initialized check the BuffersInitialized property. | |
IsMaterialSortingEnabled | Gets or sets a Boolean that specified if sorting objects by their materials is enabled. Sorting objects usually improves rendering performance because objects with same materials are rendered one after another and this reduces the required DirectX state changes. Objects are sorted by their material hash value only when they are in the MaterialSortedRenderingQueue (usually all standard and opaque geometry objects). But sometimes user wants to have full control of the order in which the objects are sorted. In this case it is possible to disable material sorting. Default value is true. | |
IsRendering | Returns true when DXScene is currently executing object rendering (is inside RenderScene method). This property can be checked from a background thread. | |
IsSwapChainCreated | Gets a Boolean that specifis if DXScene will be using SwapChain to render the scene and if SwapChain is already created. | |
IsTransparencySortingEnabled | Gets or sets a Boolean that specifies if sorting transparent objects by their distance to the camera is enabled. Default value is false. See remarks for more info. | |
IsWaitingUntilRenderedEnabled | Gets a Boolean that specifies if the background waiting until rendered is enabled (when using DirectXImage presentation type, when DXViewportView.IsWaitingInBackgroundUntilRendered is true and when two consecutive frames took longer then BackgroundWaitingUntilRenderedThresholdTimeMs). | |
Lights | Gets a list of lights that are used in this DXScene. | |
LineGeometryRenderingQueue | Gets a RenderingQueue that contains opaque and single-colored 3D line objects that are rendered with ThickLineEffect. Objects in this queue are not sorted but are rendered with using multi-threading. | |
MasterDXScene | Gets a DXScene that is set when this DXScene is rendered a 3D scene that is defined in a MasterDXScene. | |
MaxBackgroundThreadsCount | Gets or sets an integer that specifies the maximum number of background threads that can be used for multi-threaded operations. Value 0 means that no background thread will be used and that all rendering will be performed on the main thread. Value 4 means that besides the main thread up to four additional background threads can be used for rendering. The actually used number of threads can be lower if there is not a lot of objects to render. Default value is set to Environment.ProcessorCount minus 1 but 7 is the maximum value. See remarks for more info. | |
MaxFarPlaneDistance | When MaxFarPlaneDistance is set to any positive value and OptimizeNearAndFarCameraPlanes is true, the calculated far plane distance is never bigger then the specified value. This value must be bigger then MinNearPlaneDistance or its value is not used. Default value is NaN. | |
MinNearPlaneDistance | When MinNearPlaneDistance is set to any positive value and OptimizeNearAndFarCameraPlanes is true, the calculated near plane distance is never smaller than the specified value. Default value is NaN. | |
MSAABackBuffer | Gets the MSAA BackBuffer as Texture2D (set if multisampling is used) | |
MSAABackBufferDescription | Gets the Description of the MSAABackBuffer | |
MSAABackBufferRenderTargetView | Get the RenderTargetView of the MSAA BackBuffer | |
MultisampleCount | Gets an integer that represents a used multisample count (used for anti-aliasing) | |
OptimizeNearAndFarCameraPlanes | Gets or sets a boolean that specify if NearPlaneDistance and FarPlaneDistance are automatically set by scene bounds (true by default). This can prevent z-fighting problems. If you want that NearPlaneDistance and FarPlaneDistance are set manually, this property must be set to false. | |
OtherGeometryRenderingQueue | Gets a RenderingQueue that contains opaque objects that cannot be rendered with StandardEffect. Usually this queue contains pixels, objects with physically based rendering material and other objects with non-standard effect (for example vertex colored materials). The objects in this queue are not rendered with using multi-threading. Objects in this queue are sorted so that they are grouped by material to minimize state changes. | |
OverlayRenderingQueue | Gets a RenderingQueue that is rendered last. Objects in this queue are not sorted and are rendered in the same order as they are added to the queue. | |
PostProcesses | Gets a collection of post processes that will be applied after rendering the 3D scene. | |
RenderAntialiased3DLines | When false and UseGeometryShaderFor3DLines is also false, the 3D lines are rendered without antialiasing them. This greatly improves rendering performance. Default value is true. | |
RenderConnectedLinesAsDisconnected | Gets or sets a boolean that specifies if all connected 3D lines (polylines, line arc, rectangle, etc.) are rendered as disconnected 3D lines (separate lines). Default value is false. | |
RenderConnectedLinesAsDisconnectedLinesThicknessLimit | Obsolete. Gets or sets the LineThickness value that will limit rendering connected 3D lines (polylines, line arc, rectangle, etc.), as disconnected 3D lines (fully hardware accelerated). The connected 3D lines that have lower or equal LineThickness then the value of this property will be rendered as disconnected 3D line; other connected lines will still be generated on the CPU by Ab3d.PowerToys library. Default value is 3. | |
RenderingContext | Gets the RenderingContext that defines the context information that are used during scene rendering. | |
RenderingQueues | RenderingQueues is a read only collection of rendering queues that represent queues of low lever objects that are prepared to be rendered with DirectX. RenderingQueue are rendered in the same order as in the RenderingQueues list. The rendering is done in the RenderObjectsRenderingStep rendering step. | |
RenderingSteps | Gets a RenderingStepsList that represents the rendering steps that are executed to render the 3D scene. | |
RenderMultiPolyLinesWithOneDrawCall | When true (by default) then multiple poly-lines can be rendered with one draw call (one ScreenSpaceLineNode is created). When false, then for each poly-line one ScreenSpaceLineNode is create and this renders each line with its own draw call. | |
RootNode | Gets or sets a root SceneNode - the first in the hierarchy. | |
ShaderQuality | Gets or sets a quality settings that specifies the type of shader that should be used to render the scene. If DXScene is used with DXViewportView, then this value is set from used GraphicsProfile. NOTE: Changing this property after the DXDevice is initialized will have no effect. | |
ShadowRenderingProvider | Obsolete. ShadowRenderingProvider property is obsolete because it is possible to use multiple shadow rendering providers. Use GetShaderBytecodeProviders method to get an array of shadow rendering providers. This methods still returns the first shadow rendering provider, but when multiple providers are initialized, the GetShaderBytecodeProviders method needs to be used. | |
SSAABackBuffer | Gets the super-sampled BackBuffer as Texture2D (set if super-sampling is used) | |
SSAABackBufferDescription | Gets the Description of the super-sampled BackBuffer | |
SSAABackBufferRenderTargetView | Get the RenderTargetView of the super-sampled BackBuffer | |
SSAABackBufferShaderResourceView | Get the ShaderResourceView of the super-sampled BackBuffer | |
SSAONormalDepthShaderResourceView | Get the ShaderResourceView of the normal-depth buffer for SSAO rendering. The difference between standard normal-depth buffer and SSAO normal-depth buffer is that in the later normals in this buffer are also transformed by the view matrix. The format of the buffer is R16G16B16A16_Float. This property is set when ScreenSpaceAmbientOcclusionRenderingProvider is initialized by calling InitializeShadowRendering(ShadowRenderingProviderBase) method. | |
SSAOShadowMapShaderResourceView | Get the ShaderResourceView of the SSAO shadow map. The format of the buffer is R16_UNorm. This property is set when ScreenSpaceAmbientOcclusionRenderingProvider is initialized by calling InitializeShadowRendering(ShadowRenderingProviderBase) method. | |
StagingBackBuffer | Gets the StagingBackBuffer that is used when the final rendered image needs to be copied to main memory. This can be done only from staging buffer. When final render image in not copied to main memory the StagingBackBuffer is null. | |
StagingBackBufferDescription | Gets the Description of the StagingBackBuffer | |
StandardGeometryRenderingQueue | Gets a RenderingQueue that contains standard opaque objects that can be rendered with StandardEffect (all objects with StandardMaterial or objects that are created from WPF 3D objects). Objects in this queue are sorted so that they are grouped by material to minimize state changes and are also rendered with using multi-threading. | |
Statistics | Gets RenderingStatistics class that contains various rendering statistics. Statistics is collected only when IsCollectingStatistics is set to true. | |
SupersamplingCount | Gets the super-sampling count that describes how much more pixels are rendered for each final pixel. The rendering is done on a scaled texture that is bigger for the amount specified by SupersamplingCount. At the end of rendering this texture is down-sampled into the texture with the final size. Valid values are 1 (no super-sampling), 4, 16 and 64. Value 4 means that width and height are multiplied by 2 and this produces a texture with 4 times as much pixels. | |
SupersamplingFactor | Gets the factor by which width and height are multiplied because of the SupersamplingCount. | |
SwapChain | Gets the SwapChain or null if SwapChain is not used. | |
TransparentRenderingQueue | Gets a RenderingQueue that contains transparent objects. Objects in this queue are sorted by their distance to the camera - farthest objects are rendered first. | |
UsedMultisamplingDescription | Gets a SampleDescription that describes what level of multisampling is used by the current DXScene. Multisampling is used to create antialiased images with rendering the multiple samples of the same pixel. | |
UsedSwapChainEffect | Gets the SwapEffect that was used to create the SwapChain. | |
UseGeometryShaderFor3DLines | Gets or sets a boolean that specifies if 3D lines are rendered with using GeometryShader that can create thick lines. If false, then all 3D lines will be rendered as simple DirectX lines with thickness 1. Default value is true. | |
UseSharedWpfTexture | Gets or sets a nullable Boolean that is used only when using BackBuffer without SwapChain and specifies if DXScene is using a shared resources (texture) that can be used by both DirectX 11 (DXEngine) and DirectX 9 (WPF). Using shared resources improves performance because the texture that is used to render the DirectX 11 image is shader with WPF composition engine. This means that the texture is not copied to main CPU memory and than back to GPU by WPF. When the value is not set by the user (is null), then the value is set in the DXScene initialization. It is set to true when DXEngine is using the same graphics card (adapter) then WPF. Otherwise the value is set to false. | |
Viewport | Gets or sets a Viewport that defines the area where the scene will be rendered. | |
VirtualRealityProvider | Gets a virtual reality provider that is currently used by this DXScene. This property can be set by calling InitializeVirtualRealityRendering(VirtualRealityProviderBase) method. | |
Width | Gets an integer that represents a width of the Viewport |
Name | Description | |
---|---|---|
AddRenderingQueueAfter | Adds the newRenderQueue after the already registered afterRenderQueue. If rendering queue is MaterialSortedRenderingQueue or CameraDistanceSortedRenderingQueue, then also its IsSortingEnabled property is set according to the current DXScene settings. | |
AddRenderingQueueBefore | Adds the newRenderQueue before the already registered afterRenderQueue | |
CalculateCameraPlanes(ICamera, Boolean, Single, Single) | CalculateCameraPlanes sets the zNear and zFar parameters to camera near plane distance and camera far plane distance. The values are calculated with using the bounding box of the current scene and specified camera. When adjustValues Boolean parameter is true, the zNear and zFar values are slightly adjusted to increase the distance between zNear and zFar (recommended). CalculateCameraPlanes returns false if the calculated values are not correct (are 0, NaN or Infinity). This can happen when camera's matrices are not set. | |
CalculateCameraPlanes(Matrix, Boolean, Boolean, Vector3, Boolean, Single, Single) | CalculateCameraPlanes sets the zNear and zFar parameters to camera near plane distance and camera far plane distance. When adjustValues Boolean parameter is true, the zNear and zFar values are slightly adjusted to increase the distance between zNear and zFar (recommended). CalculateCameraPlanes returns false if the calculated values are not correct (are 0, NaN or Infinity). This can happen when camera's matrices are not set. | |
CreateAndUseStagingBuffer | CreateAndUseStagingBuffer creates a Staging buffer (used to copy the rendered back buffer to main memory) and set it to RenderingContext. | |
CreateCustomRenderingContext(Int32, Int32, Int32, BackBufferReadyEventHandler, DisposeList) | Creates a CustomRenderingContext with all needed DirectX buffers and views that can be used to call RenderScene with custom RenderingContext. The created RenderingContext can be used in RenderScene(RenderingContext, Boolean) or RenderScene(RenderingContext, Boolean, Boolean, DXScene) methods. | |
CreateCustomRenderingContext(Texture2D, Texture2DDescription, RenderTargetView, DepthStencilView, Int32) | Creates a CustomRenderingContext from the specified back buffer, its render target view and depthStencilView. The created CustomRenderingContext can be used in RenderScene(RenderingContext, Boolean) or RenderScene(RenderingContext, Boolean, Boolean, DXScene) methods. | |
CreateCustomRenderingContext(Int32, Int32, Int32, Format, Format, BackBufferReadyEventHandler, DisposeList) | Creates a CustomRenderingContext with all needed DirectX buffers and views that can be used to call RenderScene with custom RenderingContext. The created RenderingContext can be used in RenderScene(RenderingContext, Boolean) or RenderScene(RenderingContext, Boolean, Boolean, DXScene) methods. | |
CreateCustomRenderingContext(Int32, Int32, Int32, Format, Format, BackBufferReadyEventHandler, VirtualRealityProviderBase, DisposeList) | Creates a CustomRenderingContext with all needed DirectX buffers and views that can be used to call RenderScene with custom RenderingContext. The created RenderingContext can be used in RenderScene(RenderingContext, Boolean) or RenderScene(RenderingContext, Boolean, Boolean, DXScene) methods. | |
CreateCustomRenderingContext(Int32, Int32, Int32, Int32, Format, Format, BackBufferReadyEventHandler, VirtualRealityProviderBase, DisposeList) | Creates a CustomRenderingContext with all needed DirectX buffers and views that can be used to call RenderScene with custom RenderingContext. The created RenderingContext can be used in RenderScene(RenderingContext, Boolean) or RenderScene(RenderingContext, Boolean, Boolean, DXScene) methods. | |
CreateDefaultRenderingSteps | CreateDefaultRenderingSteps clears the current rendering step (RenderingSteps) and adds the default rendering steps to the RenderingSteps list. | |
CreateSpriteBatch(String) | Creates a SpriteBatch that will be used in this DXScene. The SpriteBatch will be added to the DefaultRenderSpritesRenderingStep rendering step. If this is the first sprite batch then the DefaultRenderSpritesRenderingStep is added to RenderingSteps. | |
CreateSpriteBatch(RenderSpritesRenderingStep, String) | Creates a SpriteBatch that will be added to the specified RenderSpritesRenderingStep. When renderSpritesRenderingStep is not specified, then the created SpriteBatch is added to a the DefaultRenderSpritesRenderingStep rendering step (if this is the first sprite batch then the DefaultRenderSpritesRenderingStep is added to RenderingSteps). | |
DisposeBackBuffers | Disposes the back buffers and views that are defined in this DXScene | |
DumpRenderingQueues | Writes string that contains details about all objects inside rendering queues to the console (when the application is debugged in Visual Studio the string is written to Output window). | |
DumpRenderingSteps | Writes string that contains details about all RenderingSteps in this DXScene to the console (when the application is debugged in Visual Studio the string is written to Output window). | |
DumpSceneNodes | Writes string that contains details about all DXScene's SceneNodes and their hierarchy to the console (when the application is debugged in Visual Studio the string is written to Output window). | |
FindNode | FindNode searches SceneNode hierarchy starting from RootNode and tries to find the SceneNode with the nodeName. Null is returned if SceneNode is not found. | |
GetAllHitObjects | GetAllHitObjects method executes a hit testing on the SceneNodes in this DXScene (or when specified on rootSceneNode and its children) and returns a list of DXRayHitTestResult objects sorted from the closest to the farthest object. When no object is hit, an empty list is returned. | |
GetClosestHitObject | GetClosestHitObject method executes a hit testing on the SceneNodes in this DXScene (or when specified on rootSceneNode and its children) and returns a DXRayHitTestResult object with the closest triangle hit by the specified ray. When no triangle is hit, null is returned. | |
GetHitSceneNodeBounds | GetHitSceneNodeBounds returns a List of SceneNode objects where the ray intersects the BoundingBox of the SceneNode. | |
GetRayFromCamera | Returns SharpDX.Ray that goes into a direction that is calculated from the specified x and y position in screen coordinates. For perspective camera the ray starts at the current camera position. The ray can be used for hit testing from the mouse position defined by x and y (relative to this DXScene object). | |
GetRayFromNearPlane | Returns SharpDX.Ray that starts at the camera's near plane and goes into a direction that is calculated from the specified x and y position in screen coordinates. The ray can be used for hit testing from the mouse position defined by x and y (relative to this DXScene object). | |
GetRenderingQueuesDumpString(Boolean) | Returns string that contains details about all objects inside rendering queues. | |
GetRenderingQueuesDumpString(Boolean, Boolean, Boolean) | Returns string that contains details about all objects inside rendering queues. | |
GetRenderingStepsDumpString | Returns string that contains details about all RenderingSteps in this DXScene. | |
GetSceneNodesDumpString(Boolean, Boolean, Boolean, Boolean) | Returns string that contains details about all DXScene's SceneNodes and their hierarchy. | |
GetSceneNodesDumpString(Boolean, Boolean, Boolean, Boolean, Boolean, Boolean) | Returns string that contains details about all DXScene's SceneNodes and their hierarchy. | |
GetShadowRenderingProviders | Returns an array of shadow rendering providers that were initialized by calling InitializeShadowRendering(ShadowRenderingProviderBase) method. When no shadow rendering providers is initialized, then null is returned. | |
HandleDeviceRemoved | HandleDeviceRemoved is called when a DirectX device is removed or reset. The method gets device removed reason from DirectX API and then calls the DeviceRemoved event handler. If the event handler handles the event, then the method returns. Otherwise the method throws an DXEngineException with description from specified message and device removed reason. | |
HasDirtyFlag | Returns true if this DXScene has the flags from the method argument set. Note that if this value is checked before the Update phase is completed, then the value may not have the final value (but it has the camera and light changed flags already set). | |
HitTestSceneNode | Returns DXRayHitTestResult if the specified ray hits the specified sceneNode. Otherwise null is returned. Child SceneNodes are not tested. | |
InitializeBackBuffer | InitializeWithBackBuffer | |
InitializeDevice | InitializeDevice is a virtual method that calls InitializeDevice on DXDevice if it was not yet initialized. | |
InitializeShadowRendering | InitializeShadowRendering initializes shadow rendering by using the specified shadowRenderingProvider. This method can be called multiple times to register multiple shadow rendering providers. To get all initialized shadow rendering providers, call GetShadowRenderingProviders method. To remove shadow rendering provider, call RemoveShadowRenderingProvider(ShadowRenderingProviderBase) method. | |
InitializeSwapChain | InitializeWithSwapChain | |
InitializeVirtualRealityRendering | InitializeVirtualRealityRendering initializes virtual reality rendering with using the specified virtualRealityProvider. To dispose virtual reality rendering pass null as virtualRealityProvider parameter. | |
IsOnMainRenderThread | Returns true when the code is currently executing on main render thread (the thread that was used to create this DXScene). | |
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. | |
NotifyChange(DXSceneChangeNotifications) | NotifyChange method adds the specified ChangeNotifications to all the changes flags | |
NotifyChange(DXSceneChangeNotifications, Object) | NotifyChange method adds the specified ChangeNotifications to all the changes flags | |
RemoveRenderingQueue | Adds the newRenderQueue before the already registered afterRenderQueue | |
RemoveShadowRenderingProvider | Removes the shadow rendering provider that was initialized by calling InitializeShadowRendering(ShadowRenderingProviderBase) method. This will also disable (set IsEnabled to false) on the shadowRenderingProvider. | |
RemoveSpriteBatch(SpriteBatch) | Removes the specified SpriteBatch from the list of sprite batches that are rendered by this DXScene. If this is the last SpriteBatch in the DefaultRenderSpritesRenderingStep, then it will be removed from the RenderingSteps. | |
RemoveSpriteBatch(SpriteBatch, RenderSpritesRenderingStep) | Removes the specified SpriteBatch from the list of sprite batches that are rendered by the specified RenderSpritesRenderingStep. | |
RenderScene(Boolean) | Renders the scene. If forceRenderAll is true, then the RenderingQueues are always regenerated and the scene is always rendered (use RenderScene(Boolean, Boolean) to control regeneration of rendering queues). | |
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). | |
RenderScene(RenderingContext, Boolean) | Renders the scene with using custom RenderingContext. This allows rendering to custom buffers and render targets. | |
RenderScene(DXScene, Boolean, Boolean) | Renders the scene to the back buffers and with using cameras defined in childDXScene. | |
RenderToBitmap(Int32, Int32, Int32, BackBufferReadyEventHandler) | RenderToBitmap renders the 3D scene to bitmap with specified width, height and multisampling count (used if possible). When the scene is rendered the renderedTextureReadyCallback delegate is called - here it is possible to read the memory with the rendered buffer. | |
RenderToBitmap(Int32, Int32, Int32, Int32, BackBufferReadyEventHandler) | RenderToBitmap renders the 3D scene to bitmap with specified width, height and multisampling count (used if possible). When the scene is rendered the renderedTextureReadyCallback delegate is called - here it is possible to read the memory with the rendered buffer. | |
Resize(Int32, Int32) | Resize method resizes the buffers needed to render the DXScene (DpiScale values are preserved; to change or set DpiScale, call overloaded method that takes DpiScale parameters) | |
Resize(Int32, Int32, Single, Single) | Resize method resizes the buffers needed to render the DXScene | |
Resize(Int32, Int32, Int32, Single, Single) | Resize method resizes the buffers needed to render the DXScene | |
SetupWaitingInBackgroundUntilRendered | SetupWaitingInBackgroundUntilRendered method can be used to enable waiting in background until rendering is complete (this can be used for DirectXImage PresentationType where the DXEngine needs to notify WPF when the 3D scene is rendered; this is enabled by default - the DXViewportView.IsWaitingInBackgroundUntilRendered is set to true). In this case the rendering steps in DXEngine are completed before graphic card finishes rendering. When the rendering is complete the renderingCompleteAction is called from another thread. There the user can update the shared texture. When the renderingCompleteAction parameter is null, then waiting in background is disabled. | |
TransformRay | Transforms the specified ray with the specified matrix. The transformation is done with transforming the ray's position and its direction (direction is transformed without translation). | |
Update | Update calls Update method on all child nodes. |
Name | Description | |
---|---|---|
AfterFrameInitialized | AfterFrameInitialized event is triggered after the RenderTargets have been set and cleared, Viewports have been set and default Rasterizer state has been set. | |
AfterFrameRendered | AfterFrameRendered event is triggered after all the rendering activities for one frame have been finished. | |
AfterObjectsRendered | AfterObjectsRendered event is triggered after all the objects have been rendered and before rendered objects are "sent to the screen" (Present method on SwapChain is called or the render target is prepared for D3DImage) | |
AfterUpdated | AfterUpdated event is triggered after the SceneNode objects have been updated and before the decision is made to render the next frame or not. Subscriber to this event can prevent rendering frame or force rendering it with changing the IsRenderNeeded property in the event args. | |
BackBufferReady | BackBufferReady event is triggered when the rendered image is ready to be copied from graphic to main memory. This is used when DirectXImage presentation type is used and when DXEngine is using software rendering or when UseSharedWpfTexture is set to true. In those cases the DXEngine is rendering the image to a so called staging buffer and when the image in staging buffer is ready the BackBufferReady is triggered. The event arguments contain the size of the image, its format and the mapped subresource. | |
DeviceRemoved | DeviceRemoved event is triggered when the DirectX device is removed or reset (for example when the DirectX driver is updated; but not when computer goes to sleep). The event handler can handle this case with saving the current state of the 3D scene, dispose the current DirectX objects and recreate the 3D scene. | |
HardwareAccelerate3DLineSettingsChanged | HardwareAccelerate3DLineSettingsChanged is triggered when HardwareAccelerate3DLines or HardwareAccelerate3DLineCaps properties are changed. | |
SizeChanged | SizeChanged event is trigger after the Resize(Int32, Int32, Single, Single) method is called. |
Name | Description | |
---|---|---|
LinesCountRequiredForComplexGeometry | LinesCountRequiredForComplexGeometry specifies the number of 3D lines that are required to put the objects rendered with ScreenSpaceLineNode into the ComplexGeometryRenderingQueue (sending it to GPU as fast as possible) instead of into the LineGeometryRenderingQueue. Default value is 20000. | |
Logger | Logger is not used in release build and is always null | |
MeshTriangleIndicesCountRequiredForComplexGeometry | TriangleIndicesCountRequiredForComplexGeometry specifies the number of triangles that are required to put the objects rendered with WpfGeometryModel3DNode into the ComplexGeometryRenderingQueue (sending it to GPU as fast as possible) instead of into the StandardGeometryRenderingQueue. Default value is 100000. |
DXScene has the following tasks in the DXEngine:
- it represents a viewport that shows the scene (has a render target, buffers and other DirectX objects that are used to render the scene to)
- it has the camera
- it holds the hierarchical tree of the 3d objects
- it creates lists of used materials and effects
- it creates list of RenderQueues. Each RenderQueue is filled with IRenderable objects. List of RenderQueues is than passed to DXDevice that renderer the objects to the render targets specified by this DXScene.
- it can get change notifications from 3d objects and updates the lists of materials, effects, and RenderQueues accordingly. It also triggers rendering when needed.