Class MaterialVariable
- Namespace
- HelixToolkit.SharpDX.Model
- Assembly
- HelixToolkit.SharpDX.dll
public abstract class MaterialVariable : DisposeObject, IDisposable
- Inheritance
-
MaterialVariable
- Implements
- Derived
- Inherited Members
Constructors
MaterialVariable(IEffectsManager?, IRenderTechnique?, ConstantBufferDescription?, MaterialCore?)
Initializes a new instance of the MaterialVariable class.
public MaterialVariable(IEffectsManager? manager, IRenderTechnique? technique, ConstantBufferDescription? meshMaterialConstantBufferDesc, MaterialCore? materialCore)
Parameters
managerIEffectsManagerThe manager.
techniqueIRenderTechniqueThe technique.
meshMaterialConstantBufferDescConstantBufferDescriptionThe Constant Buffer description
materialCoreMaterialCore
Fields
DefaultMeshConstantBufferDesc
public static readonly ConstantBufferDescription DefaultMeshConstantBufferDesc
Field Value
DefaultNonMaterialBufferDesc
public static readonly ConstantBufferDescription DefaultNonMaterialBufferDesc
Field Value
DefaultPointLineConstantBufferDesc
public static readonly ConstantBufferDescription DefaultPointLineConstantBufferDesc
Field Value
DefaultVolumeConstantBufferDesc
public static readonly ConstantBufferDescription DefaultVolumeConstantBufferDesc
Field Value
materialCB
Gets the material cb.
protected ConstantBufferProxy? materialCB
Field Value
- ConstantBufferProxy
The material cb.
nonMaterialCB
Gets the non material cb. Used for non material related rendering such as Shadow map
protected ConstantBufferProxy? nonMaterialCB
Field Value
- ConstantBufferProxy
The non material cb.
Properties
EffectsManager
protected IEffectsManager? EffectsManager { get; }
Property Value
ID
Gets or sets the identifier. Used for material sorting
public ushort ID { get; set; }
Property Value
- ushort
The identifier.
NeedUpdate
protected bool NeedUpdate { get; }
Property Value
Technique
protected IRenderTechnique? Technique { get; }
Property Value
Methods
AddPropertyBinding(string, Action)
protected void AddPropertyBinding(string propertyName, Action action)
Parameters
BindMaterialResources(RenderContext, DeviceContextProxy, ShaderPass)
Binds the material textures, samplers, etc,.
public abstract bool BindMaterialResources(RenderContext context, DeviceContextProxy deviceContext, ShaderPass shaderPass)
Parameters
contextRenderContextdeviceContextDeviceContextProxyThe device context.
shaderPassShaderPassThe shader pass.
Returns
Draw(DeviceContextProxy, IAttachableBufferModel, int)
Draws the specified device context.
public abstract void Draw(DeviceContextProxy deviceContext, IAttachableBufferModel bufferModel, int instanceCount)
Parameters
deviceContextDeviceContextProxyThe device context.
bufferModelIAttachableBufferModelGeometry buffer model.
instanceCountintThe instance count.
DrawIndexed(DeviceContextProxy, int, int)
public static void DrawIndexed(DeviceContextProxy context, int indexCount, int instanceCount)
Parameters
contextDeviceContextProxyindexCountintinstanceCountint
DrawPoints(DeviceContextProxy, int, int)
public static void DrawPoints(DeviceContextProxy context, int vertexCount, int instanceCount)
Parameters
contextDeviceContextProxyvertexCountintinstanceCountint
GetDepthPass(RenderType, RenderContext)
Gets the depth pass.
public abstract ShaderPass GetDepthPass(RenderType renderType, RenderContext context)
Parameters
renderTypeRenderTypeType of the render.
contextRenderContextThe context.
Returns
GetPass(RenderType, RenderContext)
Gets the pass.
public abstract ShaderPass GetPass(RenderType renderType, RenderContext context)
Parameters
renderTypeRenderTypeType of the render.
contextRenderContextThe context.
Returns
GetPassByName(string)
Gets the name of the pass by.
public ShaderPass? GetPassByName(string name)
Parameters
namestringThe name.
Returns
GetShadowPass(RenderType, RenderContext)
Gets the shadow pass.
public abstract ShaderPass GetShadowPass(RenderType renderType, RenderContext context)
Parameters
renderTypeRenderTypecontextRenderContextThe context.
Returns
GetWireframePass(RenderType, RenderContext)
Gets the wireframe pass.
public abstract ShaderPass GetWireframePass(RenderType renderType, RenderContext context)
Parameters
renderTypeRenderTypecontextRenderContextThe context.
Returns
InvalidateRenderer()
protected void InvalidateRenderer()
NotifyUpdateNeeded()
protected void NotifyUpdateNeeded()
OnDispose(bool)
protected override void OnDispose(bool disposeManagedResources)
Parameters
disposeManagedResourcesbool
OnInitialPropertyBindings()
protected virtual void OnInitialPropertyBindings()
TriggerPropertyAction(string)
protected void TriggerPropertyAction(string propertyName)
Parameters
propertyNamestring
UpdateInternalVariables(DeviceContextProxy)
protected virtual void UpdateInternalVariables(DeviceContextProxy deviceContext)
Parameters
deviceContextDeviceContextProxy
UpdateMaterialStruct<T>(DeviceContextProxy, ref T)
Updates the material structure. And upload data to constant buffer
public bool UpdateMaterialStruct<T>(DeviceContextProxy context, ref T model) where T : unmanaged
Parameters
contextDeviceContextProxyThe context.
modelTThe model.
Returns
Type Parameters
T
UpdateNonMaterialStruct<T>(DeviceContextProxy, ref T)
Updates the non material structure.
public bool UpdateNonMaterialStruct<T>(DeviceContextProxy context, ref T model) where T : unmanaged
Parameters
contextDeviceContextProxyThe context.
modelTThe model.
Returns
Type Parameters
T
WriteValue<T>(string, T)
Writes the value to internal buffer array
public void WriteValue<T>(string name, T value) where T : unmanaged
Parameters
namestringThe name.
valueTThe value.
Type Parameters
T
WriteValue<T>(string, ref T)
Writes the value to internal buffer array
public void WriteValue<T>(string name, ref T value) where T : unmanaged
Parameters
namestringThe name.
valueTThe value.
Type Parameters
T
Events
UpdateNeeded
public event EventHandler? UpdateNeeded