New major release of Ab3d.PowerToys library available

by abenedik 22. October 2013 21:04

I am really happy to announce that the v4.0 of Ab3d.PowerToys is now available. It brings tons of new features and updates. The most important new features are:
-    Added polygon triangulation, creating extruded and lathe 3D objects,
-    Improved EventManager3D for even simpler usage of mouse events on 3D objects,
-    Added support for upcoming Ab3d.DXEngine library that will be able to render WPF 3D graphics with full DirectX 11 hardware acceleration.
-    Many new very interesting samples that show how easy is to create amazing 3D applications.

Polygon triangulation is a technique that converts a 2D polygon into triangles that can be used to define a 3D object. This makes it easy to create extruded objects – object that are created with extruding a 2D shape into a 3D world. The following image shows a screenshot from a sample that demonstrates those two techniques. The 2D shape is defined on the left side. It is the base for the 3D object that is shown on the right.

Ab3d.PowerToys Extrude

Lathe 3D objects are objects that are created be rotating the shape around an axis. The following image screenshot is taken from the sample that demonstrates how to create lathe objects. On the rights side the shape is defined by drawing the red lines. It is then rotated around up axis and the 3D object shown on the left is created. As seen on the 3D object it is also possible to define which edges are hard and which are soft.

Ab3d.PowerToys Lathe creator

Because we can now easily create lathe objects, we can also easily create 3D arrows. They can be created with the new ArrowMesh3D, ArrowVisual3D or ArrowUIElement3D objects. The following image shows many 3D arrows with different colors (screenshot from the new sample - still under development).

Ab3d.PowerToys Arrows sample

As mentioned before, another big improvement in this library was made with EventManager3D. EventManager3D can be used to simply subscribe to 3D objects just as they were normal FrameworkElements. For example the following code subscribes to some mouse events:

var eventSource3D = new Ab3d.Utilities.VisualEventSource3D(MyBoxVisual3D);
eventSource3D.MouseEnter += OnBoxMouseEnter;
eventSource3D.MouseLeave += OnBoxMouseLeave;
eventSource3D.MouseClick += OnBoxMouseClick;

var eventManager = new Ab3d.Utilities.EventManager3D(MyViewport3D);
eventManager.RegisterEventSource3D(eventSource3D);

The new version of Ab3d.PowerToys adds the following additional functionality to the EventManager3D:

 

  • Added RegisterExcludedVisual3D and RemoveExcludedVisual3D methods to EventManager3D – used to define Visual3D objects that are excluded from hit testing.
  • Added CustomEventsSourceElement property to EventManager3D - it can be set to any FrameworkElement that will be used as source of mouse events instead of TargetViewport3D.
  • Added MouseMove event to EventManager3D.
  • Added FinalPointHit to all EventArgs used in EventManager3D event handlers - it gets the transformed 3D point that was hit by the mouse (if Visual3D uses Transformation, than HitPoint will be wrong, but FinalHitPoint will be transformed).

Ab3d.PowerToys can help you in all stages of development – also during debugging. In the Ab3d.Utilities.Dumper there are many methods that can be used to get nicely formatted info about MeshGeometry3D, Model3D, Transform3D, Material or Matrix. With the new version it is now possible to specify the format string used to format the values (this allows control of the number of displayed decimals). The new version also adds two new methods to Dumper class: DumpMeshInitializationCode and GetMeshInitializationCode. They can be used to generate the complete c# source code that can be used to create the MeshGeometry3D with all the Position, TriangleIndices, etc.

This is not all. The following are the additional new features and fixes:

  • Added CreateMouseRay3D to BaseCamera - it can be use used to calculate the 3D ray that goes from the mouse position into the 3D scene.
  • Improved Refresh method in LinesUpdater - calling this method now forces to redraw all visible lines.
  • Added MaxLineArrowLength and LineArrowAngle to LinesUpdater to better control the size and shape of the arrows on 3D lines.
  • Fixed LineWithTextVisual3D when it was created in code behind and the properties were set without using BeginInit and EndInit methods.
  • Fixed recreating the content of 3D objects derived from Visual3D (if initially IsVisible was set to false and was then set to true the object was not shown under some circumstances).
  • Added many possibilities to change the CameraAxisPanel with overriding CreateAxisVisual, SetAxisLength, SetAxisColors or EnsureAxisTextBlocks (the later also existed before)
  • Improved performance of Box3D geometry mesh creation when X, Y and Z segments count is 1 (simple box with 2 triangles for one plane) - the mesh is now created 10 times faster.
  • Moved initialization of RotationCursor in MouseCameaController from constructor to OnLoad event handler - this prevented calling virtual method in constructor.

Besides new features in Ab3d.PowerToys there are also some new very interesting samples that demonstrate the use of the library. Extrude and Lathe samples were already mentioned. I would also like to show the screenshot of the new “Distance measurement” sample:

Ab3d.PowerToys 3D distance measurement sample

The sample uses HeightMap (also part of Ab3d.PowerToys), 3D lines and custom hit testing (uses CreateMouseRay3D method on camera) to show the distance between two points in 3D world.

Another interesting new sample is Objects inspector. It can display many information about the selected object – shows individual triangles with TriangleIndice index, normals, all positions, XAML text and other data. The following is the screenshot of the sample:

Ab3d.PowerToys Objects inspector

Lastly, the new version of Ab3d.PowerToys adds support for the upcoming Ab3d.DXEngine.

The Ab3d.DXEngine is a brand new 3D rendering engine that can render WPF 3D graphics in hardware accelerated DirectX 11. This means a huge performance boost and what is more it allows many customizations and tweaks of the displayed graphics. Do not get me wrong – I still think that WPF 3D is great for business applications that need 3D graphics. But it has its limits. When it comes to very complex 3D objects, the existing rendering engine based on DirectX 9 just cannot use the full power of the GPU. Another limitation is that the current WPF 3D engine is a closed box – you cannot extend it in any way. If you would like to use some other shading technique, this is not possible. Even simple task as showing 3D lines is kind of a hack in WPF 3D. What is more, the new engine can be used with just very minimal change in the code.

The new engine will be soon ready for the first alpha version. But before going public with the new engine, I would like to test it with some of our partners. I already have a few interested Ab3d.PowerToys customers that would like to try the new engine. If you are interested in that, please contact me to our email or with using Feedback page.

Tags:

Ab3d.PowerToys