shader_vs_core
The standard Vertex Shader package.
Defines the crucial attribute layout that matches the Vertex
struct in Odin and provides helpers for coordinate space transformation.
ShaderData
Section titled “ShaderData”layout(binding=0) uniform ShaderData { mat4 uViewProjectionMatrix;}Binding 0: The global shader data.
Automatically uploaded by flushBatch.
aBytes
Section titled “aBytes”in vec4 aBytes;Location 5: Packed data (texture index, layer, flags).
aColor
Section titled “aColor”in vec4 aColor;Location 1: Vertex color (rgba).
aColorOverride
Section titled “aColorOverride”in vec4 aColorOverride;Location 6: Color override.
aLocalUv
Section titled “aLocalUv”in vec2 aLocalUv;Location 3: Local UVs (0-1)
aParams
Section titled “aParams”in vec4 aParams;Location 7: Custom parameters for user shaders.
aPosition
Section titled “aPosition”in vec3 aPosition;Location 0: World space position (x, y). Z position is used for depth.
in vec2 aSize;Location 4: Size of the sprite in pixels.
in vec2 aUv;Location 2: Atlas texture coordinates (u, v).
getProjectedPosition
Section titled “getProjectedPosition”vec4 getProjectedPosition(vec3 position) { return uViewProjectionMatrix * vec4(position.xy, 0.0, 1.0);}Transforms a raw 2D world position into clip space (screen coordinates). Applies the current camera and projection matrices.
Arguments:
position: World space position.
passVertexData
Section titled “passVertexData”void passVertexData() { vPosition = aPosition; vColor = aColor; vUv = aUv; vLocalUv = aLocalUv; vSize = aSize; vBytes = aBytes; vColorOverride = aColorOverride; vParams = aParams;}Passes all standard attributes (color, UVs, flags, etc.) to the Fragment Shader.