Graphics Reference
In-Depth Information
Using the sample rendering framework
To work with complex scenes more easily, we are going to explore a set of classes that will
serve as our simple rendering framework throughout the topic. This framework will take care
of initializing our Direct3D device, swap chain and render targets, and provide appropriate
methods and events for implementing the Direct3D resource lifecycle management in our
example applications.
The three key elements of this framework include the following:
F Device manager: This is a class that manages the lifecycle of our Direct3D device
and device context.
F Direct3D application: This is a set of classes that manage our swap chain and
render targets, along with other common-size dependent resources, such as the
depth/stencil buffer and viewport setup. We descend from one of these to create
our Direct3D application/render loop.
F Renderer: This is a small class that we use to implement a renderer for a single
element/area of a scene. We create instances of these within our Direct3D
application class.
The framework is based on elements of the SharpDX Windows 8
sample code and the C++ DirectX Windows Store app template.
Changes have been made to simplify the code and to make it
suitable for desktop applications.
Getting ready
The sample rendering framework can be found with the downloadable companion content
for this topic. After downloading this content, we can prepare a project for use with the
framework as follows:
1.
From the downloadable companion content for this topic, retrieve the Common.
csproj C# class library project and source files.
2.
Copy and add Common.csproj to our solution (for example, D3DRendering.sln ).
3.
Add a new Windows Form Application project to the solution in order to create your
Direct3D application.
For Windows Store apps, use the Common.WinRT.csproj class
library instead. Chapter 11 , Integrating Direct3D with XAML and
Windows 8.1 , provides an overview of working with this library.
 
Search WWH ::




Custom Search