Partager via


Playing with Managed Direct3D

A few people have e-mailed and asked if—since I claim to be a developer—I actually write any code. It's a great question, and based on most of my blog posts, you'd think I haven't written an ounce in quite some time. Fortunately for both you and especially me, that assessment would be wrong. I spend quite a bit of time writing C#, my current favorite langage. Some of it is for illustration or example as I mentor other developers, some of it is to answer specific Microsoft technology questions, some of it is to demonstrate a preferred practice, method, or algorithm, and some of it is for just plain fun.

For example, I've done a lot of 2D graphics and game development in the past, and I've worked a bit with 3D algorithms, but I've never tried to marry the two. Since Longhorn (and with our recent announcement, Windows XP) introduces a rich 3D graphical interface, I thought it'd be a good idea to increase my understanding by creating a sample project that provides a 3D animation framework for Windows Form-based applications. Managed DirectX 9.0 seemed the perfect starting point.

So, I've created a pluggable animation class hierarchy, a couple of time controllers, a few motion providers, timeline and keyframe logic, view controls, a flexible camera class, and picking and selection logic (among others). I extended the sample application with a simple command window that lets me play with various animations and camera setups, and I can move throughout the world with a few mouse movements and keyboard strokes.

This is really just an exercise in learning...I don't intend to do much with my sample application beyond that. Here are a couple of screen shots that won't do the motion any justice at all. Imagine that you can manually control a very complex animation cycle with the TrackBar control at the top, and you can smoothly "fly" the camera through the scene. It doesn't look like much, but it's fun to play with and simple to extend.

Comments

  • Anonymous
    September 07, 2004
    Where can we find your sample ?? Have you posted it on any website ?
  • Anonymous
    September 07, 2004
    I haven't posted it anywhere, Patrice. Frankly, I hadn't even considered it, since it's mostly just a learning project for me. Perhaps I'll post it here when it's far enough along to make sense. Is anyone else interested?
  • Anonymous
    September 07, 2004
    I think it would be nice to see your sample Michael, I downloaded the Managed DirectX SDK recently, but haven't had a chance to play around with it yet.
  • Anonymous
    September 08, 2004
    I am interested a lot too. It is a learning project for you but it could helps lots of people, me inside :)
    Moreover, it looks very great !
  • Anonymous
    September 08, 2004
    Yes it can be very interresting to get this small program
  • Anonymous
    September 08, 2004
    I would be willing to help you with some samples Mike, I really like 3d. I still need to complete my 3d engine one of these days but it is fun none the less. A couple of good books on the subject I have is

    Introduction to 3D Game Engine Design Using DirectX 9 and C#
    http://www.apress.com/book/bookDisplay.html?bID=156

    And

    Beginning .NET Game Programming in C#
    http://www.apress.com/book/bookDisplay.html?bID=324

    I recomend the second one if your just getting into it. The first one there is no buffer, First chapter in the first one you start building a class with your world origins and so on. The second one walks you through some rather simple stuff like building a Tetris game in .net with Excellent inheritance designs and so on understanding what the world coordinates are and clipping plains and so on.

    Anyway we can discuss it at the meeting next week if you want.
  • Anonymous
    September 08, 2004
    Yeah defintely post it
  • Anonymous
    September 09, 2004
    I'd like to see the code too
  • Anonymous
    September 22, 2004
    You bet Michael, post it!

    There are relatively few good MDX books out there; David Weller's is good but seeing more working code would be nice.
  • Anonymous
    September 28, 2004
    I see several people are requesting the source. if you're just looking for more C#/DX examples, then I suppose a shameless plug for my site is in order.

    I've been doing a lot of Managed Direct3D coding lately and I have several demos with source on my website. I put them there for others to learn from, so have at it!