-
Notifications
You must be signed in to change notification settings - Fork 411
IEffect
DirectXTK | Effects |
---|
This is the abstract interface implemented by all effects in DirectX Tool Kit, and is typically used as the 'base' reference.
classDiagram
class IEffect{
<<Interface>>
+Apply()
}
class IEffectMatrices{
<<Interface>>
+SetWorld()
+SetView()
+SetProjection()
+SetMatrices()
}
class IEffectLights{
<<Interface>>
+SetAmbientLightColor()
+SetLightEnabled()
+SetLightDirection()
+SetLightDiffuseColor()
+SetLightSpecularColor()
+EnableDefaultLighting()
}
class IEffectFog{
<<Interface>>
+SetFogStart()
+SetFogEnd()
+SetFogColor()
}
class IEffectSkinning{
<<Interface>>
+SetBoneTransforms()
+ResetBoneTransforms()
}
IEffect .. IEffectMatrices
IEffect .. IEffectLights
IEffect .. IEffectFog
IEffect .. IEffectSkinning
The Apply method is used to set the Pipeline State Object (PSO) and root signature for drawing with the effect. This includes updating and setting the required constants consumed by these shaders.
The caller must ensure that the bound vertex and index buffer and primitive topology match the PSO in the effect.
Texturing effects require the GPU handle to the descriptor for the texture, and the caller must ensure the proper descriptor heap is active before applying the effect.
effect->Apply( commandList );
commandList->IASetVertexBuffers(0, 1, &vertexBufferView);
commandList->IASetIndexBuffer(&indexBufferView);
commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
commandList->DrawIndexedInstanced(indexCount, 1, 0, 0, 0);
Direct3D 12 Pipeline State Objects (PSO) include the specific input layout provided as a D3D12_INPUT_LAYOUT_DESC
at creation time. If a different input layout is required, the caller must create a new effect to match that input layout.
All built-in effects require the SV_Position
semantic.
This effect requires TEXCOORD0
, and COLOR
if per-vertex colors are enabled.
This effect requires NORMAL
if lighting is enabled, COLOR
if per-vertex colors are enabled, and TEXCOORD0
if texturing is enabled.
This effect requires TEXCOORD0
and TEXCOORD1
.
This effect requires NORMAL
and TEXCOORD0
.
This effect requires NORMAL
, TEXCOORD0
and TANGENT
. If per-vertex colors are enabled, it also requires COLOR
.
This effect requires NORMAL
, TEXCOORD0
, BLENDINDICES
and BLENDWEIGHT
.
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.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Xbox One
- Xbox Series X|S
- x86
- x64
- ARM64
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- MinGW 12.2, 13.2
- CMake 3.20