ShaderBuiltin
enum ShaderBuiltin
Package: dev.joid.lib.bridge.render.shader.source · Module: core · Source: ShaderBuiltin.java
The names that a JOID GLSL source uses without declaring them, the vertex attributes, the matrices and the lighting that JOID provides, and the fragment output.
Description
Section titled “Description”A shader reads aPosition or writes fragColor without a declaration: ShaderSource notes which built-in names each stage uses, and GlslShaderTranslator declares those, plus fragColor in every fragment stage.
A declaration of a built-in name in the source is ignored.
The attributes take their location and their format from VertexAttribute; Shader.builtins writes the uniforms before each draw.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
ShaderBuiltin | of(String identifier) factory | Returns the built-in with this GLSL name, or null when the name is not a built-in. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
String | getIdentifier() | Returns the name used in the GLSL source, such as aPosition. |
String | getType() | Returns the GLSL type, such as vec3 or mat4. |
Kind | getKind() | Returns whether the built-in is a vertex attribute, a uniform or the fragment output. |
Values
Section titled “Values”| Value | Summary |
|---|---|
POSITION | vec3 aPosition: the position of the vertex, in design pixels in a UI, before the model-view and projection matrices. |
TEXTURE_COORDINATE | vec2 aTexCoord: the texture coordinate of the vertex. |
COLOR | vec4 aColor: the color of the vertex, or the current color of the render state for a buffer without colors. |
NORMAL | vec3 aNormal: the normal of the vertex, for lit 3D models. |
PROJECTION_MATRIX | mat4 uProjectionMatrix: the projection of the render bridge. |
MODEL_VIEW_MATRIX | mat4 uModelViewMatrix: the model-view matrix of the render bridge. |
NORMAL_MATRIX | mat3 uNormalMatrix: the matrix that transforms the normals for the model-view matrix. |
LIGHTING | bool uLighting: true while the render state has lighting on. |
FRAGMENT_COLOR | vec4 fragColor: the color that the fragment stage writes. |
Creation details
Section titled “Creation details”ShaderBuiltin of(String identifier) factory
Returns the built-in with this GLSL name, or null when the name is not a built-in.
Method details
Section titled “Method details”getIdentifier
Section titled “getIdentifier”String getIdentifier()
Returns the name used in the GLSL source, such as aPosition.
getType
Section titled “getType”String getType()
Returns the GLSL type, such as vec3 or mat4.
getKind
Section titled “getKind”Kind getKind()
Returns whether the built-in is a vertex attribute, a uniform or the fragment output.
Value details
Section titled “Value details”POSITION
Section titled “POSITION”POSITION
vec3 aPosition: the position of the vertex, in design pixels in a UI, before the model-view and projection matrices.
TEXTURE_COORDINATE
Section titled “TEXTURE_COORDINATE”TEXTURE_COORDINATE
vec2 aTexCoord: the texture coordinate of the vertex.
COLOR
vec4 aColor: the color of the vertex, or the current color of the render state for a buffer without colors.
NORMAL
Section titled “NORMAL”NORMAL
vec3 aNormal: the normal of the vertex, for lit 3D models.
PROJECTION_MATRIX
Section titled “PROJECTION_MATRIX”PROJECTION_MATRIX
mat4 uProjectionMatrix: the projection of the render bridge.
MODEL_VIEW_MATRIX
Section titled “MODEL_VIEW_MATRIX”MODEL_VIEW_MATRIX
mat4 uModelViewMatrix: the model-view matrix of the render bridge.
NORMAL_MATRIX
Section titled “NORMAL_MATRIX”NORMAL_MATRIX
mat3 uNormalMatrix: the matrix that transforms the normals for the model-view matrix.
LIGHTING
Section titled “LIGHTING”LIGHTING
bool uLighting: true while the render state has lighting on.
FRAGMENT_COLOR
Section titled “FRAGMENT_COLOR”FRAGMENT_COLOR
vec4 fragColor: the color that the fragment stage writes.
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
