Click or drag to resize
AB4D logo

DXAttributeType Enumeration

DXAttributeType enum defines possible types of DXAttributes that can be used to annotate WPF objects with DXEngine's properties.

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine.Wpf (in Ab3d.DXEngine.Wpf.dll) Version: 7.1.9105.2048
Syntax
C#
public enum DXAttributeType
Members
Member nameValueDescription
Undefined0 Undefined
Material_EnvironmentMap100 The attribute can be set to a WPF's Material and represents an environment map (as SharpDX.Direct3D11.ShaderResourceView or as Ab3d.DirectX.Materials.DXCubeMap).
Material_ReflectionFactor101 The attribute Color3, float or double can be set to a WPF's Material and represents the percentage (from 0 to 1) of how much the environment map will be visible on top of diffuse material. When Color3 is used the color components represent reflection factor for that color.
Material_ReflectionMap102 The attribute can be set to a WPF's Material and represents a reflection map where white color represents full reflection and black no reflection (full diffuse color). The value type can be BitmapSource or ShaderResourceView.
Texture_AlphaClipThreshold103 This attribute can be set to a WPF's Material. Its float value can be between 0 and 1. When set to a float value that is bigger then 0, then alpha clipping is enabled. This means that pixels with alpha color values below this value will be clipped (not rendered and their depth will not be written to depth buffer). When alpha clipping is disabled (this attribute is not set or is set to 0) 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).
Texture_UseAlphaToCoverage104 This attribute can be set to a WPF's Material. When set to true, then the texture is rendered with using AlphaToCoverage blend state that can be used to render textures with transparent and semi-transparent pixels and does not require objects to be sorted by their camera distance. See remarks for more information.
UseSolidColorEffect105 UseSolidColorEffect can be set to any WPF's Material. The value must be set before the DXEngine's material is initialized (changes after that does not have any effect). When true, then the material is rendered by a SolidColorEffect - this means that the material is not affected by lighting calculations and is always fully illuminated even if it is not facing the light.
LineDepthBias200 LineDepthBias attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. Depth bias is a float value that specifies the depth offset for 3D lines. This can prevent drawing the 3D line and solid object at the same depth (preventing z-fighting).
LineDynamicDepthBiasFactor201 LineDynamicDepthBiasFactor attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. When DynamicDepthBiasFactor is bigger then 0 then this factor is multiplied by the distance of the position to the camera and this is then multiplied by the LineDepthBias. This can be used to correctly set the depth bias for objects that are close (require small depth bias) to the camera and to the objects that are far away from the camera (require big depth bias). Recommended values are: DepthBias: 0.1, DynamicDepthBiasFactor: 0.02; or LineDepthBias: 0.002, LineDynamicBiasFactor: 1.
LinePattern202 LinePattern attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. LinePattern is an int value that defines the 16 bit int value that defines the line pattern - if bit is 1 then line is drawn, when 0 line is not drawn. For example value 0xFFFF means full line without any dots or dashes. Value 0x5555 means line with dots - one full dot follows one empty dot. Note that the lowest bit is rendered first so the patten value needs to be read from right to left. For example, line with pattern 0xF0F0 will starts with empty part (4 empty bits) and then 4 full parts will be rendered.
LinePatternScale203 LinePatternScale attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. LinePatternScale is a float value that sets the pattern scale factor. Value 1 does not scale the pattern. Values bigger then 1 increase the pattern length; values smaller then 1 decrease the pattern length (making it more dense).
LinePatternOffset204 LinePatternOffset attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. LinePatternOffset is a float value that sets a pattern offset. This value is usually between 0 and 1 - 0 value means no offset, 1 means offset for the whole patter which is the same as no offset. Value 0.1 means that the line will begin with the pattern advanced by 10%, 1/16 means that the pattern is offset by one bit.
UseGeometryShaderFor3DLines205 UseGeometryShaderFor3DLines attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. When UseGeometryShaderFor3DLines is set, then this overrides the UseGeometryShaderFor3DLines setting in DXScene object. If set to false and also the RenderAntialiased3DLines is set to false, then the lines are always rendered as 1 pixel thick lines. Note that when using super-sampling the line rendered with that DXAttribute become dimmer because the super-sampled image is still rendered with 1 pixel thick line and that is then down-sampled to final image.
RenderAntialiased3DLines206 RenderAntialiased3DLines attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D class. When RenderAntialiased3DLines is set, then this overrides the RenderAntialiased3DLines setting in DXScene object. This setting can be used only when UseGeometryShaderFor3DLines is set to false.
ReadZBuffer301 ReadZBuffer attribute can be set to any object derived from BaseLineVisual3D type or to WireframeVisual3D. ReadZBuffer is a Boolean that specifies if the 3D lines are rendered with (true) or without (false) reading depth buffer values. This allows rendering 3D lines that appear inside 3D objects.
IsReceivingShadow302 IsReceivingShadow attribute can be set to a GeometryModel3D object. Boolean values that specifies if the object is receiving shadow. Note that not all objects support this attribute. This works only for VarianceShadowRenderingProvider.
IsCastingShadow303 IsCastingShadow attribute can be set to a GeometryModel3D object. Boolean values that specifies if the light or object is casting shadow. Before shadows can be rendered, they need to be initialized with InitializeShadowRendering(ShadowRenderingProviderBase) method. This works for VarianceShadowRenderingProvider and PlanarShadowRenderingProvider but not for ScreenSpaceAmbientOcclusionRenderingProvider.
CustomRenderingQueue304 CustomRenderingQueue attribute can be set to a WPF 3D object. The attribute can be used on GeometryModel3D or Visual3D and specifies the RenderingQueue that will be used to render the DXEngine's object created from the WPF object. The value can be an instance of RenderingQueue (as RenderingQueue) or name of the RenderingQueue (as string).
CachedBitmapSize305 The CachedBitmapSize attribute can be used on WPF's Material object to specify the size of the bitmap that will be rendered in case of using VisualBrush, GradientBrush or DrawingImage. The value of this attribute can be specified with the following types: SharpDX.Size2, Size, Int32, double, float (in case of double, float and int the Width and Height are both set to the same value). It is recommended that the size is a power or 2 (64, 128, 256, etc.)
CreateDynamicVertexBuffer306 The CreateDynamicVertexBuffer attribute can be set to a GeometryModel3D object. When set to true, then a dynamic vertex buffer will be created. This can be used when you change the Positions, Normals or TextureCoordinates very often (and when count of position is the same). When using a dynamic vertex buffer, the existing vertex buffer is reused when updating the data; otherwise the existing vertex buffer is disposed and a new vertex buffer is created - this can lead to GPU memory fragmentation.
MeshTangentArray400 When MeshTangentArray DXAttribute is set to a MeshGeometry3D, it specifies an array of Vector3 values that represents the tangent values for each position defined by this MeshGeometry3D. This DXAttribute must be set before the MeshGeometry3D is initialized in DXEngine. If the tangents are changed, a new MeshGeometry3D must be created.
OnDXResourcesInitializedAction500 OnDXResourcesInitializedAction attribute can be set to a WPF 3D object. Its value is a callback method defined as Action<object> or Action<SceneNode>. The callback method is called after the specified DXEngine's resource is initialized and DirectX resource objects are created (after OnInitializeResources is called). For example when this method is set to Ab3d.Visuals.LineVisual3D object, the Action<object> or Action<SceneNode> is called with the WpfModelVisual3DNode that is created from the LineVisual3D object (ScreenSpaceLineNode with LineMaterial is created as the first child of the WpfModelVisual3DNode).
OnSceneNodeCreatedAction501 OnDXResourcesInitializedAction attribute can be set to a WPF 3D object. Its value is a callback method defined as Action<SceneNode>. The callback method is called after a SceneNode is created from the WPF object. To get a callback after the DirectX resources and child SceneNodes are already initialized use the OnDXResourcesInitializedAction instead.
LastUsedEnumValue100,000 Last used official enum value. User may use bigger values for its own data types. If value is bigger than this value, it will not be replaced by any official enum value in the future version of Ab3d.DXEngine.
Remarks

