<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>directxtk Wiki Rss Feed</title><link>https://directxtk.codeplex.com/</link><description>directxtk Wiki Rss Description</description><item><title>Updated Wiki: GeometricPrimitive</title><link>https://directxtk.codeplex.com/wikipage?title=GeometricPrimitive&amp;version=31</link><description>&lt;div class="wikidoc"&gt;This is a helper for drawing simple geometric shapes including texture coordinates and surface normals.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Cube&lt;/li&gt;
&lt;li&gt;Sphere&lt;/li&gt;
&lt;li&gt;Geodesic Sphere&lt;/li&gt;
&lt;li&gt;Cylinder&lt;/li&gt;
&lt;li&gt;Torus&lt;/li&gt;
&lt;li&gt;Teapot&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Initialization&lt;/h1&gt;The GeometryPrimitive class must be created from a factory method which takes the Direct3D 11 device context.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
std::unique_ptr&amp;lt;GeometricPrimitive&amp;gt; shape(
GeometricPrimitive::CreateTeapot(deviceContext) );
&lt;/pre&gt;&lt;/div&gt;For exception safety, it is recommended you make use of the C++ RAII pattern and use a std::unique_ptr or std::shared_ptr&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;CreateCube( deviceContext, float size = 1)&lt;/li&gt;
&lt;li&gt;CreateSphere( deviceContext, float diameter = 1, size_t tessellation = 16)&lt;/li&gt;
&lt;li&gt;CreateGeoSphere( deviceContext, float diameter = 1, size_t tessellation = 3)&lt;/li&gt;
&lt;li&gt;CreateCylinder( deviceContext, float height = 1, float diameter = 1, size_t tessellation = 32)&lt;/li&gt;
&lt;li&gt;CreateTorus( deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32)&lt;/li&gt;
&lt;li&gt;CreateTeapot( deviceContext, float size = 1, size_t tessellation = 8)&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Simple drawing&lt;/h1&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
shape-&amp;gt;Draw(world, view, projection, Colors::CornflowerBlue);
&lt;/pre&gt;&lt;/div&gt;The draw method accepts an optional texture parameter, wireframe flag, and a callback function which can be used to override the default rendering state:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
shape-&amp;gt;Draw(world, view, projection, Colors::White, catTexture, &lt;span style="color:Blue;"&gt;false&lt;/span&gt;, [=]
{
    deviceContext-&amp;gt;OMSetBlendState(...);
});
&lt;/pre&gt;&lt;/div&gt;This makes use of a BasicEffect shared by all geometric primitives drawn on that device context.&lt;br /&gt;
&lt;h1&gt;Advanced drawing&lt;/h1&gt;This form of drawing makes use of a custom &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=GeometricPrimitive"&gt;Effects&lt;/a&gt; instance. The caller is responsible for using an input layout that matches the effect.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
IEffect* myeffect = ...

Microsoft::WRL::ComPtr&amp;lt;ID3D11InputLayout&amp;gt; inputLayout;
shape-&amp;gt;CreateInputLayout( myeffect, &amp;amp;inputLayout );

shape-&amp;gt;Draw( myeffect, inputLayout.Get() );
&lt;/pre&gt;&lt;/div&gt;This takes an optional parameter for enabling alpha-blending, wireframe, and a callback function which can be used to override the default rendering state.&lt;br /&gt;
&lt;h1&gt;Coordinate systems&lt;/h1&gt;These geometric primitives (based on the XNA Game Studio conventions) use right-handed coordinates. They can be used with left-handed coordinates by setting the &lt;i&gt;rhcoords&lt;/i&gt; parameter on the factory methods to &amp;#39;false&amp;#39; to reverse the winding ordering (the parameter defaults to &amp;#39;true&amp;#39;).&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
std::unique_ptr&amp;lt;GeometricPrimitive&amp;gt; shape(
GeometricPrimitive::CreateTeapot( deviceContext, 1.f, 8, &lt;span style="color:Blue;"&gt;false&lt;/span&gt; ) );
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Alpha blending&lt;/h1&gt;Alpha blending defaults to using premultiplied alpha. To make use of &amp;#39;straight&amp;#39; alpha textures, override the blending mode via the optional callback:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
CommonStates states(deviceContext);

shape-&amp;gt;Draw(world, view, projection, Colors::White, catTexture, &lt;span style="color:Blue;"&gt;false&lt;/span&gt;, [=]
{
    deviceContext-&amp;gt;OMSetBlendState( states.NonPremultiplied(), &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, 0xFFFFFFFF);
});
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, the GeometricPrimitive implementation make use of 16-bit indices (DXGI_FORMAT_R16_UINT) which limits to a maximum of 65535 vertices. Feature Level 9.1 is limited to a maximum of 65535 primitives in a single draw.&lt;br /&gt;
&lt;h1&gt;Threading model&lt;/h1&gt;Each GeometricPrimitive instance only supports drawing from one thread at a time, but you can simultaneously submit primitives on multiple threads if you create a separate GeometricPrimitive instance per Direct3D 11 deferred context.&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476892.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476892.aspx&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Cube"&gt;http://en.wikipedia.org/wiki/Cube&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Sphere"&gt;http://en.wikipedia.org/wiki/Sphere&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Cylinder_(geometry)"&gt;http://en.wikipedia.org/wiki/Cylinder_(geometry)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Utah_teapot"&gt;http://en.wikipedia.org/wiki/Utah_teapot&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Torus"&gt;http://en.wikipedia.org/wiki/Torus&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Wed, 22 May 2013 22:32:33 GMT</pubDate><guid isPermaLink="false">Updated Wiki: GeometricPrimitive 20130522103233P</guid></item><item><title>Updated Wiki: GeometricPrimitive</title><link>https://directxtk.codeplex.com/wikipage?title=GeometricPrimitive&amp;version=30</link><description>&lt;div class="wikidoc"&gt;This is a helper for drawing simple geometric shapes including texture coordinates and surface normals.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Cube&lt;/li&gt;
&lt;li&gt;Sphere&lt;/li&gt;
&lt;li&gt;Geodesic Sphere&lt;/li&gt;
&lt;li&gt;Cylinder&lt;/li&gt;
&lt;li&gt;Torus&lt;/li&gt;
&lt;li&gt;Teapot&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Initialization&lt;/h1&gt;The GeometryPrimitive class must be created from a factory method which takes the Direct3D 11 device context.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
std::unique_ptr&amp;lt;GeometricPrimitive&amp;gt; shape(
GeometricPrimitive::CreateTeapot(deviceContext) );
&lt;/pre&gt;&lt;/div&gt;For exception safety, it is recommended you make use of the C++ RAII pattern and use a std::unique_ptr or std::shared_ptr&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;CreateCube( deviceContext, float size = 1)&lt;/li&gt;
&lt;li&gt;CreateSphere( deviceContext, float diameter = 1, size_t tessellation = 16)&lt;/li&gt;
&lt;li&gt;CreateGeoSphere( deviceContext, float diameter = 1, size_t tessellation = 3)&lt;/li&gt;
&lt;li&gt;CreateCylinder( deviceContext, float height = 1, float diameter = 1, size_t tessellation = 32)&lt;/li&gt;
&lt;li&gt;CreateTorus( deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32)&lt;/li&gt;
&lt;li&gt;CreateTeapot( deviceContext, float size = 1, size_t tessellation = 8)&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Simple drawing&lt;/h1&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
shape-&amp;gt;Draw(world, view, projection, Colors::CornflowerBlue);
&lt;/pre&gt;&lt;/div&gt;The draw method accepts an optional texture parameter, wireframe flag, and a callback function which can be used to override the default rendering state:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
shape-&amp;gt;Draw(world, view, projection, Colors::White, catTexture, &lt;span style="color:Blue;"&gt;false&lt;/span&gt;, [=]
{
    deviceContext-&amp;gt;OMSetBlendState(...);
});
&lt;/pre&gt;&lt;/div&gt;This makes use of a BasicEffect shared by all geometric primitives drawn on that device context.&lt;br /&gt;
&lt;h1&gt;Advanced drawing&lt;/h1&gt;This form of drawing makes use of a custom &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=GeometricPrimitive"&gt;Effects&lt;/a&gt; instance. The caller is responsible for using an input layout that matches the effect.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
IEffect* myeffect = ...

Microsoft::WRL::ComPtr&amp;lt;ID3D11InputLayout&amp;gt; inputLayout;
shape-&amp;gt;CreateInputLayout( myeffect, &amp;amp;inputLayout );

shape-&amp;gt;Draw( myeffect, inputLayout.Get() );
&lt;/pre&gt;&lt;/div&gt;This takes an optional parameter for enabling alpha-blending, wireframe, and a callback function which can be used to override the default rendering state.&lt;br /&gt;
&lt;h1&gt;Coordinate systems&lt;/h1&gt;These geometric primitives (based on the XNA Game Studio conventions) use right-handed coordinates. They can be used with left-handed coordinates by setting the &lt;i&gt;rhcoords&lt;/i&gt; parameter on the factory methods to &amp;#39;false&amp;#39; to reverse the winding ordering (the parameter defaults to &amp;#39;true&amp;#39;).&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
std::unique_ptr&amp;lt;GeometricPrimitive&amp;gt; shape(
GeometricPrimitive::CreateTeapot( deviceContext, 1.f, 8, &lt;span style="color:Blue;"&gt;false&lt;/span&gt; ) );
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Alpha blending&lt;/h1&gt;Alpha blending defaults to using premultiplied alpha. To make use of &amp;#39;straight&amp;#39; alpha textures, override the blending mode via the optional callback:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
CommonStates states(deviceContext);

shape-&amp;gt;Draw(world, view, projection, Colors::White, catTexture, &lt;span style="color:Blue;"&gt;false&lt;/span&gt;, [=]
{
    deviceContext-&amp;gt;OMSetBlendState( states.NonPremultiplied(), &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, 0xFFFFFFFF);
});
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, the GeometricPrimitive implementation make use of 16-bit indices (DXGI_FORMAT_R16_UINT) which limits to a maximum of 65535 vertices. Feature Level 9.1 is limited to a maximum of 65535 primitives in a single draw.&lt;br /&gt;
&lt;h1&gt;Threading model&lt;/h1&gt;Each GeometricPrimitive instance only supports drawing from one thread at a time, but you can simultaneously submit primitives on multiple threads if you create a separate GeometricPrimitive instance per Direct3D 11 deferred context.&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476892.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476892.aspx&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Cube"&gt;http://en.wikipedia.org/wiki/Cube&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Utah_teapot"&gt;http://en.wikipedia.org/wiki/Utah_teapot&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Wed, 22 May 2013 22:29:11 GMT</pubDate><guid isPermaLink="false">Updated Wiki: GeometricPrimitive 20130522102911P</guid></item><item><title>Updated Wiki: Model</title><link>https://directxtk.codeplex.com/wikipage?title=Model&amp;version=17</link><description>&lt;div class="wikidoc"&gt;This is a class hierarchy for drawing simple meshes with support for loading rigid models from Visual Studio 3D Starter Kit .CMO files and legacy DirectX SDK .SDKMESH files. It is an implementation of a mesh renderer similar to the XNA Game Studio Model, &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMesh&amp;referringTitle=Model"&gt;ModelMesh&lt;/a&gt;, &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMeshPart&amp;referringTitle=Model"&gt;ModelMeshPart&lt;/a&gt; design.&lt;br /&gt;&lt;br /&gt;NOTE: &lt;i&gt;Currently Model only supports rigid models. Support for animation, skinning, and frame hierarchy is not yet implemented.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;A Model consists of one or more ModelMesh instances. The ModelMesh instances can be shared by multiple instances of Model. A ModelMesh instance consists of one or more ModelMeshPart instances.&lt;br /&gt;&lt;br /&gt;Each ModelMeshPart references an index buffer, a vertex buffer, an input layout, an &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=Model"&gt;Effects&lt;/a&gt; instance, and includes various metadata for drawing the geometry. Each ModelMeshPart represents a single material to be drawn at the same time (i.e. a submesh).&lt;br /&gt;
&lt;h1&gt;Initialization&lt;/h1&gt;Model instances can be loaded from either .CMO files or .SDKMESH files, or from custom file formats. The Model loaders take an &lt;a href="https://directxtk.codeplex.com/wikipage?title=EffectFactory&amp;referringTitle=Model"&gt;EffectFactory&lt;/a&gt; instance to facilitate the sharing of &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=Model"&gt;Effects&lt;/a&gt; and textures between models. For simplicity, provided Model loaders always return built-in &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effect&amp;referringTitle=Model"&gt;Effect&lt;/a&gt; instances. Any references to specific shaders in the runtime mesh files are ignored.&lt;br /&gt;&lt;br /&gt;Visual Studio 2012 includes a built-in content pipeline that can generate .CMO files from an Autodesk FBX, as well as DDS texture files from various bitmap image formats, as part of the build process. See the Visual Studio 3D Starter Kit for details. &lt;a href="http://code.msdn.microsoft.com/windowsapps/Visual-Studio-3D-Starter-455a15f1"&gt;http://code.msdn.microsoft.com/windowsapps/Visual-Studio-3D-Starter-455a15f1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
EffectFactory fx( device );

