Click or drag to resize
AB4D logo

PixelMaterial Class

PixelMaterial defines how 3D pixels are drawn with the PixelEffect.
Inheritance Hierarchy
SystemObject
  Ab3d.DirectXDXResourceBase
    Ab3d.DirectXSharedDXResource
      Ab3d.DirectXSharedDXDeviceResource
        Ab3d.DirectXMaterial
          Ab3d.DirectX.MaterialsPixelMaterial

Namespace: Ab3d.DirectX.Materials
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.1.9105.2048 (1.0.0.0)
Syntax
C#
public class PixelMaterial : Material, 
	IPixelMaterial, IVertexColorMaterial, IVertexScalesMaterial, IZBufferStateMaterial, ITransparentMaterial, 
	IDiffuseTextureMaterial

The PixelMaterial type exposes the following members.

Constructors
 NameDescription
Public methodPixelMaterial Constructor with white color and pixel size set to 1.
Public methodPixelMaterial(Color4, Single) Constructor
Top
Properties
 NameDescription
Public propertyAlphaClipThreshold Pixels with alpha color values below this value will be clipped (not rendered and their depth will not be written to depth buffer). This value is fixed to 0.5.
Public propertyCreateDynamicBuffer Gets or sets a Boolean that specifies if a dynamic vertex buffer will be created from the PixelColors array. This can be used in case when the colors change very often.
Public propertyDiffuseTextures Gets an array of ShaderResourceView objects that define the textures. Call SetTexture(ShaderResourceView, Size2, Color4, SamplerState, BlendState, String) or SetTexture(ShaderResourceView, Size2, SamplerState, BlendState, String) to set this property.
Public propertyFixedUpVector Gets a nullable Vector3 that can specify a fixed up vector. By default (when FixedUpVector is null), pixels always face the camera so that their up vector is perpendicular to the look direction. But for some cases (for example for rendering trees that always grow upwards), you can fix the up vector. When FixedUpVector is set to a Vector3, then it will always be used for up vector when orienting pixel towards the camera. Fixed up vector can be used only when IsWorldSize is set to true. This property can be set by SetFixedUpVector(Vector3) and ResetFixedUpVector methods.
Public propertyHasTransparency Gets a Boolean that specifies if the PixelColors array contains any transparent color (alpha < 1). This property is used only when PixelColors array is defined. Default value is false.
Public propertyIsCircularPixel When true then each pixel is rendered as circle instead of square. Default value is false.
Public propertyIsWorldSize When true then the PixelSize is specified in 3D world coordinates (when using perspective camera, the size of the pixel is smaller when it is farther away from the camera). When false (by default), then the size is defined in screen coordinates (the size of the pixel is always the same regardless of the distance from the camera).
Public propertyPixelColor Gets or sets the Color4 of pixels. Default value is White. When PixelColors array is set, the value of this property is used as a mask that is multiplied with each color defined in the array.
Public propertyPixelColors Gets or sets a Color4 array that specifies the colors for each pixel. When color's alpha is 0, the pixel is not rendered. When PixelColors array is set, the PixelColor is used as a mask that is multiplied with each color defined in the array (set PixelColor to White to use the values specified in this array). When null, the color of all the pixels is set by the color defined by the PixelColor property. When individual values of PixelColors are changed, you need to call UpdatePixelColors method for the changes to take effect. To hide an individual pixel from rendering, set its color in PixelColors to a color with alpha value if zero (you can also set its size in the PixelSizes to 0).
Public propertyPixelSize Gets or sets the width and height of the pixel in screen space units. This value is scaled with DPI scale factor.
Public propertyPixelSizes Gets or sets a float array that specifies the sizes for each pixel. When size is less of equal to 0, the pixel is not rendered. When PixelSizes array is set, the PixelSize value is multiplied with each size defined in the array (set PixelSize to 1 to use the values specified in this array). When null, the size of all the pixels is set by the value defined by the PixelSize property. When individual values of PixelSizes are changed, you need to call UpdatePixelSizes method for the changes to take effect. To hide an individual pixel from rendering, set its size in the PixelSizes to 0 (you can also set its color in PixelColors to a color with alpha value if zero).
Public propertyReadZBuffer Gets or sets a Boolean that specifies if Z buffer is read when rendering the pixel - if the depth test is done when rendering the pixel. If false then the pixel is rendered regardless of its depth - if is rendered even if it is behind some other 3D objects.
Public propertySamplerStates Gets an array of SamplerState objects that define the state of the samplers. Call SetTexture(ShaderResourceView, Size2, Color4, SamplerState, BlendState, String) or SetTexture(ShaderResourceView, Size2, SamplerState, BlendState, String) to set this property.
Public propertyTextureBlendState Gets a BlendState that is used to render the texture. If null a CommonStates.Opaque will be used. Call SetTexture(ShaderResourceView, Size2, Color4, SamplerState, BlendState, String) or SetTexture(ShaderResourceView, Size2, SamplerState, BlendState, String) to set this property.
Public propertyTextureResourceName Gets a string that can be used to specify the name of the texture - this can be a file name of the texture file. Call SetTexture(ShaderResourceView, Size2, Color4, SamplerState, BlendState, String) or SetTexture(ShaderResourceView, Size2, SamplerState, BlendState, String) to set this property.
Public propertyTextureSize Size of the pixel texture.
Public propertyVertexColorsVertexBufferBinding Gets a VertexBufferBinding for an array of Color4 values where each value represents a color of one position.
Public propertyVertexScalesVertexBufferBinding Gets a VertexBufferBinding that is created from PixelSizes array.
Public propertyWriteZBuffer Gets or sets a Boolean that specifies if Z buffer is written when rendering the pixel - if the pixel can occlude other 3D objects. If true then the objects behind the pixel will not be rendered. If false the line will not prevent rendering objects behind it.
Top
Methods
 NameDescription
