| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| DirectXTK | Effects |
|---|
This abstract interface controls distance fog settings. Settings for this interface can influence the choice of shader permutation. This interface is implemented by BasicEffect, AlphaTestEffect, DualTextureEffect, EnvironmentMapEffect, NormalMapEffect, and SkinnedEffect.
Related tutorial: Rendering a model
class DirectX::IEffectFogThere are two methods used in DirectX Tool Kit. For simple cases, just maintain a reference directly to the desired effect class:
std::shared_ptr<BasicEffect> effect;
...
effect->SetFogEnable(true);
effect->SetFogStart(6);
effect->SetFogEnd(8);
effect->SetFogColor( Colors::CornflowerBlue );For more general cases where a number of effect classes can be in use (such as Model which uses a mix of BasicEffect, DualTextureEffect, SkinnedEffect, and/or DGSLEffect), use Run-Time Type Information (RTTI) to obtain the interface.
std::shared_ptr<IEffect> effect;
...
auto ifog = dynamic_cast<IEffectFog*>( effect.get() );
if ( ifog )
{
ifog->SetFogEnable(true);
ifog->SetFogStart(6);
ifog->SetFogEnd(8);
ifog->SetFogColor( Colors::CornflowerBlue );
}The fog effects work for both right-handed and left-handed coordinate systems, but the distance settings should be negated for left-handed coordinates.
These implement a simple linear fog which is inexpensive on all feature levels.
Fog settings are encoded in the choice of DGSL pixel shader, if supported, and these shaders do not expose settings to control such effects. Therefore, this built-in effect does not support this interface. The default materials (Unlit, Lambert, and Phong) have no fog effects.
These methods must be defined by classes that implement this interface:
void __cdecl SetFogStart(float value) override;
void __cdecl SetFogEnd(float value) override;
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;The interface supports move semantics, but not copy semantics.
The methods implemented by the built-in effects do not throw C++ exceptions.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
| Back | FazBrowse Home | New Git URL |