Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A beginning DirectX application using MFC.

0.00/5 (No votes)
29 Mar 2004 1  
Lets user create and manipulate 3D DirectX models.

Sample screenshot

Introduction

This project lets you create 3D models using DirectX's helper functions. You're also able to manipulate pre-made .x files. You can also save the models you create yourself as .x files in binary, compressed, or text format. I started off using the DirectX 8 SDK. I now have version 9 and have changed required #includes to make it work.

Background

I ordered a book a few months ago that came with a CD with a demo version of a 3D modeling package, but I didn't get the CD. So I decided to try to write my own. Never thought that it would take as much as it did! This is by no means a fully functional 3D modeling program. But for anybody interested in DirectX game programming, maybe they can look at some of my code (as beginner-level as it is) and it'll help them.

Using the code

All of the objects are derived from a class, CMesh which is a wrapper for DirectX's mesh object. There is a CScene object used for containment of all the mesh objects. CScene has a method called Render() which loops through all of the CMesh- derived objects and draws them to the screen. The picture box that I'm using as a device for the Direct3D presentation of the objects was derived from class CStatic and drawn dynamically so that you can get the events that you wouldn't normally get with a regular picture box. The toolbars are drawn with the help of code that was obtained from MSDN. To display an object, click the object type you want to draw first, then click 'Add object' button. Anytime after the object is selected, you may click on options to change different characteristics of the object. There is no support for textures or animation. To rotate an object more freely, you should click the appropriate rotate button, then since it is now default, hold down 'Enter' button on your keyboard to prevent having to click button again. When copying and pasting an object, click one of the translation buttons to see the object move, since new object will be copied directly in the same spot as the previous object. You can only perform operations on the current object.

Points of Interest

I had a problem when moving from one hard drive to another with the path to my mfc\include directory specified in the Modeler.hpj file. No doubt your path is different also. You'll have to manually edit the text of that file to point to the correct folder.

History

First release - I don't really plan on finishing it, but I just hope it helps anyone the way it is!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here