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 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
objobject?-
The object to compare with the current object.
Returns
Equals(ChannelMapping?)
Determines whether the specified ChannelMapping is equal to this instance.
public bool Equals(ChannelMapping? other)Parameters
otherChannelMapping?
Returns
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
Returns
FromUInt32(uint)
Creates a ChannelMapping from a packed uint value.
public static ChannelMapping FromUInt32(uint packedValue)Parameters
packedValueuint
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
Returns
ToByte(ChannelMapping)
Returns the first mapped channel component.
public static byte ToByte(ChannelMapping channelMapping)Parameters
channelMappingChannelMapping
Returns
ToComponent(ChannelMapping)
Returns the first mapped channel component.
public static byte ToComponent(ChannelMapping channelMapping)Parameters
channelMappingChannelMapping
Returns
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
leftChannelMappingrightChannelMapping
Returns
explicit operator ChannelMapping(uint)
Converts from uint to ChannelMapping.
public static explicit operator ChannelMapping(uint value)Parameters
valueuint
Returns
implicit operator byte(ChannelMapping)
Returns the first mapped channel component.
public static implicit operator byte(ChannelMapping channelMapping)Parameters
channelMappingChannelMapping
Returns
operator !=(ChannelMapping, ChannelMapping)
Inequality operator.
public static bool operator !=(ChannelMapping left, ChannelMapping right)Parameters
leftChannelMappingrightChannelMapping