Game Development Reference
In-Depth Information
D3DXHANDLE BaseTexHandle = 0;
D3DXHANDLE SpotLightTexHandle = 0;
D3DXHANDLE StringTexHandle
= 0;
D3DXCONSTANT_DESC BaseTexDesc;
D3DXCONSTANT_DESC SpotLightTexDesc;
D3DXCONSTANT_DESC StringTexDesc;
The vertex structure for the multitexturing sample is defined as:
struct MultiTexVertex
{
MultiTexVertex(float x, float y, float z,
float u0, float v0,
float u1, float v1,
float u2, float v2)
{
_x = x; _y = y; _z = z;
_u0 = u0; _v0 = v0;
_u1 = u1; _v1 = v1;
_u2 = u2, _v2 = v2;
}
float _x, _y, _z;
float _u0, _v0;
float _u1, _v1;
float _u2, _v2;
static const DWORD FVF;
};
const DWORD MultiTexVertex::FVF = D3DFVF_XYZ | D3DFVF_TEX3;
Observe that it contains three sets of texture coordinates.
The Setup function performs the following tasks:
Fills the vertex buffer representing the quad
Compiles the pixel shader
Creates the pixel shader
Loads the textures
Sets the projection matrix and disables lighting
Gets handles to the sampler objects
Gets descriptions of the sampler objects
bool Setup()
{
HRESULT hr = 0;
//
// Create quad geometry.
//
Device->CreateVertexBuffer(
6 * sizeof(MultiTexVertex),
D3DUSAGE_WRITEONLY,
Search WWH ::




Custom Search