ShaderParams

@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class ShaderParams(val attributes: Array<Attribute>)

Marks a class providing shader parameters data.

Samples

import graphics.glimpse.shaders.annotations.Attribute
import graphics.glimpse.shaders.annotations.AttributeRole
import graphics.glimpse.shaders.annotations.Sampler2D
import graphics.glimpse.shaders.annotations.ShaderParams
import graphics.glimpse.shaders.annotations.Uniform
import graphics.glimpse.textures.Texture
import graphics.glimpse.types.Mat3
import graphics.glimpse.types.Mat4
fun main() { 
   //sampleStart 
   @ShaderParams(
    attributes = [
        Attribute(name = "aPos", role = AttributeRole.POSITIONS, vectorSize = 3),
        Attribute(name = "aTexCoords", role = AttributeRole.TEX_COORDS, vectorSize = 2),
        Attribute(name = "aNormal", role = AttributeRole.NORMALS, vectorSize = 3),
        Attribute(name = "aTangent", role = AttributeRole.TANGENTS, vectorSize = 3),
        Attribute(name = "aBitangent", role = AttributeRole.BITANGENTS, vectorSize = 3),
    ]
)
data class SampleShaderParams(

    @Uniform(name = "uProjMatrix")
    val projectionMatrix: Mat4,

    @Uniform(name = "uViewMatrix")
    val viewMatrix: Mat4,

    @Uniform(name = "uModelMatrix")
    val modelMatrix: Mat4,

    @Uniform(name = "uNormalMatrix")
    val normalMatrix: Mat3,

    @Sampler2D(name = "uTexture")
    val texture: Texture,

    @Sampler2D(name = "uNormalMap")
    val normalMap: Texture,
) 
   //sampleEnd
}

See also

Constructors

Link copied to clipboard
fun ShaderParams(attributes: Array<Attribute>)

Properties

Link copied to clipboard
val attributes: Array<Attribute>

Vertex attributes arrays provided to the shader from the mesh.