Cannon Sample
Cannon is an advanced sample. It demonstrates calculation on
intersections on a line with all objects in the model. It also demonstrates
direct user drawing with IDraw interface, Runtime creation and manipulation of
objects, programmatic manipulation of view with ILook interface and
runtime programmatic positioning and arranging objects in the model. It also
demonstrates usage of transparent background to optimise layout of the user
interface
Running the Cannon Sample
By default the application loads Tank model. The user can load any
.mdg model. Location and Direction control groups allow positioning of the
cannon anywhere in 3D space. Pressing "Fire" button executes
calculation of all intersections of line of fire of the cannon with the model.
"Objects hit" list boxes display all objects of the model, which have
an intersection with the line.
Controls at the bottom of the page (hidden when there is no intersections)
display information about the current intersection points for the currently
selected object in the "Objects hit" list and normal of the surface at
the point of intersection. This information is immediately updated when a
different object is selected in the list or different point is selected as
current in "Cur Intersection" up/down control.
The current intersection point and normal to the surface at the point are displayed
in 3D with red and black lines.
The application works in two modes, determined by selection in "List
intersection" radio buttons. In the first mode intersection points with all
objects in the model are calculated and displayed. In the second model "Hit
list" list box allows selection of which object in the model intersections
are displayed for.
"Wire Frame" check box allows changing between surface and wire
frame rendering mode.
Implementation
Transparent background is enabled by setting the
TransparBackgrEnabled
property to true, DIBackColor
property to zero and Visible property of
the DG Kernel control to false
More:
.NET Platform
C#
Native
Delphi
C++
|