From Wakapon
Revision as of 15:52, 16 August 2010 by Patapom (talk | contribs)
Jump to: navigation, search

Nuaj [nu-a-j'] is my little .Net renderer for DirectX 10. It's quite small and really easy to use. Source code is available here and it's free.

If you want to use it, you will need the SlimDX .Net wrapper that tightly wraps DirectX for use into .Net managed code. Also, it was created with Visual Studio 2010 and .Net Framework 4.0 so make sure you have that !


The main idea behind Nuaj is to "make my life easier", not to create the ultimate renderer that washes dishes and serves coffee. Those are never finished and you always come up with a bad surprise once it's time to use it (providing that you reach that point).


So I decided to create first a set of basic helpers to manage my stuff. Basically, all I need is to create geometry easily using vertices and/or indices, I need to create materials from shaders that compile either from memory or from file, I need to create textures and render targets to feed my shaders and rendering pipeline, tie all this together and roll the dice...


Helpers

All helpers in Nuaj derive from a base Component class that takes a Device and a Name as basic parameters for construction.

  • Device, the Device helper is a singleton and wraps the DX10 Device. It contains a swap chain and a back buffer (the default render target). The basic DirectX Device methods are rewired through that new Device class.
Basically, nothing fancy here, you just create your Device with specific parameters and call "ClearRenderTarget()" and "Present()" to run the show.
The Device is the first parameter needed for every other component type in Nuaj so make sure it's created first.



.Net Subtlety

If you create a new application from scratch and wish to use SlimDX, make sure to edit you app.config file and change these lines :

   <?xml version="1.0"?>
   <configuration>
    <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
   </configuration>

by these so you can use backward compatible assemblies :

   <?xml version="1.0"?>
   <configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
   </configuration>