Table of Contents

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

manager IEffectsManager

The manager.

technique IRenderTechnique

The technique.

meshMaterialConstantBufferDesc ConstantBufferDescription

The Constant Buffer description

materialCore MaterialCore

Fields

DefaultMeshConstantBufferDesc

public static readonly ConstantBufferDescription DefaultMeshConstantBufferDesc

Field Value

ConstantBufferDescription

DefaultNonMaterialBufferDesc

public static readonly ConstantBufferDescription DefaultNonMaterialBufferDesc

Field Value

ConstantBufferDescription

DefaultPointLineConstantBufferDesc

public static readonly ConstantBufferDescription DefaultPointLineConstantBufferDesc

Field Value

ConstantBufferDescription

DefaultVolumeConstantBufferDesc

public static readonly ConstantBufferDescription DefaultVolumeConstantBufferDesc

Field Value

ConstantBufferDescription

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

IEffectsManager

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

bool

Technique

protected IRenderTechnique? Technique { get; }

Property Value

IRenderTechnique

Methods

AddPropertyBinding(string, Action)

protected void AddPropertyBinding(string propertyName, Action action)

Parameters

propertyName string
action Action

BindMaterialResources(RenderContext, DeviceContextProxy, ShaderPass)

Binds the material textures, samplers, etc,.

public abstract bool BindMaterialResources(RenderContext context, DeviceContextProxy deviceContext, ShaderPass shaderPass)

Parameters

context RenderContext
deviceContext DeviceContextProxy

The device context.

shaderPass ShaderPass

The shader pass.

Returns

bool

Draw(DeviceContextProxy, IAttachableBufferModel, int)

Draws the specified device context.

public abstract void Draw(DeviceContextProxy deviceContext, IAttachableBufferModel bufferModel, int instanceCount)

Parameters

deviceContext DeviceContextProxy

The device context.

bufferModel IAttachableBufferModel

Geometry buffer model.

instanceCount int

The instance count.

DrawIndexed(DeviceContextProxy, int, int)

public static void DrawIndexed(DeviceContextProxy context, int indexCount, int instanceCount)

Parameters

context DeviceContextProxy
indexCount int
instanceCount int

DrawPoints(DeviceContextProxy, int, int)

public static void DrawPoints(DeviceContextProxy context, int vertexCount, int instanceCount)

Parameters

context DeviceContextProxy
vertexCount int
instanceCount int

GetDepthPass(RenderType, RenderContext)

Gets the depth pass.

public abstract ShaderPass GetDepthPass(RenderType renderType, RenderContext context)

Parameters

renderType RenderType

Type of the render.

context RenderContext

The context.

Returns

ShaderPass

GetPass(RenderType, RenderContext)

Gets the pass.

public abstract ShaderPass GetPass(RenderType renderType, RenderContext context)

Parameters

renderType RenderType

Type of the render.

context RenderContext

The context.

Returns

ShaderPass

GetPassByName(string)

Gets the name of the pass by.

public ShaderPass? GetPassByName(string name)

Parameters

name string

The name.

Returns

ShaderPass

GetShadowPass(RenderType, RenderContext)

Gets the shadow pass.

public abstract ShaderPass GetShadowPass(RenderType renderType, RenderContext context)

Parameters

renderType RenderType
context RenderContext

The context.

Returns

ShaderPass

GetWireframePass(RenderType, RenderContext)

Gets the wireframe pass.

public abstract ShaderPass GetWireframePass(RenderType renderType, RenderContext context)

Parameters

renderType RenderType
context RenderContext

The context.

Returns

ShaderPass

InvalidateRenderer()

protected void InvalidateRenderer()

NotifyUpdateNeeded()

protected void NotifyUpdateNeeded()

OnDispose(bool)

protected override void OnDispose(bool disposeManagedResources)

Parameters

disposeManagedResources bool

OnInitialPropertyBindings()

protected virtual void OnInitialPropertyBindings()

TriggerPropertyAction(string)

protected void TriggerPropertyAction(string propertyName)

Parameters

propertyName string

UpdateInternalVariables(DeviceContextProxy)

protected virtual void UpdateInternalVariables(DeviceContextProxy deviceContext)

Parameters

deviceContext DeviceContextProxy

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

context DeviceContextProxy

The context.

model T

The model.

Returns

bool

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

context DeviceContextProxy

The context.

model T

The model.

Returns

bool

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

name string

The name.

value T

The 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

name string

The name.

value T

The value.

Type Parameters

T

Events

UpdateNeeded

public event EventHandler? UpdateNeeded

Event Type

EventHandler