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
CameraType
Only being used when Mode is RelativeScreenSpaced
public ScreenSpacedCameraType CameraType { get; set; }
Property Value
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
GlobalTransform
public GlobalTransformStruct GlobalTransform { get; }
Property Value
Height
Viewport Height
public float Height { get; }
Property Value
IsPerspective
public bool IsPerspective { get; }
Property Value
IsRightHand
public bool IsRightHand { get; }
Property Value
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
RelativeScreenLocationY
Relative position Y of the center of viewport
public float RelativeScreenLocationY { get; set; }
Property Value
ScreenRatio
public float ScreenRatio { get; }
Property Value
Size
Default size. To scale, use SizeScale
public float Size { get; }
Property Value
SizeScale
Size scaling
public float SizeScale { get; set; }
Property Value
Width
Viewport Width
public float Width { get; }
Property Value
Methods
CreateViewMatrix(RenderContext, out Vector3)
Creates the view matrix.
protected Matrix4x4 CreateViewMatrix(RenderContext renderContext, out Vector3 eye)
Parameters
renderContextRenderContextThe render context.
eyeVector3The eye.
Returns
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
techniqueIRenderTechnique
Returns
OnCreateProjectionMatrix(RenderContext)
Called when [create projection matrix].
protected virtual void OnCreateProjectionMatrix(RenderContext context)
Parameters
contextRenderContext
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
renderContextRenderContextThe render context.
deviceContextDeviceContextProxyThe device context.
SetScreenSpacedCoordinates(RenderContext, DeviceContextProxy)
Sets the screen spaced coordinates.
public void SetScreenSpacedCoordinates(RenderContext context, DeviceContextProxy deviceContext)
Parameters
contextRenderContextThe context.
deviceContextDeviceContextProxyThe device context.
SetScreenSpacedCoordinates(RenderContext, DeviceContextProxy, bool)
Sets the screen spaced coordinates.
protected virtual void SetScreenSpacedCoordinates(RenderContext context, DeviceContextProxy deviceContext, bool clearDepthBuffer)
Parameters
contextRenderContextThe context.
deviceContextDeviceContextProxyThe device context.
clearDepthBufferboolif set to
true[clear depth buffer].
UpdateParameters(RenderContext, float, float)
protected void UpdateParameters(RenderContext context, float width, float height)
Parameters
contextRenderContextwidthfloatheightfloat
Events
OnCoordinateSystemChanged
public event EventHandler<BoolArgs>? OnCoordinateSystemChanged