Here is what I want to do in my dx11 vertex shader:
struct VertexInput
{
//imediate data
float3 PositionLocal : POSITION;
int index : TEXCOORD;
//instance data
float3 Translation : NORMAL;
float Altitudes[3] : TEXCOORD;
};
struct VertexOutput
{
float3 PositionWorld : POSITION;
float2 MainTexCoord : TEXCOORD;
};
VertexOutput VS(VertexInput vin)
{
VertexOutput vout;
//Add altitudes
float3 transPos = vin.PositionLocal + vin.Translation;
transPos.y += vin.Altitudes[vin.Index];
vout.MainTexCoord = transPos.xz;
vout.PositionWorld = transPos;
return vout;
}
Is it allowed to use an array this way in dx11? I can easily fake it with swizzling I suppose, but I would prefer that the code convey its meaning more clearly. What would be the proper way to create the input elements for an array?