Click or drag to resize
Ab4d.SharpEngine logo

PixelMaterial Class

PixelMaterial is a material that can be used to render 3D pixels.
Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.CoreComponentBase
    Ab4d.SharpEngine.CoreInitializedSceneComponent
      Ab4d.SharpEngine.MaterialsMaterial
        Ab4d.SharpEngine.MaterialsPixelMaterial

Namespace: Ab4d.SharpEngine.Materials
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 3.1.9316+94bbd23b55747f096f056a5602f7dd90558b3673
Syntax
C#
public class PixelMaterial : Material, 
	IPixelMaterial, IVertexColorMaterial, ITransparentMaterial, IVertexScaleMaterial, IDiffuseTextureMaterial, 
	IAlphaPreMultipliedMaterial

The PixelMaterial type exposes the following members.

Constructors
 NameDescription
Public methodPixelMaterial(String) Constructor with white color and pixel size set to 1.
Public methodPixelMaterial(Color4, Single, String) Constructor
Public methodPixelMaterial(Color4, Boolean, Single, String) Constructor
Public methodPixelMaterial(Color4, Single, Boolean, String) 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). Expected values are between 0 and 1. When 0 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). Default value is 0.5f.
Public propertyDiffuseTexture Gets or sets a GpuImage objects that define the texture. When rendering texture, the colors from texture are multiplied by the PixelColor (White color is used when a texture is set and PixelColor is not changed by the user). When user does not set the PixelColor but sets the DiffuseTexture, then the PixelColor is automatically set to White color to preserve the colors in the texture. The GpuImage is not disposed when disposing this Material.
Public propertyDiffuseTextureSampler Gets the GpuSampler that defines how the diffuse texture is read by the graphics card. The sampler can be set by DiffuseTextureSamplerType or by calling the SetDiffuseTextureSampler(GpuSampler) method.
Public propertyDiffuseTextureSamplerType Gets or sets the sampler type for the diffuse texture. Sampler type defines how the texture is read by the graphics card. Default value is Mirror. Setting this property sets the DiffuseTextureSampler with the actual GpuSampler when the material is initialized. It is also possible to set the DiffuseTextureSampler by calling the SetDiffuseTextureSampler(GpuSampler) method.
Public propertyHasTransparency HasTransparency can be set when PixelColors is used and can specify if any of the pixel color has alpha value less than 1. When this property not set and PixelColors is used, then all colors are checked to see if there is any transparent color.
Public propertyIsPreMultipliedAlphaColor When IsPreMultipliedAlphaColor is true (false by default), then the PixelColor and PixelColors array contains pre-multiplied colors (color components multiplied with alpha value). Default value is false.
Public propertyPixelColor Gets or sets the Color4 of pixels. 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. By default, the PixelColor value is not alpha pre-multiplied. To use alpha pre-multiplied colors, set the IsPreMultipliedAlphaColor property to true. If this property is not set and when PixelColors property is set, then the default value of this property is Color.White (no color mask). When PixelColors is not set, then the default value of this property is Colors.Black.
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. By default, the color values are not alpha pre-multiplied. To use alpha pre-multiplied colors, set the IsPreMultipliedAlphaColor property to true. 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.
Public propertyPixelSize Gets or sets the width and height of the pixel in screen space units. This value is scaled with DPI scale factor. Default value is 1.
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.
Public propertyTextureSource Gets a source string that can contain file name or other string that defines the source of this GpuImage (TextureSource is read from GpuImage object and can be null even when DiffuseTexture is set).
Public propertyVertexColorsBuffer Gets a GpuBuffer for an array of Color4 values where each value represents a color of one position (vertex).
Public propertyVertexScaleBuffer Gets a GpuBuffer for an array of float values where each value represents a scale (or size) of one position (pixel).
Top
Methods
 NameDescription
Protected methodDispose Dispose
(Overrides MaterialDispose(Boolean))
Protected methodOnDiffuseTextureDisposing OnDiffuseTextureDisposing
Protected methodOnEffectChanged OnEffectChanged is called after the effect is changed - overridden methods can return false to prevent the change of effect.
(Overrides MaterialOnEffectChanged(Effect, Effect))
Protected methodOnInitializeSceneResources Initializes resources with the specified Scene and GpuDevice. This method can be overriden and is called from InitializeSceneResources(Scene) method.
(Overrides MaterialOnInitializeSceneResources(Scene, VulkanDevice))
Public methodSetDiffuseTextureSampler SetDiffuseTextureSampler method sets the DiffuseTextureSampler to the specified sampler. It also sets the DiffuseTextureSamplerType to Other. It is also possible to set the DiffuseTextureSampler to a common sampler by setting the DiffuseTextureSamplerType.
Public methodToString ToString
(Overrides MaterialToString)
Public methodUpdatePixelColors UpdatePixelColors must be called when the values in the PixelColors array is changed. The method recreates the GpuBuffer that defined the pixel color data for the graphics card.
Public methodUpdatePixelColorsTransparency UpdatePixelColorsTransparency method check if any color in the PixelColors has Alpha value less than 1 and sets HasTransparency accordingly.
Public methodUpdatePixelSizes UpdatePixelSizes must be called when the values in the PixelSizes array is changed. The method recreates the GpuBuffer that defined the pixel sizes data for the graphics card.
Top
Remarks

[Missing <remarks> documentation for "T:Ab4d.SharpEngine.Materials.PixelMaterial"]

See Also