Table of Contents

Class ChannelMapping

Namespace
ValveResourceFormat.CompiledShader
Assembly
ValveResourceFormat.dll

Channel mapping definition used in shaders.

public class ChannelMapping : IEquatable<ChannelMapping>

Inheritance

Implements

Inherited Members

Fields

A

Alpha channel mapping.

public static readonly ChannelMapping A

Field Value

ChannelMapping

AG

Alpha-green channel mapping.

public static readonly ChannelMapping AG

Field Value

ChannelMapping

B

Blue channel mapping.

public static readonly ChannelMapping B

Field Value

ChannelMapping

G

Green channel mapping.

public static readonly ChannelMapping G

Field Value

ChannelMapping

MaxChannels

Maximum number of channels.

public const int MaxChannels = 4

Field Value

int

NULL

Null channel mapping.

public static readonly ChannelMapping NULL

Field Value

ChannelMapping

R

Red channel mapping.

public static readonly ChannelMapping R

Field Value

ChannelMapping

RG

Red-green channel mapping.

public static readonly ChannelMapping RG

Field Value

ChannelMapping

RGB

RGB channel mapping.

public static readonly ChannelMapping RGB

Field Value

ChannelMapping

RGBA

RGBA channel mapping.

public static readonly ChannelMapping RGBA

Field Value

ChannelMapping

Properties

Channels

Gets all channel bytes.

public IReadOnlyList<byte> Channels { get; }

Property Value

IReadOnlyList<byte>

Count

Gets the number of valid channels.

public int Count { get; }

Property Value

int

Indices

Gets channel indices.

public IReadOnlyList<byte> Indices { get; }

Property Value

IReadOnlyList<byte>

PackedValue

Gets the packed uint value.

public uint PackedValue { get; }

Property Value

uint

ValidChannels

Gets valid channel bytes.

public IReadOnlyList<byte> ValidChannels { get; }

Property Value

IReadOnlyList<byte>

Methods

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object?

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(ChannelMapping?)

Determines whether the specified ChannelMapping is equal to this instance.

public bool Equals(ChannelMapping? other)

Parameters

other ChannelMapping?

Returns

bool

FromChannels(byte, byte, byte, byte)

Creates a ChannelMapping from channel bytes, filling missing slots with ValveResourceFormat.CompiledShader.ChannelMapping.Channel.NULL.

public static ChannelMapping FromChannels(byte first, byte second = 255, byte third = 255, byte fourth = 255)

Parameters

first byte
second byte
third byte
fourth byte

Returns

ChannelMapping

FromUInt32(uint)

Creates a ChannelMapping from a packed uint value.

public static ChannelMapping FromUInt32(uint packedValue)

Parameters

packedValue uint

Returns

ChannelMapping

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetPackedValueComponent(uint, int)

Gets a component byte from a packed value.

public static byte GetPackedValueComponent(uint packedValue, int index)

Parameters

packedValue uint
index int

Returns

byte

ToByte(ChannelMapping)

Returns the first mapped channel component.

public static byte ToByte(ChannelMapping channelMapping)

Parameters

channelMapping ChannelMapping

Returns

byte

ToComponent(ChannelMapping)

Returns the first mapped channel component.

public static byte ToComponent(ChannelMapping channelMapping)

Parameters

channelMapping ChannelMapping

Returns

byte

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Remarks

Returns the channel letters (e.g., "RGBA", "RG", "A") or a hexadecimal representation if no channels are mapped.

Operators

operator ==(ChannelMapping, ChannelMapping)

Equality operator.

public static bool operator ==(ChannelMapping left, ChannelMapping right)

Parameters

left ChannelMapping
right ChannelMapping

Returns

bool

explicit operator ChannelMapping(uint)

Converts from uint to ChannelMapping.

public static explicit operator ChannelMapping(uint value)

Parameters

value uint

Returns

ChannelMapping

implicit operator byte(ChannelMapping)

Returns the first mapped channel component.

public static implicit operator byte(ChannelMapping channelMapping)

Parameters

channelMapping ChannelMapping

Returns

byte

operator !=(ChannelMapping, ChannelMapping)

Inequality operator.

public static bool operator !=(ChannelMapping left, ChannelMapping right)

Parameters

left ChannelMapping
right ChannelMapping

Returns

bool