Home

Let there be light !

February 20, 2013

I’m still building the fabrics needed to run Kadma. This week, it was lights.

Nothing fancy, my point is to make a game, not a technical lighting demo that some people more experienced and with more time already did several times ๐Ÿ™‚

Image

ย 

Image

ย 

ย 

Also got some old friends rendered ๐Ÿ˜‰Image

There is one beautiful thing with the current .NET Framework and Windows 8 Apps : running your code asynchronously without blocking your UI thread.

You simply have to have a function like that, and it “magically” works:

private async void StartButton_Click(object sender, RoutedEventArgs e)
{
    try
    {
         textBox1.Text = 
         await httpClient.GetStringAsync
         ("http://msdn.microsoft.com");
    } catch (Exception) { // Process the exception. . . . }
}

Using that, you get a code that is running from the UI thread, runs into StartButton_Click, launch a task for the GetStringAsync and returns. When the GetStringAsync is finally over, the “textBox1.Text = thing” part get executed, and it works because we are still on the UI Thread. Doing so, we don’t violate the constraint of accessing UI elements from the thread that created it.

But how does it work really ? How does the Framework knows which thread is targeted and where to run the remaining of the method ?

Read the rest of this entry »

When you build an Editor, there’s always one thing you are going to need : a good property editor.

For that, I’ve chosen the one in Extended WPF Toolkitย and it behaves quite nicely. But then it got tricky. In my engine, one does not simply walk set a property like that. I have that kind of structure:

 /// <summary>
 /// ...
 /// </summary>
 public GeometryMaterial GetGlobalMaterialOverride(ModifierReference reference)
 {
...
 }

/// <summary>
 /// ...
 /// </summary>
 public void SetGlobalMaterialOverride(ModifierReference reference, GeometryMaterial material)
 {
...
 }

Thus, giving it to the property grid produces no result.

Read the rest of this entry »

One of the first thing you have to do when converting a project from XNA to something else (let say, SharpDX) is reinventing yourself a way to load assets.

XNA had a great content pipeline providing ways to import and process everything in Visual Studio during the build process, and that was one of the key points of the simplicity of XNA. When going through the DirectX way, I had to basically reproduce the same thing myself.

There are some alternatives though. Some guys have implemented a content pipeline for Mono for example, but I wanted to do it myself as I’m not using Mono anyway. If you want to do the same thing, you might want to take a shortcut to load models, and that shortcut is AssimpNet. It’s a wrapper for a library specialized in loading 3d models. The next step is just to process the data from Assimp’s format to your own.

You might get it right:

Image

Or wrong …

Image

But still, it’s worth a try.