Class ChannelMapping
Namespace: ValveResourceFormat.CompiledShader
Assembly: ValveResourceFormat.dll
Channel mapping definition used in shaders.
public class ChannelMapping : IEquatable<ChannelMapping>Inheritance
object ← ChannelMapping
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
int
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
IReadOnlyList<byte>
Count
Gets the number of valid channels.
public int Count { get; }Property Value
int
Destinations
Gets the output channel each mapped source channel is written to.
public IReadOnlyList<byte> Destinations { 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 ChannelMapping.Channel.NULL. Each channel is written to the output channel of the same position.
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, bool)
Creates a ChannelMapping from a packed uint value.
public static ChannelMapping FromUInt32(uint packedValue, bool packedDestinations = false)Parameters
packedValue uint
One byte per mapped channel, terminated by ChannelMapping.Channel.NULL.
packedDestinations bool
Whether each byte holds the source channel in the high nibble and the destination channel in the low nibble, which is how vcs version 67 and newer store the mapping. Older files store just the source channel, and the destination is the position of the byte.
Returns
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
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
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

