C# Class VoxelTerrain.Helper

Defines a class with various helper functions.
Show file Open project: barograf/VoxelTerrain

Public Methods

Method Description
Clamp ( float value, float min, float max ) : float

Restricts a value to be within a specified range.

Lerp ( float x, float y, float s ) : float

Performs a linear interpolation.

MouseDirection ( Device graphicsDevice, Camera camera, System.Vector2 mousePosition ) : System.Vector3

Computes a mouse direction in world coordinates.

Saturate ( float value ) : float

Restricts a value to be within a zero to one range.

Method Details

Clamp() public static method

Restricts a value to be within a specified range.
public static Clamp ( float value, float min, float max ) : float
value float The value to clamp.
min float The minimum value.
max float The maximum value.
return float

Lerp() public static method

Performs a linear interpolation.
public static Lerp ( float x, float y, float s ) : float
x float First parameter.
y float Second parameter.
s float A value that linearly interpolates between parameters.
return float

MouseDirection() public static method

Computes a mouse direction in world coordinates.
public static MouseDirection ( Device graphicsDevice, Camera camera, System.Vector2 mousePosition ) : System.Vector3
graphicsDevice Device Virtual adapter used to perform rendering.
camera Camera Allows observing the scene with the mouse and keyboard.
mousePosition System.Vector2 Position of a mouse in screen coordinates.
return System.Vector3

Saturate() public static method

Restricts a value to be within a zero to one range.
public static Saturate ( float value ) : float
value float The value to saturate.
return float