&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; teapot = Model::CreateFromCMO( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;teapot.cmo&amp;quot;&lt;/span&gt;, fx );
&lt;/pre&gt;&lt;/div&gt;The legacy DirectX SDK has an exporter that will generate .SDKMESH files from an Autodesk FBX. The latest version of this exporter tool can be obtained from &lt;a href="http://go.microsoft.com/fwlink/?LinkId=226208"&gt;http://go.microsoft.com/fwlink/?LinkId=226208&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; tiny = Model::CreateFromSDKMESH( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;tiny.sdkmesh&amp;quot;&lt;/span&gt;, fx );
&lt;/pre&gt;&lt;/div&gt;A Model instance also contains a name (a wide-character string) for tracking and application logic. Model can be copied to create a new Model instance which will have shared references to the same set of ModelMesh instances (i.e. a &amp;#39;shallow&amp;#39; copy).&lt;br /&gt;
&lt;h1&gt;Simple drawing&lt;/h1&gt;The Model::Draw functions provides a high-level, easy to use method for drawing models.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
CommonStates states(device);

XMMATRIX local = XMMatrixTranslation( 1.f, 1.f, 1.f );
local = XMMatrixMultiply( world, local );
tiny-&amp;gt;Draw( context, states, local, view, projection );
&lt;/pre&gt;&lt;/div&gt;There are optional parameters for rendering in wireframe and to provide a custom state override callback.&lt;br /&gt;
&lt;h1&gt;Advanced drawing&lt;/h1&gt;Rather than using the standard Model::Draw, the ModelMesh::Draw method can be used on each mesh in turn listed in the Model::meshes collection. ModelMesh::Draw can be used to draw all the opaque parts or the alpha parts individually. The ModelMesh::PrepareForRendering method can be used as a helper to setup common render state, or the developer can set up the state directly before calling ModelMesh::Draw. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMesh&amp;referringTitle=Model"&gt;ModelMesh&lt;/a&gt; for an example.&lt;br /&gt;&lt;br /&gt;More detailed control over rendering can be had by skipping the use of Model::Draw and ModelMesh::Draw in favor of the ModelMeshPart::Draw method. Each Model::meshes collection can be scanned for each ModelMesh::meshParts collection to enumerate all ModelMeshPart instances. For this version of draw, the ModelMeshPart::effect and ModelMeshPart::inputLayout can be used, or a custom effect override can be used instead (be sure to create the appropriate matching input layout for the custom effect beforehand using ModelMeshPart::CreateInputLayout). See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMeshPart&amp;referringTitle=Model"&gt;ModelMeshPart&lt;/a&gt; for an example.&lt;br /&gt;
&lt;h1&gt;Effects control&lt;/h1&gt;The Model loaders create an appropriate Effects instance for each ModelMeshPart in a mesh. Generally all effects in a mesh should use the same lighting and fog settings, which is facilitated by the Model::UpdateEffects method. This calls back for each unique effect in the ModelMesh once.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
tiny-&amp;gt;UpdateEffects([&amp;amp;](IEffect* effect)
{
    &lt;span style="color:Blue;"&gt;auto&lt;/span&gt; lights = &lt;span style="color:Blue;"&gt;dynamic_cast&lt;/span&gt;&amp;lt;IEffectLights*&amp;gt;(effect);
    &lt;span style="color:Blue;"&gt;if&lt;/span&gt; ( lights )
    {
        XMVECTOR dir = XMVector3Rotate( g_XMOne, quat );
        lights-&amp;gt;SetLightDirection( 0, dir );
    }
    &lt;span style="color:Blue;"&gt;auto&lt;/span&gt; fog = &lt;span style="color:Blue;"&gt;dynamic_cast&lt;/span&gt;&amp;lt;IEffectFog*&amp;gt;(effect);
    &lt;span style="color:Blue;"&gt;if&lt;/span&gt; ( fog )
    {
        fog-&amp;gt;SetFogEnabled(&lt;span style="color:Blue;"&gt;true&lt;/span&gt;);
        fog-&amp;gt;SetFogStart(6); &lt;span style="color:Green;"&gt;// assuming RH coordiantes&lt;/span&gt;
        fog-&amp;gt;SetFogEnd(8);
        fog-&amp;gt;SetFogColor(Colors::CornflowerBlue);
    }
});
&lt;/pre&gt;&lt;/div&gt;It is also possible to change the Effects instance used by a given part (such as when overriding the default effect put in place from a Model loader) by calling ModelMeshPart::ModifyEffect. This will regenerate the ModelMeshPart::inputLayout appropriately.&lt;br /&gt;&lt;br /&gt;Be sure to call Model::Modified on all Model instances that reference the impacted ModelMesh instance to ensure the cache used by UpdateEffects is correctly updated. Model::Modified should also be called whenever a Model::meshes or ModelMesh::meshParts collection is modified.&lt;br /&gt;&lt;br /&gt;As noted above, it is also possible to render part or all of a model using a custom effect as an override, rather than changing the effect referenced by the ModelMeshPart::effect directly. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMeshPart&amp;referringTitle=Model"&gt;ModelMeshPart&lt;/a&gt; for an example.&lt;br /&gt;
&lt;h1&gt;Alpha blending&lt;/h1&gt;Proper drawing of alpha-blended models can be a complicated procedure. Each ModelMeshPart has a bool value to indicate if the associated part is fully opaque (isAlpha is false), or has some level of alpha transparency (isAlpha is true). The Model::Draw routine handles some basic logic for the rendering, first rendering the opaque parts, then rendering the alpha parts.  More detailed control is provided by the ModelMesh::Draw method which can be used to draw all opaque parts of all meshes first, then go back and draw all alpha parts of all meshes second. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMesh&amp;referringTitle=Model"&gt;ModelMesh&lt;/a&gt; for an example.&lt;br /&gt;&lt;br /&gt;To indicate the use of ‘straight’ alpha vs. ‘premultiplied’ alpha blending modes, ModelMesh::pmalpha is set by the various loaders functions controlled by a default parameter (which defaults false to indicate the texture files are using &amp;#39;straight&amp;#39; alpha). If you make use of DirectXTex&amp;#39;s texconv tool with the -pmalpha switch, you should use pmalpha=true instead.&lt;br /&gt;
&lt;h1&gt;Custom render states&lt;/h1&gt;All the various Draw method provide a setCustomState callback which can be used to change the state just before the geometry is drawn.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
tiny-&amp;gt;Draw( context, states, local, view, projection, &lt;span style="color:Blue;"&gt;false&lt;/span&gt;, [&amp;amp;]()
{
    ID3D11ShaderResourceView* srv = &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;;
    context-&amp;gt;PSSetShaderResources( 0, 1, &amp;amp;srv );
});
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Coordinate systems&lt;/h1&gt;Meshes are authored in a specific winding order, typically using the standard counter-clockwise winding common in graphics. The choice of viewing handedness (right-handed vs. left-handed coordinates) is largely a matter of preference and convenience, but it impacts how the models are built and/or exported.&lt;br /&gt;&lt;br /&gt;The Visual Studio 3D Starter Kit’s .CMO files assume the developer is using right-handed coordinates. DirectXTK’s default parameters assume you are using right-handed coordinates as well, so the ‘ccw’ parameter defaults to true. If using a .CMO with left-handed coordinates, you should pass false for the ‘ccw’ parameter which will use clockwise winding instead. This makes the geometry visible, but could make textures on the model appear ‘flipped’ in U.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// When using LH coordinates&lt;/span&gt;
&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; teapot = Model::CreateFromCMO( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;teapot.cmo&amp;quot;&lt;/span&gt;, fx, &lt;span style="color:Blue;"&gt;false&lt;/span&gt; );
&lt;/pre&gt;&lt;/div&gt;The legacy DirectX SDK’s .SDKMESH files assume the developer is using left-handed coordinates. DirectXTK’s default parameters assume you are using right-handed coordinates, so the ‘ccw’ parameter defaults to false which will use clockwise winding and potentially have the ‘flipped in U’ texture problem. If using a .SDKMESH with left-handed coordinates, you should pass true for the ‘ccw’ parameter.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// When using LH coordinates&lt;/span&gt;
&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; tiny = Model::CreateFromSDKMESH( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;tiny.sdkmesh&amp;quot;&lt;/span&gt;, fx, &lt;span style="color:Blue;"&gt;true&lt;/span&gt; );
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;If any ModelMeshPart makes use of 32-bit indices (i.e. ModelMeshPart:: indexFormat equals DXGI_FORMAT_R32_UINT) rather than 16-bit indices (DXGI_FORMAT_R16_UINT), then that model requires Feature Level 9.2 or greater.&lt;br /&gt;&lt;br /&gt;If any ModelMeshPart uses adjacency (i.e. ModelMeshPart::primitiveType equals D3D_PRIMITIVE_TOPOLOGY_*_ADJ), then that model requires Feature Level 10.0 or greater. If using tessellation (i.e. D3D_PRIMITIVE_TOPOLOGY_?_CONTROL_POINT_PATCHLIST), then that model requires Feature Level 11.0 or greater.&lt;br /&gt;&lt;br /&gt;Keep in mind that there are maximum primitive count limits per ModelMeshPart based on feature level as well (65535 for Feature Level 9.1, 1048575 or Feature Level 9.2 and 9.3, and 4294967295 for Feature Level 10.0 or greater).&lt;br /&gt;
&lt;h1&gt;Content Notes&lt;/h1&gt;The SDKMESH exporter &lt;a href="http://go.microsoft.com/fwlink/?LinkId=226208"&gt;http://go.microsoft.com/fwlink/?LinkId=226208&lt;/a&gt; uses Autodesk FBX 2011.3.1.&lt;br /&gt;&lt;br /&gt;VS 2012&amp;#39;s CMO exporter uses Autodesk FBX 2013.1. Recommended settings for exporting an FBX as a CMO include:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Geometry: Smoothing Groups, TurboSmooth, Convert Deforming Dummies to Bones, Preserve edge orientation&lt;/li&gt;
&lt;li&gt;Animation: Bake Animation (Start=0, End=100, Step=1), Deformations, Skins, Morphs&lt;/li&gt;
&lt;li&gt;Units: Automatic&lt;/li&gt;
&lt;li&gt;Axis conversion: Y-up&lt;/li&gt;
&lt;li&gt;FBX File Format: Binary, FBX 2013&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Threading model&lt;/h1&gt;The ModelMeshPart is tied to a device, but not a device context. This means that Model creation/loading is ‘free threaded’. Drawing can be done on the immediate context or by a deferred context, but keep in mind device contexts are not ‘free threaded’. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=EffectFactory&amp;referringTitle=Model"&gt;EffectFactory&lt;/a&gt; for some additional notes.&lt;br /&gt;
&lt;h1&gt;Further reading&lt;/h1&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476891.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476891.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sat, 04 May 2013 03:26:19 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Model 20130504032619A</guid></item><item><title>Updated Wiki: Model</title><link>https://directxtk.codeplex.com/wikipage?title=Model&amp;version=16</link><description>&lt;div class="wikidoc"&gt;This is a class hierarchy for drawing simple meshes with support for loading rigid models from Visual Studio 3D Starter Kit .CMO files and legacy DirectX SDK .SDKMESH files. It is an implementation of a mesh renderer similar to the XNA Game Studio Model, &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMesh&amp;referringTitle=Model"&gt;ModelMesh&lt;/a&gt;, &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMeshPart&amp;referringTitle=Model"&gt;ModelMeshPart&lt;/a&gt; design.&lt;br /&gt;&lt;br /&gt;NOTE: &lt;i&gt;Currently Model only supports rigid models. Support for animation, skinning, and frame hierarchy is not yet implemented.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;A Model consists of one or more ModelMesh instances. The ModelMesh instances can be shared by multiple instances of Model. A ModelMesh instance consists of one or more ModelMeshPart instances.&lt;br /&gt;&lt;br /&gt;Each ModelMeshPart references an index buffer, a vertex buffer, an input layout, an &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=Model"&gt;Effects&lt;/a&gt; instance, and includes various metadata for drawing the geometry. Each ModelMeshPart represents a single material to be drawn at the same time (i.e. a submesh).&lt;br /&gt;
&lt;h1&gt;Initialization&lt;/h1&gt;Model instances can be loaded from either .CMO files or .SDKMESH files, or from custom file formats. The Model loaders take an &lt;a href="https://directxtk.codeplex.com/wikipage?title=EffectFactory&amp;referringTitle=Model"&gt;EffectFactory&lt;/a&gt; instance to facilitate the sharing of &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=Model"&gt;Effects&lt;/a&gt; and textures between models. For simplicity, provided Model loaders always return built-in &lt;a href="https://directxtk.codeplex.com/wikipage?title=Effect&amp;referringTitle=Model"&gt;Effect&lt;/a&gt; instances. Any references to specific shaders in the runtime mesh files are ignored.&lt;br /&gt;&lt;br /&gt;Visual Studio 2012 includes a built-in content pipeline that can generate .CMO files from an Autodesk FBX, as well as DDS texture files from various bitmap image formats, as part of the build process. See the Visual Studio 3D Starter Kit for details. &lt;a href="http://code.msdn.microsoft.com/windowsapps/Visual-Studio-3D-Starter-455a15f1"&gt;http://code.msdn.microsoft.com/windowsapps/Visual-Studio-3D-Starter-455a15f1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
EffectFactory fx( device );

&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; teapot = Model::CreateFromCMO( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;teapot.cmo&amp;quot;&lt;/span&gt;, fx );
&lt;/pre&gt;&lt;/div&gt;The legacy DirectX SDK has an exporter that will generate .SDKMESH files from an Autodesk FBX. The latest version of this exporter tool can be obtained from &lt;a href="http://go.microsoft.com/fwlink/?LinkId=226208"&gt;http://go.microsoft.com/fwlink/?LinkId=226208&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; tiny = Model::CreateFromSDKMESH( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;tiny.sdkmesh&amp;quot;&lt;/span&gt;, fx );
&lt;/pre&gt;&lt;/div&gt;A Model instance also contains a name (a wide-character string) for tracking and application logic. Model can be copied to create a new Model instance which will have shared references to the same set of ModelMesh instances (i.e. a &amp;#39;shallow&amp;#39; copy).&lt;br /&gt;
&lt;h1&gt;Simple drawing&lt;/h1&gt;The Model::Draw functions provides a high-level, easy to use method for drawing models.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
CommonStates states(device);

XMMATRIX local = XMMatrixTranslation( 1.f, 1.f, 1.f );
local = XMMatrixMultiply( world, local );
tiny-&amp;gt;Draw( context, states, local, view, projection );
&lt;/pre&gt;&lt;/div&gt;There are optional parameters for rendering in wireframe and to provide a custom state override callback.&lt;br /&gt;
&lt;h1&gt;Advanced drawing&lt;/h1&gt;Rather than using the standard Model::Draw, the ModelMesh::Draw method can be used on each mesh in turn listed in the Model::meshes collection. ModelMesh::Draw can be used to draw all the opaque parts or the alpha parts individually. The ModelMesh::PrepareForRendering method can be used as a helper to setup common render state, or the developer can set up the state directly before calling ModelMesh::Draw. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMesh&amp;referringTitle=Model"&gt;ModelMesh&lt;/a&gt; for an example.&lt;br /&gt;&lt;br /&gt;More detailed control over rendering can be had by skipping the use of Model::Draw and ModelMesh::Draw in favor of the ModelMeshPart::Draw method. Each Model::meshes collection can be scanned for each ModelMesh::meshParts collection to enumerate all ModelMeshPart instances. For this version of draw, the ModelMeshPart::effect and ModelMeshPart::inputLayout can be used, or a custom effect override can be used instead (be sure to create the appropriate matching input layout for the custom effect beforehand using ModelMeshPart::CreateInputLayout). See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMeshPart&amp;referringTitle=Model"&gt;ModelMeshPart&lt;/a&gt; for an example.&lt;br /&gt;
&lt;h1&gt;Effects control&lt;/h1&gt;The Model loaders create an appropriate Effects instance for each ModelMeshPart in a mesh. Generally all effects in a mesh should use the same lighting and fog settings, which is facilitated by the Model::UpdateEffects method. This calls back for each unique effect in the ModelMesh once.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
tiny-&amp;gt;UpdateEffects([&amp;amp;](IEffect* effect)
{
    &lt;span style="color:Blue;"&gt;auto&lt;/span&gt; lights = &lt;span style="color:Blue;"&gt;dynamic_cast&lt;/span&gt;&amp;lt;IEffectLights*&amp;gt;(effect);
    &lt;span style="color:Blue;"&gt;if&lt;/span&gt; ( lights )
    {
        XMVECTOR dir = XMVector3Rotate( g_XMOne, quat );
        lights-&amp;gt;SetLightDirection( 0, dir );
    }
    &lt;span style="color:Blue;"&gt;auto&lt;/span&gt; fog = &lt;span style="color:Blue;"&gt;dynamic_cast&lt;/span&gt;&amp;lt;IEffectFog*&amp;gt;(effect);
    &lt;span style="color:Blue;"&gt;if&lt;/span&gt; ( fog )
    {
        fog-&amp;gt;SetFogEnabled(&lt;span style="color:Blue;"&gt;true&lt;/span&gt;);
        fog-&amp;gt;SetFogStart(6); &lt;span style="color:Green;"&gt;// assuming RH coordiantes&lt;/span&gt;
        fog-&amp;gt;SetFogEnd(8);
        fog-&amp;gt;SetFogColor(Colors::CornflowerBlue);
    }
});
&lt;/pre&gt;&lt;/div&gt;It is also possible to change the Effects instance used by a given part (such as when overriding the default effect put in place from a Model loader) by calling ModelMeshPart::ModifyEffect. This will regenerate the ModelMeshPart::inputLayout appropriately.&lt;br /&gt;&lt;br /&gt;Be sure to call Model::Modified on all Model instances that reference the impacted ModelMesh instance to ensure the cache used by UpdateEffects is correctly updated. Model::Modified should also be called whenever a Model::meshes or ModelMesh::meshParts collection is modified.&lt;br /&gt;&lt;br /&gt;As noted above, it is also possible to render part or all of a model using a custom effect as an override, rather than changing the effect referenced by the ModelMeshPart::effect directly. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMeshPart&amp;referringTitle=Model"&gt;ModelMeshPart&lt;/a&gt; for an example.&lt;br /&gt;
&lt;h1&gt;Alpha blending&lt;/h1&gt;Proper drawing of alpha-blended models can be a complicated procedure. Each ModelMeshPart has a bool value to indicate if the associated part is fully opaque (isAlpha is false), or has some level of alpha transparency (isAlpha is true). The Model::Draw routine handles some basic logic for the rendering, first rendering the opaque parts, then rendering the alpha parts.  More detailed control is provided by the ModelMesh::Draw method which can be used to draw all opaque parts of all meshes first, then go back and draw all alpha parts of all meshes second. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=ModelMesh&amp;referringTitle=Model"&gt;ModelMesh&lt;/a&gt; for an example.&lt;br /&gt;&lt;br /&gt;To indicate the use of ‘straight’ alpha vs. ‘premultiplied’ alpha blending modes, ModelMesh::pmalpha is set by the various loaders functions controlled by a default parameter (which defaults false to indicate the texture files are using &amp;#39;straight&amp;#39; alpha). If you make use of DirectXTex&amp;#39;s texconv tool with the -pmalpha switch, you should use pmalpha=true instead.&lt;br /&gt;
&lt;h1&gt;Custom render states&lt;/h1&gt;All the various Draw method provide a setCustomState callback which can be used to change the state just before the geometry is drawn.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
tiny-&amp;gt;Draw( context, states, local, view, projection, &lt;span style="color:Blue;"&gt;false&lt;/span&gt;, [&amp;amp;]()
{
    ID3D11ShaderResourceView* srv = &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;;
    context-&amp;gt;PSSetShaderResources( 0, 1, &amp;amp;srv );
});
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Coordinate systems&lt;/h1&gt;Meshes are authored in a specific winding order, typically using the standard counter-clockwise winding common in graphics. The choice of viewing handedness (right-handed vs. left-handed coordinates) is largely a matter of preference and convenience, but it impacts how the models are built and/or exported.&lt;br /&gt;&lt;br /&gt;The Visual Studio 3D Starter Kit’s .CMO files assume the developer is using right-handed coordinates. DirectXTK’s default parameters assume you are using right-handed coordinates as well, so the ‘ccw’ parameter defaults to true. If using a .CMO with left-handed coordinates, you should pass false for the ‘ccw’ parameter which will use clockwise winding instead. This makes the geometry visible, but could make textures on the model appear ‘flipped’ in U.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// When using LH coordinates&lt;/span&gt;
&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; teapot = Model::CreateFromCMO( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;teapot.cmo&amp;quot;&lt;/span&gt;, fx, &lt;span style="color:Blue;"&gt;false&lt;/span&gt; );
&lt;/pre&gt;&lt;/div&gt;The legacy DirectX SDK’s .SDKMESH files assume the developer is using left-handed coordinates. DirectXTK’s default parameters assume you are using right-handed coordinates, so the ‘ccw’ parameter defaults to false which will use clockwise winding and potentially have the ‘flipped in U’ texture problem. If using a .SDKMESH with left-handed coordinates, you should pass true for the ‘ccw’ parameter.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// When using LH coordinates&lt;/span&gt;
&lt;span style="color:Blue;"&gt;auto&lt;/span&gt; tiny = Model::CreateFromSDKMESH( device, L&lt;span style="color:#A31515;"&gt;&amp;quot;tiny.sdkmesh&amp;quot;&lt;/span&gt;, fx, &lt;span style="color:Blue;"&gt;true&lt;/span&gt; );
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;If any ModelMeshPart makes use of 32-bit indices (i.e. ModelMeshPart:: indexFormat equals DXGI_FORMAT_R32_UINT) rather than 16-bit indices (DXGI_FORMAT_R16_UINT), then that model requires Feature Level 9.2 or greater.&lt;br /&gt;&lt;br /&gt;If any ModelMeshPart uses adjacency (i.e. ModelMeshPart::primitiveType equals D3D_PRIMITIVE_TOPOLOGY_*_ADJ), then that model requires Feature Level 10.0 or greater. If using tessellation (i.e. D3D_PRIMITIVE_TOPOLOGY_?_CONTROL_POINT_PATCHLIST), then that model requires Feature Level 11.0 or greater.&lt;br /&gt;&lt;br /&gt;Keep in mind that there are maximum primitive count limits per ModelMeshPart based on feature level as well (65535 for Feature Level 9.1, 1048575 or Feature Level 9.2 and 9.3, and 4294967295 for Feature Level 10.0 or greater).&lt;br /&gt;
&lt;h1&gt;Content Notes&lt;/h1&gt;The SDKMESH exporter &lt;a href="http://go.microsoft.com/fwlink/?LinkId=226208"&gt;http://go.microsoft.com/fwlink/?LinkId=226208&lt;/a&gt; uses Autodesk FBX 2011.3.1.&lt;br /&gt;&lt;br /&gt;VS 2012&amp;#39;s CMO exporter uses Autodesk FBX 2013.1.&lt;br /&gt;
&lt;h1&gt;Threading model&lt;/h1&gt;The ModelMeshPart is tied to a device, but not a device context. This means that Model creation/loading is ‘free threaded’. Drawing can be done on the immediate context or by a deferred context, but keep in mind device contexts are not ‘free threaded’. See &lt;a href="https://directxtk.codeplex.com/wikipage?title=EffectFactory&amp;referringTitle=Model"&gt;EffectFactory&lt;/a&gt; for some additional notes.&lt;br /&gt;
&lt;h1&gt;Further reading&lt;/h1&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476891.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476891.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sat, 04 May 2013 03:24:57 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Model 20130504032457A</guid></item><item><title>Updated Wiki: DirectXTK</title><link>https://directxtk.codeplex.com/wikipage?title=DirectXTK&amp;version=27</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Headers&lt;/h1&gt;Public headers are in the &lt;b&gt;Inc&lt;/b&gt; folder of the distribution package.&lt;br /&gt;
&lt;h1&gt;Namespace&lt;/h1&gt;All the functions in the library are in the &lt;b&gt;DirectX&lt;/b&gt; C++ namespace.&lt;br /&gt;
&lt;h1&gt;Modules&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=SpriteBatch&amp;referringTitle=DirectXTK"&gt;SpriteBatch&lt;/a&gt; - simple &amp;amp; efficient 2D sprite rendering&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=SpriteFont&amp;referringTitle=DirectXTK"&gt;SpriteFont&lt;/a&gt; - bitmap based text rendering&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=DirectXTK"&gt;Effects&lt;/a&gt; - set of built-in shaders for common rendering tasks&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=PrimitiveBatch&amp;referringTitle=DirectXTK"&gt;PrimitiveBatch&lt;/a&gt; - simple and efficient way to draw user primitives&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=GeometricPrimitive&amp;referringTitle=DirectXTK"&gt;GeometricPrimitive&lt;/a&gt; - draws basic shapes such as cubes and spheres&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=Model&amp;referringTitle=DirectXTK"&gt;Model&lt;/a&gt; - draws simple meshes loaded from .CMO or .SDKMESH files&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=CommonStates&amp;referringTitle=DirectXTK"&gt;CommonStates&lt;/a&gt; - factory providing commonly used D3D state objects&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=VertexTypes&amp;referringTitle=DirectXTK"&gt;VertexTypes&lt;/a&gt; - structures for commonly used vertex data formats&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;referringTitle=DirectXTK"&gt;DDSTextureLoader&lt;/a&gt; - light-weight DDS file texture loader&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=WICTextureLoader&amp;referringTitle=DirectXTK"&gt;WICTextureLoader&lt;/a&gt; - WIC-based image file texture loader&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=ScreenGrab&amp;referringTitle=DirectXTK"&gt;ScreenGrab&lt;/a&gt; - light-weight screen shot saver&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;referringTitle=DirectXTK"&gt;SimpleMath&lt;/a&gt; - simplified C++ wrapper for DirectXMath&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Tools&lt;/h1&gt;&lt;a href="https://directxtk.codeplex.com/wikipage?title=MakeSpriteFont&amp;referringTitle=DirectXTK"&gt;MakeSpriteFont&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Building&lt;/h1&gt;This code is designed to build with either Visual Studio 2012 or Visual Studio 2010. It requires the Windows 8.0 SDK for functionality such as the DirectXMath library and optionally the DXGI 1.2 headers. Visual Studio 2012 already includes this Windows SDK, but Visual Studio 2010 users must install the standalone Windows 8.0 SDK. Details on using the Windows 8.0 SDK with VS 2010 are described on the Visual C++ Team Blog &lt;a href="http://blogs.msdn.com/b/vcblog/archive/2012/11/23/using-the-windows-8-sdk-with-visual-studio-2010-configuring-multiple-projects.aspx"&gt;http://blogs.msdn.com/b/vcblog/archive/2012/11/23/using-the-windows-8-sdk-with-visual-studio-2010-configuring-multiple-projects.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These components are designed to work without requiring any content from the DirectX SDK. For details, see &amp;quot;Where is the DirectX SDK&amp;quot;? &lt;a href="http://msdn.microsoft.com/en-us/library/ee663275.aspx"&gt;http://msdn.microsoft.com/en-us/library/ee663275.aspx&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Adding to a VS Project&lt;/h1&gt;In your application&amp;#39;s solution, right-click on the Solution and use &amp;quot;Add \ Existing Project...&amp;quot; to add the appropriate .vcxproj file to your solution.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;i&gt;DirectXTK_Windows8&lt;/i&gt; is for Windows Store apps building with VS 2012&lt;/li&gt;
&lt;li&gt;&lt;i&gt;DirectXTK_WindowsPhone8&lt;/i&gt; is for Windows phone 8 apps building with VS 2012 and the Windows Phone 8.0 SDK&lt;/li&gt;
&lt;li&gt;&lt;i&gt;DirectXTK_Desktop_2012&lt;/i&gt; is for Win32 desktop applications building with VS 2012 Express for Desktop, VS 2012 Professional or higher&lt;/li&gt;
&lt;li&gt;&lt;i&gt;DirectXTK_Desktop_2010&lt;/i&gt; is for Win32 desktop applications building with VS 2010 using the Windows 8.0 SDK&lt;/li&gt;&lt;/ul&gt;
In your application&amp;#39;s project, right-click on the Project and use &amp;quot;References...&amp;quot;, then &amp;quot;Add New Reference...&amp;quot;, and then check the DirectXTK project name and click OK. For a &lt;b&gt;Windows Store app&lt;/b&gt;, you need to set &lt;i&gt;Reference Assembly Output&lt;/i&gt; to &lt;i&gt;false&lt;/i&gt; since DirectXTK is a static C++ library and not a WinRT component.&lt;br /&gt;&lt;br /&gt;In your application&amp;#39;s project settings, on the &amp;quot;C++ / General&amp;quot; page set Configuration to &amp;quot;All Configurations&amp;quot;, set Platform to &amp;quot;All Plaforms&amp;quot;, and then add the path &lt;b&gt;$(SolutionDir)\DirectXTK\inc;&lt;/b&gt; to the &lt;i&gt;Additional Include Directories&lt;/i&gt; properties. Click Apply.&lt;br /&gt;
&lt;h1&gt;Error Handling&lt;/h1&gt;DirectXTK makes use of C++ exception handling which should be enabled by the application via the /EHsc compiler switch. In Visual Studio, this is set in the project settings under &amp;quot;C++ / Code Generation&amp;quot; with &lt;i&gt;Enable C++ Exceptions&lt;/i&gt; set to &amp;quot;Yes (/EHsc)&amp;quot; for all configurations.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/4t3saedz.aspx"&gt;http://msdn.microsoft.com/en-us/library/4t3saedz.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/d14azbfh.aspx"&gt;http://msdn.microsoft.com/en-us/library/d14azbfh.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/09/17/dual-use-coding-techniques-for-games.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/09/17/dual-use-coding-techniques-for-games.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization"&gt;http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sun, 14 Apr 2013 06:01:51 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DirectXTK 20130414060151A</guid></item><item><title>Updated Wiki: DDSTextureLoader</title><link>https://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;version=27</link><description>&lt;div class="wikidoc"&gt;A streamlined version of the DirectX SDK sample DDSWithoutD3DX11 texture loading code for a simple light-weight runtime .DDS file loader. This version only supports Direct3D 11 and performs no runtime pixel data conversions (see &lt;i&gt;Release Notes&lt;/i&gt; for more details). This is ideal for runtime usage, and supports the full complement of Direct3D 11 texture resources (1D, 2D, volume maps, cubemaps, mipmap levels, texture arrays, BC formats, etc.). It supports both legacy and &amp;#39;DX10&amp;#39; extension header format .dds files.&lt;br /&gt;&lt;br /&gt;Also part of DirectXTex &lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Functions&lt;/h1&gt;
&lt;b&gt;CreateDDSTextureFromMemory&lt;/b&gt;&lt;br /&gt;Loads a .DDS file assuming the image of the file is located in a memory buffer. Creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFile&lt;/b&gt;&lt;br /&gt;Loads a .DDS file from disk and creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;For both these functions if &amp;#39;maxsize&amp;#39; parameter non-zero, then all mipmap levels larger than the maxsize are ignored before creating the Direct3D 11 resource. This allows for load-time scaling. If &amp;#39;0&amp;#39;, then if the attempt to create the Direct3D 11 resource fails and there are mipmaps present, it will retry assuming a maxsize based on the device&amp;#39;s current feature level.&lt;br /&gt;&lt;br /&gt;The last optional parameter for both functions is a pointer to return the &lt;i&gt;alpha mode&lt;/i&gt; of the DDS file. This can be one of the following values to return information about the alpha channel if present in the file:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DDS_ALPHA_MODE_UNKNOWN (0) - This is the default for most .DDS files if the specific metadata isn&amp;#39;t present, and it&amp;#39;s up to the application to know if it&amp;#39;s really something else. Viewers should assume the alpha channel is intended for &amp;#39;normal&amp;#39; alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_STRAIGHT (1) - This indicates that the alpha channel if present is assumed to be using &amp;#39;straight&amp;#39; alpha. Viewers should use the alpha channel with &amp;#39;normal&amp;#39; alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_PREMULTIPLIED (2) - This indicates the alpha channel if present is premultiplied alpha. This information is only present if the file is written using the latest version of the &amp;quot;DX10&amp;quot; extended header, or if the file is BC2/BC3 with the &amp;quot;DXT2&amp;quot;/&amp;quot;DXT4&amp;quot; FourCC which are explicitly stored as premultiplied alpha. Viewers should use the alpha channel with premultiplied alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_OPAQUE (3) - This indicates that the alpha channel if present is fully opaque for all pixels. Viewers can assume there is no alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_CUSTOM (4) - This indicates the alpha channel if present does not contain transparency (neither straight or premultiplied alpha) and instead is encoding some other channel of information. Viewers should not use the alpha channel for blending, and should instead view it as a distinct image channel.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromMemoryEx&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFileEx&lt;/b&gt;&lt;br /&gt;These versions provide explicit control over the created resource&amp;#39;s usage, binding flags, CPU access flags, and miscellaneous flags for advanced / expert scenarios. The standard routines default to D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, and 0 respectively. For cubemaps, the miscellaneous flags default to D3D11_RESOURCE_MISC_TEXTURECUBE. There is also a &amp;#39;forceSRGB&amp;#39; option for working around gamma issues with content that is in the sRGB or similar color space but is not encoded explicitly as an SRGB format. Note that the &amp;#39;maxsize&amp;#39; parameter is not at the end of the parameter list like it is in the non-Ex version.&lt;br /&gt;
&lt;h1&gt;Example&lt;/h1&gt;
This example creates a shader resource view on the ID3D11Device d3dDevice which can be used for rendering.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; Microsoft::WRL;

ComPtr&amp;lt;ID3D11ShaderResourceView&amp;gt; srv;
HRESULT hr = CreateDDSTextureFromFile( d3dDevice, L&lt;span style="color:#A31515;"&gt;&amp;quot;SEAFLOOR.DDS&amp;quot;&lt;/span&gt;, &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, &amp;amp;srv )
ThrowIfFailed(hr);
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, you should make sure your DDS textures are mip-mapped so that they contain a suitably sized image. Non-mipmapped textures will either need explicit feature level association, or be sized less than or equal to 2048 for 1D, 2048 x 2048 for 2D, 512 x 512 for cubemaps, and 256 x 256 x 256 for volume maps.&lt;br /&gt;&lt;br /&gt;Texture arrays require Feature Level  10.0 or later. Cubemap arrays requires Feature Level 10.1 or later.&lt;br /&gt;&lt;br /&gt;Be sure to review the various format limitations for the different feature levels. To support all feature levels, stick with textures in the following formats:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8B8A8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_B8G8R8A8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R16G16_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB&lt;/li&gt;&lt;/ul&gt;
On Windows 8 with WDDM 1.2 drivers, all feature levels support 16bpp formats as well DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, and DXGI_FORMAT_B4G4R4A4_UNORM.&lt;br /&gt;
&lt;h1&gt;Release Notes&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;DDSTextureLoader performs no run-time conversions. If there is not a direct mapping to a DXGI supported format, the function fails. You can make use of the DirectXTex library or texconv tool to convert legacy Direct3D9 DDS files to a supported format. Legacy formats which require conversion include:
&lt;ul&gt;&lt;li&gt;D3DFMT_R8G8B8 (24bpp RGB) - Use a 32bpp format &lt;/li&gt;
&lt;li&gt;D3DFMT_X8B8G8R8 (32bpp RGBX) - Use BGRX, BGRA, or RGBA&lt;/li&gt;
&lt;li&gt;D3DFMT_A2R10G10B10 (BGRA 10:10:10:2) - Use RGBA 10:10:10:2&lt;/li&gt;
&lt;li&gt;D3DFMT_X1R5G5B5 (BGR 5:5:5) - Use BGRA 5:5:5:1 or BGR 5:6:5&lt;/li&gt;
&lt;li&gt;D3DFMT_A8R3G3B2, D3DFMT_R3G3B2 (BGR 3:3:2) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_P8, D3DFMT_A8P8 (8-bit palette) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_A4L4 (Luminance 4:4) - Expand to a supported format&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;On a system with the DirectX 11.0 Runtime or lacking WDDM 1.2 drivers, attempts to load 16bpp format files (BGR 5:6:5, BGRA 5:5:5:1, and BGRA 4:4:4:4) will fail.&lt;/li&gt;&lt;/ul&gt;

&lt;ul&gt;&lt;li&gt;Partial cubemaps (i.e. DDS files without all six faces defined) are not supported by Direct3D 11.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Thu, 11 Apr 2013 22:44:15 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DDSTextureLoader 20130411104415P</guid></item><item><title>Updated Wiki: SimpleMath</title><link>http://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;version=5</link><description>&lt;div class="wikidoc"&gt;SimpleMath.h wraps the DirectXMath SIMD vector/matrix math API with an easier to use C++ interface. It provides the following types, with similar names, methods, and operator overloads to the XNA Game Studio math API:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Vector2&lt;/li&gt;
&lt;li&gt;Vector3&lt;/li&gt;
&lt;li&gt;Vector4&lt;/li&gt;
&lt;li&gt;Matrix&lt;/li&gt;
&lt;li&gt;Quaternion&lt;/li&gt;
&lt;li&gt;Plane&lt;/li&gt;
&lt;li&gt;Ray&lt;/li&gt;
&lt;li&gt;Color&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;To use:&lt;/h1&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
    #include &lt;span style="color:#A31515;"&gt;&amp;quot;SimpleMath.h&amp;quot;&lt;/span&gt;

    &lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX::SimpleMath;
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Why wrap DirectXMath?&lt;/h1&gt;
DirectXMath provides highly optimized vector and matrix math functions, which take advantage of SSE SIMD intrinsics when compiled for x86/x64, or the ARM NEON instruction set when compiled for an ARM platform such as Windows RT or Windows Phone. The downside of being designed for efficient SIMD usage is that DirectXMath can be somewhat complicated to work with. Developers must be aware of correct type usage (understanding the difference between SIMD register types such as XMVECTOR vs. memory storage types such as XMFLOAT4), must take care to maintain correct alignment for SIMD heap allocations, and must carefully structure their code to avoid accessing individual components from a SIMD register. This complexity is necessary for optimal SIMD performance, but sometimes you just want to get stuff working without so much hassle!&lt;br /&gt;
&lt;h1&gt;Enter SimpleMath...&lt;/h1&gt;
These types derive from the equivalent DirectXMath memory storage types (for instance Vector3 is derived from XMFLOAT3), so they can be stored in arbitrary locations without worrying about SIMD alignment, and individual components can be accessed without bothering to call SIMD accessor functions. But unlike XMFLOAT3, the Vector3 type defines a rich set of methods and overloaded operators, so it can be directly manipulated without having to first load its value into an XMVECTOR. Vector3 also defines an operator for automatic conversion to XMVECTOR, so it can be passed directly to methods that were written to use the lower level DirectXMath types.&lt;br /&gt;&lt;br /&gt;If that sounds horribly confusing, the short version is that the SimpleMath types pretty much &amp;quot;Just Work&amp;quot; the way you would expect them to.&lt;br /&gt;&lt;br /&gt;By now you must be wondering, where is the catch? And of course there is one. SimpleMath hides the complexities of SIMD programming by automatically converting back and forth between memory and SIMD register types, which tends to generate additional load and store instructions. This can add significant overhead compared to the lower level DirectXMath approach, where SIMD loads and stores are under explicit control of the programmer.&lt;br /&gt;&lt;br /&gt;You should use SimpleMath if you are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Looking for a C++ math library with similar API to the C# XNA types&lt;/li&gt;
&lt;li&gt;Porting existing XNA code from C# to C++&lt;/li&gt;
&lt;li&gt;Wanting to optimize for programmer efficiency (simplicity, readability, development speed) at the expense of runtime efficiency&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should go straight to the underlying DirectXMath API if you:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Want to create the fastest possible code&lt;/li&gt;
&lt;li&gt;Enjoy the lateral thinking needed to express algorithms in raw SIMD&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;This need not be a global either/or decision. The SimpleMath types know how to convert themselves to and from the corresponding DirectXMath types, so it is easy to mix and match. You can use SimpleMath for the parts of your program where readability and development time matter most, then drop down to DirectXMath for performance hotspots where runtime efficiency is more important.&lt;br /&gt;
&lt;h1&gt;Coordinate Systems&lt;/h1&gt;
Because SimpleMath Is intended to look a lot like like XNA Game Studio&amp;#39;s math library, it uses &lt;i&gt;right-handed coordinates&lt;/i&gt; by convention for the following Matrix methods:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;CreatePerspectiveFieldOfView&lt;/li&gt;
&lt;li&gt;CreatePerspective&lt;/li&gt;
&lt;li&gt;CreatePerspectiveOffCenter&lt;/li&gt;
&lt;li&gt;CreateOrthographic&lt;/li&gt;
&lt;li&gt;CreateOrthographicOffCenter&lt;/li&gt;
&lt;li&gt;CreateLookAt&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;If you want to use &lt;i&gt;left-handed coordinates&lt;/i&gt;, use the DirectXMath methods directly. For example&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// Here&amp;#39;s a RH example&lt;/span&gt;
Vector3 eye, target, up;
...
Matrix mView = Matrix::CreateLookAt( eye, target, up );

&lt;span style="color:Green;"&gt;// Here&amp;#39; is a LH example of same thing which relies on&lt;/span&gt;
&lt;span style="color:Green;"&gt;// Vector3 and Matrix conversion operators&lt;/span&gt;
Vector3 eye, target, up;
...
Matrix mView = XMMatrixLookAtLH( eye, target, up ); 
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/03/27/introducing-directxmath.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/03/27/introducing-directxmath.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/09/11/directxmath-sse-sse2-and-arm-neon.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/09/11/directxmath-sse-sse2-and-arm-neon.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2013/03/06/known-issues-directxmath-3-03.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2013/03/06/known-issues-directxmath-3-03.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/shawnhar/archive/2013/01/08/simplemath-a-simplified-wrapper-for-directxmath.aspx"&gt;http://blogs.msdn.com/b/shawnhar/archive/2013/01/08/simplemath-a-simplified-wrapper-for-directxmath.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Tue, 26 Mar 2013 20:27:23 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SimpleMath 20130326082723P</guid></item><item><title>Updated Wiki: SimpleMath</title><link>http://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;version=4</link><description>&lt;div class="wikidoc"&gt;SimpleMath.h wraps the DirectXMath SIMD vector/matrix math API with an easier to use C++ interface. It provides the following types, with similar names, methods, and operator overloads to the XNA Game Studio math API:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Vector2&lt;/li&gt;
&lt;li&gt;Vector3&lt;/li&gt;
&lt;li&gt;Vector4&lt;/li&gt;
&lt;li&gt;Matrix&lt;/li&gt;
&lt;li&gt;Quaternion&lt;/li&gt;
&lt;li&gt;Plane&lt;/li&gt;
&lt;li&gt;Ray&lt;/li&gt;
&lt;li&gt;Color&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;To use:&lt;/h1&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
    #include &lt;span style="color:#A31515;"&gt;&amp;quot;SimpleMath.h&amp;quot;&lt;/span&gt;

    &lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX::SimpleMath;
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Why wrap DirectXMath?&lt;/h1&gt;
DirectXMath provides highly optimized vector and matrix math functions, which take advantage of SSE SIMD intrinsics when compiled for x86/x64, or the ARM NEON instruction set when compiled for an ARM platform such as Windows RT or Windows Phone. The downside of being designed for efficient SIMD usage is that DirectXMath can be somewhat complicated to work with. Developers must be aware of correct type usage (understanding the difference between SIMD register types such as XMVECTOR vs. memory storage types such as XMFLOAT4), must take care to maintain correct alignment for SIMD heap allocations, and must carefully structure their code to avoid accessing individual components from a SIMD register. This complexity is necessary for optimal SIMD performance, but sometimes you just want to get stuff working without so much hassle!&lt;br /&gt;
&lt;h1&gt;Enter SimpleMath...&lt;/h1&gt;
These types derive from the equivalent DirectXMath memory storage types (for instance Vector3 is derived from XMFLOAT3), so they can be stored in arbitrary locations without worrying about SIMD alignment, and individual components can be accessed without bothering to call SIMD accessor functions. But unlike XMFLOAT3, the Vector3 type defines a rich set of methods and overloaded operators, so it can be directly manipulated without having to first load its value into an XMVECTOR. Vector3 also defines an operator for automatic conversion to XMVECTOR, so it can be passed directly to methods that were written to use the lower level DirectXMath types.&lt;br /&gt;&lt;br /&gt;If that sounds horribly confusing, the short version is that the SimpleMath types pretty much &amp;quot;Just Work&amp;quot; the way you would expect them to.&lt;br /&gt;&lt;br /&gt;By now you must be wondering, where is the catch? And of course there is one. SimpleMath hides the complexities of SIMD programming by automatically converting back and forth between memory and SIMD register types, which tends to generate additional load and store instructions. This can add significant overhead compared to the lower level DirectXMath approach, where SIMD loads and stores are under explicit control of the programmer.&lt;br /&gt;&lt;br /&gt;You should use SimpleMath if you are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Looking for a C++ math library with similar API to the C# XNA types&lt;/li&gt;
&lt;li&gt;Porting existing XNA code from C# to C++&lt;/li&gt;
&lt;li&gt;Wanting to optimize for programmer efficiency (simplicity, readability, development speed) at the expense of runtime efficiency&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should go straight to the underlying DirectXMath API if you:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Want to create the fastest possible code&lt;/li&gt;
&lt;li&gt;Enjoy the lateral thinking needed to express algorithms in raw SIMD&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;This need not be a global either/or decision. The SimpleMath types know how to convert themselves to and from the corresponding DirectXMath types, so it is easy to mix and match. You can use SimpleMath for the parts of your program where readability and development time matter most, then drop down to DirectXMath for performance hotspots where runtime efficiency is more important.&lt;br /&gt;
&lt;h1&gt;Coordinate Systems&lt;/h1&gt;
Because SimpleMath Is intended to look a lot like like XNA Game Studio&amp;#39;s math library, it uses &lt;i&gt;right-handed coordinates&lt;/i&gt; by convention for the following Matrix methods:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;CreatePerspectiveFieldOfView&lt;/li&gt;
&lt;li&gt;CreatePerspective&lt;/li&gt;
&lt;li&gt;CreatePerspectiveOffCenter&lt;/li&gt;
&lt;li&gt;CreateOrthographic&lt;/li&gt;
&lt;li&gt;CreateOrthographicOffCenter&lt;/li&gt;
&lt;li&gt;CreateLookAt&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;If you want to use &lt;i&gt;left-handed coordinates&lt;/i&gt;, use the DirectXMath methods directly. For example&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// Here&amp;#39;s a RH example&lt;/span&gt;
Vector3 eye, target, up;
...
Matrix mView = Matrix::CreateLookAt( eye, target, up );

&lt;span style="color:Green;"&gt;// Here&amp;#39; is a LH example of same thing which relies on Vector3 and Matrix conversion operators&lt;/span&gt;
Vector3 eye, target, up;
...
Matrix mView = XMMatrixLookAtLH( eye, target, up ); 
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/03/27/introducing-directxmath.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/03/27/introducing-directxmath.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/09/11/directxmath-sse-sse2-and-arm-neon.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/09/11/directxmath-sse-sse2-and-arm-neon.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2013/03/06/known-issues-directxmath-3-03.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2013/03/06/known-issues-directxmath-3-03.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/shawnhar/archive/2013/01/08/simplemath-a-simplified-wrapper-for-directxmath.aspx"&gt;http://blogs.msdn.com/b/shawnhar/archive/2013/01/08/simplemath-a-simplified-wrapper-for-directxmath.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Tue, 26 Mar 2013 18:30:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SimpleMath 20130326063034P</guid></item><item><title>Updated Wiki: SimpleMath</title><link>http://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;version=3</link><description>&lt;div class="wikidoc"&gt;SimpleMath.h wraps the DirectXMath SIMD vector/matrix math API with an easier to use C++ interface. It provides the following types, with similar names, methods, and operator overloads to the XNA Game Studio math API:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Vector2&lt;/li&gt;
&lt;li&gt;Vector3&lt;/li&gt;
&lt;li&gt;Vector4&lt;/li&gt;
&lt;li&gt;Matrix&lt;/li&gt;
&lt;li&gt;Quaternion&lt;/li&gt;
&lt;li&gt;Plane&lt;/li&gt;
&lt;li&gt;Ray&lt;/li&gt;
&lt;li&gt;Color&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;To use:&lt;/h1&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
    #include &lt;span style="color:#A31515;"&gt;&amp;quot;SimpleMath.h&amp;quot;&lt;/span&gt;

    &lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX::SimpleMath;
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Why wrap DirectXMath?&lt;/h1&gt;
DirectXMath provides highly optimized vector and matrix math functions, which take advantage of SSE SIMD intrinsics when compiled for x86/x64, or the ARM NEON instruction set when compiled for an ARM platform such as Windows RT or Windows Phone. The downside of being designed for efficient SIMD usage is that DirectXMath can be somewhat complicated to work with. Developers must be aware of correct type usage (understanding the difference between SIMD register types such as XMVECTOR vs. memory storage types such as XMFLOAT4), must take care to maintain correct alignment for SIMD heap allocations, and must carefully structure their code to avoid accessing individual components from a SIMD register. This complexity is necessary for optimal SIMD performance, but sometimes you just want to get stuff working without so much hassle!&lt;br /&gt;
&lt;h1&gt;Enter SimpleMath...&lt;/h1&gt;
These types derive from the equivalent DirectXMath memory storage types (for instance Vector3 is derived from XMFLOAT3), so they can be stored in arbitrary locations without worrying about SIMD alignment, and individual components can be accessed without bothering to call SIMD accessor functions. But unlike XMFLOAT3, the Vector3 type defines a rich set of methods and overloaded operators, so it can be directly manipulated without having to first load its value into an XMVECTOR. Vector3 also defines an operator for automatic conversion to XMVECTOR, so it can be passed directly to methods that were written to use the lower level DirectXMath types.&lt;br /&gt;&lt;br /&gt;If that sounds horribly confusing, the short version is that the SimpleMath types pretty much &amp;quot;Just Work&amp;quot; the way you would expect them to.&lt;br /&gt;&lt;br /&gt;By now you must be wondering, where is the catch? And of course there is one. SimpleMath hides the complexities of SIMD programming by automatically converting back and forth between memory and SIMD register types, which tends to generate additional load and store instructions. This can add significant overhead compared to the lower level DirectXMath approach, where SIMD loads and stores are under explicit control of the programmer.&lt;br /&gt;&lt;br /&gt;You should use SimpleMath if you are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Looking for a C++ math library with similar API to the C# XNA types&lt;/li&gt;
&lt;li&gt;Porting existing XNA code from C# to C++&lt;/li&gt;
&lt;li&gt;Wanting to optimize for programmer efficiency (simplicity, readability, development speed) at the expense of runtime efficiency&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should go straight to the underlying DirectXMath API if you:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Want to create the fastest possible code&lt;/li&gt;
&lt;li&gt;Enjoy the lateral thinking needed to express algorithms in raw SIMD&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;This need not be a global either/or decision. The SimpleMath types know how to convert themselves to and from the corresponding DirectXMath types, so it is easy to mix and match. You can use SimpleMath for the parts of your program where readability and development time matter most, then drop down to DirectXMath for performance hotspots where runtime efficiency is more important.&lt;br /&gt;
&lt;h1&gt;Coordinate Systems&lt;/h1&gt;
Because SimpleMath Is intended to look a lot like like XNA Game Studio&amp;#39;s math library, it uses &lt;i&gt;right-handed coordinates&lt;/i&gt; by convention for the following Matrix methods:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;CreatePerspectiveFieldOfView&lt;/li&gt;
&lt;li&gt;CreatePerspective&lt;/li&gt;
&lt;li&gt;CreatePerspectiveOffCenter&lt;/li&gt;
&lt;li&gt;CreateOrthographic&lt;/li&gt;
&lt;li&gt;CreateOrthographicOffCenter&lt;/li&gt;
&lt;li&gt;CreateLookAt&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;If you want to use &lt;i&gt;left-handed coordinates&lt;/i&gt;, use the DirectXMath methods directly. For example&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Green;"&gt;// Here&amp;#39;s a RH example&lt;/span&gt;
Vector3 eye, target, up;
...
Matrix mView = Matrix::CreateLookAt( eye, target, up );

&lt;span style="color:Green;"&gt;// Here&amp;#39; is a LH example of same thing which relies on Vector3 and Matrix conversion operators&lt;/span&gt;
Vector3 eye, target, up;
...
Matrix mView = XMMatrixLookAtLH( eye, target, up ); 
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Tue, 26 Mar 2013 18:28:13 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SimpleMath 20130326062813P</guid></item><item><title>Updated Wiki: DDSTextureLoader</title><link>http://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;version=26</link><description>&lt;div class="wikidoc"&gt;A streamlined version of the DirectX SDK sample DDSWithoutD3DX11 texture loading code for a simple light-weight runtime .DDS file loader. This version only supports Direct3D 11 and performs no runtime pixel data conversions (see &lt;i&gt;Release Notes&lt;/i&gt; for more details). This is ideal for runtime usage, and supports the full complement of Direct3D 11 texture resources (1D, 2D, volume maps, cubemaps, mipmap levels, texture arrays, BC formats, etc.). It supports both legacy and &amp;#39;DX10&amp;#39; extension header format .dds files.&lt;br /&gt;&lt;br /&gt;Also part of DirectXTex &lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Functions&lt;/h1&gt;
&lt;b&gt;CreateDDSTextureFromMemory&lt;/b&gt;&lt;br /&gt;Loads a .DDS file assuming the image of the file is located in a memory buffer. Creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFile&lt;/b&gt;&lt;br /&gt;Loads a .DDS file from disk and creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;For both these functions if &amp;#39;maxsize&amp;#39; parameter non-zero, then all mipmap levels larger than the maxsize are ignored before creating the Direct3D 11 resource. This allows for load-time scaling. If &amp;#39;0&amp;#39;, then if the attempt to create the Direct3D 11 resource fails and there are mipmaps present, it will retry assuming a maxsize based on the device&amp;#39;s current feature level.&lt;br /&gt;&lt;br /&gt;The last optional parameter for both functions is a pointer to return the &lt;i&gt;alpha mode&lt;/i&gt; of the DDS file. This can be one of the following values to return information about the alpha channel if present in the file:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DDS_ALPHA_MODE_STRAIGHT (0) - This indicates that the alpha channel if present is assumed to be using &amp;#39;straight&amp;#39; alpha. This is the default for most .DDS files if the specific metadata isn&amp;#39;t present, and it&amp;#39;s up to the application to know if it&amp;#39;s really something else. Viewers should assume the alpha channel is intended for &amp;#39;normal&amp;#39; alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_PREMULTIPLIED (1) - This indicates the alpha channel if present is premultiplied alpha. This information is only present if the file is written using the latest version of the &amp;quot;DX10&amp;quot; extended header, or if the file is BC2/BC3 with the &amp;quot;DXT2&amp;quot;/&amp;quot;DXT4&amp;quot; FourCC which are explicitly stored as premultiplied alpha. Viewers should use the alpha channel with premultiplied alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_4TH_CHANNEL (2) - This indicates the alpha channel if present does not contain transparency (neither straight or premultiplied alpha) and instead is encoding some other channel of information. Viewers should not use the alpha channel for blending, and should instead view it as a distinct image channel.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_OPAQUE (3) - This indicates that the alpha channel if present is fully opaque for all pixels. Viewers can assume there is no alpha blending.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromMemoryEx&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFileEx&lt;/b&gt;&lt;br /&gt;These versions provide explicit control over the created resource&amp;#39;s usage, binding flags, CPU access flags, and miscellaneous flags for advanced / expert scenarios. The standard routines default to D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, and 0 respectively. For cubemaps, the miscellaneous flags default to D3D11_RESOURCE_MISC_TEXTURECUBE. There is also a &amp;#39;forceSRGB&amp;#39; option for working around gamma issues with content that is in the sRGB or similar color space but is not encoded explicitly as an SRGB format. Note that the &amp;#39;maxsize&amp;#39; parameter is not at the end of the parameter list like it is in the non-Ex version.&lt;br /&gt;
&lt;h1&gt;Example&lt;/h1&gt;
This example creates a shader resource view on the ID3D11Device d3dDevice which can be used for rendering.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; Microsoft::WRL;

ComPtr&amp;lt;ID3D11ShaderResourceView&amp;gt; srv;
HRESULT hr = CreateDDSTextureFromFile( d3dDevice, L&lt;span style="color:#A31515;"&gt;&amp;quot;SEAFLOOR.DDS&amp;quot;&lt;/span&gt;, &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, &amp;amp;srv )
ThrowIfFailed(hr);
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, you should make sure your DDS textures are mip-mapped so that they contain a suitably sized image. Non-mipmapped textures will either need explicit feature level association, or be sized less than or equal to 2048 for 1D, 2048 x 2048 for 2D, 512 x 512 for cubemaps, and 256 x 256 x 256 for volume maps.&lt;br /&gt;&lt;br /&gt;Texture arrays require Feature Level  10.0 or later. Cubemap arrays requires Feature Level 10.1 or later.&lt;br /&gt;&lt;br /&gt;Be sure to review the various format limitations for the different feature levels. To support all feature levels, stick with textures in the following formats:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8B8A8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_B8G8R8A8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R16G16_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB&lt;/li&gt;&lt;/ul&gt;
On Windows 8 with WDDM 1.2 drivers, all feature levels support 16bpp formats as well DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, and DXGI_FORMAT_B4G4R4A4_UNORM.&lt;br /&gt;
&lt;h1&gt;Release Notes&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;DDSTextureLoader performs no run-time conversions. If there is not a direct mapping to a DXGI supported format, the function fails. You can make use of the DirectXTex library or texconv tool to convert legacy Direct3D9 DDS files to a supported format. Legacy formats which require conversion include:
&lt;ul&gt;&lt;li&gt;D3DFMT_R8G8B8 (24bpp RGB) - Use a 32bpp format &lt;/li&gt;
&lt;li&gt;D3DFMT_X8B8G8R8 (32bpp RGBX) - Use BGRX, BGRA, or RGBA&lt;/li&gt;
&lt;li&gt;D3DFMT_A2R10G10B10 (BGRA 10:10:10:2) - Use RGBA 10:10:10:2&lt;/li&gt;
&lt;li&gt;D3DFMT_X1R5G5B5 (BGR 5:5:5) - Use BGRA 5:5:5:1 or BGR 5:6:5&lt;/li&gt;
&lt;li&gt;D3DFMT_A8R3G3B2, D3DFMT_R3G3B2 (BGR 3:3:2) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_P8, D3DFMT_A8P8 (8-bit palette) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_A4L4 (Luminance 4:4) - Expand to a supported format&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;On a system with the DirectX 11.0 Runtime or lacking WDDM 1.2 drivers, attempts to load 16bpp format files (BGR 5:6:5, BGRA 5:5:5:1, and BGRA 4:4:4:4) will fail.&lt;/li&gt;&lt;/ul&gt;

&lt;ul&gt;&lt;li&gt;Partial cubemaps (i.e. DDS files without all six faces defined) are not supported by Direct3D 11.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sat, 23 Mar 2013 06:31:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DDSTextureLoader 20130323063134A</guid></item><item><title>Updated Wiki: DDSTextureLoader</title><link>http://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;version=25</link><description>&lt;div class="wikidoc"&gt;A streamlined version of the DirectX SDK sample DDSWithoutD3DX11 texture loading code for a simple light-weight runtime .DDS file loader. This version only supports Direct3D 11 and performs no runtime pixel data conversions (see &lt;i&gt;Release Notes&lt;/i&gt; for more details). This is ideal for runtime usage, and supports the full complement of Direct3D 11 texture resources (1D, 2D, volume maps, cubemaps, mipmap levels, texture arrays, BC formats, etc.). It supports both legacy and &amp;#39;DX10&amp;#39; extension header format .dds files.&lt;br /&gt;&lt;br /&gt;Also part of DirectXTex &lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Functions&lt;/h1&gt;
&lt;b&gt;CreateDDSTextureFromMemory&lt;/b&gt;&lt;br /&gt;Loads a .DDS file assuming the image of the file is located in a memory buffer. Creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFile&lt;/b&gt;&lt;br /&gt;Loads a .DDS file from disk and creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;For both these functions if &amp;#39;maxsize&amp;#39; parameter non-zero, then all mipmap levels larger than the maxsize are ignored before creating the Direct3D 11 resource. This allows for load-time scaling. If &amp;#39;0&amp;#39;, then if the attempt to create the Direct3D 11 resource fails and there are mipmaps present, it will retry assuming a maxsize based on the device&amp;#39;s current feature level.&lt;br /&gt;&lt;br /&gt;The last optional parameter for both functions is a pointer to return the &lt;i&gt;alpha mode&lt;/i&gt; of the DDS file. This can be one of the following values to return information about the alpha channel if present in the file:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DDS_ALPHA_MODE_STRAIGHT (0) - This indicates that the alpha channel if present is assumed to be using &amp;#39;straight&amp;#39; alpha. This is the default for most .DDS files if the specific metadata isn&amp;#39;t present, and it&amp;#39;s up to the application to know if it&amp;#39;s really something else. Viewers should assume the alpha channel is intended for &amp;#39;normal&amp;#39; alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_PREMULTIPLIED (1) - This indicates the alpha channel if present is premultiplied alpha. This information is only present if the file is written using the latest version of the &amp;quot;DX10&amp;quot; extended header, or if the file is BC2/BC3 with the &amp;quot;DXT2&amp;quot;/&amp;quot;DXT4&amp;quot; FourCC which are explicitly stored as premultiplied alpha. Viewers should use the alpha channel with premultiplied alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_TH_CHANNEL (2) - This indicates the alpha channel if present does not contain transparency (neither straight or premultiplied alpha) and instead is encoding some other channel of information. Viewers should not use the alpha channel for blending, and should instead view it as a distinct image channel.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_OPAQUE (3) - This indicates that the alpha channel if present is fully opaque for all pixels. Viewers can assume there is no alpha blending.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromMemoryEx&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFileEx&lt;/b&gt;&lt;br /&gt;These versions provide explicit control over the created resource&amp;#39;s usage, binding flags, CPU access flags, and miscellaneous flags for advanced / expert scenarios. The standard routines default to D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, and 0 respectively. For cubemaps, the miscellaneous flags default to D3D11_RESOURCE_MISC_TEXTURECUBE. There is also a &amp;#39;forceSRGB&amp;#39; option for working around gamma issues with content that is in the sRGB or similar color space but is not encoded explicitly as an SRGB format. Note that the &amp;#39;maxsize&amp;#39; parameter is not at the end of the parameter list like it is in the non-Ex version.&lt;br /&gt;
&lt;h1&gt;Example&lt;/h1&gt;
This example creates a shader resource view on the ID3D11Device d3dDevice which can be used for rendering.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; Microsoft::WRL;

ComPtr&amp;lt;ID3D11ShaderResourceView&amp;gt; srv;
HRESULT hr = CreateDDSTextureFromFile( d3dDevice, L&lt;span style="color:#A31515;"&gt;&amp;quot;SEAFLOOR.DDS&amp;quot;&lt;/span&gt;, &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, &amp;amp;srv )
ThrowIfFailed(hr);
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, you should make sure your DDS textures are mip-mapped so that they contain a suitably sized image. Non-mipmapped textures will either need explicit feature level association, or be sized less than or equal to 2048 for 1D, 2048 x 2048 for 2D, 512 x 512 for cubemaps, and 256 x 256 x 256 for volume maps.&lt;br /&gt;&lt;br /&gt;Texture arrays require Feature Level  10.0 or later. Cubemap arrays requires Feature Level 10.1 or later.&lt;br /&gt;&lt;br /&gt;Be sure to review the various format limitations for the different feature levels. To support all feature levels, stick with textures in the following formats:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8B8A8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_B8G8R8A8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R16G16_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB&lt;/li&gt;&lt;/ul&gt;
On Windows 8 with WDDM 1.2 drivers, all feature levels support 16bpp formats as well DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, and DXGI_FORMAT_B4G4R4A4_UNORM.&lt;br /&gt;
&lt;h1&gt;Release Notes&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;DDSTextureLoader performs no run-time conversions. If there is not a direct mapping to a DXGI supported format, the function fails. You can make use of the DirectXTex library or texconv tool to convert legacy Direct3D9 DDS files to a supported format. Legacy formats which require conversion include:
&lt;ul&gt;&lt;li&gt;D3DFMT_R8G8B8 (24bpp RGB) - Use a 32bpp format &lt;/li&gt;
&lt;li&gt;D3DFMT_X8B8G8R8 (32bpp RGBX) - Use BGRX, BGRA, or RGBA&lt;/li&gt;
&lt;li&gt;D3DFMT_A2R10G10B10 (BGRA 10:10:10:2) - Use RGBA 10:10:10:2&lt;/li&gt;
&lt;li&gt;D3DFMT_X1R5G5B5 (BGR 5:5:5) - Use BGRA 5:5:5:1 or BGR 5:6:5&lt;/li&gt;
&lt;li&gt;D3DFMT_A8R3G3B2, D3DFMT_R3G3B2 (BGR 3:3:2) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_P8, D3DFMT_A8P8 (8-bit palette) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_A4L4 (Luminance 4:4) - Expand to a supported format&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;On a system with the DirectX 11.0 Runtime or lacking WDDM 1.2 drivers, attempts to load 16bpp format files (BGR 5:6:5, BGRA 5:5:5:1, and BGRA 4:4:4:4) will fail.&lt;/li&gt;&lt;/ul&gt;

&lt;ul&gt;&lt;li&gt;Partial cubemaps (i.e. DDS files without all six faces defined) are not supported by Direct3D 11.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sat, 23 Mar 2013 06:26:26 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DDSTextureLoader 20130323062626A</guid></item><item><title>Updated Wiki: DDSTextureLoader</title><link>http://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;version=24</link><description>&lt;div class="wikidoc"&gt;A streamlined version of the DirectX SDK sample DDSWithoutD3DX11 texture loading code for a simple light-weight runtime .DDS file loader. This version only supports Direct3D 11 and performs no runtime pixel data conversions (see &lt;i&gt;Release Notes&lt;/i&gt; for more details). This is ideal for runtime usage, and supports the full complement of Direct3D 11 texture resources (1D, 2D, volume maps, cubemaps, mipmap levels, texture arrays, BC formats, etc.). It supports both legacy and &amp;#39;DX10&amp;#39; extension header format .dds files.&lt;br /&gt;&lt;br /&gt;Also part of DirectXTex &lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Functions&lt;/h1&gt;
&lt;b&gt;CreateDDSTextureFromMemory&lt;/b&gt;&lt;br /&gt;Loads a .DDS file assuming the image of the file is located in a memory buffer. Creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFile&lt;/b&gt;&lt;br /&gt;Loads a .DDS file from disk and creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;For both these functions if &amp;#39;maxsize&amp;#39; parameter non-zero, then all mipmap levels larger than the maxsize are ignored before creating the Direct3D 11 resource. This allows for load-time scaling. If &amp;#39;0&amp;#39;, then if the attempt to create the Direct3D 11 resource fails and there are mipmaps present, it will retry assuming a maxsize based on the device&amp;#39;s current feature level.&lt;br /&gt;&lt;br /&gt;The last optional parameter for both functions is a pointer to return the &lt;i&gt;alpha mode&lt;/i&gt; of the DDS file. This can be one of the following values to return information about the alpha channel if present in the file:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DDS_ALPHA_MODE_STRAIGHT (0) - This indicates that the alpha channel if present is assumed to be using &amp;#39;straight&amp;#39; alpha. This is the default for most .DDS files if the specific metadata isn&amp;#39;t present, and it&amp;#39;s up to the application to know if it&amp;#39;s really something else. Viewers should assume the alpha channel is intended for &amp;#39;normal&amp;#39; alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_PREMULTIPLIED (1) - This indicates the alpha channel if present is premultiplied alpha. This information is only present if the file is written using the latest version of the &amp;quot;DX10&amp;quot; extended header, or if the file is BC2/BC3 with the &amp;quot;DXT2&amp;quot;/&amp;quot;DXT4&amp;quot; FourCC which are explicitly stored as premultiplied alpha. Viewers should use the alpha channel with premultiplied alpha blending.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_TH_CHANNEL (2) - This indicates the alpha channel if present does not contain transparency (neither straight or premultiplied alpha) and instead is encoding some other channel of information. Viewer should not use the alpha channel for blending, and should instead view it as a distinct image channel.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_OPAQUE (3) - This indicates that the alpha channel if present is fully opaque for all pixels. Viewers can assume there is no alpha blending.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromMemoryEx&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFileEx&lt;/b&gt;&lt;br /&gt;These versions provide explicit control over the created resource&amp;#39;s usage, binding flags, CPU access flags, and miscellaneous flags for advanced / expert scenarios. The standard routines default to D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, and 0 respectively. For cubemaps, the miscellaneous flags default to D3D11_RESOURCE_MISC_TEXTURECUBE. There is also a &amp;#39;forceSRGB&amp;#39; option for working around gamma issues with content that is in the sRGB or similar color space but is not encoded explicitly as an SRGB format. Note that the &amp;#39;maxsize&amp;#39; parameter is not at the end of the parameter list like it is in the non-Ex version.&lt;br /&gt;
&lt;h1&gt;Example&lt;/h1&gt;
This example creates a shader resource view on the ID3D11Device d3dDevice which can be used for rendering.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; Microsoft::WRL;

ComPtr&amp;lt;ID3D11ShaderResourceView&amp;gt; srv;
HRESULT hr = CreateDDSTextureFromFile( d3dDevice, L&lt;span style="color:#A31515;"&gt;&amp;quot;SEAFLOOR.DDS&amp;quot;&lt;/span&gt;, &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, &amp;amp;srv )
ThrowIfFailed(hr);
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, you should make sure your DDS textures are mip-mapped so that they contain a suitably sized image. Non-mipmapped textures will either need explicit feature level association, or be sized less than or equal to 2048 for 1D, 2048 x 2048 for 2D, 512 x 512 for cubemaps, and 256 x 256 x 256 for volume maps.&lt;br /&gt;&lt;br /&gt;Texture arrays require Feature Level  10.0 or later. Cubemap arrays requires Feature Level 10.1 or later.&lt;br /&gt;&lt;br /&gt;Be sure to review the various format limitations for the different feature levels. To support all feature levels, stick with textures in the following formats:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8B8A8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_B8G8R8A8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R16G16_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB&lt;/li&gt;&lt;/ul&gt;
On Windows 8 with WDDM 1.2 drivers, all feature levels support 16bpp formats as well DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, and DXGI_FORMAT_B4G4R4A4_UNORM.&lt;br /&gt;
&lt;h1&gt;Release Notes&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;DDSTextureLoader performs no run-time conversions. If there is not a direct mapping to a DXGI supported format, the function fails. You can make use of the DirectXTex library or texconv tool to convert legacy Direct3D9 DDS files to a supported format. Legacy formats which require conversion include:
&lt;ul&gt;&lt;li&gt;D3DFMT_R8G8B8 (24bpp RGB) - Use a 32bpp format &lt;/li&gt;
&lt;li&gt;D3DFMT_X8B8G8R8 (32bpp RGBX) - Use BGRX, BGRA, or RGBA&lt;/li&gt;
&lt;li&gt;D3DFMT_A2R10G10B10 (BGRA 10:10:10:2) - Use RGBA 10:10:10:2&lt;/li&gt;
&lt;li&gt;D3DFMT_X1R5G5B5 (BGR 5:5:5) - Use BGRA 5:5:5:1 or BGR 5:6:5&lt;/li&gt;
&lt;li&gt;D3DFMT_A8R3G3B2, D3DFMT_R3G3B2 (BGR 3:3:2) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_P8, D3DFMT_A8P8 (8-bit palette) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_A4L4 (Luminance 4:4) - Expand to a supported format&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;On a system with the DirectX 11.0 Runtime or lacking WDDM 1.2 drivers, attempts to load 16bpp format files (BGR 5:6:5, BGRA 5:5:5:1, and BGRA 4:4:4:4) will fail.&lt;/li&gt;&lt;/ul&gt;

&lt;ul&gt;&lt;li&gt;Partial cubemaps (i.e. DDS files without all six faces defined) are not supported by Direct3D 11.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sat, 23 Mar 2013 06:25:45 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DDSTextureLoader 20130323062545A</guid></item><item><title>Updated Wiki: DDSTextureLoader</title><link>http://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;version=23</link><description>&lt;div class="wikidoc"&gt;A streamlined version of the DirectX SDK sample DDSWithoutD3DX11 texture loading code for a simple light-weight runtime .DDS file loader. This version only supports Direct3D 11 and performs no runtime pixel data conversions (see &lt;i&gt;Release Notes&lt;/i&gt; for more details). This is ideal for runtime usage, and supports the full complement of Direct3D 11 texture resources (1D, 2D, volume maps, cubemaps, mipmap levels, texture arrays, BC formats, etc.). It supports both legacy and &amp;#39;DX10&amp;#39; extension header format .dds files.&lt;br /&gt;&lt;br /&gt;Also part of DirectXTex &lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Functions&lt;/h1&gt;
&lt;b&gt;CreateDDSTextureFromMemory&lt;/b&gt;&lt;br /&gt;Loads a .DDS file assuming the image of the file is located in a memory buffer. Creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFile&lt;/b&gt;&lt;br /&gt;Loads a .DDS file from disk and creates a Direct3D 11 resource and optionally a Direct3D 11 shader resource view.&lt;br /&gt;&lt;br /&gt;For both these functions if &amp;#39;maxsize&amp;#39; parameter non-zero, then all mipmap levels larger than the maxsize are ignored before creating the Direct3D 11 resource. This allows for load-time scaling. If &amp;#39;0&amp;#39;, then if the attempt to create the Direct3D 11 resource fails and there are mipmaps present, it will retry assuming a maxsize based on the device&amp;#39;s current feature level.&lt;br /&gt;&lt;br /&gt;The last optional parameter for both functions is a pointer to return the &lt;i&gt;alpha mode&lt;/i&gt; of the DDS file. This can be one of the following values to return information about the alpha channel if present in the file:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DDS_ALPHA_MODE_STRAIGHT (0) - This indicates that the alpha channel if present is assumed to be using &amp;#39;straight&amp;#39; alpha. This is the default for most .DDS files if the specific metadata isn&amp;#39;t present, and it&amp;#39;s largely up to the application to know if it&amp;#39;s really something else.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_PREMULTIPLIED}&amp;quot; (1) - This indicates the alpha channel if present is premultiplied alpha. This information is only present if the file is written using the latest version of the &amp;quot;DX10&amp;quot; extended header, or if the file is BC2/BC3 with the &amp;quot;DXT2&amp;quot;/&amp;quot;DXT4&amp;quot; FourCC which are explicitly stored as premultiplied alpha.&lt;br /&gt;* {&amp;quot;DDS_ALPHA_MODE_TH_CHANNEL (2) - This indicates the alpha channel if present does not contain transparency neither straight or premultiplied alpha and instead is encoding some other channel of information.&lt;/li&gt;
&lt;li&gt;DDS_ALPHA_MODE_OPAQUE (3) - This indicates that the alpha channel if present is fully opaque for all pixels.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromMemoryEx&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CreateDDSTextureFromFileEx&lt;/b&gt;&lt;br /&gt;These versions provide explicit control over the created resource&amp;#39;s usage, binding flags, CPU access flags, and miscellaneous flags for advanced / expert scenarios. The standard routines default to D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, and 0 respectively. For cubemaps, the miscellaneous flags default to D3D11_RESOURCE_MISC_TEXTURECUBE. There is also a &amp;#39;forceSRGB&amp;#39; option for working around gamma issues with content that is in the sRGB or similar color space but is not encoded explicitly as an SRGB format. Note that the &amp;#39;maxsize&amp;#39; parameter is not at the end of the parameter list like it is in the non-Ex version.&lt;br /&gt;
&lt;h1&gt;Example&lt;/h1&gt;
This example creates a shader resource view on the ID3D11Device d3dDevice which can be used for rendering.&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX;
&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; Microsoft::WRL;

ComPtr&amp;lt;ID3D11ShaderResourceView&amp;gt; srv;
HRESULT hr = CreateDDSTextureFromFile( d3dDevice, L&lt;span style="color:#A31515;"&gt;&amp;quot;SEAFLOOR.DDS&amp;quot;&lt;/span&gt;, &lt;span style="color:Blue;"&gt;nullptr&lt;/span&gt;, &amp;amp;srv )
ThrowIfFailed(hr);
&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;Feature Level Notes&lt;/h1&gt;In order to support all feature levels, you should make sure your DDS textures are mip-mapped so that they contain a suitably sized image. Non-mipmapped textures will either need explicit feature level association, or be sized less than or equal to 2048 for 1D, 2048 x 2048 for 2D, 512 x 512 for cubemaps, and 256 x 256 x 256 for volume maps.&lt;br /&gt;&lt;br /&gt;Texture arrays require Feature Level  10.0 or later. Cubemap arrays requires Feature Level 10.1 or later.&lt;br /&gt;&lt;br /&gt;Be sure to review the various format limitations for the different feature levels. To support all feature levels, stick with textures in the following formats:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8B8A8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_B8G8R8A8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R16G16_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8G8_SNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_R8_UNORM&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB&lt;/li&gt;
&lt;li&gt;DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB&lt;/li&gt;&lt;/ul&gt;
On Windows 8 with WDDM 1.2 drivers, all feature levels support 16bpp formats as well DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, and DXGI_FORMAT_B4G4R4A4_UNORM.&lt;br /&gt;
&lt;h1&gt;Release Notes&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;DDSTextureLoader performs no run-time conversions. If there is not a direct mapping to a DXGI supported format, the function fails. You can make use of the DirectXTex library or texconv tool to convert legacy Direct3D9 DDS files to a supported format. Legacy formats which require conversion include:
&lt;ul&gt;&lt;li&gt;D3DFMT_R8G8B8 (24bpp RGB) - Use a 32bpp format &lt;/li&gt;
&lt;li&gt;D3DFMT_X8B8G8R8 (32bpp RGBX) - Use BGRX, BGRA, or RGBA&lt;/li&gt;
&lt;li&gt;D3DFMT_A2R10G10B10 (BGRA 10:10:10:2) - Use RGBA 10:10:10:2&lt;/li&gt;
&lt;li&gt;D3DFMT_X1R5G5B5 (BGR 5:5:5) - Use BGRA 5:5:5:1 or BGR 5:6:5&lt;/li&gt;
&lt;li&gt;D3DFMT_A8R3G3B2, D3DFMT_R3G3B2 (BGR 3:3:2) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_P8, D3DFMT_A8P8 (8-bit palette) - Expand to a supported format&lt;/li&gt;
&lt;li&gt;D3DFMT_A4L4 (Luminance 4:4) - Expand to a supported format&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;On a system with the DirectX 11.0 Runtime or lacking WDDM 1.2 drivers, attempts to load 16bpp format files (BGR 5:6:5, BGRA 5:5:5:1, and BGRA 4:4:4:4) will fail.&lt;/li&gt;&lt;/ul&gt;

&lt;ul&gt;&lt;li&gt;Partial cubemaps (i.e. DDS files without all six faces defined) are not supported by Direct3D 11.&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Further Reading&lt;/h1&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2010/02/05/the-dds-file-format-lives.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/06/20/direct3d-feature-levels.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/bb219822.aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Sat, 23 Mar 2013 06:21:51 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DDSTextureLoader 20130323062151A</guid></item><item><title>Updated Wiki: Game Gallery</title><link>http://directxtk.codeplex.com/wikipage?title=Game Gallery&amp;version=1</link><description>&lt;div class="wikidoc"&gt;This is a list of known released games that make use of DirectX Tool Kit.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Galactic Reign&lt;/i&gt;&lt;br /&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=281841"&gt;http://go.microsoft.com/fwlink/?LinkId=281841&lt;/a&gt;&lt;br /&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=281840"&gt;http://go.microsoft.com/fwlink/?LinkId=281840&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Thu, 14 Mar 2013 18:59:31 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Game Gallery 20130314065931P</guid></item><item><title>Updated Wiki: Documentation</title><link>http://directxtk.codeplex.com/documentation?version=3</link><description>&lt;div class="wikidoc"&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=DirectXTK&amp;referringTitle=Documentation"&gt;DirectXTK&lt;/a&gt; library&lt;br /&gt;&lt;br /&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=Version%20History&amp;referringTitle=Documentation"&gt;Version History&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=Samples&amp;referringTitle=Documentation"&gt;Samples&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=Game%20Gallery&amp;referringTitle=Documentation"&gt;Game Gallery&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=Resources&amp;referringTitle=Documentation"&gt;Resources&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Thu, 14 Mar 2013 18:58:09 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20130314065809P</guid></item><item><title>Updated Wiki: Version History</title><link>http://directxtk.codeplex.com/wikipage?title=Version History&amp;version=12</link><description>&lt;div class="wikidoc"&gt;&lt;b&gt;February 22, 2013&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Added SimpleMath header&lt;/li&gt;
&lt;li&gt;Fixed bug that prevented properly overriding EffectFactory::CreateTexture&lt;/li&gt;
&lt;li&gt;Fixed forceSRGB logic in DDSTextureLoader and WICTextureLoader&lt;/li&gt;
&lt;li&gt;Break circular reference chains when using SpriteBatch with a setCustomShaders lambda&lt;/li&gt;
&lt;li&gt;Updated projects with /fp:fast for all configs, /arch:SSE2 for Win32 configs&lt;/li&gt;
&lt;li&gt;Sensibly named .pdb output files&lt;/li&gt;
&lt;li&gt;Added WIC_USE_FACTORY_PROXY build option (uses WindowsCodecs.dll entrypoint rather than CoCreateInstance)&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;January 25, 2013&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;GeometricPrimitive support for left-handed coordinates and drawing with custom effects &lt;/li&gt;
&lt;li&gt;Model, ModelMesh, and ModelMeshPart added with loading of rigid non-animating models from .CMO and .SDKMESH files&lt;/li&gt;
&lt;li&gt;EffectFactory helper class added&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;December 11, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Ex versions of DDSTextureLoader and WICTextureLoader&lt;/li&gt;
&lt;li&gt;Removed use of ATL&amp;#39;s CComPtr in favor of WRL&amp;#39;s ComPtr for all platforms to support VS Express editions&lt;/li&gt;
&lt;li&gt;Updated VS 2010 project for official &amp;#39;property sheet&amp;#39; integration for Windows 8.0 SDK&lt;/li&gt;
&lt;li&gt;Minor fix to CommonStates for Feature Level 9.1&lt;/li&gt;
&lt;li&gt;Tweaked AlphaTestEffect.cpp to work around ARM NEON compiler codegen bug&lt;/li&gt;
&lt;li&gt;Added dxguid.lib as a default library for Debug builds to resolve GUID link issues&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;November 15, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Added support for WIC2 when available on Windows 8 and Windows 7 with KB 2670838&lt;/li&gt;
&lt;li&gt;Cleaned up warning level 4 warnings&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;October 30, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Added project files for Windows Phone 8&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;October 12, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Added PrimitiveBatch for drawing user primitives&lt;/li&gt;
&lt;li&gt;Debug object names for all D3D resources (for PIX and debug layer leak reporting)&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;October 2, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Added ScreenGrab module&lt;/li&gt;
&lt;li&gt;Added CreateGeoSphere for drawing a geodesic sphere&lt;/li&gt;
&lt;li&gt;Put DDSTextureLoader and WICTextureLoader into the DirectX C++ namespace&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;September 7, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Renamed project files for better naming consistency&lt;/li&gt;
&lt;li&gt;Updated WICTextureLoader for Windows 8 96bpp floating-point formats&lt;/li&gt;
&lt;li&gt;Win32 desktop projects updated to use Windows Vista (0x0600) rather than Windows 7 (0x0601) APIs&lt;/li&gt;
&lt;li&gt;Tweaked SpriteBatch.cpp to workaround ARM NEON compiler codegen bug&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;May 31, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Updated Metro project for Visual Studio 2012 Release Candidate changes&lt;/li&gt;
&lt;li&gt;Cleaned up x64 Debug configuration warnings and switched to use &amp;quot;_DEBUG&amp;quot; instead of &amp;quot;DEBUG&amp;quot;&lt;/li&gt;
&lt;li&gt;Minor fix for DDSTextureLoader&amp;#39;s retry fallback that can happen with 10level9 feature levels&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;May 2, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Added SpriteFont implementation and the MakeSpriteFont utility&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;March 29, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;WICTextureLoader updated with Windows 8 WIC native pixel formats&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;March 6, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Fix for too much temp memory used by WICTextureLoader&lt;/li&gt;
&lt;li&gt;Add separate Visual Studio 11 projects for Desktop vs. Metro builds&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;March 5, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Bug fix for SpriteBatch with batches &amp;gt; 2048&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;February 24, 2012&lt;/b&gt;
&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>walbourn</author><pubDate>Fri, 22 Feb 2013 22:44:47 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Version History 20130222104447P</guid></item><item><title>Updated Wiki: SimpleMath</title><link>http://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;version=2</link><description>&lt;div class="wikidoc"&gt;SimpleMath.h wraps the DirectXMath SIMD vector/matrix math API with an easier to use C++ interface. It provides the following types, with similar names, methods, and operator overloads to the XNA Game Studio math API:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Vector2&lt;/li&gt;
&lt;li&gt;Vector3&lt;/li&gt;
&lt;li&gt;Vector4&lt;/li&gt;
&lt;li&gt;Matrix&lt;/li&gt;
&lt;li&gt;Quaternion&lt;/li&gt;
&lt;li&gt;Plane&lt;/li&gt;
&lt;li&gt;Ray&lt;/li&gt;
&lt;li&gt;Color&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;To use:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
    #include &lt;span style="color:#A31515;"&gt;&amp;quot;SimpleMath.h&amp;quot;&lt;/span&gt;

    &lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX::SimpleMath;
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Why wrap DirectXMath?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;DirectXMath provides highly optimized vector and matrix math functions, which take advantage of SSE SIMD intrinsics when compiled for x86/x64, or the ARM NEON instruction set when compiled for an ARM platform such as Windows RT or Windows Phone. The downside of being designed for efficient SIMD usage is that DirectXMath can be somewhat complicated to work with. Developers must be aware of correct type usage (understanding the difference between SIMD register types such as XMVECTOR vs. memory storage types such as XMFLOAT4), must take care to maintain correct alignment for SIMD heap allocations, and must carefully structure their code to avoid accessing individual components from a SIMD register. This complexity is necessary for optimal SIMD performance, but sometimes you just want to get stuff working without so much hassle!&lt;br /&gt;&lt;br /&gt;Enter SimpleMath...&lt;br /&gt;&lt;br /&gt;These types derive from the equivalent DirectXMath memory storage types (for instance Vector3 is derived from XMFLOAT3), so they can be stored in arbitrary locations without worrying about SIMD alignment, and individual components can be accessed without bothering to call SIMD accessor functions. But unlike XMFLOAT3, the Vector3 type defines a rich set of methods and overloaded operators, so it can be directly manipulated without having to first load its value into an XMVECTOR. Vector3 also defines an operator for automatic conversion to XMVECTOR, so it can be passed directly to methods that were written to use the lower level DirectXMath types.&lt;br /&gt;&lt;br /&gt;If that sounds horribly confusing, the short version is that the SimpleMath types pretty much &amp;quot;Just Work&amp;quot; the way you would expect them to.&lt;br /&gt;&lt;br /&gt;By now you must be wondering, where is the catch? And of course there is one. SimpleMath hides the complexities of SIMD programming by automatically converting back and forth between memory and SIMD register types, which tends to generate additional load and store instructions. This can add significant overhead compared to the lower level DirectXMath approach, where SIMD loads and stores are under explicit control of the programmer.&lt;br /&gt;&lt;br /&gt;You should use SimpleMath if you are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Looking for a C++ math library with similar API to the C# XNA types&lt;/li&gt;
&lt;li&gt;Porting existing XNA code from C# to C++&lt;/li&gt;
&lt;li&gt;Wanting to optimize for programmer efficiency (simplicity, readability, development speed) at the expense of runtime efficiency&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should go straight to the underlying DirectXMath API if you:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Want to create the fastest possible code&lt;/li&gt;
&lt;li&gt;Enjoy the lateral thinking needed to express algorithms in raw SIMD&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;This need not be a global either/or decision. The SimpleMath types know how to convert themselves to and from the corresponding DirectXMath types, so it is easy to mix and match. You can use SimpleMath for the parts of your program where readability and development time matter most, then drop down to DirectXMath for performance hotspots where runtime efficiency is more important.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ShawnHargreaves</author><pubDate>Fri, 22 Feb 2013 22:10:06 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SimpleMath 20130222101006P</guid></item><item><title>Updated Wiki: SimpleMath</title><link>http://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;version=1</link><description>&lt;div class="wikidoc"&gt;SimpleMath.h wraps the DirectXMath SIMD vector/matrix math API with an easier to use C++ interface. It provides the following types, with similar names, methods, and operator overloads to the XNA Game Studio math API:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Vector2&lt;/li&gt;
&lt;li&gt;Vector3&lt;/li&gt;
&lt;li&gt;Vector4&lt;/li&gt;
&lt;li&gt;Matrix&lt;/li&gt;
&lt;li&gt;Quaternion&lt;/li&gt;
&lt;li&gt;Plane&lt;/li&gt;
&lt;li&gt;Ray&lt;/li&gt;
&lt;li&gt;Color&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;To use:&lt;br /&gt;&lt;br /&gt;&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
    #include &lt;span style="color:#A31515;"&gt;&amp;quot;SimpleMath.h&amp;quot;&lt;/span&gt;

    &lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; DirectX::SimpleMath;
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Why wrap DirectXMath?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;DirectXMath provides highly optimized vector and matrix math functions, which take advantage of SSE SIMD intrinsics when compiled for x86/x64, or the ARM NEON instruction set when compiled for an ARM platform such as Windows RT or Windows Phone. The downside of being designed for efficient SIMD usage is that DirectXMath can be somewhat complicated to work with. Developers must be aware of correct type usage (understanding the difference between SIMD register types such as XMVECTOR vs. memory storage types such as XMFLOAT4), must take care to maintain correct alignment for SIMD heap allocations, and must carefully structure their code to avoid accessing individual components from a SIMD register. This complexity is necessary for optimal SIMD performance, but sometimes you just want to get stuff working without so much hassle!&lt;br /&gt;&lt;br /&gt;Enter SimpleMath...&lt;br /&gt;&lt;br /&gt;These types derive from the equivalent DirectXMath memory storage types (for instance Vector3 is derived from XMFLOAT3), so they can be stored in arbitrary locations without worrying about SIMD alignment, and individual components can be accessed without bothering to call SIMD accessor functions. But unlike XMFLOAT3, the Vector3 type defines a rich set of methods and overloaded operators, so it can be directly manipulated without having to first load its value into an XMVECTOR. Vector3 also defines an operator for automatic conversion to XMVECTOR, so it can be passed directly to methods that were written to use the lower level DirectXMath types.&lt;br /&gt;&lt;br /&gt;If that sounds horribly confusing, the short version is that the SimpleMath types pretty much &amp;quot;Just Work&amp;quot; the way you would expect them to.&lt;br /&gt;&lt;br /&gt;By now you must be wondering, where is the catch? And of course there is one. SimpleMath hides the complexities of SIMD programming by automatically converting back and forth between memory and SIMD register types, which tends to generate additional load and store instructions. This can add significant overhead compared to the lower level DirectXMath approach, where SIMD loads and stores are under explicit control of the programmer.&lt;br /&gt;&lt;br /&gt;You should use SimpleMath if you are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Looking for a C++ math library with similar API to the C# XNA types&lt;/li&gt;
&lt;li&gt;Porting existing XNA code from C# to C++&lt;/li&gt;
&lt;li&gt;Wanting to optimize for programmer efficiency (simplicity, readability, development speed) at the expense of runtime efficiency&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;You should go straight to the underlying DirectXMath API if you:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Want to create the fastest possible code&lt;/li&gt;
&lt;li&gt;Enjoy the lateral thinking needed to express algorithms in raw SIMD&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;This need not be a global either/or decision. The SimpleMath types know how to convert themselves to and from the corresponding DirectXMath types, so it is easy to mix and match. You can use SimpleMath for the parts of your program where readability and development time matter most, then drop down to DirectXMath for performance hotspots where runtime efficiency is more important.&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ShawnHargreaves</author><pubDate>Fri, 22 Feb 2013 22:09:36 GMT</pubDate><guid isPermaLink="false">Updated Wiki: SimpleMath 20130222100936P</guid></item><item><title>Updated Wiki: DirectXTK</title><link>http://directxtk.codeplex.com/wikipage?title=DirectXTK&amp;version=26</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Headers&lt;/h1&gt;Public headers are in the &lt;b&gt;Inc&lt;/b&gt; folder of the distribution package.&lt;br /&gt;
&lt;h1&gt;Namespace&lt;/h1&gt;All the functions in the library are in the &lt;b&gt;DirectX&lt;/b&gt; C++ namespace.&lt;br /&gt;
&lt;h1&gt;Modules&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=SpriteBatch&amp;referringTitle=DirectXTK"&gt;SpriteBatch&lt;/a&gt; - simple &amp;amp; efficient 2D sprite rendering&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=SpriteFont&amp;referringTitle=DirectXTK"&gt;SpriteFont&lt;/a&gt; - bitmap based text rendering&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=Effects&amp;referringTitle=DirectXTK"&gt;Effects&lt;/a&gt; - set of built-in shaders for common rendering tasks&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=PrimitiveBatch&amp;referringTitle=DirectXTK"&gt;PrimitiveBatch&lt;/a&gt; - simple and efficient way to draw user primitives&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=GeometricPrimitive&amp;referringTitle=DirectXTK"&gt;GeometricPrimitive&lt;/a&gt; - draws basic shapes such as cubes and spheres&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=Model&amp;referringTitle=DirectXTK"&gt;Model&lt;/a&gt; - draws simple meshes loaded from .CMO or .SDKMESH files&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=CommonStates&amp;referringTitle=DirectXTK"&gt;CommonStates&lt;/a&gt; - factory providing commonly used D3D state objects&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=VertexTypes&amp;referringTitle=DirectXTK"&gt;VertexTypes&lt;/a&gt; - structures for commonly used vertex data formats&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=DDSTextureLoader&amp;referringTitle=DirectXTK"&gt;DDSTextureLoader&lt;/a&gt; - light-weight DDS file texture loader&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=WICTextureLoader&amp;referringTitle=DirectXTK"&gt;WICTextureLoader&lt;/a&gt; - WIC-based image file texture loader&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=ScreenGrab&amp;referringTitle=DirectXTK"&gt;ScreenGrab&lt;/a&gt; - light-weight screen shot saver&lt;/li&gt;
&lt;li&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=SimpleMath&amp;referringTitle=DirectXTK"&gt;SimpleMath&lt;/a&gt; - simplified C++ wrapper for DirectXMath&lt;/li&gt;&lt;/ul&gt;

&lt;h1&gt;Tools&lt;/h1&gt;&lt;a href="http://directxtk.codeplex.com/wikipage?title=MakeSpriteFont&amp;referringTitle=DirectXTK"&gt;MakeSpriteFont&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Building&lt;/h1&gt;This code is designed to build with either Visual Studio 2012 or Visual Studio 2010. It requires the Windows 8.0 SDK for functionality such as the DirectXMath library and optionally the DXGI 1.2 headers. Visual Studio 2012 already includes this Windows SDK, but Visual Studio 2010 users must install the standalone Windows 8.0 SDK. Details on using the Windows 8.0 SDK with VS 2010 are described on the Visual C++ Team Blog &lt;a href="http://blogs.msdn.com/b/vcblog/archive/2012/11/23/using-the-windows-8-sdk-with-visual-studio-2010-configuring-multiple-projects.aspx"&gt;http://blogs.msdn.com/b/vcblog/archive/2012/11/23/using-the-windows-8-sdk-with-visual-studio-2010-configuring-multiple-projects.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These components are designed to work without requiring any content from the DirectX SDK. For details, see &amp;quot;Where is the DirectX SDK&amp;quot;? &lt;a href="http://msdn.microsoft.com/en-us/library/ee663275.aspx"&gt;http://msdn.microsoft.com/en-us/library/ee663275.aspx&lt;/a&gt;&lt;br /&gt;
&lt;h1&gt;Adding to a VS Project&lt;/h1&gt;In your application&amp;#39;s solution, right-click on the Solution and use &amp;quot;Add \ Existing Project...&amp;quot; to add the appropriate .vcxproj file to your solution.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;i&gt;DirectXTK_Windows8&lt;/i&gt; is for Windows Store apps building with VS 2012&lt;/li&gt;
&lt;li&gt;&lt;i&gt;DirectXTK_WindowsPhone8&lt;/i&gt; is for Windows phone 8 apps building with VS 2012 and the Windows Phone 8.0 SDK&lt;/li&gt;
&lt;li&gt;&lt;i&gt;DirectXTK_Desktop_2012&lt;/i&gt; is for Win32 desktop applications building with VS 2012 Express for Desktop, VS 2012 Professional or higher&lt;/li&gt;
&lt;li&gt;&lt;i&gt;DirectXTK_Desktop_2010&lt;/i&gt; is for Win32 desktop applications building with VS 2010 using the Windows 8.0 SDK&lt;/li&gt;&lt;/ul&gt;
In your application&amp;#39;s project, right-click on the Project and use &amp;quot;References...&amp;quot;, then &amp;quot;Add New Reference...&amp;quot;, and then check the DirectXTK project name and click OK. For a &lt;b&gt;Windows Store app&lt;/b&gt;, you need to set &lt;i&gt;Reference Assembly Output&lt;/i&gt; to &lt;i&gt;false&lt;/i&gt; since DirectXTK is a static C++ library and not a WinRT component.&lt;br /&gt;&lt;br /&gt;In your application&amp;#39;s project settings, on the &amp;quot;C++ / General&amp;quot; page set Configuration to &amp;quot;All Configurations&amp;quot;, set Platform to &amp;quot;All Plaforms&amp;quot;, and then add the relative path to &lt;b&gt;DirectXTK\inc;&lt;/b&gt; to the &lt;i&gt;Additional Include Directories&lt;/i&gt; properties. Click Apply.&lt;br /&gt;
&lt;h1&gt;Error Handling&lt;/h1&gt;DirectXTK makes use of C++ exception handling which should be enabled by the application via the /EHsc compiler switch. In Visual Studio, this is set in the project settings under &amp;quot;C++ / Code Generation&amp;quot; with &lt;i&gt;Enable C++ Exceptions&lt;/i&gt; set to &amp;quot;Yes (/EHsc)&amp;quot; for all configurations.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/4t3saedz.aspx"&gt;http://msdn.microsoft.com/en-us/library/4t3saedz.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/d14azbfh.aspx"&gt;http://msdn.microsoft.com/en-us/library/d14azbfh.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/chuckw/archive/2012/09/17/dual-use-coding-techniques-for-games.aspx"&gt;http://blogs.msdn.com/b/chuckw/archive/2012/09/17/dual-use-coding-techniques-for-games.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization"&gt;http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization&lt;/a&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ShawnHargreaves</author><pubDate>Fri, 22 Feb 2013 22:04:48 GMT</pubDate><guid isPermaLink="false">Updated Wiki: DirectXTK 20130222100448P</guid></item><item><title>Updated Wiki: Home</title><link>http://directxtk.codeplex.com/wikipage?version=16</link><description>&lt;div class="wikidoc"&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=248929"&gt;http://go.microsoft.com/fwlink/?LinkId=248929&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Project Description&lt;/b&gt;&lt;br /&gt;The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing Direct3D 11 code in C++.&lt;br /&gt;&lt;br /&gt;Supported platforms:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Windows Store apps&lt;/li&gt;
&lt;li&gt;Windows 8 Win32 desktop&lt;/li&gt;
&lt;li&gt;Windows Phone 8&lt;/li&gt;
&lt;li&gt;Windows 7&lt;/li&gt;
&lt;li&gt;Windows Vista Service Pack 2 with KB 971644&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;Features:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;SpriteBatch - simple &amp;amp; efficient 2D sprite rendering&lt;/li&gt;
&lt;li&gt;SpriteFont - bitmap based text rendering&lt;/li&gt;
&lt;li&gt;Effects - set of built-in shaders for common rendering tasks&lt;/li&gt;
&lt;li&gt;PrimitiveBatch - simple and efficient way to draw user primitives&lt;/li&gt;
&lt;li&gt;GeometricPrimitive - draws basic shapes such as cubes and spheres&lt;/li&gt;
&lt;li&gt;Model - draws simple meshes loaded from .CMO or .SDKMESH files&lt;/li&gt;
&lt;li&gt;CommonStates - factory providing commonly used D3D state objects&lt;/li&gt;
&lt;li&gt;VertexTypes - structures for commonly used vertex data formats&lt;/li&gt;
&lt;li&gt;DDSTextureLoader - light-weight DDS file texture loader&lt;/li&gt;
&lt;li&gt;WICTextureLoader - WIC-based image file texture loader&lt;/li&gt;
&lt;li&gt;ScreenGrab - light-weight screen shot saver&lt;/li&gt;
&lt;li&gt;SimpleMath - simplified C++ wrapper for DirectXMath&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;b&gt;Related&lt;/b&gt;&lt;br /&gt;The DirectXTex project &lt;a href="http://go.microsoft.com/fwlink/?LinkId=248926"&gt;http://go.microsoft.com/fwlink/?LinkId=248926&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Contributions&lt;/b&gt;&lt;br /&gt;The DirectXTK contributors list will remain closed to ensure high-quality and focused feature set, but we are very interested in any bug-fixes, optimizations, additional features, or other community feedback on this library. Please use the &lt;i&gt;Issue Tracker&lt;/i&gt; and feel free to attach code to the issue as needed. Note that any code contributed or released for the DirectXTK project is subject to the MS-PL.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ShawnHargreaves</author><pubDate>Fri, 22 Feb 2013 22:04:16 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20130222100416P</guid></item></channel></rss>