IDirect3DDevice9* device;
IDirect3DPixelShader9* vertexShader;
IDirect3DPixelShader9* pixelShader;
IDirect3DVertexDeclaration9* vertexDeclaration;
device->CreateVertexDeclaration(description, &vertexDeclaration);
...
device->SetPixelShader(vertexShader);
device->SetPixelShader(pixelShader);
...
device->SetVertexDeclaration(vertexDeclaration);
device->SetStreamSource(0, ...);
device->DrawPrimitive...
device->SetStreamSource(0, nullptr, 0, 0);
Buffer, array of elements.
Definition RRBuffer.h:168
Using uv coordinates in HLSL vertex shader: void vertexShader(in float2 iLightmapCoord: TEXCOORD0,
..., out float2 oLightmapCoord: TEXCOORD0)
{
...
oLightmapCoord = iLightmapCoord;
}
Sampling and using illumination value in HLSL pixel shader: sampler lightmap;
void pixelShader(in float2 iLightmapCoord: TEXCOORD0,
..., out float4 oColor: COLOR)
{
float4 light = tex2D(lightmap, iLightmapCoord);
...
oColor = ... + materialColor * light;
}