Language Features
Ember takes advantage of a few core language features in C++ that help simplify the coding effort.
Templates
Since the process of rendering a fractal flame from start to finish is lengthy, it’s interesting to experiment with how using different data types affects performance and image quality. C++ provides an elegant solution to this problem through the use of template parameters. Ember supports changing the data type of almost every calculation used in the algorithm to either float or double. The data types of the histogram and density filtering buffers are always float.
While interesting from an engineering perspective, it only provides a ~10% speed advantage to use float instead of double on the CPU. The downside is that some flames come out looking different between the two types.
The only place where performance is really affected by changing the type is on the GPU.
Lambdas
These were added to the standard in C++0x and have been a blessing to those implementing multi-threaded programs ever since. Before that, the traditional threading model required a programmer to butcher their design just to achieve parallelism. Modern C++ offers a vast improvement through the use of lambdas. These allow us to write multi-threaded code while keeping good program design structure in tact. Ember achieves this by using the Intel Threading Building Blocks library for most loop threading needs.
Containers
C++ Standard Template Library containers are used extensively throughout Ember, greatly simplifying the code, reducing its verbosity and enhancing its readability.
Fixed containers are initialized using initializer-list constructors.
Extensibility
Derived classes can override virtual functions to implement portions of the rendering process using OpenCL on the GPU.