Util

Description

sealed class Tinman.Shaders.Util

Derived from

GpuCode abstract

Full source code is included in the Tinman 3D SDK download.

Helper methods for general-purpose tasks.

Public / Constants

Luminance


public static readonly attribute Luminance → (float3)

Color channel weights for computing the luminance of a color (linear sRGB).

Public / Methods

Decode​Normal​XY


[Pure]
public static method DecodeNormalXY → (1)

encoded in : float2

The X- and Y-components of a unit-length direction normal vector, transformed to the range [0..1].

returns → float3

The decoded unit-length normal vector.

Decodes a unit-length normal vector.

Decode​Shift


[Pure]
public static method DecodeShift → (1)

encoded in : float3

The encoded vector.

returns → float3

The decoded vector.

Decodes a normalized and shifted normal vector.

The encoded vector components are in the range [0..1].
The decoded vector components are in the range [-1..1].

From​Srgb

3 overloads


[Pure]
public static method FromSrgb1 → (1)

color in : float32

The input color (compressed sRGB).

returns → float32

The output color (linear sRGB).

Applies sRGB decompression to the given color.


[Pure]
public static method FromSrgb2 → (1)

color in : float3

The input color (compressed sRGB).

returns → float3

The output color (linear sRGB).

Applies sRGB decompression to the given color.


[Pure]
public static method FromSrgb3 → (1)

color in : float4

The input color (compressed sRGB).

returns → float4

The output color (linear sRGB).

Applies sRGB decompression to the given color (the alpha channel is retained).

Normalize


[Pure]
public static method Normalize → (2)

value in : float3

The vector to normalize.

defaultValue in : float3

The value to return if the given vector is zero.

returns → float3

The normalized input vector or, if it is null, the given default value.

Tries to normalize the given vector.

Sqr


[Pure]
public static method Sqr → (1)

in : float32

Input value.

returns → float32

v * v

Compute the square value.

To​Srgb

3 overloads


[Pure]
public static method ToSrgb1 → (1)

color in : float32

The input color (linear sRGB).

returns → float32

The output color (compressed sRGB).

Applies sRGB compression to the given color.


[Pure]
public static method ToSrgb2 → (1)

color in : float3

The input color (linear sRGB).

returns → float3

The output color (compressed sRGB).

Applies sRGB compression to the given color.


[Pure]
public static method ToSrgb3 → (1)

color in : float4

The input color (linear sRGB).

returns → float4

The output color (compressed sRGB).

Applies sRGB compression to the given color (the alpha channel is retained).