|
I created a windows control to hopefully simplify adding Direct3D to .Net
applications, it is written in C#. This control has a lot of functionality, but it by no means has
everything that I intended on putting in. It is my first real Managed DirectX
project so be a little forgiving if you find something that is not done just
right.
The purpose of this
control is to provide a Direct3D surface that can be added to any .Net windows
form. It has a lot of features that can do most of the busy work for you. One
thing to note is that this library is not intended for hard core games, but more
for windowed applications.
This library has been sitting around for the last six months unfinished, but still in a good working state. I have been to busy
with other things to work on it, so I decided to put it up here in case some one could learn from it. I know I learned a lot making it.
The library consists of a user control which handles the render loop, direct3d initialization on so on, as well as a bunch of mesh classes and a camera class.
I don't have a lot of time to go over how to use it but included in the download are four sample applications that use the control, so you
should be able to figure it out.
To use it all you have to do is add the control to your tool box. Add event handlers for the OnSceneUpdateReady
and OnRender events and then you are ready to go. By default a camera class will be created and set in the controls ActiveCamera property.
The default settings is to automatically add the transforms for the active camera before the OnRender event is fired, however this is configurable.
The OnSceneUpdateReady event is fired before the OnRender and is intended for updating the scene and doing all of your program logic.
The OnRender event is fired between the BeginScene and Present methods and is intended for rendering the objects.
The included mesh objects all implement the ID3DMesh interface and can be rendered using the Render() method. There is a RenderSettings property that you can use to set some render settings such as wireframe, solid, autoset transform,
and so on. The ID3DMesh interface also has a method for rendering planar shadows as well as a bunch of other stuff.
One of the best features of the control is that it enumerates all the supported hardware configurations on start up and stores all the combinations
in a DataTable, which can be used for setting the best device settings. In addition to this there is a ShowDeviceSettingsForm()
method which will open a dialog that will allow the user to choose from the supported settings. It can be seen in the
Mesh Viewer screen shot below. The Mesh Viewer is one of the test apps that is included in the download.
Please send all feed back and code updates to rccode [at] gmail . com
Update Go here to get the newest version: New D3DControls Page
|
|