Click here to Skip to main content
Click here to Skip to main content

A beginning DirectX application using MFC.

By , 29 Mar 2004
 

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

About the Author

BlackDice
Web Developer
United States United States
Member
Started off with vb6 Smile | :) and am self-taught at C++, FoxPro, DirectX, etc. I'm currently developing with VFP9 and C# in desktop apps, webservices, telephony apps.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralA question !!memberchenbuaa7 Jun '04 - 17:11 
Can you give me some advice about how to begin a Directx project?
 
buaa_chenx@hotmail.com
 
thanks~~
GeneralRe: A question !!memberbdiamond8 Jun '04 - 3:45 
Well, this was just something to be done using MFC. Actually you wouldn't want to use MFC for any real stuff, like games because MFC will slow it down. Basically you'd create a window (the windows way), create a device, (which will also be your window) then do your stuff. It's kinda hard (for me anyway) starting out, but once you get a sense of how things are set up, it's easy to just keep the code you need and start off with that base code for every project
 
If it's broken, I probably did it
 
bdiamond

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 30 Mar 2004
Article Copyright 2004 by BlackDice
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid