Rust-based🦀 project for rendering simple IFS (Iterated function system) and L-System (Lindenmayer system) fractals.
FractalRenderer is a Rust project for rendering fractals. It originated from two separate university lab projects focused on L-System and Iterated Function System (IFS) fractals.
These projects were later merged and adapted for WebAssembly (WASM), allowing fractals to be rendered directly in a web browser.
- L-System Fractals: Generate complex patterns using Lindenmayer systems.
- IFS Fractals: Create simple visuals with Iterated Function Systems.
- WASM Integration: Leverage the power of Rust and WASM for web-based rendering.
- Modular Design: Organized and maintainable codebase, designed for extensibility.
- egui: Used for building graphical user interfaces in Rust.
- WebAssembly: Enables high-performance rendering in web environments.
- Trunk: Build and bundle the application for the web.
Precompiled binaries for Windows, Linux and MacOS can be found in the latest releases.
-
Ensure you are using the latest stable version of Rust:
rustup update
-
Build and run the application:
cargo run --release
On Linux systems, you may need to install the following dependencies:
sudo apt install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
On Fedora systems, you may need to install:
dnf install clang clang-devel clang-tools-extra libxkbcommon-devel pkg-config openssl-devel libxcb-devel gtk3-devel atk fontconfig-devel
You can compile the app to WASM and test it locally:
-
Install the required Rust target:
rustup target add wasm32-unknown-unknown
-
Install Trunk:
cargo install --locked trunk
-
Build and serve the application:
trunk serve
Open your browser and navigate to
http://127.0.0.1:8080/index.html#dev
. This bypasses caching for development.
Note
The assets/sw.js
script enables offline functionality by caching the app. Using the #dev
suffix skips this caching during development.
-
Build the application for production:
trunk build --release
-
The output will be in the
dist
directory. You can upload it to any static hosting provider (e.g., GitHub Pages).
This project is licensed under the MIT License.
- University lab projects that laid the foundation for this work.
- The Rust and WebAssembly communities for their amazing tools and resources.
Contributions are welcome! Please fork the repository and create a pull request with your changes.