Wpf |
public sealed class WpfMaterial : Material, IDiffuseMaterial, ITransparentMaterial, IDiffuseTextureMaterial, ISpecularMaterial, IEmissiveMaterial, ITwoSidedMaterial, IEnvironmentalMapMaterial, IConstantBuffersCache, IDXAttributeChangedHandler
The WpfMaterial type exposes the following members.
Name | Description | |
---|---|---|
WpfMaterial(Material) | Constructor | |
WpfMaterial(Material, DXDevice) | Constructor | |
WpfMaterial(Material, Rect) | Constructor | |
WpfMaterial(Material, Rect, DXDevice) | Constructor |
Name | Description | |
---|---|---|
Alpha | Gets a float value that defines the alpha value for the material. | |
AlphaClipThreshold | Pixels with alpha color values below this value will be clipped (not rendered and their depth will not be written to depth buffer). Expected values are between 0 and 1. When 0 (by default) then alpha clipping is disabled - this means that also pixels with alpha value 0 are fully processed (they are not visible but its depth value is still written so objects that are rendered afterwards and are behind the pixel will not be visible). | |
AmbientColor | Gets a Color3 that specifies an color that defines how much ambient color is reflected by this material. | |
CachedConstantBuffers | Gets or sets an array of DirectX Constant buffers that can be created for this instance of Material. The buffers can be created in Effects and can be reused for multiple frames when the material is not changed. | |
ConstantBuffersVersion | Gets or sets a version that was read from Material's Version at the time of creating the CachedConstantBuffers | |
DiffuseColor | Gets a Color3 that specifies the diffuse color of this material. | |
DiffuseTextures | Gets an array of ShaderResourceView that define the textures. | |
EmissiveColor | Gets a Color3 that that represents the emissive color - the color of the object regardless of the lights. | |
EnvironmentalCubeMap | Gets ShaderResourceView that defines the EnvironmentalCubeMap. ShaderResourceView should define a cube map with 6 textures for each side of the cube. | |
HasImageInvertedYTransformation | If true then the texture image has a transformation that flips the texture vertically. This property is used by DXEngine to optimize the rendering of a texture. | |
HasOnlyEmissiveColor | Gets a Boolean that specifies if this material has only emissive color. If false than other material properties are also defined. | |
HasSpecularColor | Gets a boolean that specifies if specular material is used by the WpfMaterial | |
HasTransparency | Gets a boolean that specifies if this material is semi-transparent and needs to be alpha blended with the scene. | |
IsDirty | Gets or sets a Boolean that specifies if the properties of the used WPF material have changed and we need to call UpdateMaterial method to update the properties of this material. | |
IsPreMultipliedAlphaColor | When IsPreMultipliedAlphaColor is true (false by default) and Alpha is less then 1, then the color components of the DiffuseColor are multiplied with alpha value to produce pre-multiplied alpha colors. When false, then non-pre-multiplied color is converted to pre-multiplied color when this is required by the shader. | |
IsRenderToBitmapRequired | Gets a Boolean that specifies if this material is a complex material (VisualBrush, Gradient, DrawingImage, etc.) and require calling RenderToBitmap method to get a bitmap that will be used as a texture. This property is false for solid color materials and materials with BitmapImages. | |
IsTwoSided | Gets a Boolean that specifies if the material should be rendered on both front and back side. | |
Material | Gets a WPF Material that is used by this WpfMaterial object instance. | |
ReflectionFactor | Gets reflection factor from 0 to 1 that is used when ReflectionMap is null. Values 1 means full reflection (only enviromental map will be shown) and 0 means that only diffuse material without environmental map is shown. | |
ReflectionMap | Gets ShaderResourceView that defines the reflection map where white colors mean fully reflective image and black colors mean no reflection (fully diffuse). | |
RenderedBrushTextureHeight | When set to a value bigger than 0, than this property defines the height of the RenderTargetBitmap that is created when a VisualBrush, GradientBrush (LinearGradientBrush or RadialGradientBrush) or DrawingImage is rendered into texture that is used in DXEngine. When value is 0 or less then the DefaultVisualBrushTextureSize or DefaultGradientBrushTextureSize is used (in case of rendering DrawingImage this value can be 0 and if RenderedBrushTextureWidth is set, the height will be calculate to preserve the aspect ratio). This value can be also set with using the SetDXAttribute(Material, DXAttributeType, Object) method on WPF's material with CachedBitmapSize attribute. | |
RenderedBrushTextureWidth | When set to a value bigger than 0, than this property defines the width of the RenderTargetBitmap that is created when a VisualBrush, GradientBrush (LinearGradientBrush or RadialGradientBrush) or DrawingImage is rendered into texture that is used in DXEngine. When value is 0 or less then the DefaultVisualBrushTextureSize or DefaultGradientBrushTextureSize is used (in case of rendering DrawingImage this value can be 0 and if RenderedBrushTextureHeight is set, the width will be calculate to preserve the aspect ratio). This value can be also set with using the SetDXAttribute(Material, DXAttributeType, Object) method on WPF's material with CachedBitmapSize attribute. | |
RenderToBitmapOnEveryFrame | Gets or sets a Boolean that can be specifies to true to render the material to bitmap on each rendered frame (used only in case of VisualBrush, GradientBrush or DrawingImage). This can be used to render animating VisualBrush. Use this property with caution because it can greatly decrease performance. In this case it is recommended to lower the resolution of the rendered bitmap with setting the RenderedBrushTextureWidth or RenderedBrushTextureHeight or using CachedBitmapSize DXAttribute. | |
SamplerStates | Gets an array of SamplerState that define the state of the samplers. | |
SpecularColor | Gets the Color3 that specifies the color used to draw the specular highlight effect. | |
SpecularPower | Gets a float that specifies the power of the specular effect. Zero values means that the specular effect is turned off. | |
TextureBlendState | Gets a BlendState that is used to render the texture. If null a CommonStates.Opaque will be used. | |
TextureCoordinatesBounds | TextureCoordinatesBounds contains the bounding value of the mesh's texture coordinates - needed when drawing texture and texture coordinates size is not 1. | |
TextureResourceName | Gets a string that can be used to specify the name of the texture - this can be a the file name of the texture file. |
Name | Description | |
---|---|---|
ClearUsedDXMaterial | Clears a cached DXEngine's Material that is used for the WPF material. This means that next time the WPF material will be used a new instance of DXEngine's Material will be created. | |
Clone |
Clones the current material with creating a shallow copy of this Material (properties are copied but referenced objects are preserved).
(Overrides MaterialClone) | |
CreateLineMaterial(Material, Color4, Single) | CreateLineMaterial converts WPF's material into DXEngine's LineMaterial. Line's color is get from DiffuseMaterial or EmissiveMaterial if present (else default color is used). | |
CreateLineMaterial(Material, Color, Double) | CreateLineMaterial converts WPF's material into DXEngine's LineMaterial. Line's color is get from DiffuseMaterial or EmissiveMaterial if present (else default color is used). | |
CreateTexture2D(DXDevice, BitmapSource) | CreateTexture2D creates a 2D Texture from the specified WPF BitmapSource and returns a ShaderResourceView for the texture. User must dispose the returned ShaderResourceView when it is not used any more to prevent memory leak. | |
CreateTexture2D(DXDevice, BitmapSource, TextureInfo) | CreateTexture2D creates a 2D Texture from the specified WPF BitmapSource and returns a ShaderResourceView for the texture. User must dispose the returned ShaderResourceView when it is not used any more to prevent memory leak. | |
GetDefaultRenderingQueue |
Returns the RenderingQueue that should be used to render this material.
The method returns TransparentRenderingQueue or StandardGeometryRenderingQueue based on the HasTransparency value.
(Overrides MaterialGetDefaultRenderingQueue(DXScene)) | |
GetUsedDXMaterial | GetUsedDXMaterial method returns a DXEngine's Material that was created from the WPF material (or null if no DXMaterial was created for the WPF material) parentDXDevice is requireed to check if the created DXMeshGeometry3D was created for the same device. | |
LoadTexture2D(DXDevice, String) | LoadTexture2D loads a 2D Texture from the specified fileName and returns a ShaderResourceView for the texture. User must dispose the returned ShaderResourceView when it is not used any more to prevent memory leak. This method uses WPF's image loader - to load the image directly into DirectX use the LoadShaderResourceView(Device, String, TextureInfo) or LoadShaderResourceView(Device, String, Boolean, Boolean, Boolean, TextureInfo) methods instead. | |
LoadTexture2D(DXDevice, String, TextureInfo) | LoadTexture2D loads a 2D Texture from the specified fileName and returns a ShaderResourceView for the texture. User must dispose the returned ShaderResourceView when it is not used any more to prevent memory leak. This method uses WPF's image loader - to load the image directly into DirectX use the LoadShaderResourceView(Device, String, TextureInfo) or LoadShaderResourceView(Device, String, Boolean, Boolean, Boolean, TextureInfo) methods instead. | |
Refresh |
Refresh method updates the values of the properties used by Ab3d.DXEngine with reading the values from the used WPF Material.
The method also recreates any textures that were created from WPF Material.
(Overrides MaterialRefresh) | |
SetUsedDXMaterial(Material, Material) | Sets the specified DXEngine's Material (dxMaterial) to be used when rendering the specified WPF material (wpfMaterial). It will be used when the WPF material will be shown in DXEngine (must be set before the objects are initialized in DXEngine). | |
SetUsedDXMaterial(Material, Material, DXDevice) | Obsolete. Sets the specified DXEngine's Material (dxMaterial) to be used when rendering the specified WPF material (wpfMaterial). It will be used when the WPF material will be shown in DXEngine (must be set before the objects are initialized in DXEngine). | |
ToString |
Provides a formated text of this WpfMaterial
(Overrides MaterialToString) |
Name | Description | |
---|---|---|
DefaultGradientBrushTextureSize | DefaultGradientBrushTextureSize static field defines the width and height of the RenderTargetBitmap that is created when a GradientBrush (LinearGradientBrush or RadialGradientBrush) is rendered into texture that is used in DXEngine. The value can be overridden by RenderedBrushTextureWidth and RenderedBrushTextureHeight properties. | |
DefaultVisualBrushTextureSize | DefaultVisualBrushTextureSize static field defines the width and height of the RenderTargetBitmap that is created when a VisualBrush is rendered into texture that is used in DXEngine. The value can be overridden by RenderedBrushTextureWidth and RenderedBrushTextureHeight properties. | |
LoadDdsIfAvailable | When LoadDdsIfAvailable is set to true (false by default) the texture loader will check if there is a dds file with the same name but dds file extension. If dds file exist, it is loaded instead of the specified file. This can greatly improve load performance and memory usage. The check is done only on BitmapImages that do not have CacheOption set to OnLoad - in this case the bitmap is already loaded into BitmapImage. |