Skip to content

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.

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.

ReturnsSignatureSummary
UniformMembercreate(String name, UniformType type, int length, int start) factoryCreates 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.

ReturnsSignatureSummary
StringgetDeclaration()Returns the GLSL declaration of the member, such as vec4 u_Color or float u_Weights[3], for messages.
intgetLength()Returns the array length, or 0 for a single value.
intgetOffset()Returns the byte offset of the member in the std140 block.
StringgetName()Returns the name of the uniform in the GLSL source.
intgetArrayStride()Returns the distance in bytes between two elements of an array, a multiple of 16, or 0 for a single value.
intgetMatrixStride()Returns the distance in bytes between two columns of a matrix, 16, or 0 for a type that is not a matrix.
UniformTypegetType()Returns the GLSL type of the member.
ByteBuffergetValues()Returns the current values, packed as 32-bit words in native byte order: what a loose upload sends as it is.
booleanisDirty()If true, a value changed since the last upload.
intgetSize()Returns the number of bytes that the member takes in the block.
ReturnsSignatureSummary
thisvalue(boolean value) fluentWrites 1 or 0 into a single bool or int member.
thisvalue(int… values) fluentWrites 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.
thisvalue(float… values) fluentWrites floats into a float member, with the same counts as integers.
thisvalue(UniformMember source) fluentCopies every value of another member of the same type and length, as the line variant of a shader does to follow its source shader.
thisclean() fluentMarks the member as sent; the block or the backend calls it after an upload.

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.

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.

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

Report a problem with this page