Class RaylibUniform
One non-sampler uniform of a RaylibShader.
public sealed record RaylibUniform : IEquatable<RaylibUniform>
- Inheritance
-
RaylibUniform
- Implements
- Inherited Members
Constructors
RaylibUniform(string, string, int)
One non-sampler uniform of a RaylibShader.
public RaylibUniform(string Name, string GlslType, int ArrayLength)
Parameters
NamestringThe GLSL uniform name (the HLSL global's name).
GlslTypestringThe GLSL type, e.g.
vec4; pick the matchingShaderUniformDataType.ArrayLengthintElement count for an array uniform, or
0for a non-array.
Properties
ArrayLength
Element count for an array uniform, or 0 for a non-array.
public int ArrayLength { get; init; }
Property Value
DefaultValue
The default the HLSL declaration gives this uniform (float Thickness = 1.0;), or
null when it is unknown: the same values, in the same layout, as
DefaultValue on the MGFX route for the same source
(issue #435). The fragment shader declares the uniform WITHOUT a value, so raylib reads it
as zero until the caller sets it; set it to this value to get the effect the .fx
author declared.
public IReadOnlyList<float>? DefaultValue { get; init; }
Property Value
Remarks
Layout. max(1, ArrayLength) elements one after another, each the
uniform's components in order, no padding: exactly the values
SetShaderValueV(shader, loc, values, type, max(1, ArrayLength)) takes. Matrices do
not occur, because the converter refuses matrix uniforms (SD0636).
Values. int values converted to floats, uint values by their
unsigned value (one beyond 2^24 is not exact), bool as 0 or 1; the MGFX route's value
for an OpenGL build (the converter's macro set). A bool global is a uint uniform
(SPIR-V has no bool in a uniform block). An int/ivecN uniform takes the values as
int (ShaderUniformDataType.Int...); a uint/uvecN one, a bool's
included, as uint (ShaderUniformDataType.UInt...: Int on a uint
uniform is a GL error).
When it is null. The global has no initializer, or the
initializer could not be evaluated or does not match the uniform's shape (the conversion
then carries the MGFX route's SD0017 warning; so does a global with a default that no
listed uniform pairs with). Samplers are not uniforms here (see
Samplers).
GlslType
The GLSL type, e.g. vec4; pick the matching ShaderUniformDataType.
public string GlslType { get; init; }
Property Value
Name
The GLSL uniform name (the HLSL global's name).
public string Name { get; init; }
Property Value
Methods
Equals(RaylibUniform?)
Value equality, comparing DefaultValue element by element.
public bool Equals(RaylibUniform? other)
Parameters
otherRaylibUniformThe uniform to compare with.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.