Using the Fixed Function rendering pipeline in DirectX 9, it's quite easy to set a texture and render vertices by doing the following:
struct vert { float x, y, z, u, v; };
device->SetFVF(D3DFVF_XYZ | D3DFVF_TEX1);
device->SetTexture(0, MyTexture);
//Draw vertices here
However, I'd like to add an additional float value to each vertex, which is then multiplied by the resulting colour output from the texture. (So the value would be between 0 and 1)
EG (psuedocode) Colour = TextureColour(u, v) * CustomFloat
I think there is a way using device->SetTextureStageState
, but I am unsure of how to do it... Can anyone help me?
You could set a 1D linear grayscale texture as a second texture, configured to modulate the first. Then send a single texture coordinate for the second texture (by specifying D3DFVF_TEXCOORDSIZE1 for it, I think). Speculating here -- haven't tried it myself.
To paraphrase your pseudocode: Colour = Texture0Colour(u0, v0) * Texture1Colour(u1)
Edit I think you need:
device->SetFVF(D3DFVF_XYZ | D3DFVF_TEX2 | D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE1(1))
MSDN also has a similar example.