没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
oss.trustie.net/open_source_projects | 主页 > 开源项目社区 > d3dcontrols |
d3dcontrols
|
0 | 0 | 0 |
贡献者 | 讨论 | 代码提交 |
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.
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. The mesh classes handle most of the complicated stuff for you, all you have to do is call the Render() method and it should do the rest. I don't have a lot of time to go over how to use it but included in the download are some sample applications that use the control, so you should be able to figure it out. This component DOES support multiple controls on a single form. A seperate swap chain will be created and used for each control and they will automatically share the device.
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 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.