|
This handy utility enables you to create simple 3D images. The source
code is fairly easy to follow so here is just a quick description. The
application is composed of two modules:
3dcore.dll - Core 3D engine, it implements classes for:
- 3D points (Point3D)
- Elements (Element3D), a list of 3D points linked by straight lines.
- 3D objects (Object3D), a list of elements that together form an object.
- Sorting (ObjectSorter), a set of rules based on which 3D objects and elements are sorted to determine the drawing order.
- 3D points mapping to 2D display (CMap3Dto2D, CAttenFunc), classes
encapsulating the rules to transform 3D points to 2D points for rendering
on the display. CAttenFunc is a helper to CMap3Dto2D. It implements an
attenuation function giving a depth effect (see inline source comments).
view3d.exe - GUI to create 3D images. The GUI sits on top of 3dcore.dll to provide the ability to:
- Create and configure 3D object instances.
- Configure the various 3D to 2D mapping parameters.
- Streaming to/from disk of individual object as *.3DO files using XML serialization.
- Streaming to/from disk of projects as *.3DP files using XML serialization.
- Saving of images in various formats BMP, JPG, PNG and EMF.
One of the features I like most is the ability to save 3D projects as images. Following that, using the new
image as background to the project you can create some interesting effects.
There is a lot more functionality that could have been added but
unfortunately I ran out of time. A few fairly easy enhancements would be:
- Support for simple 3D transforms.
- Improved 3D object sorting.
- Improved support for transfer of objects to background image.
Well that is why the source code is included after all. If anyone feels like updating this code I will be
pleased to make it available from this site. Just mail me on feedback@windeveloper.com
Installation/Setup/Usage
Minimum requirements:
To install download the application and run the self extracting installation. Follow the installation wizard steps.
Once you run '3D Plot' a new blank project is started ready for drawing. Create objects from 'Objects\Add New...'. The Objects menu also provides functionality to load/save
individual objects to disk as *.3DO files. In this way you can easily re-use them across projects.
Use the View menu to toggle display of the 2D/3D base axis relative to which objects are drawn. The axis,
also provide a visual interface to modify the position of the origin and some
of the 3D-to-2D mapping parameters by just dragging the grippers. For the
complete set of parameters access these from 'Options\Scale...'.
From Options\Background configure the background color or image to use.
Use the file menu to save the complete image as a project *.3DP or as an image file in one of the standard
formats. A *.3DP can be later on re-loaded for further drawing through 'File\Load'. Projects saved as images could instead be loaded as background
through 'Options\Background\File...'.
|