Public methodGetDefaultRenderingQueue Returns the RenderingQueue that should be used to render this material.
(Overrides MaterialGetDefaultRenderingQueue(DXScene))
Public methodRemoveTexture Removes the texture that was set by calling SetTexture method.
Public methodResetFixedUpVector Resets the fixed up vector that was set by SetFixedUpVector(Vector3) to default behaviour (pixels always face the camera so that their up vector is perpendicular to the look direction).
Public methodSetFixedUpVector SetFixedUpVector sets a fixed up Vector3 to be always used for up vector when orienting pixel towards the camera. By default, pixels always face the camera so that their up vector is perpendicular to the look direction. But for some cases (for example for rendering trees that always grow upwards), you can fix the up vector. To reset that up vector to default behaviour, call ResetFixedUpVector. Fixed up vector can be used only when IsWorldSize is set to true.
Public methodSetTexture(ShaderResourceView, Size2, SamplerState, BlendState, String) SetTexture method sets the specified texture to be rendered for each pixel. This value is used when the object does not provide a PixelMaterial. When rendering texture, AlphaClipThreshold is set to 0.5 (pixel with alpha color values below this value will be clipped). To remove the texture, set the pixelTexture to null or call RemoveTexture.
Public methodSetTexture(ShaderResourceView, Size2, Color4, SamplerState, BlendState, String) SetTexture method sets the specified texture to be rendered for each pixel. This value is used when the object does not provide a PixelMaterial. This also sets the PixelColor to colorMask. When rendering texture, AlphaClipThreshold is set to 0.5 (pixel with alpha color values below this value will be clipped). To remove the texture, set the pixelTexture to null or call RemoveTexture.
Public methodToString ToString
(Overrides MaterialToString)
Public methodUpdatePixelColors UpdatePixelColors method updates the DirectX vertex buffer from the current values of PixelColors.
Public methodUpdatePixelSizes UpdatePixelSizes method updates the DirectX vertex buffer from the current values of PixelSize.
Top
See Also