UniformMember
final class UniformMember
Package: dev.joid.lib.bridge.render.shader.uniform · Module: core · Source: UniformMember.java
One uniform of a block, its std140 place, its current value as raw 32-bit words, and whether it changed since the backend last sent it.
Description
Section titled “Description”A member checks each value against its UniformType and throws IllegalArgumentException, with its declaration in the message, when the value does not fit.
It turns dirty only when a written word differs from the stored one, so writing the same value again costs no upload.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
UniformMember | create(String name, UniformType type, int length, int start) factory | Creates a member from its name, its type, its array length (0 for a single value) and start, the first free byte of the block; the member aligns its offset from there with the std140 rules. |
Methods
Section titled “Methods”Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
String | getDeclaration() | Returns the GLSL declaration of the member, such as vec4 u_Color or float u_Weights[3], for messages. |
int | getLength() | Returns the array length, or 0 for a single value. |
int | getOffset() | Returns the byte offset of the member in the std140 block. |
String | getName() | Returns the name of the uniform in the GLSL source. |
int | getArrayStride() | Returns the distance in bytes between two elements of an array, a multiple of 16, or 0 for a single value. |
int | getMatrixStride() | Returns the distance in bytes between two columns of a matrix, 16, or 0 for a type that is not a matrix. |
UniformType | getType() | Returns the GLSL type of the member. |
ByteBuffer | getValues() | Returns the current values, packed as 32-bit words in native byte order: what a loose upload sends as it is. |
boolean | isDirty() | If true, a value changed since the last upload. |
int | getSize() | Returns the number of bytes that the member takes in the block. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
this | value(boolean value) fluent | Writes 1 or 0 into a single bool or int member. |
this | value(int… values) fluent | Writes integers into an integer member: exactly as many as the type holds for a single value, or one or more whole elements of an array, from the first element. |
this | value(float… values) fluent | Writes floats into a float member, with the same counts as integers. |
this | value(UniformMember source) fluent | Copies every value of another member of the same type and length, as the line variant of a shader does to follow its source shader. |
this | clean() fluent | Marks the member as sent; the block or the backend calls it after an upload. |
Creation details
Section titled “Creation details”create
Section titled “create”UniformMember create(String name, UniformType type, int length, int start) factory
Creates a member from its name, its type, its array length (0 for a single value) and start, the first free byte of the block; the member aligns its offset from there with the std140 rules.
Method details
Section titled “Method details”getDeclaration
Section titled “getDeclaration”String getDeclaration()
Returns the GLSL declaration of the member, such as vec4 u_Color or float u_Weights[3], for messages.
getLength
Section titled “getLength”int getLength()
Returns the array length, or 0 for a single value.
getOffset
Section titled “getOffset”int getOffset()
Returns the byte offset of the member in the std140 block.
getName
Section titled “getName”String getName()
Returns the name of the uniform in the GLSL source.
getArrayStride
Section titled “getArrayStride”int getArrayStride()
Returns the distance in bytes between two elements of an array, a multiple of 16, or 0 for a single value.
getMatrixStride
Section titled “getMatrixStride”int getMatrixStride()
Returns the distance in bytes between two columns of a matrix, 16, or 0 for a type that is not a matrix.
getType
Section titled “getType”UniformType getType()
Returns the GLSL type of the member.
getValues
Section titled “getValues”ByteBuffer getValues()
Returns the current values, packed as 32-bit words in native byte order: what a loose upload sends as it is.
isDirty
Section titled “isDirty”boolean isDirty()
If true, a value changed since the last upload.
getSize
Section titled “getSize”int getSize()
Returns the number of bytes that the member takes in the block.
this value(boolean value) fluent
Writes 1 or 0 into a single bool or int member.
this value(int... values) fluent
Writes integers into an integer member: exactly as many as the type holds for a single value, or one or more whole elements of an array, from the first element. A float member receives the integers as floats.
this value(float... values) fluent
Writes floats into a float member, with the same counts as integers.
this value(UniformMember source) fluent
Copies every value of another member of the same type and length, as the line variant of a shader does to follow its source shader.
this clean() fluent
Marks the member as sent; the block or the backend calls it after an upload.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
