Table of Contents

Class ScreenSpacedMeshRenderCore

Namespace
HelixToolkit.SharpDX.Core
Assembly
HelixToolkit.SharpDX.dll

Used to change view matrix and projection matrix to screen spaced coordinate system.

Usage: Call SetScreenSpacedCoordinates(RenderHost) to move coordinate system. Call other render functions for sub models. Finally call RestoreCoordinates(RenderHost) to restore original coordinate system.

public class ScreenSpacedMeshRenderCore : RenderCore, IDisposable, IGUID, IThrowingShadow, IScreenSpacedRenderParams
Inheritance
ScreenSpacedMeshRenderCore
Implements
Inherited Members

Constructors

ScreenSpacedMeshRenderCore()

Initializes a new instance of the ScreenSpacedMeshRenderCore class.

public ScreenSpacedMeshRenderCore()

Properties

AbsolutePosition3D

Gets or sets the absolute position. Used in AbsolutePosition3D

public Vector3 AbsolutePosition3D { get; set; }

Property Value

Vector3

The absolute position.

CameraDistance

public float CameraDistance { get; }

Property Value

float

CameraType

Only being used when Mode is RelativeScreenSpaced

public ScreenSpacedCameraType CameraType { get; set; }

Property Value

ScreenSpacedCameraType

FarPlane

Gets the far plane.

public float FarPlane { get; set; }

Property Value

float

The far plane.

Fov

Fov in radian

public float Fov { get; }

Property Value

float

GlobalTransform

public GlobalTransformStruct GlobalTransform { get; }

Property Value

GlobalTransformStruct

Height

Viewport Height

public float Height { get; }

Property Value

float

IsPerspective

public bool IsPerspective { get; }

Property Value

bool

IsRightHand

public bool IsRightHand { get; }

Property Value

bool

Mode

Gets or sets the mode.

public ScreenSpacedMode Mode { get; set; }

Property Value

ScreenSpacedMode

The mode.

NearPlane

Gets the near plane.

public float NearPlane { get; set; }

Property Value

float

The near plane.

RelativeScreenLocationX

Relative position X of the center of viewport

public float RelativeScreenLocationX { get; set; }

Property Value

float

RelativeScreenLocationY

Relative position Y of the center of viewport

public float RelativeScreenLocationY { get; set; }

Property Value

float

ScreenRatio

public float ScreenRatio { get; }

Property Value

float

Size

Default size. To scale, use SizeScale

public float Size { get; }

Property Value

float

SizeScale

Size scaling

public float SizeScale { get; set; }

Property Value

float

Width

Viewport Width

public float Width { get; }

Property Value

float

Methods

CreateViewMatrix(RenderContext, out Vector3)

Creates the view matrix.

protected Matrix4x4 CreateViewMatrix(RenderContext renderContext, out Vector3 eye)

Parameters

renderContext RenderContext

The render context.

eye Vector3

The eye.

Returns

Matrix4x4

OnAttach(IRenderTechnique?)

During attatching render core. Create all local resources. Use Collect(resource) to let object be released automatically during Detach().

protected override bool OnAttach(IRenderTechnique? technique)

Parameters

technique IRenderTechnique

Returns

bool

OnCreateProjectionMatrix(RenderContext)

Called when [create projection matrix].

protected virtual void OnCreateProjectionMatrix(RenderContext context)

Parameters

context RenderContext

OnDetach()

On detaching, default is to release all resources

protected override void OnDetach()

Render(RenderContext, DeviceContextProxy)

Called when [render].

public override void Render(RenderContext renderContext, DeviceContextProxy deviceContext)

Parameters

renderContext RenderContext

The render context.

deviceContext DeviceContextProxy

The device context.

SetScreenSpacedCoordinates(RenderContext, DeviceContextProxy)

Sets the screen spaced coordinates.

public void SetScreenSpacedCoordinates(RenderContext context, DeviceContextProxy deviceContext)

Parameters

context RenderContext

The context.

deviceContext DeviceContextProxy

The device context.

SetScreenSpacedCoordinates(RenderContext, DeviceContextProxy, bool)

Sets the screen spaced coordinates.

protected virtual void SetScreenSpacedCoordinates(RenderContext context, DeviceContextProxy deviceContext, bool clearDepthBuffer)

Parameters

context RenderContext

The context.

deviceContext DeviceContextProxy

The device context.

clearDepthBuffer bool

if set to true [clear depth buffer].

UpdateParameters(RenderContext, float, float)

protected void UpdateParameters(RenderContext context, float width, float height)

Parameters

context RenderContext
width float
height float

Events

OnCoordinateSystemChanged

public event EventHandler<BoolArgs>? OnCoordinateSystemChanged

Event Type

EventHandler<BoolArgs>