DXAttributeType enum defines possible types of DXAttributes that can be used to annotate WPF objects with DXEngine's properties.

Each attribute type can be set to a specific WPF's object and can be set by a specific type (for example, LineDepthBias can be attached to a WireframeVisual3D or an object derived from BaseLineVisual3D class; the value can be a float or a double number). See description of the attribute to see its target type and type of its value.

The attribute can be attached to a WPF 3D object by using an extension methods (for example SetDXAttribute(Geometry3D, DXAttributeType, Object)). Internally the attributes are stored in a DXAttributeCollection collection so you can attach many different attributes to a single WPF object.

Attributes support change notifications, so most of them can be changed after they are applied. But there are some attributes that are read only at initialization time (for example MeshTangentArray that specifies mesh tangents that are used for PBR materials).

Example

The following code sample shows how to use SetDXAttribute to assign 3 different line pattern setting to a LineVisual3D object.

C#
var lineVisual3D = new Ab3d.Visuals.LineVisual3D()
{
    StartPosition = new Point3D(0, 0, 0),
    EndPosition = new Point3D(0, 100, 0),
    LineThickness = 4,
    LineColor = Colors.Orange
};

lineVisual3D.SetDXAttribute(DXAttributeType.LinePattern, 0x5555);
lineVisual3D.SetDXAttribute(DXAttributeType.LinePatternScale, 2);
lineVisual3D.SetDXAttribute(DXAttributeType.LinePatternOffset, 0);
See Also