// Shapekey shader for texcord

struct VertexAttributes {
    float color;
    float2 position;
};

RWStructuredBuffer<VertexAttributes> rw_buffer : register(u5);
StructuredBuffer<VertexAttributes> base : register(t50);
StructuredBuffer<VertexAttributes> shapekey : register(t51);

Texture1D<float4> IniParams : register(t120);
#define FREQ IniParams[88].x

[numthreads(1, 1, 1)]
void main(uint3 threadID : SV_DispatchThreadID)
{
    uint i = threadID.x;
    float inter = FREQ - floor(FREQ);
    VertexAttributes diff;
    diff.position = shapekey[i].position - base[i].position ;

    // (0.5*(sin(TIME*(SPEED+1)*10)+1))
    rw_buffer[i].position += diff.position*(inter);
}