this tutorial will not work with borland kylix
Dmitry Pryadkin has been kind enough to take the time to demonstrate how to convert ASE ASCII data from 3DS Max to his own .mft format (MyFormat) which allows vertex coordinate data to be read into Delphi to display your 3D objects. The readme.txt file included in the zip file gives a run down on how to use it, but for clarity I've written this tutorial to explain how to get started. Thank you to Dmitry for clearing up some questions I had while writing this tutorial, we are all in your debt :-D
How To Compile
Before you can run either the converter program, or the viewer program you'll need to get hold of the Jedi DirectX converted headers so that you can make calls to DirectX functions. You can find these headers at this site.
Once you've unzipped these, you need to tell Delphi where to find them. Unlike DelphiX, these files are not actual components, but rather units which contain functions and procedures that when added to the uses clause of our own programs, allows us to use a whole new range of features. To tell Delphi where to find the files, the best way is to head to the menu and click on Tools -> Environment Options. You then need to click on the Library tab, and then the three dotted button beside the Library Path line. You'll now see another dialog box which contains a list of those directories that contain units which Delphi is already using. To add the directory in which you placed DirectX into, to the list, click on the three dotted button near the bottom, browse to the directory where you placed it and click OK. To finally add it, just click the Add button and that's it!
You need to also tell Delphi where the units directory of Dmitry's code is, as his converter and viewer programs make use of special units which he wrote. You do this in the same way as described above.
As long as you don't uninstall Delphi, you should never have to follow this procedure again as Delphi will always know now where to find DirectX and Dmitry's units.
So, what's this .ASE format all about then?
Some of you may not be familiar with the .ase file format. When exporting your 3D objects, you should find that many packages will give you the option to export in this ASCII format. The steps required to do this in 3D Max are outlined below, but you should be able to achieve similar things with another piece of software. When you've finished designing your 3D object ready for Delphi, you need to first map the UV coordinates to the mesh of your object. In 3D Max this is done by selecting your object, and going to Modifiers -> UV Coordinates -> UVW Map in the menu. You then just choose the appropriate options on the right to map the coordinates. In my case I chose Shrink Wrap in the Parameters box, and then Fit from the Alignment box.
The important bit comes when you go to actually export in the .ASE format as you need to select some special options from the dialog box that comes up after you select a filename. The options which you should select are shown below, but just in case you can't make them out, you should only tick Mesh Definition, Materials, Geometric, Shapes, Mesh Normals and Mapping Coordinates. Everything else should be either unticked or just left alone!
Now let's get down to the good stuff! To convert your .ase files to .mft you need to first compile aseload.dpr which you'll find in the converter directory of the zip file. Once you've done that, before you run it, alter the !init.cfg file in the converter directory, changing the filename on the FILE_TO_CONVERT line to that of your .ase file, and the OUTPUT_FILE to the name you want the file to be when it is converted. Dmitry has included a sample file, teapot.ase which you can convert to test it out. Running the newly compiled aseload.exe will now open a DOS window and fire away with the conversion. When it's done you'll be asked to press Enter to quit. That's it!
If you managed to convert your file, you'll find viewing it a piece of cake. You need to compile viewer.dpr in the usual way, and like before you need to change the !init.cfg file, this time altering the LOADFILE line to that of your .mft file and the APPLYTEXTURE to that of your bitmap texture file to wrap around your 3D object.
You're now ready to run viewer.exe and view your first 3D object in Delphi. What you should now see is a window displaying the object, and a click of your mouse button in the window will start it rotating. If you find yourself a bit too close for comfort you can zoom out a little by altering the VIEW: section of the !init.cfg file. Changing the 60 value here to a higher value will move the camera further away from the object.
Now it's up to you...
It's at this point that I must leave you to explore the program and its units. It is pretty complex stuff but you'll find the code well commented, and if you leave a message on the board here, I'm sure Dmitry, myself, or some other knowing volunteer will help you out. In the future I may write another tutorial explaining the program in its entirety, but for the moment, have fun exploring!