Class ChannelMapping
Namespace: ValveResourceFormat.CompiledShader
Assembly: ValveResourceFormat.dll
Channel mapping definition used in shaders.
public class ChannelMapping : IEquatable<ChannelMapping>Inheritance
Implements
Fields
A
Alpha channel mapping.
public static readonly ChannelMapping AField Value
AG
Alpha-green channel mapping.
public static readonly ChannelMapping AGField Value
B
Blue channel mapping.
public static readonly ChannelMapping BField Value
G
Green channel mapping.
public static readonly ChannelMapping GField Value
MaxChannels
Maximum number of channels.
public const int MaxChannels = 4Field Value
NULL
Null channel mapping.
public static readonly ChannelMapping NULLField Value
R
Red channel mapping.
public static readonly ChannelMapping RField Value
RG
Red-green channel mapping.
public static readonly ChannelMapping RGField Value
RGB
RGB channel mapping.
public static readonly ChannelMapping RGBField Value
RGBA
RGBA channel mapping.
public static readonly ChannelMapping RGBAField Value
Properties
Channels
Gets all channel bytes.
public IReadOnlyList<byte> Channels { get; }Property Value
Count
Gets the number of valid channels.
public int Count { get; }Property Value
Indices
Gets channel indices.
public IReadOnlyList<byte> Indices { get; }Property Value
PackedValue
Gets the packed uint value.
public uint PackedValue { get; }Property Value
ValidChannels
Gets valid channel bytes.
public IReadOnlyList<byte> ValidChannels { get; }Property Value
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
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
FromChannels(byte, byte, byte, byte)
Creates a ChannelMapping from channel bytes, filling missing slots with .
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
FromUInt32(uint)
Creates a ChannelMapping from a packed uint value.
public static ChannelMapping FromUInt32(uint packedValue)Parameters
packedValue uint
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()Returns
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
ToByte(ChannelMapping)
Returns the first mapped channel component.
public static byte ToByte(ChannelMapping channelMapping)Parameters
channelMapping ChannelMapping
Returns
ToComponent(ChannelMapping)
Returns the first mapped channel component.
public static byte ToComponent(ChannelMapping channelMapping)Parameters
channelMapping ChannelMapping
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()Returns
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
explicit operator ChannelMapping(uint)
Converts from uint to ChannelMapping.
public static explicit operator ChannelMapping(uint value)Parameters
value uint
Returns
implicit operator byte(ChannelMapping)
Returns the first mapped channel component.
public static implicit operator byte(ChannelMapping channelMapping)Parameters
channelMapping ChannelMapping
Returns
operator !=(ChannelMapping, ChannelMapping)
Inequality operator.
public static bool operator !=(ChannelMapping left, ChannelMapping right)Parameters
left ChannelMapping
right ChannelMapping

