Curl Global Community
Fire Simulator - Printable Version

+- Curl Global Community (https://communities.curl.com)
+-- Forum: Widgets/Gadgets/Curlets (https://communities.curl.com/forumdisplay.php?fid=15)
+--- Forum: Code Samples (https://communities.curl.com/forumdisplay.php?fid=16)
+--- Thread: Fire Simulator (/showthread.php?tid=98)



Fire Simulator - ashimo - 07-01-2011

This example displays flames by simulating them mathematically, not just by showing a series of precomputed images. The fire in this demo is procedurally generated locally on the client machine. It is not an animated series of pictures, but instead a complex mathematical function that has been downloaded to your computer as programming code.

Description
This demo shows the combination of high level programming constructs for graphical events with fast, pixel-level graphics control. It also demonstrates how high-level constructs can be created by the programmer if they are needed and don't currently exist.

The fire itself combines:
  • Random number generator
  • Spectrum
  • Displacement Mesh
  • Blur Algorithm
The algorithm contains:
  • A distortion field to swirl the fire
  • A blur that spreads the flame
  • A flame generator
  • A dispersion filter
Note that any user modifications are handled at the user machine, without server interaction.

Instructions
  • Select and de-select the various checkboxes that relate to the algorithm for drawing / animating the fire. Alterations of these boxes change the dynamics of the fire without needing to transmit or receive any additional instructions or pictures from the network server.
  • You can use the check boxes to turn on and off the convection and dispersion, replace the jets with a checkerboard pattern, and turn the animation on and off.

To run the Fire Simulator application click on the link below.

Fire Simulator

Download the zip file attachment below to get the complete source for the Fire Simulator.

You will also need the to download and unzip the Styled Controls package from the link below. The
unzipped contents should be placed alongside the unzipped fire simulator demo source.

Styled Controls Package Zip File

fire.zip