#version 450
// vertices
layout(location=0)in vec2 pos;
// offset (position basically)
//layout(location=1)in vec2 offset;
#if 0
// uv
layout(location=2)in vec2 uvIn;
layout(location=5)out vec2 uv;
// texIdx
layout(location=3)in float texIdx;
layout(location=6)out float texIdxOut;
// size
layout(location=4)in vec2 size;
#endif
layout (set=0, binding = 0) uniform Block
{
// camera
vec2 camera;
// resolution (for scaling from pixels to NDC)
//vec2 pixelsToNdc;
};
vec2 positions[3] = vec2[](
vec2(0.0,-0.5),
vec2(0.5,0.5),
vec2(-0.5,0.5)
);
void main()
{
#if 0
texIdxOut = texIdx;
// set UV
uv = uvIn;
// set size of the object (square only)
vec2 newPos = (pos.xy*(vec2(64,64)*0.5));
//make 0,0 be the Top Left of the object drawn
newPos.xy -= vec2(-64,64)*0.5;
// offset position
newPos += vec2(offset.x,offset.y);
// offset camera
newPos += camera;
// scale to the resolution (so positions can be in pixels)
newPos *= pixelsToNdc;
// make (0,0) Top Left
newPos -= vec2(1,-1);
gl_Position = vec4(newPos,1.0,1.0);
#endif
vec2 test = pos + camera;
gl_Position = vec4(test,1,1);
}