Click or drag to resize
AB4D logo

DXDeviceResourcesCache Class

DXDeviceResourcesCache is used to store DXEngine's objects (WpfMaterial, DXMeshGeometry3D and WpfGeometryModel3DNode) that are created from WPF objects. This allows reusing DXEngine's objects when one instance of WPF object is used on multiple objects - for example one DiffuseMaterial can be used on many GeometryModel3D objects. This class caches objects per DXDevice and is set to the DXDevice's ResourcesCache property.
Inheritance Hierarchy
SystemObject
  Ab3d.DirectX.CommonDXDeviceResourcesCache

Namespace: Ab3d.DirectX.Common
Assembly: Ab3d.DXEngine.Wpf (in Ab3d.DXEngine.Wpf.dll) Version: 7.0.8865.1045
Syntax
C#
public class DXDeviceResourcesCache : IDisposable

The DXDeviceResourcesCache type exposes the following members.

Methods
 NameDescription
Public methodAddDXMaterial Adds the DXEngine's dxMaterial that was created from the WPF material to this DXDeviceResourcesCache.
Public methodAddDXMeshGeometry3D Adds the DXEngine's DXMeshGeometry3D that was created from the WPF MeshGeometry3D to this DXDeviceResourcesCache.
Public methodDispose Dispose
Public methodStatic memberGetDXDeviceResourcesCache Returns the DXDeviceResourcesCache for the specified dxDevice or create a new cache if it was not yet created for the DXDevice.
Public methodRemoveDXMaterial Removes the cached DXEngine's material for the specified WPF material.
Public methodRemoveDXMeshGeometry3D Removes the cached DXEngine's DXMeshGeometry3D for the specified WPF MeshGeometry3D.
Public methodTryGetDXMaterial Returns true and sets the dxMaterial parameter when the WPF material was cached in this DXDeviceResourcesCache. Otherwise returns false and sets dxMaterial to null.
Public methodTryGetDXMeshGeometry3D Returns true and sets the dxMeshGeometry3D parameter when the WPF MeshGeometry3D was cached in this DXDeviceResourcesCache. Otherwise returns false and sets dxMeshGeometry3D to null.
Top
Remarks

DXDeviceResourcesCache is used to store DXEngine's objects that are created from WPF objects.

This allows reusing DXEngine's objects when one instance of WPF object is used on multiple objects - for example one DiffuseMaterial can be used on many GeometryModel3D objects.

This class caches objects per DXDevice and is set to the DXDevice's ResourcesCache property.

To get an instance of the DXDeviceResourcesCache, call the static GetDXDeviceResourcesCache(DXDevice) method. It will get the DXDeviceResourcesCache for the specified dxDevice or create a new cache if it was not yet created.

The constructor of the class is protected to allow creating a derived classes.

This class is not thread safe. When DXEngine objects are created in multiple threads you need to synchronize access to this class with using lock. This is already done when this class is used in DXEngine.

See Also