Game Development Reference
In-Depth Information
SetVector —Used to set a variable of type D3DXVECTOR4 . Sam-
ple call:
D3DXVECTOR4 v(1.0f, 2.0f, 3.0f, 4.0f);
ConstTable->SetVector(Device, handle, &v);
SetVectorArray —Used to set a variable that is a vector array.
Sample call:
D3DXVECTOR4 v[3];
// ...Initialize vectors
ConstTable->SetVectorArray(Device, handle, v, 3);
SetValue —Used to set an arbitrarily sized type, such as a struc-
ture. In the sample call, we use SetValue to set a D3DXMATRIX :
D3DXMATRIX M(…);
ConstTable->SetValue(Device, handle, (void*)&M, sizeof(M));
16.2.1.3 Setting the Constant Default Values
This next method simply sets the constants to their default values,
which are the values they are initialized with when they are declared.
This method should be called once during application setup.
HRESULT ID3DXConstantTable::SetDefaults(
LPDIRECT3DDEVICE9 pDevice
);
pDevice —Pointer to the device that is associated with the con-
stant table
16.2.2 Compiling an HLSL Shader
We can compile a shader, which we have saved to a text file, using the
following function:
HRESULT D3DXCompileShaderFromFile(
LPCSTR pSrcFile,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPCSTR pFunctionName,
LPCSTR pTarget,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs,
LPD3DXCONSTANTTABLE* ppConstantTable
);
Search WWH ::




Custom Search