

It then travels in a direction towards the other object and then finally curves again to meet that objects’ port. I use a 3D Bézier curve that starts by matching its direction to the port it’s attached to. I am using skeletal meshing, a technology that is usually used for character movement in games, to accomplish this. One fun feature of iCircuit 3D is that its wires arc around the environment like real wires. This is a short section, I just thought the LED lights were fun. This actually overwhelms SceneKit because it has a maximum of 8 light sources, but things are pretty fun up until that point. I decided to make every LED a light source. Once you have a good lighting model, you need some good lights. That’s all done using a real-time generated texture. This is most notable on AA batteries who have a diffuse body, a shiny metallic stripe, then dull metallic contacts. The fact that you can vary these levels on a pixel-per-pixel level enables a lot of nice effects. Roughness lets you control how rough or shiny an object is and metalness controls the color of light reflected off the object. PBR requires that you provide three textures for every object: its color, its roughness, and its metalness. It’s actually a technology developed for movies to make visuals look less, well, plasticky and now I’m able to run it on my phone. PBR is the new hotness if real-time realistic-looking rendering. With that pattern I could confidently manipulate the scene graph from whatever thread I wanted. Whenever you want to manipulate rendered objects. When the user undos and redos, the system just has to figure out which of those values to restore to the property.Īll of this is achieved with property definitions such as this: That event captures the property’s value before and after the change. When a property changes, an undo change event is registered with the OS (Apple has NSUndoManager). The undo (and redo) system of the app is based on property changes. (Circuits can contain binary data thanks to image and board import facilities.) I also chose to use the BSON serialization format so that the app could handle binary data more efficiently. I’m able to serialize and restore entire object graphs (thanks to its object reference handling) and only have to be careful that I don’t serialize more than I need to. Serialization is a simple process thanks to advanced libraries like Newtonsoft.Json. The key was to base both undo and serialization on properties of objects. I decided to solve both problems in a generic way that would require very little on-going work.
Icircuit windows how to#
Properties FTWĪ mental road block I often run into when starting a new app is how to handle serialization and undo buffers. Sometimes when you’re stuck, the best thing to do is to lean into your strengths. I’ve been writing OOP programs since the 1990s and I am very comfortable with the abstraction and patterns. I decided to go OOP, in some ways, to rid myself of writer’s block too. Like it or hate it, OOP is well understood at this point. But react style programming of a real-time engine like this is not trivial and I found myself trailblazing a bit more than I like. This is funny considering that I am quite an advocate for functional programming and more reactive style UI design these days. In fact, this may be the largest OOP app I’ve ever built. :-) The null reference checking feature of C# 8 has been especially useful in tracking down bugs. I started with C# 7 but C# 9 had already been released by the time I shipped the app. ICircuit 3D is written 100% in C# using Xamarin.iOS and Xamarin.Mac. Maybe you can get some ideas for your next app from it! So here is a very extended colophon for the app. iCircuit 3D has been a work of passion over the last couple years and I thought I would take a moment to describe some of the more interesting technical aspects of it.
Icircuit windows mac#
Today I’m pleased to announce the macOS release of iCircuit 3D! Last week I released the iOS version to a wonderful reception and I’m happy to now be able to give all the Mac users out there the same experience.
