
#ifndef I_SPRITE_H
#define I_SPRITE_H

#include "../lib/defs.glslh"

#ifdef VERT_STAGE
/*
 * Per-vertex attributes
 */
ATTRIBUTE(0) vec2  vertPos;
ATTRIBUTE(1) vec2  vertTexCoord;
ATTRIBUTE(2) vec3  vertNormal;
ATTRIBUTE(3) vec4  vertTangent;

/*
 * Per-instance attributes
 */
ATTRIBUTE(4)   mat4  spriteVMTransform;
// 5
// 6
// 7
ATTRIBUTE(8)   mat4  spriteTexTransform;
// 9
// 10
// 11
ATTRIBUTE(12)  vec4  spriteRGBA;
ATTRIBUTE(13)  vec4  spriteTexRegion;
ATTRIBUTE(14)  vec2  spriteDimensions;
ATTRIBUTE(15)  vec4  spriteCustomParams;
#endif

#ifdef FRAG_STAGE
OUT(0) vec4 fragColor;
#endif

UNIFORM(0) sampler2D tex;

// see NUM_SPRITE_AUX_TEXTURES in api.h.
UNIFORM(64) sampler2D tex_aux0;
UNIFORM(65) sampler2D tex_aux1;
UNIFORM(66) sampler2D tex_aux2;

VARYING(0) vec2  texCoordRaw;
VARYING(1) vec2  texCoord;
VARYING(2) vec2  texCoordOverlay;
VARYING(3) vec4  texRegion;
VARYING(4) vec4  color;
VARYING(5) vec2  dimensions;
VARYING(6) vec4  customParams;

#endif
