Game Development Reference
In-Depth Information
pPasses —Returns the number of passes in the currently active
technique
Flags —Any one of the following flags:
Zero (0) —Instructs the effect to save the current device
states and shader states and then restore them after the effect
is finished (when ID3DXEffect::End is called). This is use-
ful because the effect file can change the states, and it may be
desirable to restore the states prior to beginning the effect.
D3DXFX_DONOTSAVESTATE —Instructs the effect to not save
and restore device states (excludes shader states)
D3DXFX_DONOTSAVESHADERSTATE —Instructs the effect to
not save and restore shader states
19.6.4 Setting the Current Rendering Pass
Before we can render any geometry using an effect, we must specify
the rendering pass to use. Recall that a technique consists of one or
more rendering passes, where each pass encapsulates different device
states, samplers, and/or shaders that are to be used for that pass. The
rendering pass is specified with the following method:
HRESULT ID3DXEffect::Pass(
UINT iPass // Index identifying the pass.
);
The rendering passes for a technique are labeled as 0… n -1 for n
passes. Thus, we can iterate through each pass using a simple for loop
and render the geometry for that pass. Section 19.6.6 shows an
example.
19.6.5 Ending an Effect
Finally, after we have rendered the geometry for each pass, we disable
or end the effect with ID3DXEffect::End :
HRESULT ID3DXEffect::End(VOID);
19.6.6 Example
The following code snippet illustrates the above five steps necessary to
use an effect:
// In effect file:
technique T0
{
pass P0
{
...
Search WWH ::




Custom Search